text:
/* Global styles */

body {
  background-color: white;
}


text:
<?php
      session_start();
      if (!isset($_SESSION['usr_rol'])) {
       header('Location:../../index.php');
          exit();
      }else{
     if ($_SESSION['usr_rol'] == 'Usr') {
        #  If user isnt't admin can't see this page
      if(!isset($_SESSION['usuario']))
      {
          header('Location: ../../index.php');
          exit();
      }
    }elseif ($_SESSION['usr_rol'] == 'Admin') {
      header('Location:../../index.php');
          exit();
    }
$usr= $_SESSION['usuario'];
}
    ?>
<?php
$id_ship = ($_GET['id']);
$ship_detail = ($_GET['detail']);
$ship_hin = ($_GET['hin']);
$ship_hmax = ($_GET['hmax']);
$ramp = ($_GET['rampa']);
$caj = ($_GET['caja']);
$asn = ($_GET['asn']);
$bol = ($_GET['bol']);
?>
<!Doctype html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <meta name="description" content="ADIENT">
    <meta name="author" content="Avantec - elucio">
    <link rel="icon" href="">
    <title>ADIENT</title>

    <link href="../../css/bootstrap.min.css" rel="stylesheet">

    <link href="http://getbootstrap.com/assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">

    <link href="../../css/dashboard.css" rel="stylesheet">
    <link href="../../css/main.css" rel="stylesheet">

    <link href="../../css/normalize.css" rel="stylesheet">

<form class="form-horizontal" action="" method="POST">

    Ventana:

      <input type="text" class="form-control" id="ship" name = "ship" value ="<?php echo $ship_detail;?>" readonly>

    Hora a enviar:

      <input type="time" class="form-control" id="ship" name = "hour_ship" value =<?php echo $ship_hin;?> >

    Hora límite:

      <input type="time" class="form-control" id="ship" name = "hour_shipm" value =<?php echo $ship_hmax;?> >

    Caja:

      <input type="text" class="form-control" id="caj" name = "caj" value =<?php echo $caj;?> >

    Rampa:

      <input type="text" class="form-control" id="ramp" name = "ram" value =<?php echo $ramp;?> >

    ASN:

      <input type="text" class="form-control" id="asn" name = "asn" required value =<?php echo $asn;?>>

    BOL:

      <input type="text" class="form-control" id="bol" name = "bol" value =<?php echo $bol;?> >

  <button type="submit" name="sv" class="btn btn-info btn-block">Guardar</button>
</form>

<?php
if(!isset($_POST["sv"])){

}else{
require_once('../../db/config.php');
if(!function_exists('mysql_connect'))
{
    echo 'PHP cannot find the mysql extension. MySQL is required for run. Aborting.';
    exit();
}
$conn = @mysqli_connect($servername, $username, $password, $bd)
or die("Connection failed: " . mysqli_connect_error());
$hora = $_POST["hour_ship"];
$hora_max = $_POST["hour_shipm"];
$rp = $_POST["ram"];
$cajaa = $_POST["caj"];
$asnn = $_POST['asn'];
$boll = $_POST['bol'];
$upd = "UPDATE shippings SET ship_hour = '$hora', ship_hourmax = '$hora_max', rampa = '$rp', caja = '$cajaa', asn = '$asnn', bol = '$boll'  WHERE id_ship = '$id_ship'";
if (mysqli_query($conn, $upd)) {
    ?>

  <?php
} else {
    echo "Error updating record: " . mysqli_error($conn);
}

mysqli_close($conn);
}
?>

redpajama_set_name: RedPajamaGithub


text:
from lib.frk import app

from lib.link import SQLLink as Link

@app.route('GET', '/test')
async def test(request):
    return {
        'status': 'OK'
    }

@app.route('POST', '/save')
async def save(request):
    await request.post()
    doc = Link.from_request(request)

    status = await doc.persist()

    return {
        'status': 'ok' if status else 'error',
        'document': doc.public()
    }

@app.route('GET', '/all')
async def get_all(request):
    _all = await Link.all()

    return {
        'status': 'ok',
        'tags': list(set([
            t for d in _all
            for t in d.tags
        ])),
        'document': [
            a.public() for a in _all
        ]
    }

@app.route('GET', '/find/{tag}')
async def find_with_tag(request):
    tag = request.match_info.get('tag')
    matches = await Link.find_with_tags(tag)

    return {
        'status': 'ok',
        'document': [
            m.public() for m in matches
        ]
    }

@app.route('DELETE', '/{id}')
async def delete(request):
    id = request.match_info.get('id')
    await Link.delete(id)

    return {
        'status': 'ok'
    }


text:
package com.bumptech.glide.tests;

public class BackgroundUtil {
  public interface BackgroundTester {
    public void runTest() throws Exception;
  }

  public static void testInBackground(BackgroundTester test) throws InterruptedException {
    TestThread thread = new TestThread(test);
    thread.start();
    thread.join();
    if (thread.exception != null) {
      throw new RuntimeException(thread.exception);
    }
  }

  private static class TestThread extends Thread {
    private Exception exception;
    private BackgroundTester test;

    public TestThread(BackgroundTester test) {
      this.test = test;
    }

    @Override
    public void run() {
      super.run();
      try {
        test.runTest();
      } catch (Exception e) {
        exception = e;
      }
    }
  }
}


text:
package com.example.mohit.tpomnnit.messenger;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.mohit.tpomnnit.R;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by neera on 3/24/2017.
 */

public class ChatUserAdapter extends RecyclerView.Adapter<ChatUserAdapter.MyViewHolder> {
    private ArrayList<String> users;
    public class MyViewHolder extends RecyclerView.ViewHolder {
        TextView name;

        public MyViewHolder(View view) {
            super(view);
            name=(TextView)view.findViewById(R.id.name);
        }
    }
    public ChatUserAdapter(ArrayList<String> users)
    {
        this.users=users;
    }
    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType){
        View itemView= LayoutInflater.from(parent.getContext()).inflate(R.layout.user_row,parent,false);
        return new MyViewHolder(itemView);
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {
        String user=users.get(position);
        holder.name.setText(user);
    }

    @Override
    public int getItemCount() {
        return users.size();
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="
	http://www.springframework.org/schema/aop
	http://www.springframework.org/schema/aop/spring-aop.xsd
	http://www.springframework.org/schema/tx
	http://www.springframework.org/schema/tx/spring-tx.xsd
	http://www.springframework.org/schema/beans
	http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">

</beans>


text:
package com.hp.autonomy.frontend.find.hod.savedsearches.query;

import com.hp.autonomy.frontend.find.core.savedsearches.query.AbstractSavedQueryIT;

public class HodSavedQueryIT extends AbstractSavedQueryIT {}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  This configuration file was written by the eclipse-cs plugin configuration editor
-->
<!--
Checkstyle-Configuration: GWT Checks
Description:

-->
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
    <property name="severity" value="warning"/>
    <module name="RegexpSingleline">
        <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="bad // comment"/>
        <property name="severity" value="error"/>
        <property name="format" value="  [/][/][A-z]"/>
        <property name="message" value="// comments must be followed by a space and be on their own line"/>
    </module>
    <module name="RegexpHeader">
        <property name="severity" value="error"/>
        <property name="header" value="/\*\n \* Copyright 20(0[6789]|1[0]) Google Inc\.\n \*[ ]*\n \* Licensed under the Apache License, Version 2\.0 \(the "License"\); you may not\n \* use this file except in compliance with the License\. You may obtain a copy of\n \* the License at\n \*[ ]*\n \* http://www\.apache\.org/licenses/LICENSE-2\.0\n \*[ ]*\n \* Unless required by applicable law or agreed to in writing, software\n \* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n \* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\. See the\n \* License for the specific language governing permissions and limitations under\n \* the License\.\n \*/"/>
    </module>
    <module name="FileTabCharacter">
        <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="no tabs"/>
        <property name="severity" value="error"/>
    </module>
    <module name="TreeWalker">
        <module name="FileContentsHolder"/>
        <module name="InterfaceIsType">
            <property name="severity" value="error"/>
        </module>
        <module name="RedundantImport">
            <property name="severity" value="error"/>
        </module>
        <module name="UnusedImports">
            <property name="severity" value="error"/>
        </module>
        <module name="JavadocType">
            <property name="severity" value="error"/>
            <property name="scope" value="protected"/>
        </module>
        <module name="PackageName">
            <property name="severity" value="error"/>
            <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]{1,})*$"/>
        </module>
        <module name="ParameterName">
            <property name="severity" value="error"/>
        </module>
        <module name="LocalFinalVariableName">
            <property name="severity" value="error"/>
        </module>
        <module name="LocalVariableName">
            <property name="severity" value="error"/>
            <property name="tokens" value="PARAMETER_DEF,VARIABLE_DEF"/>
        </module>
        <module name="LeftCurly"/>
        <module name="RightCurly"/>
        <module name="CovariantEquals">
            <property name="severity" value="error"/>
        </module>
        <module name="HiddenField">
            <property name="severity" value="error"/>
            <property name="tokens" value="VARIABLE_DEF"/>
            <property name="ignoreConstructorParameter" value="true"/>
            <property name="ignoreSetter" value="true"/>
        </module>
        <module name="IllegalInstantiation">
            <property name="severity" value="error"/>
            <property name="classes" value="java.lang.Boolean"/>
        </module>
        <module name="UpperEll">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="checking for 4l rather than 4L"/>
            <property name="severity" value="error"/>
        </module>
        <module name="JavadocStyle">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Well formed java docs"/>
            <property name="severity" value="info"/>
            <property name="checkHtml" value="false"/>
            <property name="tokens" value="CLASS_DEF,CTOR_DEF,INTERFACE_DEF,METHOD_DEF,VARIABLE_DEF"/>
        </module>
        <module name="NeedBraces">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="make sure if has braces"/>
        </module>
        <module name="JavadocMethod">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.lastEnabledSeverity" value="info"/>
            <property name="severity" value="info"/>
            <property name="scope" value="protected"/>
            <property name="allowUndeclaredRTE" value="true"/>
            <property name="allowMissingParamTags" value="true"/>
            <property name="allowMissingThrowsTags" value="true"/>
            <property name="allowMissingReturnTag" value="true"/>
            <property name="allowMissingJavadoc" value="true"/>
            <property name="allowMissingPropertyJavadoc" value="true"/>
            <property name="logLoadErrors" value="true"/>
            <property name="tokens" value="METHOD_DEF"/>
        </module>
        <module name="ImportOrder">
            <property name="severity" value="error"/>
            <property name="groups" value="com.google, com,  junit, net,org, java,javax"/>
            <property name="ordered" value="false"/>
            <property name="separated" value="true"/>
        </module>
        <module name="DefaultComesLast">
            <property name="severity" value="error"/>
        </module>
        <module name="MultipleStringLiterals">
            <property name="severity" value="info"/>
            <property name="ignoreStringsRegexp" value=".{0,3}"/>
        </module>
        <module name="FallThrough">
            <property name="severity" value="error"/>
        </module>
        <module name="IllegalInstantiation">
            <property name="severity" value="error"/>
            <property name="classes" value="Boolean"/>
        </module>
        <module name="Regexp">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="check that a space is left after a colon with an assembled error message"/>
            <property name="severity" value="info"/>
            <property name="format" value="[^:^"]:" .*+"/>
            <property name="message" value="check that a space is left after a colon on an assembled error message"/>
            <property name="illegalPattern" value="true"/>
        </module>
        <module name="Regexp">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="more than one blank line"/>
            <property name="severity" value="info"/>
            <property name="format" value="[\r]?[\n][ \t]*[\r]?[\n][ \t]*[\r]?[\n][ \t]*"/>
            <property name="message" value="more than one blank line"/>
            <property name="illegalPattern" value="true"/>
        </module>
        <module name="WhitespaceAround">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Must have spaces"/>
            <property name="severity" value="error"/>
            <property name="tokens" value="COLON,NOT_EQUAL,QUESTION,DIV,DIV_ASSIGN,BXOR,BXOR_ASSIGN,MINUS,LCURLY,STAR,STAR_ASSIGN,TYPE_EXTENSION_AND,BAND,LAND,BAND_ASSIGN,MOD,MOD_ASSIGN,PLUS,PLUS_ASSIGN,LT,SL,SL_ASSIGN,LE,ASSIGN,MINUS_ASSIGN,EQUAL,GT,GE,SR,SR_ASSIGN,BSR,BSR_ASSIGN,BOR,BOR_ASSIGN,LOR,LITERAL_ASSERT,LITERAL_ASSERT,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,SLIST,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE"/>
        </module>
        <module name="Regexp">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="newline before }"/>
            <property name="severity" value="error"/>
            <property name="format" value="[\r]?[\n][ \t]*[\r]?[\n][ \t]+[}][ ]*[\n]"/>
            <property name="message" value="newline before }"/>
            <property name="illegalPattern" value="true"/>
        </module>
        <module name="ModifierOrder">
            <property name="severity" value="error"/>
        </module>
        <module name="AvoidStarImport">
            <property name="severity" value="error"/>
        </module>
<!--
        <module name="com.google.gwt.checkstyle.Order">
            <property name="severity" value="error"/>
        </module>
        <module name="com.google.gwt.checkstyle.Field">
            <property name="severity" value="error"/>
        </module>
-->
        <module name="DoubleCheckedLocking">
            <property name="severity" value="error"/>
        </module>
        <module name="EmptyStatement">
            <property name="severity" value="error"/>
        </module>
        <module name="MethodName">
            <property name="severity" value="error"/>
        </module>
        <module name="MemberName">
            <property name="severity" value="error"/>
            <property name="format" value="[a-z]|[a-z][a-z_0-9][A-Za-z0-9_]*|[a-z](?<!f)[A-Z0-9]*"/>
        </module>
        <module name="TodoComment">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Author tags"/>
            <property name="severity" value="error"/>
            <property name="format" value="@author"/>
        </module>
        <module name="Regexp">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="No one line javadoc comments"/>
            <property name="severity" value="error"/>
            <property name="format" value="[/][*][*][^\n]*[*][/]"/>
            <property name="message" value="No one line javadoc comments"/>
            <property name="illegalPattern" value="true"/>
        </module>
        <module name="NoWhitespaceAfter">
            <property name="severity" value="error"/>
            <property name="allowLineBreaks" value="false"/>
            <property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
        </module>
        <module name="WhitespaceAfter">
            <property name="tokens" value="TYPECAST"/>
        </module>
        <module name="TypecastParenPad">
            <property name="severity" value="error"/>
            <property name="tokens" value="RPAREN,TYPECAST"/>
        </module>
        <module name="ParenPad"/>
        <module name="MethodParamPad"/>
        <module name="NoWhitespaceBefore">
            <property name="severity" value="error"/>
            <property name="tokens" value="SEMI,DOT,POST_DEC,POST_INC"/>
        </module>
        <module name="RedundantModifier"/>
        <module name="EqualsHashCode"/>
    </module>
<!--
    <module name="PackageHtml">
        <property name="severity" value="ignore"/>
    </module>
-->
    <module name="SuppressionCommentFilter">
        <property name="offCommentFormat" value="CHECKSTYLE_OFF"/>
        <property name="onCommentFormat" value="CHECKSTYLE_ON"/>
    </module>
    <module name="SuppressionCommentFilter">
        <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Avoid name checking"/>
        <property name="offCommentFormat" value="CHECKSTYLE_NAMING_OFF"/>
        <property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
        <property name="checkFormat" value=".*Name.*"/>
        <property name="messageFormat" value=".*name.*"/>
    </module>
</module>


text:
from __future__ import print_function
from collections import namedtuple
from fileinput import input
from operator import itemgetter

Coord = namedtuple('Coord', 'y x')
Delta = namedtuple('Delta', 'y x')
Cell = namedtuple('Cell', 'y x value')
Quadrant = namedtuple('Quadrant', 'y_start y_end x_start x_end')

MOVE_LEFT = Delta(0, -1)
MOVE_RIGHT = Delta(0, 1)
MOVE_UP = Delta(-1, 0)
MOVE_DOWN = Delta(1, 0)

MOVE_DES = {
    MOVE_DOWN: 'DOWN',
    MOVE_LEFT: 'LEFT',
    MOVE_UP: 'UP',
    MOVE_RIGHT: 'RIGHT',
}

def debug(*args, **kwargs):
    import sys

    kwargs.setdefault('file', sys.stderr)
    print(*args, **kwargs)

class Board(object):
    _state = None

    def __init__(self, grid_size, state):
        self.grid_size = grid_size
        self.state = state

    @property
    def state(self):
        return self._state

    @state.setter
    def state(self, value):
        self._state = [[char for char in line] for line in value.split('\n') if line]

    def iter_state(self):
        return (Cell(y, x, char) for y, row in enumerate(self.state) for x, char in enumerate(row))

    def find(self, needle):
        if isinstance(needle, Cell):
            return needle

        if isinstance(needle, Coord):
            return Cell(needle.y, needle.x, self.state[needle.y][needle.x])

        for cell in self.iter_state():
            if cell.value == needle:
                return cell

        return None

    def findall(self, value):
        return [cell for cell in self.iter_state() if cell.value == value]

    def set_cell(self, needle, value):
        needle_cell = self.find(needle)
        self.state[needle_cell.y][needle_cell.x] = value

    def is_valid_coord(self, coord):
        if not isinstance(coord, Coord):
            return False

        for axis in (coord.x, coord.y):
            if axis < 0 or axis >= self.grid_size:
                return False
        return True

    def resolve_delta(self, delta, ref):
        if not isinstance(delta, Delta):
            return delta

        ref_cell = self.find(ref)

        coord = Coord(ref_cell.y + delta.y, ref_cell.x + delta.x)

        if not self.is_valid_coord(coord):
            raise InvalidMove()

        return coord

    def find_delta(self, char, target):
        char_cell, target_cell = self.find(char), self.find(target)

        if char_cell is None or target_cell is None:
            raise NoValidMove()

        delta_y = target_cell.y - char_cell.y
        delta_x = target_cell.x - char_cell.x
        return Delta(delta_y, delta_x)

    def move(self, a, b):
        cell_a = self.find(a)
        cell_b = self.find(self.resolve_delta(b, a))

        self.set_cell(cell_a, '-')
        self.set_cell(cell_b, cell_a.value)

    def pformat(self):
        return '\n'.join(''.join(row) for row in self.state if row)

class Bot(object):
    def __init__(self, board=None, char='b'):
        self.board = board
        self._char = char

    @property
    def char(self):
        return self.board.find(self._char)

    @char.setter
    def char(self, value):
        self._char = value

    def get_proximity(self, target):
        char_cell = self.char
        target_cell = self.board.find(target)

        delta = self.board.find_delta(char_cell, target_cell)
        return abs(delta.x) + abs(delta.y)

    def choose_target(self, targets):
        targets = [{'cell': target, 'proximity': self.get_proximity(target)} for target in targets]

        for target in targets:
            target['priority_inverse'] = target['proximity'] * 100
            target['quadrants'] = []
        grid_size = self.board.grid_size - 1
        quadrant_size = grid_size // 2
        quadrant_boxes = {
            'q1': Quadrant(0, quadrant_size, 0, quadrant_size),
            'q2': Quadrant(0, quadrant_size, quadrant_size, grid_size),
            'q3': Quadrant(quadrant_size, grid_size, quadrant_size, grid_size),
            'q4': Quadrant(quadrant_size, grid_size, 0, quadrant_size),
        }

        targets_by_quadrant = {
            'q1': [],
            'q2': [],
            'q3': [],
            'q4': [],
        }

        for quadrant_name, quadrant_box in quadrant_boxes.items():
            for target in targets:
                cell = target['cell']
                if cell.y < quadrant_box.y_start or cell.y > quadrant_box.y_end:
                    continue
                if cell.x < quadrant_box.x_start or cell.x > quadrant_box.x_end:
                    continue
                target['quadrants'].append(quadrant_name)
                targets_by_quadrant[quadrant_name].append(target)

        char_cell = self.char
        char_quadrants = []

        for quadrant_name, quadrant_box in quadrant_boxes.items():
            for target in [char_cell]:
                cell = target
                if cell.y < quadrant_box.y_start or cell.y > quadrant_box.y_end:
                    continue
                if cell.x < quadrant_box.x_start or cell.x > quadrant_box.x_end:
                    continue

                char_quadrants.append(quadrant_name)

        for target in targets:
            quadrant_priority = 1
            quadrant_coefficient = 10
            matching_coeffient = 1
            corner_coefficient = 1

            if not targets_by_quadrant['q1']:
                if 'q2' in target['quadrants'] or 'q4' in target['quadrants']:
                    quadrant_priority = quadrant_coefficient
            if not targets_by_quadrant['q2']:
                if 'q3' in target['quadrants'] or 'q1' in target['quadrants']:
                    quadrant_priority = quadrant_coefficient
            if not targets_by_quadrant['q3']:
                if 'q4' in target['quadrants'] or 'q2' in target['quadrants']:
                    quadrant_priority = quadrant_coefficient
            if not targets_by_quadrant['q4']:
                if 'q1' in target['quadrants'] or 'q3' in target['quadrants']:
                    quadrant_priority = quadrant_coefficient

            matching_quadrants = 0
            for target_quadrant in target['quadrants']:
                if target_quadrant in char_quadrants:
                    matching_quadrants += 1

            corner_modifier = 0
            corner_coords = [Coord(0, 0), Coord(grid_size, 0), Coord(grid_size, grid_size), Coord(0, grid_size)]
            target_coord = Coord(target['cell'].x, target['cell'].y)
            if target_coord in corner_coords:
                corner_modifier = 1 * corner_coefficient

            matching_quadrant_priority_multiplier = matching_quadrants * matching_coeffient + 1
            target['matching_quadrant_priority_multiplier'] = matching_quadrant_priority_multiplier

            quadrant_priority_multiplier = int(quadrant_priority / len(target['quadrants']))
            target['quadrant_priority_multiplier'] = quadrant_priority_multiplier

            target['corner_modifer'] = corner_modifier

            target['priority_inverse'] //= (quadrant_priority_multiplier + matching_quadrant_priority_multiplier)
            target['priority_inverse'] -= corner_modifier

        sorted_targets = sorted(targets, key=itemgetter('priority_inverse', 'proximity'))
        return sorted_targets[0]['cell']

    def suggest_move(self, target, op='+'):
        char_cell = self.char
        target_cells = self.board.findall(target)

        target_cell = self.choose_target(target_cells)
        delta = self.board.find_delta(char_cell, target_cell)

        if delta.y > 0:
            return MOVE_DOWN
        if delta.y < 0:
            return MOVE_UP
        if delta.x > 0:
            return MOVE_RIGHT
        if delta.x < 0:
            return MOVE_LEFT

        raise NoValidMove()

class InvalidMove(Exception):
    pass

class NoValidMove(Exception):
    pass

def next_move(posr, posc, grid):
    grid_size = len(grid.split('\n') if isinstance(grid, str) else grid)
    board = Board(grid_size, grid)
    bot = Bot(board, 'b')

    if not board.find('b'):
        return 'CLEAN'

    board.set_cell(Coord(posr, posc), 'b')

    move = bot.suggest_move('d')

    return MOVE_DES[move]

def parse_input(grid):
    bot_pos = Coord(*map(int, grid.pop(0).split()))
    grid_size = len(grid.split('\n') if isinstance(grid, str) else grid)
    return bot_pos, grid_size, '\n'.join(grid)

def main():
    bot_pos, grid_size, grid = parse_input([line.strip() for line in input()])
    print(next_move(bot_pos.y, bot_pos.x, grid))

if __name__ == '__main__':
    main()


text:
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_BINARY_MESSENGER_H_
#define FLUTTER_SHELL_PLATFORM_LINUX_FL_BINARY_MESSENGER_H_

#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION)
#error "Only <flutter_linux/flutter_linux.h> can be included directly."
#endif

#include <gio/gio.h>
#include <glib-object.h>

G_BEGIN_DECLS

/**
 * FlBinaryMessengerError:
 * @FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED: unable to send response, this
 * message has already been responded to.
 *
 * Errors for #FlBinaryMessenger objects to set on failures.
 */
#define FL_BINARY_MESSENGER_ERROR fl_binary_messenger_codec_error_quark()

typedef enum {
  FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED,
} FlBinaryMessengerError;

GQuark fl_binary_messenger_codec_error_quark(void) G_GNUC_CONST;

G_DECLARE_INTERFACE(FlBinaryMessenger,
                    fl_binary_messenger,
                    FL,
                    BINARY_MESSENGER,
                    GObject)

G_DECLARE_DERIVABLE_TYPE(FlBinaryMessengerResponseHandle,
                         fl_binary_messenger_response_handle,
                         FL,
                         BINARY_MESSENGER_RESPONSE_HANDLE,
                         GObject)

/**
 * FlBinaryMessengerMessageHandler:
 * @messenger: an #FlBinaryMessenger.
 * @channel: channel message received on.
 * @message: message content received from Dart.
 * @response_handle: a handle to respond to the message with.
 * @user_data: (closure): data provided when registering this handler.
 *
 * Function called when platform messages are received. Call
 * fl_binary_messenger_send_response() to respond to this message. If the
 * response is not occurring in this callback take a reference to
 * @response_handle and release that once it has been responded to. Failing to
 * respond before the last reference to @response_handle is dropped is a
 * programming error.
 */
typedef void (*FlBinaryMessengerMessageHandler)(
    FlBinaryMessenger* messenger,
    const gchar* channel,
    GBytes* message,
    FlBinaryMessengerResponseHandle* response_handle,
    gpointer user_data);

struct _FlBinaryMessengerInterface {
  GTypeInterface parent_iface;

  void (*set_message_handler_on_channel)(
      FlBinaryMessenger* messenger,
      const gchar* channel,
      FlBinaryMessengerMessageHandler handler,
      gpointer user_data,
      GDestroyNotify destroy_notify);

  gboolean (*send_response)(FlBinaryMessenger* messenger,
                            FlBinaryMessengerResponseHandle* response_handle,
                            GBytes* response,
                            GError** error);

  void (*send_on_channel)(FlBinaryMessenger* messenger,
                          const gchar* channel,
                          GBytes* message,
                          GCancellable* cancellable,
                          GAsyncReadyCallback callback,
                          gpointer user_data);

  GBytes* (*send_on_channel_finish)(FlBinaryMessenger* messenger,
                                    GAsyncResult* result,
                                    GError** error);
};

struct _FlBinaryMessengerResponseHandleClass {
  GObjectClass parent_class;
};

/**
 * FlBinaryMessenger:
 *
 * #FlBinaryMessenger is an object that allows sending and receiving of platform
 * messages with an #FlEngine.
 */

/**
 * FlBinaryMessengerResponseHandle:
 *
 * #FlBinaryMessengerResponseHandle is an object used to send responses with.
 */

/**
 * fl_binary_messenger_set_platform_message_handler:
 * @binary_messenger: an #FlBinaryMessenger.
 * @channel: channel to listen on.
 * @handler: (allow-none): function to call when a message is received on this
 * channel or %NULL to disable a handler
 * @user_data: (closure): user data to pass to @handler.
 * @destroy_notify: (allow-none): a function which gets called to free
 * @user_data, or %NULL.
 *
 * Sets the function called when a platform message is received on the given
 * channel. See #FlBinaryMessengerMessageHandler for details on how to respond
 * to messages.
 *
 * The handler is removed if the channel is closed or is replaced by another
 * handler, set @destroy_notify if you want to detect this.
 */
void fl_binary_messenger_set_message_handler_on_channel(
    FlBinaryMessenger* messenger,
    const gchar* channel,
    FlBinaryMessengerMessageHandler handler,
    gpointer user_data,
    GDestroyNotify destroy_notify);

/**
 * fl_binary_messenger_send_response:
 * @binary_messenger: an #FlBinaryMessenger.
 * @response_handle: handle that was provided in a
 * #FlBinaryMessengerMessageHandler.
 * @response: (allow-none): response to send or %NULL for an empty response.
 * @error: (allow-none): #GError location to store the error occurring, or %NULL
 * to ignore.
 *
 * Responds to a platform message.
 *
 * Returns: %TRUE on success.
 */
gboolean fl_binary_messenger_send_response(
    FlBinaryMessenger* messenger,
    FlBinaryMessengerResponseHandle* response_handle,
    GBytes* response,
    GError** error);

/**
 * fl_binary_messenger_send_on_channel:
 * @binary_messenger: an #FlBinaryMessenger.
 * @channel: channel to send to.
 * @message: (allow-none): message buffer to send or %NULL for an empty message.
 * @cancellable: (allow-none): a #GCancellable or %NULL.
 * @callback: (scope async): a #GAsyncReadyCallback to call when the request is
 * satisfied.
 * @user_data: (closure): user data to pass to @callback.
 *
 * Asynchronously sends a platform message.
 */
void fl_binary_messenger_send_on_channel(FlBinaryMessenger* messenger,
                                         const gchar* channel,
                                         GBytes* message,
                                         GCancellable* cancellable,
                                         GAsyncReadyCallback callback,
                                         gpointer user_data);

/**
 * fl_binary_messenger_send_on_channel_finish:
 * @binary_messenger: an #FlBinaryMessenger.
 * @result: a #GAsyncResult.
 * @error: (allow-none): #GError location to store the error occurring, or %NULL
 * to ignore.
 *
 * Completes request started with fl_binary_messenger_send_on_channel().
 *
 * Returns: (transfer full): message response on success or %NULL on error.
 */
GBytes* fl_binary_messenger_send_on_channel_finish(FlBinaryMessenger* messenger,
                                                   GAsyncResult* result,
                                                   GError** error);

G_END_DECLS

#endif  // FLUTTER_SHELL_PLATFORM_LINUX_FL_BINARY_MESSENGER_H_


text:
package com.funtl.framework.paypal.api.payments;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import com.funtl.framework.paypal.base.rest.PayPalModel;

@Getter
@Setter
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class Metadata extends PayPalModel {

	/**
	 * The date and time when the resource was created.
	 */
	private String createdDate;

	/**
	 * The email address of the account that created the resource.
	 */
	private String createdBy;

	/**
	 * The date and time when the resource was cancelled.
	 */
	private String cancelledDate;

	/**
	 * The actor who cancelled the resource.
	 */
	private String cancelledBy;

	/**
	 * The date and time when the resource was last edited.
	 */
	private String lastUpdatedDate;

	/**
	 * The email address of the account that last edited the resource.
	 */
	private String lastUpdatedBy;

	/**
	 * The date and time when the resource was first sent.
	 */
	private String firstSentDate;

	/**
	 * The date and time when the resource was last sent.
	 */
	private String lastSentDate;

	/**
	 * The email address of the account that last sent the resource.
	 */
	private String lastSentBy;

	/**
	 * URL representing the payer's view of the invoice.
	 */
	private String payerViewUrl;

	/**
	 * Default Constructor
	 */
	public Metadata() {
	}
}


text:
from django.shortcuts import render
from django.template import RequestContext
from .forms import formulario_usuario, formulario_trabajo
from models import Usuarios, Trabajos
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from rest_framework.renderers import JSONRenderer
from rest_framework.parsers import JSONParser
from .serializers import UsuariosSerializer, TrabajosSerializer

def index(request):
    """
    Muestra index.html con la lista de los usuarios registrados.

    :return: devuelve index.html
    """
    listaUsuarios= Usuarios.objects.values()
    listaTrabajos= Trabajos.objects.values()
    context = RequestContext(request,{'listaUsuarios':listaUsuarios, 'listaTrabajos':listaTrabajos,})
    return render(request, 'index.html',context)

def crearUsuario(request):
    """
    Muestra el formulario de registro.

    :return: devuelve crearUsuario.html
    """
    if request.method == "POST":
        formularioUsuario = formulario_usuario(request.POST)
        if formularioUsuario.is_valid():
            formularioUsuario.save(commit=True)
            listaUsuarios= Usuarios.objects.values()
            listaTrabajos= Trabajos.objects.values()
            context = RequestContext(request,{'listaUsuarios':listaUsuarios, 'listaTrabajos':listaTrabajos,})
            return render(request, 'index.html',context)
    else:
        formularioUsuario = formulario_usuario()

    context = {'formulariousuario' : formularioUsuario}
    return render(request, 'crearUsuario.html', context)

def crearTrabajo(request):
    """
    Muestra el formulario de registro.

    :return: devuelve crearTrabajo.html
    """
    if request.method == "POST":
        formularioTrabajo = formulario_trabajo(request.POST)
        if formularioTrabajo.is_valid():
            formularioTrabajo.save(commit=True)
            listaUsuarios= Usuarios.objects.values()
            listaTrabajos= Trabajos.objects.values()
            context = RequestContext(request,{'listaUsuarios':listaUsuarios, 'listaTrabajos':listaTrabajos,})
            return render(request, 'index.html',context)
    else:
        formularioTrabajo = formulario_trabajo()

    context = {'formulariotrabajo' : formularioTrabajo}
    return render(request, 'crearTrabajo.html', context)

class JSONResponse(HttpResponse):
    """
    Respuesta HttpResponse que convierte su contenido a JSON.
    """
    def __init__(self, data, **kwargs):
        content = JSONRenderer().render(data)
        kwargs['content_type'] = 'application/json'
        super(JSONResponse, self).__init__(content, **kwargs)

@csrf_exempt
def Usuarios_list(request):
    """
    Listar todos o crear un nuevo usuario.
    """
    if request.method == 'GET':
        usuarios = Usuarios.objects.all()
        serializer = UsuariosSerializer(usuarios, many=True)
        return JSONResponse(serializer.data)

    elif request.method == 'POST':
        data = JSONParser().parse(request)
        serializador = UsuariosSerializer(data=data)
        if serializer.is_valid():
            serializer.save()
            return JSONResponse(serializer.data, status=201)
        return JSONResponse(serializer.errors, status=400)

@csrf_exempt
def Usuarios_detail(request, pk):
    """
    Recuperar, actualizar o eliminar el codigo de usuarios.
    """
    try:
        usuarios = Usuarios.objects.get(pk=pk)
    except Usuarios.DoesNotExist:
        return HttpResponse(status=404)

    if request.method == 'GET':
        serializer = UsuariosSerializer(usuarios)
        return JSONResponse(serializer.data)

    elif request.method == 'PUT':
        data = JSONParser().parse(request)
        serializer = UsuariosSerializer(usuarios, data=data)
        if serializer.is_valid():
            serializer.save()
            return JSONResponse(serializer.data)
        return JSONResponse(serializer.errors, status=400)

    elif request.method == 'DELETE':
        usuarios.delete()
        return HttpResponse(status=204)

@csrf_exempt
def Trabajos_list(request):
    """
    Listar todos o crear un nuevo trabajo.
    """
    if request.method == 'GET':
        trabajos = Trabajos.objects.all()
        serializer = TrabajosSerializer(trabajos, many=True)
        return JSONResponse(serializer.data)

    elif request.method == 'POST':
        data = JSONParser().parse(request)
        serializador = TrabajosSerializer(data=data)
        if serializer.is_valid():
            serializer.save()
            return JSONResponse(serializer.data, status=201)
        return JSONResponse(serializer.errors, status=400)

@csrf_exempt
def Trabajos_detail(request, pk):
    """
    Recuperar, actualizar o eliminar el codigo de trabajos.
    """
    try:
        trabajos = Trabajos.objects.get(pk=pk)
    except Usuarios.DoesNotExist:
        return HttpResponse(status=404)

    if request.method == 'GET':
        serializer = TrabajosSerializer(trabajos)
        return JSONResponse(serializer.data)

    elif request.method == 'PUT':
        data = JSONParser().parse(request)
        serializer = TrabajosSerializer(trabajos, data=data)
        if serializer.is_valid():
            serializer.save()
            return JSONResponse(serializer.data)
        return JSONResponse(serializer.errors, status=400)

    elif request.method == 'DELETE':
        trabajos.delete()
        return HttpResponse(status=204)


text:
import { StringUtils } from './string-utils';

describe('StringUtils', () => {

    describe('capitalize', () => {
        it('should uppercase first letter of word and lowercase the rest', () => {
            const lowercaseWord = 'test';
            const uppercaseWord = 'TEST';
            const mixedWord = 'tEsT';

            expect(StringUtils.capitalize(lowercaseWord)).toBe('Test');
            expect(StringUtils.capitalize(uppercaseWord)).toBe('Test');
            expect(StringUtils.capitalize(mixedWord)).toBe('Test');
        });

        it('should uppercase first letter of first word in sentence and lowercase the rest', () => {
            const sentence = 'this is a sentence';

            expect(StringUtils.capitalize(sentence)).toBe('This is a sentence');
        });
    });

    describe('replaceAll', () => {
        it('should replace all instances provided in the delimiters obj', () => {
            const test = 'isClusterEnabled';
            const delimiters = {
                is: 'are',
                Enabled: 'Disabled'
            };

            expect(StringUtils.replaceAll(test, delimiters)).toBe('areClusterDisabled');
        });

        it('should return initial string if delimiters is not an oject', () => {
            const test = 'isClusterEnabled';
            const delimiters = 'test';

            expect(StringUtils.replaceAll(test, delimiters)).toBe('isClusterEnabled');
        });
    });

    describe('removeAll', () => {
        it('should remove all instances described in demiliters arguments in string', () => {
            const test = 'isClusterEnabled';
            const delimiters = ['is', 'Enabled'];

            expect(StringUtils.removeAll(test, ...delimiters)).toBe('Cluster');
        });
    });

    describe('prettifyBooleanEnabled', () => {
        it('should remove "is" and "enabled" from strings', () => {
            const test = 'isClusterEnabled';

            expect(StringUtils.prettifyBooleanEnabled(test)).toBe('Cluster');
        });
    });
});


text:
import { Component, OnInit } from '@angular/core';
import { GameService } from "../../services/game.service";
import { Game } from "shared/models";
import { SessionInfo } from "../../session/session-info";
import { Router } from '@angular/router';
import 'rxjs/add/operator/toPromise';

@Component({
    selector: 'game-creation',
    templateUrl: './app/components/game-creation/game-creation.component.html',
    styleUrls: ['./app/components/game-creation/game-creation.component.css']
})

export class GameCreationComponent implements OnInit {
    game: Game;

    error: any;

    constructor(
        private router: Router,
        private gameService: GameService) {
        this.game = new Game();
        this.game.createdBy = SessionInfo.Player.name;
    }

    ngOnInit(): void {
    }

    createGame(): void {
        if (this.verifyGame()) {
            this.gameService.createGame(this.game).then(createdGame => {
                let res: any = createdGame;
                if (res.error) {

                } else {
                    this.gameService.joinGameLobby(createdGame, SessionInfo.Player).then(joinedGame => {
                        SessionInfo.GameActive = true;
                        this.router.navigate(['game', createdGame._id, 'lobby']);
                    });
                }
            });
        }
    }

    private verifyGame(): boolean {
        return this.game.name &&
            (this.game.numberOfPlayers >= 5 && this.game.numberOfPlayers <= 10);
    }

    toggleRole(role: string): void {
        if (this.hasRole(role)) {
            let index: number = this.game.roles.indexOf(role);
            this.game.roles.splice(index, 1);
        } else {
            this.game.roles.push(role);
        }
    }

    hasRole(role: string): boolean {
        return this.game.roles.indexOf(role) >= 0;
    }

    toggleItem(item: string): void {
        if (this.hasItem(item)) {
            let index: number = this.game.items.indexOf(item);
            this.game.items.splice(index, 1);
        } else {
            this.game.items.push(item);
        }
    }

    hasItem(item: string): boolean {
        return this.game.items.indexOf(item) >= 0;
    }

    cancel(): void {
        this.router.navigate(['/dashboard']);
    }
}


text:
<!DOCTYPE html>

<meta charset="UTF-8">
<title></title>

        {#        #}
        {#        #}
        {#        #}
        {#        #}
        {#        #}
        {#        #}

 The Capitalist Tee

            Enter the number 'X' that you want printed on your shirt

            and we will send you the shirt for 15 + 'X' dollars

                <input type="text" class="number-input"/>

                Black
                White

            {#
#}
            {#                Masculine#}
            {#                Feminine#}
            {#
#}

                S
                M
                L

                 ship to
                <input type="text" class="shipping-input"/>

                $15
                +
                ?
                =
                What You Pay

            Purchase With Credit Card

                processing...

thankyou

            click here to start a new order

?

        see the back


text:
using System.Runtime.Serialization;
namespace UnityEngine.UI.Extensions
{
    public sealed class ColorSurrogate : ISerializationSurrogate
    {

        // Method called to serialize a Vector3 object
        public void GetObjectData(System.Object obj,
                                  SerializationInfo info, StreamingContext context)
        {
            Color color = (Color)obj;
            info.AddValue("r", color.r);
            info.AddValue("g", color.g);
            info.AddValue("b", color.b);
            info.AddValue("a", color.a);
        }

        // Method called to deserialize a Vector3 object
        public System.Object SetObjectData(System.Object obj,
                                           SerializationInfo info, StreamingContext context,
                                           ISurrogateSelector selector)
        {
            Color color = (Color)obj;
            color.r = (float)info.GetValue("r", typeof(float));
            color.g = (float)info.GetValue("g", typeof(float));
            color.b = (float)info.GetValue("b", typeof(float));
            color.a = (float)info.GetValue("a", typeof(float));
            obj = color;
            return obj;
        }
    }
}


text:
/**
 *
 */
package com.radish.master.entity.project;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import com.cnpc.framework.annotation.Header;
import com.cnpc.framework.base.entity.BaseEntity;

/**
 * @author tonyd
 *
 */
@Entity
@Table(name = "tbl_measure")
public class Measure extends BaseEntity {

    private static final long serialVersionUID = 4805661305199812852L;

    @Header(name = "名称")
    @Column(name = "name")
    private String name;

    @Header(name = "所属项目编码")
    @Column(name = "project_id")
    private String projectID;

    @Header(name = "所属项目名称")
    @Column(name = "project_name")
    private String projectName;

    @Header(name = "所属项目子项编码")
    @Column(name = "project_sub_id")
    private String projectSubID;

    @Header(name = "所属项目子项名称")
    @Column(name = "project_sub_name")
    private String projectSubName;

    @Header(name = "安全文明施工费")
    @Column(name = "construct")
    private String construct;

    @Header(name = "总价措施项目费")
    @Column(name = "issue")
    private String issue;

    @Header(name = "管理费")
    @Column(name = "manage")
    private String manage;

    @Header(name = "规费")
    @Column(name = "rule")
    private String rule;

    @Header(name = "税金")
    @Column(name = "tax")
    private String tax;

    @Header(name = "状态")
    @Column(name = "status")
    private String status;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getProjectID() {
        return projectID;
    }

    public void setProjectID(String projectID) {
        this.projectID = projectID;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getProjectSubID() {
        return projectSubID;
    }

    public void setProjectSubID(String projectSubID) {
        this.projectSubID = projectSubID;
    }

    public String getProjectSubName() {
        return projectSubName;
    }

    public void setProjectSubName(String projectSubName) {
        this.projectSubName = projectSubName;
    }

    public String getConstruct() {
        return construct;
    }

    public void setConstruct(String construct) {
        this.construct = construct;
    }

    public String getIssue() {
        return issue;
    }

    public void setIssue(String issue) {
        this.issue = issue;
    }

    public String getManage() {
        return manage;
    }

    public void setManage(String manage) {
        this.manage = manage;
    }

    public String getRule() {
        return rule;
    }

    public void setRule(String rule) {
        this.rule = rule;
    }

    public String getTax() {
        return tax;
    }

    public void setTax(String tax) {
        this.tax = tax;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

}


text:
using CodingInterviewSolutions.Chapter1;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CodingInterviewSolutionsUnitTests.Chapter1
{
	[TestClass]
	public class Problem1_3UnitTests
	{
		[TestMethod]
		public void Problem1Tests()
		{
			Problem1_3.RemoveDuplicateCharacters("doggie")
				.Should().Be("dogie");

			Problem1_3.RemoveDuplicateCharacters("my name is")
				.Should().Be("my naeis");

			Problem1_3.RemoveDuplicateCharacters("Superman")
				.Should().Be("Superman");
		}
	}
}


text:
require_relative 'monster'
require_relative '../../broadcast'
require_relative '../treasure_table'
require_relative '../stats'

# A type of monster the characters can do battle with.
class Ogre < Monster
  include Broadcast

  def initialize(random)
    @name = 'Ogre'
    @nax_hp = @current_hp = 12 + random.rand(0..4)
    @ac = 10
    @xp = 25

    @stats = Stats.new
    @stats.speed = 8
    @stats.accuracy = 16
  end

  def attack(target, random)
    if random.rand(0..3) + @stats.accuracy_modifier >= target.ac
      broadcast "#{@name} crushes #{target.name}."
      target.take_damage(random.rand(2..5))
    else
      broadcast "#{@name} swings widly but misses."
    end
  end

  def treasure
    treasure_table = TreasureTable.new
    treasure_table.medium_amount_of_gold + treasure_table.very_small_chance_for_one_item
  end
end


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;

namespace Microsoft.Build.Framework
{
    /// <summary>
    /// Will provide location information for an event, this is especially
    /// needed in a multi processor environment
    /// </summary>
    [Serializable]
    public class BuildEventContext
    {
        #region Data

        /// <summary>
        /// Node event was in
        /// </summary>
        private int _nodeId;

        /// <summary>
        /// Target event was in
        /// </summary>
        private int _targetId;

        /// <summary>
        ///The node-unique project request context the event was in
        /// </summary>
        private int _projectContextId;

        /// <summary>
        /// Id of the task the event was caused from
        /// </summary>
        private int _taskId;

        /// <summary>
        /// The id of the project instance to which this event refers.
        /// </summary>
        private int _projectInstanceId;

        /// <summary>
        /// The id of the submission.
        /// </summary>
        private int _submissionId;

        #endregion

        #region Constructor

        /// <summary>
        /// This is the original constructor.  No one should ever use this except internally for backward compatibility.
        /// </summary>
        public BuildEventContext
        (
            int nodeId,
            int targetId,
            int projectContextId,
            int taskId
        )
            : this(InvalidSubmissionId, nodeId, InvalidProjectInstanceId, projectContextId, targetId, taskId)
        {
            // UNDONE: This is obsolete.
        }

        /// <summary>
        /// Constructs a BuildEventContext with a specified project instance id.
        /// </summary>
        public BuildEventContext
        (
            int nodeId,
            int projectInstanceId,
            int projectContextId,
            int targetId,
            int taskId
        )
            : this(InvalidSubmissionId, nodeId, projectInstanceId, projectContextId, targetId, taskId)
        {
        }

        /// <summary>
        /// Constructs a BuildEventContext with a specific submission id
        /// </summary>
        public BuildEventContext
        (
            int submissionId,
            int nodeId,
            int projectInstanceId,
            int projectContextId,
            int targetId,
            int taskId
        )
        {
            _submissionId = submissionId;
            _nodeId = nodeId;
            _targetId = targetId;
            _projectContextId = projectContextId;
            _taskId = taskId;
            _projectInstanceId = projectInstanceId;
        }

        #endregion

        #region Properties

        /// <summary>
        /// Returns a default invalid BuildEventContext
        /// </summary>
        public static BuildEventContext Invalid
        {
            get
            {
                return new BuildEventContext(BuildEventContext.InvalidNodeId, BuildEventContext.InvalidTargetId, BuildEventContext.InvalidProjectContextId, BuildEventContext.InvalidTaskId);
            }
        }

        /// <summary>
        /// NodeId where event took place
        /// </summary>
        public int NodeId
        {
            get
            {
                return _nodeId;
            }
        }

        /// <summary>
        /// Id of the target the event was in when the event was fired
        /// </summary>
        public int TargetId
        {
            get
            {
                return _targetId;
            }
        }

        /// <summary>
        /// Retrieves the Project Context id.
        /// </summary>
        public int ProjectContextId
        {
            get
            {
                return _projectContextId;
            }
        }

        /// <summary>
        /// Retrieves the task id.
        /// </summary>
        public int TaskId
        {
            get
            {
                return _taskId;
            }
        }

        /// <summary>
        /// Retrieves the project instance id.
        /// </summary>
        public int ProjectInstanceId
        {
            get
            {
                return _projectInstanceId;
            }
        }

        /// <summary>
        /// Retrieves the Submission id.
        /// </summary>
        public int SubmissionId
        {
            get
            {
                return _submissionId;
            }
        }

        /// <summary>
        /// Retrieves the BuildRequest id.  Note that this is not the same as the global request id on a BuildRequest or BuildResult.
        /// </summary>
        public long BuildRequestId
        {
            get
            {
                return ((long)_nodeId << 32) + _projectContextId;
            }
        }

        #endregion

        #region Constants
        public const int InvalidProjectContextId = -2;
        public const int InvalidTaskId = -1;
        public const int InvalidTargetId = -1;
        public const int InvalidNodeId = -2;
        public const int InvalidProjectInstanceId = -1;
        public const int InvalidSubmissionId = -1;
        #endregion

        #region Equals

        /// <summary>
        /// Retrieves a hash code for this BuildEventContext.
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            return (ProjectContextId + (NodeId << 24));
        }

        /// <summary>
        /// Compare a BuildEventContext with this BuildEventContext.
        /// A build event context is compared in the following way.
        ///
        /// 1. If the obect references are the same the contexts are equivilant
        /// 2. If the object type is the same and the Id values in the context are the same, the contexts are equivilant
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            // If the references are the same no need to do any more comparing
            if (object.ReferenceEquals(this, obj))
            {
                return true;
            }

            if (object.ReferenceEquals(obj, null))
            {
                return false;
            }

            // The types do not match, they cannot be the same
            if (this.GetType() != obj.GetType())
            {
                return false;
            }

            return InternalEquals((BuildEventContext)obj);
        }
        /// <summary>
        /// Override == so the  equals comparison using this operator will be the same as
        /// .Equals
        /// </summary>
        /// <param name="left">Left hand side operand</param>
        /// <param name="right">Right hand side operand</param>
        /// <returns>True if the object values are identical, false if they are not identical</returns>
        public static bool operator ==(BuildEventContext left, BuildEventContext right)
        {
            if (Object.ReferenceEquals(left, right))
            {
                return true;
            }

            if (Object.ReferenceEquals(left, null))
            {
                return false;
            }

            return left.Equals(right);
        }

        /// <summary>
        /// Override != so the  equals comparison using this operator will be the same as
        ///  ! Equals
        /// </summary>
        /// <param name="left">Left hand side operand</param>
        /// <param name="right">Right hand side operand</param>
        /// <returns>True if the object values are not identical, false if they are identical</returns>
        public static bool operator !=(BuildEventContext left, BuildEventContext right)
        {
            return !(left == right);
        }

        /// <summary>
        /// Verify the fields are identical
        /// </summary>
        /// <param name="buildEventContext">BuildEventContext to compare to this instance</param>
        /// <returns>True if the value fields are the same, false if otherwise</returns>
        private bool InternalEquals(BuildEventContext buildEventContext)
        {
            return ((_nodeId == buildEventContext.NodeId)
                   && (_projectContextId == buildEventContext.ProjectContextId)
                   && (_targetId == buildEventContext.TargetId)
                   && (_taskId == buildEventContext.TaskId));
        }
        #endregion

    }
}


text:
class AddRoleToUser < ActiveRecord::Migration
  def change
    add_column :users, :role, :string, default: 'admin', null: false
  end
end