text:
"use strict";

if ( typeof theory === 'undefined' ) {
  throw new Error('You must load theory.js first.');
}

/**
 * More readable version that the usual `String.indexOf`.
 * @method
 */
String.prototype.contains = function(v){
  return this.indexOf(v) != -1;
}

/**
 * Simple `.indexOf` implementation that takes into account possible escape characters.
 */
!String.prototype.indexOfEscapable &&
(String.prototype.indexOfEscapable = function(needle, offset, escape){
  var p = (offset||0)-1, k, e; !escape && (escape = '\\');
  while ( (k=p=this.indexOf(needle, p+1)) != -1 ) {
    e = 0; while ( this.charAt(--k) === escape ) {e++}
    if ( !e || !(e&1) ) { break; }
  }
  return p;
});

/**
 * Simple check to match a particular char offset against an array of chars.
 */
!String.prototype.charIs &&
(String.prototype.charIs = function( string, offset, needles ){
  if ( offset < -1 ) {
    offset = string.length + offset;
  }
  return needles.indexOf( string.charAt(offset) ) != -1;
});

/**
 * JavaScript really should have this built-in by now!
 */
!String.prototype.trim &&
(String.prototype.trim = function( string ){
  return string.replace(/^\s+|\s+$/g, '');
});

/**
 * Theory's string system -- mainly used for parsing strings with
 * instruction sets i.e. parsers described by objects.
 *
 * @memberof! theory
 * @namespace
 */
theory.string = t.creator.callable({

  theory: {
    prep: function(desc){
      desc.instructions.processGroup = desc.instructions.processGroup.bind(desc);
      desc.instructions.processItem = desc.instructions.processItem.bind(desc);
      return desc;
    }
  },

  /**
   * A collection of properties that are shared (i.e. same reference) across
   * {@linkcode theory.string} instances.
   *
   * By default, all methods are shared between instances, unless specifically
   * added to {@linkcode theory.string.i}
   *
   * @memberof! theory.string
   * @namespace theory.string.shared
   */
  shared: {
    /**
     * Used to store the instruction sets used by {@linkcode theory.string} and
     * {@linkcode theory.string.parse}.
     *
     * This object shouldn't be used directly, instead use the
     * {@linkcode theory.string.instructions} method.
     *
     * @member {object} instructions
     * @memberof! theory.string.shared
     */
    instructions: {}
  },

  /**
   * A collection of properties and methods that are unique references
   * per each {@linkcode theory.string} instance.
   *
   * @memberof! theory.string
   * @namespace
   */
  i: {},

  /*
   *
   */
  prep: function(source, config){
    this.source = source;
    this.config = config || {};
    this.i = Object.create(this.i);
    return this;
  },

  /**
   * Parse a string based on a set of instructions.
   *
   * @memberof! theory.string
   * @method
   * @param {string} name - The lookup name used to find the instruction set.
   * @param {object} [instructions] - `name` will be ignored if an instruction set it passed as this parameter.
   * @return {object} the processed result, usually a structure of objects and arrays.
   */
  parse: function(name, instructions){
    if ( instructions || (instructions=this.shared.instructions[name]) ) {
      return this.instructions.processGroup(
        instructions,
        'default',
        (this.tree={string: this.source.trim()})
      );
    }
    else {
      throw new Error('unknown instruction set ' + name);
    }
  },

  /**
   * Responsible for handling all of the instruction sets for {@linkcode theory.string t.string}
   *
   * New instruction sets can be added using {@linkcode theory.string.instructions.___callable t.string.instruction}
   *
   * @memberof! theory.string
   * @namespace
   */
  instructions: t.method({

    /**
     * Get a named instruction set, that has been previously defined.
     *
     * @memberof! theory.string.instructions
     * @method ___callable
     * @param {string} name - The lookup name used to find the instruction set.
     *
     *//**
     *
     * Set a named instruction set that can be used with {@linkcode theory.string.parse}
     *
     * @memberof! theory.string.instructions
     * @method ___callable
     * @param {string} name - The lookup name that the instructions will be stored under.
     * @param {string} instructions - The instructions object
     * @chainable
     */
    method: function(name, instructions){
      if ( arguments.length > 1 ) {
        this.shared.instructions[name] = instructions;
        return this;
      }
      else {
        return this.shared.instructions[name];
      }
    },
    attributes: {
      /**
       * The parser works by logically following an object list of instructions, which in turn
       * have sub instructions that can loop back to other instructions.
       *
       * @memberof! theory.string.instructions
       * @method
       * @param {object}        instructions - the overaching set of instructions
       * @param {string|object} name         - an string describing the current name of the instruction (or the actual instruction in object form)
       * @param {object}        snowball     - initially starts with the string to be passed
       *   defined as `{string:'...'}`, later is used to keep track of the parsing, and then is the
       *   object to be returned after processing is complete.
       */
      processGroup: function( instructions, name, snowball ){
        var a,i,l, mode = typeof name === 'string' ? instructions[name] : name;
        if ( mode ) {
          if ( mode.content ) {
            /// if there are already children at this level, we need to pass deeper.
            if ( snowball.children ) {
              for ( a=snowball.children, i=0, l=a.length; i<l; i++ ) {
                this.instructions.processGroup( instructions, name, a[i] );
              }
            }
            else {
              for ( a=mode.content, i=0, l=a.length; i<l; i++ ) {
                this.instructions.processItem( instructions, a[i], snowball );
              }
            }
          }
        }
        return snowball;
      },
      /**
       * Each instruction set is applied to a particular range of the string to be parsed.
       * This string range is tracked within the snowball object.
       *
       * An instruction set can contain one or more groups of sub-instructions.
       *
       * The default behaviour is to run all sub-instructions in sequence. However, if a
       * group of sub-instructions is set to short circuit, then any time a sub-instruction
       * finds a match, processing will cease for that group and instead start for the next
       * (if there is one).
       *
       * @memberof! theory.string.instructions
       * @method
       * @param {object} instructions   - the overarching object that contains all the instructions
       * @param {object} instruction    - an individual instruction, that has been drilled down to by
       * {@linkcode theory.string.instructions.processGroup processGroup}
       * @param {object} snowball       - see the description for {@linkcode theory.string.instructions.processGroup processGroup}
       * @param {object} [options]      - change the behaviour of this function
       * @param {object} [options.dividerOffset=0] - change where the divider will start from
       */
      processItem: function( instructions, instruction, snowball, options ){
        var c,a,n, l,i,e, aa,ii,ll, itm, div, book, wrap, range, ranges;
        !options && (options = { dividerOffset: 0 });
        if ( instruction.divide || instruction.ranges ) {
          /// if this set hasnt been compiled yet, do so now.
          if ( !instruction.compiled ) {
            instruction.compiled = {};
            /// if we have any ranges, compile them into a Matchbook
            if ( instruction.ranges ) {
              instruction.compiled.ranges = {
                starts: t.matchbook.create(),
                ends: t.matchbook.create()
              };
              /// step each sub instruction and build an array of the start and end symbols
              for ( a=instruction.ranges, i=0, l=a.length; i<l; i++ ) {
                if ( (n=a[i]) && (itm=instructions[n]) ) {
                  /// ranges must have a start and end
                  itm.start && instruction.compiled.ranges.starts.add( itm.start, itm );
                  itm.end   && instruction.compiled.ranges.ends.add( itm.end, itm );
                }
              }
              /// Compile our matchbooks, so they are ready to find particular symbols within a string.
              instruction.compiled.ranges.starts.compile();
              instruction.compiled.ranges.ends.compile();
            }
            /// if we have any divisions, compile them into a Matchbook
            if ( instruction.divide ) {
              instruction.compiled.dividers = [];
              /// if we have any divide directives, we need to create matchbooks for the divide symbols.
              for ( a=instruction.divide, i=0, l=a.length; i<l; i++ ) {
                /// create a new book to house the dividers
                book = t.matchbook.create();
                /// if an array of dividers is presented, these should be given the same precedence.
                if ( a[i].join ) {
                  for ( aa=a[i], ii=0, ll=aa.length; ii<ll; ii++ ) {
                    if ( (n = aa[ii]) && (itm = instructions[n]) ) {
                      itm.token && book.add( itm.token, itm );
                    }
                  }
                }
                /// otherwise create a book out of a single divider.
                else {
                  if ( (n = a[i]) && (itm = instructions[n]) ) {
                    itm.token && book.add( itm.token, itm );
                  }
                }
                /// add this book to the list of dividers, in the order they are to be applied.
                instruction.compiled.dividers.push( book.compile() );
              }
            }
          }
          /// set our starting division point to 0
          div = 0;
          ///
          wrap = null;
          ///
          ranges = [];
          ///
          if ( instruction.compiled ) {
            a = instruction.compiled.dividers || [];
            i = options.dividerOffset;
            l = a.length;
            /// quickly scan the entire string for any divisions, being wary of ranges, and initial divider offset.
            do {
            //for ( a=instruction.compiled.dividers, i=options.dividerOffset, l=a.length; !wrap && i<l; i++ ) {
              for ( aa=snowball.string, ii=0, ll=aa.length; ii<ll; ii++ ) {
                /// if we find a divide.
                if ( a[i] && !range && (c = a[i].compare(aa, ii)) ) {
                  itm = a[i].userdata(c);
                  /// @TODO: handle if itm.length > 1 -- meaning multiple dividers have been provided with a similar start
                  itm = itm[0];
                  !wrap && (wrap = {
                    type: itm.name,
                    children: [],
                    token: c,
                    dividers: a,
                    divider: i
                  });
                  wrap.children.push((wrap.lastChild = {
                    type: itm.makes,
                    string: aa.substring(div, ii)
                  }));
                  div = ii + c.length;
                  ii += c.length - 1;
                }
                /// if we are to expect any ranges in this parsing.     (hello(test)this) (hello"this is a test)")
                else if ( instruction.compiled.ranges ) {
                  /// if we already have a range on-the-go, we are in range mode.
                  if ( range ) {
                    /// did we find a range end? that matches our current range.
                    if ( (c = instruction.compiled.ranges.ends.compare(aa, ii)) && this.ranges.hasEnd(range, c) ) {
                      /// collapse the range down to the one that matched -- out of possible endings
                      this.ranges.chooseEnd(range, c);
                      /// only bother with this if we are ending our target/base range.
                      if ( range.metrics ) {
                        range.metrics.innerEnd = ii;
                        range.metrics.outerEnd = ii + c.length;
                        range.outer = aa.substring(range.metrics.outerStart, range.metrics.outerEnd);
                        range.string = aa.substring(range.metrics.innerStart, range.metrics.innerEnd);
                      }
                      /// step back to the previous range
                      range = ranges.pop();
                      /// move on the char cursor
                      ii += c.length - 1;
                    }
                    /// did we find a range start?
                    else if ( (c = instruction.compiled.ranges.starts.compare(aa, ii)) ) {
                      itm = instruction.compiled.ranges.starts.userdata(c);
                      /// store the current range
                      ranges.push(range);
                      range = this.ranges.make(itm);
                      /// move on the char cursor
                      ii += c.length - 1;
                    }
                  }
                  /// if we have already recorded this range before, skip it out entirely.
                  else if ( snowball.ranges && snowball.ranges.lookup[ii] ) {
                    ii = snowball.ranges.lookup[ii].metrics.innerEnd;
                  }
                  /// we have detected the start of a range, we need to switch into range mode.
                  else if ( (c = instruction.compiled.ranges.starts.compare(aa, ii)) ) {
                    itm = instruction.compiled.ranges.starts.userdata(c);
                    !snowball.ranges && (snowball.ranges = {
                      lookup: {},
                      list: []
                    });
                    range = this.ranges.make(itm, {
                      outerStart: ii,
                      innerStart: ii + c.length
                    });
                    snowball.ranges.list.push(range);
                    snowball.ranges.lookup[ii] = range;
                    /// move on the char cursor
                    ii += c.length - 1;
                  }
                }
              }
              i++;
            } while ( !wrap && i<l );
            /// if we have a wrap, then we have created divisions that need to be managed.
            if ( wrap && wrap.lastChild ) {
              wrap.children.push((wrap.lastChild = {
                type: wrap.lastChild.type,
                string: snowball.string.substring(div, snowball.string.length)
              }));
              /// walk up the list of dividers in precedence order, making sure to work on the individual divided strings.
              if ( wrap.divider + 1 < wrap.dividers.length ) {
                for ( aa=wrap.children, ii=0, ll=aa.length; ii<ll; ii++ ) {
                  this.instructions.processItem( instructions, instruction, aa[ii], { dividerOffset: wrap.divider+1 } );
                }
              }
              /// now parse for the next level as per the childs type.
              for ( aa=wrap.children, ii=0, ll=aa.length; ii<ll; ii++ ) {
                if ( aa[ii].type.join ) {
                  aa[ii].type = aa[ii].type[ii];
                }
                this.instructions.processGroup( instructions, aa[ii].type, aa[ii] );
              }
              /// make sure the snowball can store children
              !snowball.children && (snowball.children = []);
              snowball.children.push(wrap);
              /// tidy up!
              delete wrap.divider;
              delete wrap.dividers;
              delete wrap.lastChild;
              wrap = null;
            }
            /// we will only get here when there are no more divisions, but there are ranges.
            else if ( snowball.ranges && snowball.ranges.list ) {
              /// only bother wrapping if there is more than one range, or the range doesn't encompass the whole segment.
              if ( snowball.ranges.list.length > 1 || (snowball.ranges.list.length === 1 && snowball.ranges.list[0].outer && snowball.ranges.list[0].outer.length < snowball.string.length) ) {
                snowball.children = [(wrap = {
                  type: 'combination',
                  children: []
                })];
                div = 0;
                /// push a null range to the end so we can support any remaining string
                snowball.ranges.list.push(null);
                /// step each range and thread it as children along with any interwoven strings.
                for ( a=snowball.ranges.list, i=0, l=a.length; i<l; i++ ) {
                  /// if there was an interwoven string
                  if ( (itm = snowball.string.substring(div, a[i] ? a[i].metrics.outerStart : snowball.string.length)) ) {
                    wrap.children.push({
                      type: 'string',
                      string: itm
                    });
                  }
                  if ( a[i] ) {
                    /// add the range
                    wrap.children.push(a[i]);
                    this.instructions.processGroup( instructions, a[i].type, a[i] );
                    div = a[i].metrics.outerEnd;
                  }
                }
              }
              /// the range exactly matches the length of the string/segment.
              else if ( (a = snowball.ranges.list[0]) ) {
                snowball.children = [a];
                this.instructions.processGroup( instructions, a.type, a );
              }
            }
            /// if we are here it means we didn't find a division or a range, if that happens
            /// some instruction sets will tell us what to make of these simple strings.
            /// generally if will mean treating them as a singular division.
            else if ( instruction.makes ) {
              this.instructions.processGroup( instructions, instruction.makes, snowball );
            }
            /// tidy up
            delete snowball.ranges;
          }
        }
        return snowball;
      }
    }
  }),

  /**
   * A collection of methods for dealing with {@linkcode theory.string} ranges.
   *
   * @memberof! theory.string
   * @namespace
   */
  ranges: {

    /**
     * Creates a range object from multiple tokens - this handles the situiaton
     * if ranges have similar starts, but (obviously) different ends. For example,
     * when scanning for ranges that can be either `[...]` and `[...]?`
     *
     * @memberof! theory.string.ranges
     * @method
     */
    make: function(itm, metrics){
      var range = {
        start: [],
        end: [],
        type: []
      };
      for ( var i=0; i<itm.length; i++ ) {
        range.start.push(itm[i].start);
        range.end.push(itm[i].end);
        range.type.push(itm[i].name);
      }
      if ( metrics ) {
        range.metrics = metrics;
      }
      return range;
    },

    /**
     * Test whether a specific range collection has met its end.
     *
     * @memberof! theory.string.ranges
     * @method
     */
    hasEnd: function(range, c){
      return range.end.indexOf(c) != -1;
    },

    /**
     * Returns which range has ended out of the possible choices
     * contained with the range object.
     *
     * @memberof! theory.string.ranges
     * @method
     */
    chooseEnd: function(range, c){
      var n = range.end.indexOf(c);
      range.start = range.start[n];
      range.type = range.type[n];
      range.end = range.end[n];
      return range;
    }

  }

});

/*
 * Use these instructions to parse Method keys for theory's overload ability
 */
theory.string.instructions('t-key', {
  'default': {
    content: [
      { ranges: ['squareOptional', 'square'] }
    ]
  },
  'squareOptional': {
    name: 'squareOptional',
    start: "[",
    end: "]?",
    content: [
      { divide: ['commas'], makes: 'item' }
    ]
  },
  square: {
    name: 'square',
    start: "[",
    end: "]",
    content: [
      { divide: ['commas'], makes: 'item' }
    ]
  },
  commas: {
    name: 'commas',
    token: ',',
    makes: 'item'
  },
  item: {
    name: 'item',
    content: [
      { divide: ['ors', 'colon'] }
    ]
  },
  ors: {
    name: 'ors',
    token: '|',
    makes: 'item'
  },
  colon: {
    name: 'colon',
    token: ':',
    makes: ['item', 'name']
  }
});

/**
 * This is the basic instruction set for the Object Path Notation
 *
 * @member {object} instructions.opn
 * @memberof! theory.string.shared
 */
theory.string.instructions('opn', {
  'default': {
    content: [
      { divide: ['segments'],
        makes: 'segment',
        ranges: ['squote', 'dquote', 'square', 'angle', 'bubble'] }
    ]
  },
  /// ranges
  bubble: {
    name: 'bubble',
    start: "(",
    end: ")",
    content: [
      { divide: ['spaces', 'segments'], /// @TODO: Require support for fallback one division i.e. no division
        makes: 'segment',
        ranges: ['squote', 'dquote', 'square', 'angle', 'bubble'] }
    ]
  },
  square: {
    name: 'square',
    start: "[",
    end: "]",
    content: [
      { divide: ['comparison'],
        makes: 'attribute',
        ranges: ['squote', 'dquote'] }
    ]
  },
  squote: {
    name: 'single-quote',
    start: "'",
    end: "'"
  },
  dquote: {
    name: 'double-quote',
    start: "\"",
    end: "\""
  },
  angle: {
    name: 'angle',
    start: "<",
    end: ">"
  },
  /// dividers
  ands: {
    name: 'ands',
    token: '&',
    makes: 'and'
  },
  ors: {
    name: 'ors',
    token: '|',
    makes: 'or'
  },
  spaces: {
    name: 'spaces',
    token: ' ',
    makes: 'spaced'
  },
  segments: {
    name: 'segments',
    token: '/',
    makes: 'segment'
  },
  comparison: {
    name: 'comparison',
    token: ['!=', '$=', '^=', '='],
    makes: ['attribute', 'value']
  },
  assignment: {
    name: 'assignment',
    token: [':='],
    makes: ['assignee', 'value']
  },
  commas: {
    name: 'commas',
    token: ',',
    makes: 'comma'
  },
  /// subitems
  spaced: {
    name: 'spaced'
  },
  segment: {
    name: 'segment',
    content: [
      { divide: ['ands', 'ors', 'commas', 'assignment', 'comparison'],
        ranges: ['squote', 'dquote', 'square', 'angle', 'bubble'] }
    ]
  },
  comma: {
    name: 'comma',
    content: [
      { divide: ['assignment', 'comparison'],
        ranges: ['squote', 'dquote', 'square', 'angle', 'bubble'] }
    ]
  },
  assignee: {
    name: 'assignee',
    content: [
      { divide: ['commas'],
        ranges: ['squote', 'dquote'] }
    ]
  },
  attribute: {
    name: 'attribute',
    content: [
      { divide: ['commas'],
        ranges: ['squote', 'dquote'] }
    ]
  },
  value: {
    name: 'value',
    content: [
      { divide: ['commas'],
        ranges: ['squote', 'dquote'] }
    ]
  }
});

/*
 * @TODO: t.opn needs to be worked out correctly in the constructor format
 */
t.opn = function(opn){
  var s = t.string(opn).parse('opn');
  s.segments = function(){
    var i = 0, segs = this.children[0].children;
    return {
      next: function(){
        return segs[i++];
      }
    };
  };
  return s;
};

t.opn.wrap = function(opn){
  return {
    string: function(){
      return opn.string;
    },
    strings: function(){
      var ret = [];
      for ( var i=0, a=opn, l=a.length; i<l; i++ ) {
        ret.push(a[i].string);
      }
      return ret;
    }
  };
};


text:
<!DOCTYPE html>

    <title>BasicRallyGrid</title>

redpajama_set_name: RedPajamaGithub


text:
/**
 * Gerado por template generation
 * Diretiva de overwrite atual:
 * TemplateName:
 **/
package br.com.dlp.jazzqa.tiporequisito;

import java.util.Date;
import java.util.List;

import javax.jws.WebMethod;
import javax.jws.WebService;

import org.apache.cxf.annotations.DataBinding;

import br.com.dlp.framework.business.IBusiness;
import br.com.dlp.framework.dao.QueryOrder;

/**
 * Incluir arquivo com comentários
 *
 * Contrado de Business para o componente TipoRequisitoVO
 *
 **/
@DataBinding(org.apache.cxf.aegis.databinding.AegisDatabinding.class)
@WebService
public interface TipoRequisitoBusiness extends IBusiness<TipoRequisitoVO> {

	/**
	 * Pesquisa entidades do tipo TipoRequisitoVO
	 * @author t_dpacifico
	 * @param dtInclusaoFrom
 	 * @param dtInclusaoTo
 	 * @param descricao
 	 * @param nome
	 * @returns Coleção de TipoRequisitoVO
	 */
	@WebMethod
	List<TipoRequisitoVO> findTipoRequisitoVO(Date dtInclusaoFrom, Date dtInclusaoTo, String descricao, String nome);

	/**
	 * Pesquisa entidades do tipo TipoRequisitoVO
	 * @author t_dpacifico
	 * @param dtInclusaoFrom
 	 * @param dtInclusaoTo
 	 * @param descricao
 	 * @param nome
	 * @param QueryOrder Ordenação de pesquisa
	 * @returns Coleção de TipoRequisitoVO
	 */
	@WebMethod
	List<TipoRequisitoVO> findTipoRequisitoVOOrdered(Date dtInclusaoFrom, Date dtInclusaoTo, String descricao, String nome, QueryOrder... queryOrders);

}


text:
@interface EditorViewController ()

@end

@implementation EditorViewController

+ (EditorViewController *)loadController
{
    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Editor" bundle:nil];
    return [sb instantiateViewControllerWithIdentifier:@"EditorViewController"];
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    // 文本编辑
    if (self.type == LEEditorText || self.type == LEEditorNumber) {
        [self.navigationItem setRightBarButtonItems:nil animated:YES];
        self.txtEdit.hidden = NO;

        // 设定光标
        [self.txtEdit becomeFirstResponder];

        // 文本框左侧空白
        UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 5, 5)];
        paddingView.opaque = NO;
        paddingView.backgroundColor = [UIColor clearColor];
        self.txtEdit.leftView = paddingView;
        self.txtEdit.leftViewMode = UITextFieldViewModeAlways;

        if (self.type == LEEditorNumber) {
            self.txtEdit.keyboardType = UIKeyboardTypeNumberPad;
        }

        // 缺省值
        self.txtEdit.text = self.defaults;
    }

    // 日期选择
    if (self.type == LEEditorDate) {
        self.selDateTime.hidden = NO;
        if (self.defaults == nil) {
            [self.selDateTime setDate:[NSDate new]];
        } else {
            [self.selDateTime setDate:self.defaults];
        }
    }

    // 选择
    if (self.type == LEEditorOption) {
        [self.navigationItem setRightBarButtonItems:nil animated:YES];
        self.tableView.hidden = NO;
        self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    }
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

// 取消
- (IBAction)onCancelTouched:(id)sender
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (IBAction)onEditEnd:(id)sender
{
    if (self.onComplet != nil) {
        self.onComplet(self.txtEdit.text);
    }
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (IBAction)onOKTouched:(id)sender
{
    if (self.onComplet != nil) {
        self.onComplet(self.selDateTime.date);
    }
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.items.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"EditorViewCell" forIndexPath:indexPath];
    cell.textLabel.text = [self.items objectAtIndex:indexPath.row];

    if ([cell.textLabel.text isEqualToString:self.defaults]) {
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
    }

    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.accessoryType = UITableViewCellAccessoryCheckmark;

    if (self.onComplet != nil) {
        self.onComplet(cell.textLabel.text);
    }
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.accessoryType = UITableViewCellAccessoryNone;
}

@end


text:
@implementation Baby
- (void)eat {
    self.hungryPersent += 5;
    NSLog(@"%s, %i", __func__, self.hungryPersent);
    if ([self.babysitter respondsToSelector:@selector(feedBaby:)]) {
        // 通知保姆
        [self.babysitter feedBaby:self];
    }
}

- (void)sleep {
    self.sleepyPersent -= 5;
    NSLog(@"%s, %i", __func__, self.sleepyPersent);
    if ([self.babysitter respondsToSelector:@selector(tellStoryToBaby:)]) {
        // 通知保姆
        [self.babysitter tellStoryToBaby:self];
    }
}
@end


text:
package de.peeeq.wurstscript.intermediatelang.interpreter;

import java.util.Comparator;
import java.util.PriorityQueue;

/**
 *
 */
public class TimerMockHandler {
    private float virtualTime = 0;
    private PriorityQueue<RunTask> nextRunnable = new PriorityQueue<>(Comparator.comparing(r -> r.time));

    public void cancelTask(RunTask runTask) {
        nextRunnable.remove(runTask);
    }

    public static class PausedTask {
        private final float remainingTime;
        private final Runnable runnable;

        private PausedTask(float remainingTime, Runnable runnable) {
            this.remainingTime = remainingTime;
            this.runnable = runnable;
        }
    }

    public static class RunTask {
        private final float time;
        private final Runnable runnable;

        private RunTask(float time, Runnable runnable) {
            this.time = time;
            this.runnable = runnable;
        }
    }

    public RunTask registerTimedAction(float timeOut, Runnable toRun) {
        RunTask t = new RunTask(virtualTime + timeOut, toRun);
        nextRunnable.add(t);
        return t;
    }

    public PausedTask pauseTask(RunTask t) {
        boolean removed = nextRunnable.remove(t);
        if (!removed) {
            return null;
        }
        return new PausedTask(t.time - virtualTime, t.runnable);
    }

    public RunTask resumeTask(PausedTask t) {
        return registerTimedAction(virtualTime + t.remainingTime, t.runnable);
    }

    public void completeTimers() {
        while (!nextRunnable.isEmpty()) {
            RunTask r = nextRunnable.remove();
            virtualTime = Math.max(virtualTime, r.time);
            r.runnable.run();
        }
    }

}


text:
The only thing we'll need for this guide is a working Phoenix application. For those of us who need a simple application to deploy, please follow the [Up and Running guide](http://www.phoenixframework.org/docs/up-and-running).

### Goals

Our main goal for this guide is to get a Phoenix application running on Heroku.

## Steps

Let's separate this process into a few steps so we can keep track of where we are.

- Initialize Git repository
- Sign up for Heroku
- Install the Heroku Toolbelt
- Create the Heroku application
- Add the Phoenix static buildpack
- Make our project Heroku-ready
- Deploy time!
- Useful Heroku commands

## Initializing Git repository

[Git](https://git-scm.com/) is a popular decentralized revision control system and is also used to deploy apps to Heroku.

Before we can push to Heroku we'll need to initialize a local Git repository and commit our files to it. We can do so by running the following commands in our project directory:

```console
$ git init
$ git add .
$ git commit -m "Initial commit"
```

Heroku offers some great information on how it is using Git [here](https://devcenter.heroku.com/articles/git#tracking-your-app-in-git).

## Signing up for Heroku

Signing up to Heroku is very simple, just head over to [https://signup.heroku.com/www-header](https://signup.heroku.com/www-header) and fill in the form.

The Free plan will give us one web [dyno](https://devcenter.heroku.com/articles/dynos#dynos) and one worker dyno, as well as a PostgreSQL and Redis instance for free.

These are meant to be used for testing and development, and come with some limitations. In order to run a production application, please consider upgrading to a paid plan.

## Installing the Heroku Toolbelt

Once we have signed up, we can download the correct version of the Heroku Toolbelt for our system [here](https://toolbelt.heroku.com/).

The Heroku CLI, part of the Toolbelt, is useful to create Heroku applications, list currently running dynos for an existing application, tail logs or run one-off commands (mix tasks for instance).

## Creating the Heroku Application

Now that we have the Toolbelt installed, let's create the Heroku application. In our project directory, run:

> Note: the first time we use a Heroku command, it may prompt us to log in. If this happens, just enter the email and password you specified during signup.

```console
$ heroku create --buildpack "https://github.com/HashNuke/heroku-buildpack-elixir.git"
Creating mysterious-meadow-6277... done, stack is cedar-14
Buildpack set. Next release on mysterious-meadow-6277 will use https://github.com/HashNuke/heroku-buildpack-elixir.git.
https://mysterious-meadow-6277.herokuapp.com/ | https://git.heroku.com/mysterious-meadow-6277.git
Git remote heroku added
```

> Note: the name of the Heroku application is the random string after "Creating" in the output above (mysterious-meadow-6277). This will be unique, so expect to see a different name from "mysterious-meadow-6277".

The `--buildpack` option we are passing allows us to specify the [Elixir buildpack](https://github.com/HashNuke/heroku-buildpack-elixir) we want Heroku to use.
A [buildpack](https://devcenter.heroku.com/articles/buildpacks) is a convenient way of packaging framework and/or runtime support. In our case it's installing Erlang, Elixir, fetching our application dependencies, and so on, before we run it.

The URL in the output is the URL to our application. If we open it in our browser now, we will get the default Heroku welcome page.

> Note: if we hadn't initialized our Git repository before we ran the `heroku create` command, we won't have our Heroku remote repository properly set up at this point. We can set that up manually by running: `heroku git:remote -a [our-app-name].`

## Adding the Phoenix Static Buildpack

We need to compile static assets for a successful Phoenix deployment. The [Phoenix static buildpack](https://github.com/gjaldon/heroku-buildpack-phoenix-static) can take care of that for us, so let's add it now.

```console
$ heroku buildpacks:add https://github.com/gjaldon/heroku-buildpack-phoenix-static.git
Buildpack added. Next release on mysterious-meadow-6277 will use:
  1. https://github.com/HashNuke/heroku-buildpack-elixir.git
  2. https://github.com/gjaldon/heroku-buildpack-phoenix-static.git
Run `git push heroku master` to create a new release using these buildpacks.
```

## Making our Project Heroku-ready

Every new Phoenix project ships with a config file `config/prod.secret.exs` which stores configuration that should not be commited along with our source code. By default Phoenix adds it to our `.gitignore` file.

This works great except Heroku uses [environment variables](https://devcenter.heroku.com/articles/config-vars) to pass sensitive informations to our application. It means we need to make some changes to our config before we can deploy.

First, let's copy over the content of `config/prod.secret.exs` to `config/prod.exs`.

Now we need to load the necessary environment variables in our configuration.

In our case:

```elixir
config :hello_phoenix, HelloPhoenix.Endpoint,
  secret_key_base: "my_secret_key"
```

becomes:

```elixir
config :hello_phoenix, HelloPhoenix.Endpoint,
  secret_key_base: System.get_env("SECRET_KEY_BASE")
```

and:

```elixir
config :hello_phoenix, HelloPhoenix.Repo,
  adapter: Ecto.Adapters.Postgres,
  username: "postgres",
  password: "postgres",
  database: "hello_phoenix_prod",
  pool_size: 20
```

becomes:

```elixir
config :hello_phoenix, HelloPhoenix.Repo,
  adapter: Ecto.Adapters.Postgres,
  url: System.get_env("DATABASE_URL"),
  pool_size: 20
```

Finally, let's tell Phoenix to use our Heroku URL and enforce we only use the SSL version of the website. Find the following:

```elixir
url: [host: "example.com", port: 80],
```

and change it to (you will want to set your Heroku application name):

```elixir
url: [scheme: "https", host: "mysterious-meadow-6277.heroku.com", port: 443],
force_ssl: [rewrite_on: [:x_forwarded_proto]],
```

We don't need to import the `config/prod.secret.exs` file in our prod config any longer so we can delete the following line:

```elixir
import_config "prod.secret.exs"
```

The final `config/prod.exs` should now look something like this (we've removed the comments for readability):

```elixir
use Mix.Config

config :hello_phoenix, HelloPhoenix.Endpoint,
  http: [port: System.get_env("PORT")],
  url: [scheme: "https", host: "mysterious-meadow-6277.heroku.com", port: 443],
  force_ssl: [rewrite_on: [:x_forwarded_proto]],
  cache_static_manifest: "priv/static/manifest.json"

config :logger, level: :info

config :hello_phoenix, HelloPhoenix.Endpoint,
  secret_key_base: System.get_env("SECRET_KEY_BASE")

config :hello_phoenix, HelloPhoenix.Repo,
  adapter: Ecto.Adapters.Postgres,
  url: System.get_env("DATABASE_URL"),
  pool_size: 20
```

## Creating Environment Variables in Heroku

The `DATABASE_URL` config var is automatically created by Heroku when we add the [Heroku Postgres add-on](https://addons.heroku.com/heroku-postgresql).

We still have to create the `SECRET_KEY_BASE` config based on a random string. First, use `mix phoenix.gen.secret` to get a new secret:

```console
$ mix phoenix.gen.secret
A_LONG_STRING_WILL_BE_PRINTED
```

Now set it in Heroku:

```console
$ heroku config:set SECRET_KEY_BASE="A_LONG_STRING_WILL_BE_PRINTED"
Setting config vars and restarting mysterious-meadow-6277... done, v3
SECRET_KEY_BASE: my_secret_key_base
```

## Deploy Time!

Our project is now ready to be deployed on Heroku.

Let's commit all our changes:

```
$ git add config/prod.exs .gitignore
$ git commit -m "Heroku ready"
```

And deploy:

```console
$ git push heroku master
Counting objects: 55, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (49/49), done.
Writing objects: 100% (55/55), 48.48 KiB | 0 bytes/s, done.
Total 55 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Multipack app detected
remote: -----> Fetching custom git buildpack... done
remote: -----> elixir app detected
remote: -----> Checking Erlang and Elixir versions
remote:        WARNING: elixir_buildpack.config wasn't found in the app
remote:        Using default config from Elixir buildpack
remote:        Will use the following versions:
remote:        * Stack cedar-14
remote:        * Erlang 17.5
remote:        * Elixir 1.0.4
remote:        Will export the following config vars:
remote:        * Config vars DATABASE_URL
remote:        * MIX_ENV=prod
remote: -----> Stack changed, will rebuild
remote: -----> Fetching Erlang 17.5
remote: -----> Installing Erlang 17.5 (changed)
remote:
remote: -----> Fetching Elixir v1.0.4
remote: -----> Installing Elixir v1.0.4 (changed)
remote: -----> Installing Hex
remote: 2015-07-07 00:04:00 URL:https://s3.amazonaws.com/s3.hex.pm/installs/1.0.0/hex.ez [262010/262010] ->
"/app/.mix/archives/hex.ez" [1]
remote: * creating /app/.mix/archives/hex.ez
remote: -----> Installing rebar
remote: * creating /app/.mix/rebar
remote: -----> Fetching app dependencies with mix
remote: Running dependency resolution
remote: Dependency resolution completed successfully
remote: [...]
remote: -----> Compiling
remote: [...]
remote: Generated phoenix_heroku app
remote: [...]
remote: Consolidated protocols written to _build/prod/consolidated
remote: -----> Creating .profile.d with env vars
remote: -----> Fetching custom git buildpack... done
remote: -----> Phoenix app detected
remote:
remote: -----> Loading configuration and environment
remote:        Loading config...
remote:        WARNING: phoenix_static_buildpack.config wasn't found in the app
remote:        Using default config from Phoenix static buildpack
remote:        Will use the following versions:
remote:        * Node 0.12.4
remote:        Will export the following config vars:
remote:        * Config vars DATABASE_URL
remote:        * MIX_ENV=prod
remote:
remote: -----> Installing binaries
remote:        Downloading node 0.12.4...
remote:        Installing node 0.12.4...
remote:        Using default npm version
remote:
remote: -----> Building dependencies
remote:        [...]
remote:        Running default compile
remote:               Building Phoenix static assets
remote:        07 Jul 00:06:22 - info: compiled 3 files into 2 files, copied 3 in 3616ms
remote:        Check your digested files at 'priv/static'.
remote:
remote: -----> Finalizing build
remote:        Creating runtime environment
remote:
remote: -----> Discovering process types
remote:        Procfile declares types     -> (none)
remote:        Default types for Multipack -> web
remote:
remote: -----> Compressing... done, 82.1MB
remote: -----> Launching... done, v5
remote:        https://mysterious-meadow-6277.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/mysterious-meadow-6277.git
 * [new branch]      master -> master
```

Typing `heroku open` in the terminal should launch a browser with the Phoenix welcome page opened. In case you are using Ecto to access a database, you will also need to run migrations after the first deploy:

```console
$ heroku run mix ecto.migrate
```

And that's it!

## Useful Heroku Commands

We can look at the logs of our application by running the following command in our project directory:

```console
$ heroku logs # use --tail if you want to tail them
```

We can also start an IEx session attached to our terminal for experimenting in our app's environment:

```console
$ heroku run iex -S mix
```

In fact, we can run anything using the `heroku run` command, like the Ecto migration task from above:

```console
$ heroku run mix ecto.migrate
```


text:
package com.hazelcast.executor.impl.operations;

import com.hazelcast.executor.impl.DistributedExecutorService;
import com.hazelcast.executor.impl.ExecutorDataSerializerHook;
import com.hazelcast.nio.serialization.IdentifiedDataSerializable;
import com.hazelcast.spi.impl.operationservice.AbstractNamedOperation;
import com.hazelcast.spi.impl.operationservice.MutatingOperation;

public final class ShutdownOperation extends AbstractNamedOperation implements MutatingOperation, IdentifiedDataSerializable {

    public ShutdownOperation() {
    }

    public ShutdownOperation(String name) {
        super(name);
    }

    @Override
    public String getServiceName() {
        return DistributedExecutorService.SERVICE_NAME;
    }

    @Override
    public void run() throws Exception {
        DistributedExecutorService service = getService();
        service.shutdownExecutor(getName());
    }

    @Override
    public Object getResponse() {
        return Boolean.TRUE;
    }

    @Override
    public int getFactoryId() {
        return ExecutorDataSerializerHook.F_ID;
    }

    @Override
    public int getClassId() {
        return ExecutorDataSerializerHook.SHUTDOWN;
    }
}


text:
module WillTranslate
  VERSION = "0.0.2" unless defined? WillTranslate::VERSION
end


text:
<?php

namespace Athens\Core\Email;

use Athens\Core\Visitor\VisitableTrait;
use Athens\Core\Writable\WritableTrait;
use Athens\Core\Emailer\EmailerInterface;

/**
 * Class Email encapsulates the data which constitutes an email.
 *
 * @package Athens\Core\Email
 */
class Email implements EmailInterface
{
    /** @var string */
    protected $subject;

    /** @var string */
    protected $message;

    /** @var string */
    protected $to;

    /** @var string */
    protected $from;

    /** @var string */
    protected $replyTo;

    /** @var string */
    protected $cc;

    /** @var string */
    protected $bcc;

    /** @var string */
    protected $xMailer;

    /** @var string */
    protected $contentType;

    /** @var string */
    protected $mimeVersion;

    /** @var EmailerInterface */
    protected $emailer;

    use WritableTrait;
    use VisitableTrait;

    /**
     * Email constructor.
     *
     * @param string           $type
     * @param string           $subject
     * @param string           $message
     * @param string           $to
     * @param string           $from
     * @param string           $replyTo
     * @param string           $cc
     * @param string           $bcc
     * @param string           $xMailer
     * @param string           $contentType
     * @param string           $mimeVersion
     * @param EmailerInterface $emailer
     */
    public function __construct(
        $type,
        $subject,
        $message,
        $to,
        $from,
        $replyTo,
        $cc,
        $bcc,
        $xMailer,
        $contentType,
        $mimeVersion,
        EmailerInterface $emailer
    ) {
        $this->subject = $subject;
        $this->message = $message;
        $this->to = $to;
        $this->from = $from;
        $this->replyTo = $replyTo;
        $this->cc = $cc;
        $this->bcc = $bcc;
        $this->xMailer = $xMailer;
        $this->contentType = $contentType;
        $this->mimeVersion = $mimeVersion;
        $this->type = $type;
        $this->emailer = $emailer;
    }

    /**
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * @return string
     */
    public function getSubject()
    {
        return $this->subject;
    }

    /**
     * @return string
     */
    public function getMessage()
    {
        return $this->message;
    }

    /**
     * @return string
     */
    public function getTo()
    {
        return $this->to;
    }

    /**
     * @return string
     */
    public function getFrom()
    {
        return $this->from;
    }

    /**
     * @return string
     */
    public function getReplyTo()
    {
        return $this->replyTo;
    }

    /**
     * @return string
     */
    public function getCc()
    {
        return $this->cc;
    }

    /**
     * @return string
     */
    public function getBcc()
    {
        return $this->bcc;
    }

    /**
     * @return string
     */
    public function getXMailer()
    {
        return $this->xMailer;
    }

    /**
     * @return string
     */
    public function getContentType()
    {
        return $this->contentType;
    }

    /**
     * @return string
     */
    public function getMimeVersion()
    {
        return $this->mimeVersion;
    }

    /**
     * @return boolean
     */
    public function send()
    {
        return $this->accept($this->emailer);
        return false;
    }
}


text: void invertMatrixSVD(float **a, float **y, int n);


text:
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
param
(
    [Parameter()]
    [string]
    $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot `
            -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" `
            -Resolve)
)

$script:DSCModuleName = 'SharePointDsc'
$script:DSCResourceName = 'SPSearchResultSource'
$script:DSCResourceFullName = 'MSFT_' + $script:DSCResourceName

function Invoke-TestSetup
{
    try
    {
        Import-Module -Name DscResource.Test -Force

        Import-Module -Name (Join-Path -Path $PSScriptRoot `
                -ChildPath "..\UnitTestHelper.psm1" `
                -Resolve)

        $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule `
            -DscResource $script:DSCResourceName
    }
    catch [System.IO.FileNotFoundException]
    {
        throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -Tasks build" first.'
    }

    $script:testEnvironment = Initialize-TestEnvironment `
        -DSCModuleName $script:DSCModuleName `
        -DSCResourceName $script:DSCResourceFullName `
        -ResourceType 'Mof' `
        -TestType 'Unit'
}

function Invoke-TestCleanup
{
    Restore-TestEnvironment -TestEnvironment $script:testEnvironment
}

Invoke-TestSetup

try
{
    InModuleScope -ModuleName $script:DSCResourceFullName -ScriptBlock {
        Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture {
            BeforeAll {
                Invoke-Command -Scriptblock $Global:SPDscHelper.InitializeScript -NoNewScope
                try
                {
                    # Initialize tests
                    Add-Type -TypeDefinition @"
                namespace Microsoft.Office.Server.Search.Administration {
                    public enum SearchObjectLevel
                    {
                        SPWeb,
                        SPSite,
                        SPSiteSubscription,
                        Ssa
                    }
                }
"@ -ErrorAction SilentlyContinue
                }
                catch
                {
                    Write-Verbose "Could not instantiante the enum Microsoft.Office.Server.Search.Administration.SearchObjectLevel"
                }

                # Mocks for all contexts
                Mock -CommandName Get-SPEnterpriseSearchServiceApplication {
                    return @{
                        SearchCenterUrl = "http://example.sharepoint.com/pages"
                    }
                }

                Mock -CommandName Get-SPWeb -MockWith {
                    return @{ }
                }

                $Global:SPDscResultSourceProviders = @(
                    @{
                        "Exchange Search Provider" = @{
                            Id   = "c1e2843d-1825-4a37-ad15-dce5d50f46d2"
                            Name = "Exchange Search Provider"
                        }
                    },
                    @{
                        "Local People Provider" = @{
                            Id   = "5acc53f4-64b1-4f5d-ad16-7e9ab7372f93"
                            Name = "Local People Provider"
                        }
                    },
                    @{
                        "Local SharePoint Provider" = @{
                            Id   = "2d443d0a-61ba-472d-9964-ef27b14c8a07"
                            Name = "Local SharePoint Provider"
                        }
                    },
                    @{
                        "OpenSearch Provider" = @{
                            Id   = "eec636ac-013c-4dea-b794-dadcb4136dfe"
                            Name = "OpenSearch Provider"
                        }
                    },
                    @{
                        "Remote People Provider" = @{
                            Id   = "bb76bb0b-035d-4981-86ae-bd9587f3b0e4"
                            Name = "Remote People Provider"
                        }
                    },
                    @{
                        "Remote SharePoint Provider" = @{
                            Id   = "f7a3db86-fb85-40e4-a178-7ad85c732ba6"
                            Name = "Remote SharePoint Provider"
                        }
                    }
                )

                Mock -CommandName New-Object {
                    switch ($TypeName)
                    {
                        "Microsoft.Office.Server.Search.Administration.SearchObjectOwner"
                        {
                            return [System.Object]::new()
                        }
                        "Microsoft.Office.Server.Search.Administration.Query.FederationManager"
                        {
                            return [System.Object]::new() | Add-Member -Name GetSourceByName `
                                -MemberType ScriptMethod `
                                -PassThru `
                                -Value {
                                return $Global:SPDscCurrentResultSourceMocks
                            } `
                            | Add-Member -Name ListProviders `
                                -MemberType ScriptMethod `
                                -PassThru `
                                -Value {
                                return $Global:SPDscResultSourceProviders
                            } `
                            | Add-Member -Name ListSources `
                                -MemberType ScriptMethod `
                                -PassThru `
                                -Value {
                                return @(
                                    @{
                                        Name           = "Test source"
                                        ProviderId     = "f7a3db86-fb85-40e4-a178-7ad85c732ba6"
                                        QueryTransform = @{
                                            QueryTemplate = "{searchTerms}"
                                        }
                                    }
                                )
                            } `
                            | Add-Member -Name CreateSource `
                                -MemberType ScriptMethod `
                                -PassThru `
                                -Value {
                                return [PSObject]@{
                                    ProviderId            = [guid]::Empty
                                    Name                  = [string]::Empty
                                    ConnectionUrlTemplate = [string]::Empty
                                } | Add-Member -Name CreateQueryTransform `
                                    -MemberType ScriptMethod `
                                    -PassThru `
                                    -Value { } `
                                | Add-Member -Name Commit `
                                    -MemberType ScriptMethod `
                                    -PassThru `
                                    -Value {
                                    $Global:SPDscResultSourceUpdated = $true
                                }
                            } `
                            | Add-Member -Name RemoveSource `
                                -MemberType ScriptMethod `
                                -PassThru `
                                -Value { } `

                        }
                        "Microsoft.Office.Server.Search.Administration.SearchObjectFilter"
                        {
                            return [System.Object]::new() | Add-Member -Name IncludeHigherLevel `
                                -MemberType ScriptProperty `
                                -PassThru `
                            {
                                # get
                                "getter"
                            }`
                            {
                                # set
                                param ( $arg )
                            }
                        }
                    }
                }

                function Add-SPDscEvent
                {
                    param (
                        [Parameter(Mandatory = $true)]
                        [System.String]
                        $Message,

                        [Parameter(Mandatory = $true)]
                        [System.String]
                        $Source,

                        [Parameter()]
                        [ValidateSet('Error', 'Information', 'FailureAudit', 'SuccessAudit', 'Warning')]
                        [System.String]
                        $EntryType,

                        [Parameter()]
                        [System.UInt32]
                        $EventID
                    )
                }
            }

            # Test contexts
            Context -Name "A search result source doesn't exist and should" -Fixture {
                BeforeAll {
                    $testParams = @{
                        Name                 = "New source"
                        ScopeName            = "SSA"
                        ScopeUrl             = "Global"
                        SearchServiceAppName = "Search Service Application"
                        ProviderType         = "Remote SharePoint Provider"
                        Query                = "{searchTerms}"
                        ConnectionUrl        = "https://sharepoint.contoso.com"
                        Ensure               = "Present"
                    }

                    $Global:SPDscCurrentResultSourceMocks = $null
                }

                It "Should return absent from the get method" {
                    (Get-TargetResource @testParams).Ensure | Should -Be "Absent"
                }

                It "Should return false from the test method" {
                    Test-TargetResource @testParams | Should -Be $false
                }

                It "Should create the result source in the set method" {
                    Set-TargetResource @testParams
                }
            }

            Context -Name "A search result source exists and should" -Fixture {
                BeforeAll {
                    $testParams = @{
                        Name                 = "Test source"
                        ScopeName            = "SSA"
                        ScopeUrl             = "https://sharepoint.contoso.com"
                        SearchServiceAppName = "Search Service Application"
                        ProviderType         = "Remote SharePoint Provider"
                        Query                = "{searchTerms}"
                        ConnectionUrl        = "https://sharepoint.contoso.com"
                        Ensure               = "Present"
                    }

                    $Global:SPDscCurrentResultSourceMocks = @{
                        Name           = $testParams.Name
                        QueryTransform = @{
                            QueryTemplate = $testParams.Query
                        }
                        ProviderId     = "f7a3db86-fb85-40e4-a178-7ad85c732ba6"
                    }
                }

                It "Should return present from the get method" {
                    (Get-TargetResource @testParams).Ensure | Should -Be "Present"
                }

                It "Should return true from the test method" {
                    Test-TargetResource @testParams | Should -Be $true
                }
            }

            Context -Name "A search result source exists and shouldn't" -Fixture {
                BeforeAll {
                    $testParams = @{
                        Name                 = "Test source"
                        ScopeUrl             = "Global"
                        SearchServiceAppName = "Search Service Application"
                        ProviderType         = "Remote SharePoint Provider"
                        Query                = "{searchTerms}"
                        ScopeName            = "SSA"
                        ConnectionUrl        = "https://sharepoint.contoso.com"
                        Ensure               = "Absent"
                    }

                    $Global:SPDscCurrentResultSourceMocks = @{
                        Name           = $testParams.Name
                        QueryTransform = @{
                            QueryTemplate = $testParams.Query
                        }
                        ProviderId     = "f7a3db86-fb85-40e4-a178-7ad85c732ba6"
                    }
                }

                It "Should return present from the get method" {
                    (Get-TargetResource @testParams).Ensure | Should -Be "Present"
                }

                It "Should return false from the test method" {
                    Test-TargetResource @testParams | Should -Be $false
                }

                It "Should remove the result source in the set method" {
                    Set-TargetResource @testParams
                }
            }

            Context -Name "A search result source doesn't exist and shouldn't" -Fixture {
                BeforeAll {
                    $testParams = @{
                        Name                 = "Non-Existing source"
                        ScopeName            = "SSA"
                        ScopeUrl             = "Global"
                        SearchServiceAppName = "Search Service Application"
                        ProviderType         = "Remote SharePoint Provider"
                        Query                = "{searchTerms}"
                        ConnectionUrl        = "https://sharepoint.contoso.com"
                        Ensure               = "Absent"
                    }

                    $Global:SPDscCurrentResultSourceMocks = $null
                }

                It "Should return absent from the get method" {
                    (Get-TargetResource @testParams).Ensure | Should -Be "Absent"
                }

                It "Should return true from the test method" {
                    Test-TargetResource @testParams | Should -Be $true
                }
            }

            Context -Name "Valid SPWeb ScopeName was provided" -Fixture {
                BeforeAll {
                    $testParams = @{
                        Name                 = "New source"
                        ScopeName            = "SPWeb"
                        ScopeUrl             = "https://SharePoint.contoso.com"
                        SearchServiceAppName = "Search Service Application"
                        ProviderType         = "Remote SharePoint Provider"
                        Query                = "{searchTerms}"
                        ConnectionUrl        = "https://sharepoint.contoso.com"
                        Ensure               = "Present"
                    }
                }

                It "Should return absent from the get method" {
                    (Get-TargetResource @testParams).Ensure | Should -Be "Absent"
                }

                It "Should return false from the test method" {
                    Test-TargetResource @testParams | Should -Be $false
                }

                It "Should create the result source in the set method" {
                    Set-TargetResource @testParams
                }
            }

            Context -Name "Local Result Source" -Fixture {
                BeforeAll {
                    $testParams = @{
                        Name                 = "Test source Local"
                        SearchServiceAppName = "Search Service Application"
                        ProviderType         = "Remote SharePoint Provider"
                        Query                = "{searchTerms}"
                        ConnectionUrl        = "https://sharepoint.contoso.com"
                        ScopeName            = "SSA"
                        ScopeUrl             = "Global"
                        Ensure               = "Present"
                    }
                }

                It "Should return absent from the get method" {
                    (Get-TargetResource @testParams).Ensure | Should -Be "Absent"
                }

                It "Should return false from the test method" {
                    Test-TargetResource @testParams | Should -Be $false
                }

                It "Should create the result source in the set method" {
                    Set-TargetResource @testParams
                }
            }

            Context -Name "The specified ProviderType doesn't exist" -Fixture {
                BeforeAll {
                    $testParams = @{
                        Name                 = "New source"
                        ScopeName            = "SSA"
                        ScopeUrl             = "Global"
                        SearchServiceAppName = "Search Service Application"
                        ProviderType         = "DoesNotExist"
                        Query                = "{searchTerms}"
                        ConnectionUrl        = "https://sharepoint.contoso.com"
                        Ensure               = "Present"
                    }

                    $Global:SPDscCurrentResultSourceMocks = $null
                    $Global:SPDscResultSourceProviders = @()
                }

                It "Should return absent from the get method" {
                    (Get-TargetResource @testParams).Ensure | Should -Be "Absent"
                }

                It "Should return false from the test method" {
                    Test-TargetResource @testParams | Should -Be $false
                }

                It "Should create the result source in the set method" {
                    { Set-TargetResource @testParams } | Should -Throw "Unknown ProviderType"
                }
            }

            Context -Name "Running ReverseDsc Export" -Fixture {
                BeforeAll {
                    Import-Module (Join-Path -Path (Split-Path -Path (Get-Module SharePointDsc -ListAvailable).Path -Parent) -ChildPath "Modules\SharePointDSC.Reverse\SharePointDSC.Reverse.psm1")

                    Mock -CommandName Write-Host -MockWith { }

                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Name                 = "External SharePoint results"
                            ScopeName            = "SPSite"
                            ScopeUrl             = "https://SharePoint.contoso.com"
                            SearchServiceAppName = "Search Service Application"
                            Query                = "{searchTerms}"
                            ProviderType         = "Remote SharePoint Provider"
                        }
                    }

                    Mock -CommandName Get-SPServiceApplication -MockWith {
                        $spServiceApp = [PSCustomObject]@{
                            DisplayName = "Search Service Application"
                            Name        = "Search Service Application"
                        }
                        $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod `
                            -Name GetType `
                            -Value {
                            return @{
                                FullName = "Microsoft.Office.Server.Search.Administration.SearchServiceApplication"
                            }
                        } -PassThru -Force
                        return $spServiceApp
                    }

                    Mock -CommandName Get-SPEnterpriseSearchFileFormat -MockWith {
                        return @(
                            @{
                                Identity = "pdf"
                            }
                        )
                    }

                    if ($null -eq (Get-Variable -Name 'spFarmAccount' -ErrorAction SilentlyContinue))
                    {
                        $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force
                        $Global:spFarmAccount = New-Object -TypeName System.Management.Automation.PSCredential ("contoso\spfarm", $mockPassword)
                    }

                    if ($null -eq (Get-Variable -Name 'SkipSitesAndWebs' -ErrorAction SilentlyContinue))
                    {
                        $Global:SkipSitesAndWebs = $true
                    }

                    $result = @'
        SPSearchResultSource [0-9A-Fa-f]{8}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{12}
        {
            Ensure               = "Present";
            Name                 = "External SharePoint results";
            PsDscRunAsCredential = \$Credsspfarm;
            Query                = "{searchTerms}";
            ScopeName            = "SPSite";
            ScopeUrl             = "Global";
            SearchServiceAppName = "Search Service Application";
        }

'@
                }

                It "Should return valid DSC block from the Export method" {
                    Export-TargetResource | Should -Match $result
                }
            }
        }
    }
}
finally
{
    Invoke-TestCleanup
}


text:
<?php
/* $Id: Z_CheckAllocs.php 6941 2014-10-26 23:18:08Z daintree $*/
/*This page adds the total of allocation records and compares this to the recorded allocation total in DebtorTrans table */

include('includes/session.inc');
$Title = _('Customer Allocations != DebtorTrans.Alloc');
include('includes/header.inc');

/*First off get the DebtorTransID of all invoices where allocations dont agree to the recorded allocation */
$sql = "SELECT debtortrans.id,
		debtortrans.debtorno,
		debtortrans.transno,
		ovamount+ovgst AS totamt,
		SUM(custallocns.Amt) AS totalalloc,
		debtortrans.alloc
	FROM debtortrans INNER JOIN custallocns
	ON debtortrans.id=custallocns.transid_allocto
	WHERE debtortrans.type=10
	GROUP BY debtortrans.ID,
		debtortrans.type,
		ovamount+ovgst,
		debtortrans.alloc
	HAVING SUM(custallocns.amt) < debtortrans.alloc - 1";

$result = DB_query($sql);

if (DB_num_rows($result)==0){
	prnMsg(_('There are no inconsistencies with allocations') . ' - ' . _('all is well'),'info');
}

while ($myrow = DB_fetch_array($result)){
	$AllocToID = $myrow['id'];

	echo '
' . _('Allocations made against') . ' ' . $myrow['debtorno'] . ' ' . _('Invoice Number') . ': ' . $myrow['transno'];
	echo '
' . _('Original Invoice Total') . ': '. $myrow['totamt'];
	echo '
' . _('Total amount recorded as allocated against it') . ': ' . $myrow['alloc'];
	echo '
' . _('Total of allocation records') . ': ' . $myrow['totalalloc'];

	$sql = "SELECT type,
				transno,
				trandate,
				debtortrans.debtorno,
				reference,
				debtortrans.rate,
				ovamount+ovgst+ovfreight+ovdiscount AS totalamt,
				custallocns.amt,
				decimalplaces AS currdecimalplaces
			FROM debtortrans INNER JOIN custallocns
			ON debtortrans.id=custallocns.transid_allocfrom
			INNER JOIN debtorsmaster ON
			debtortrans.debtorno=debtorsmaster.debtorno
			INNER JOIN currencies ON
			debtorsmaster.currcode=currencies.currabrev
			WHERE custallocns.transid_allocto='" . $AllocToID . "'";

	$ErrMsg = _('The customer transactions for the selected criteria could not be retrieved because');
	$TransResult = DB_query($sql,$ErrMsg);

	echo '
';

	$tableheader = '

				' . _('Type') . '
				' . _('Number') . '
				' . _('Reference') . '
				' . _('Ex Rate') . '
				' . _('Amount') . '
				' . _('Alloc') . '
';
	echo $tableheader;

	$RowCounter = 1;
	$k = 0; //row colour counter
	$AllocsTotal = 0;

	while ($myrow1=DB_fetch_array($TransResult)) {

		if ($k==1){
			echo '
';
			$k=0;
		} else {
			echo '
';
			$k++;
		}

		if ($myrow1['type']==11){
			$TransType = _('Credit Note');
		} else {
			$TransType = _('Receipt');
		}
		$CurrDecimalPlaces = $myrow1['currdecimalplaces'];

		printf( '%s
				%s
				%s
				%s
				%s
				%s

',
				$TransType,
				$myrow1['transno'],
				$myrow1['reference'],
				locale_number_format($myrow1['exrate'],4),
				locale_number_format($myrow1['totalamt'],$CurrDecimalPlaces),
				locale_number_format($myrow1['amt'],$CurrDecimalPlaces));

		$RowCounter++;
		If ($RowCounter == 12){
			$RowCounter=1;
			echo $tableheader;
		}
		//end of page full new headings if
		$AllocsTotal +=$myrow1['amt'];
	}
	//end of while loop
	echo '
' . locale_number_format($AllocsTotal,$CurrDecimalPlaces) . '
';
	echo '

';
}

include('includes/footer.inc');

?>


text:
@interface APUpdateUserLocalNameChanged () {
 @public
  jint uid_;
  NSString *localName_;
}

@end

J2OBJC_FIELD_SETTER(APUpdateUserLocalNameChanged, localName_, NSString *)

@implementation APUpdateUserLocalNameChanged

+ (APUpdateUserLocalNameChanged *)fromBytesWithByteArray:(IOSByteArray *)data {
  return APUpdateUserLocalNameChanged_fromBytesWithByteArray_(data);
}

- (instancetype)initWithInt:(jint)uid
               withNSString:(NSString *)localName {
  APUpdateUserLocalNameChanged_initWithInt_withNSString_(self, uid, localName);
  return self;
}

- (instancetype)init {
  APUpdateUserLocalNameChanged_init(self);
  return self;
}

- (jint)getUid {
  return self->uid_;
}

- (NSString *)getLocalName {
  return self->localName_;
}

- (void)parseWithBSBserValues:(BSBserValues *)values {
  self->uid_ = [((BSBserValues *) nil_chk(values)) getIntWithInt:1];
  self->localName_ = [values optStringWithInt:2];
}

- (void)serializeWithBSBserWriter:(BSBserWriter *)writer {
  [((BSBserWriter *) nil_chk(writer)) writeIntWithInt:1 withInt:self->uid_];
  if (self->localName_ != nil) {
    [writer writeStringWithInt:2 withNSString:self->localName_];
  }
}

- (NSString *)description {
  NSString *res = @"update UserLocalNameChanged{";
  res = JreStrcat("$$", res, JreStrcat("$I", @"uid=", self->uid_));
  res = JreStrcat("$$", res, JreStrcat("$$", @", localName=", self->localName_));
  res = JreStrcat("$C", res, '}');
  return res;
}

- (jint)getHeaderKey {
  return APUpdateUserLocalNameChanged_HEADER;
}

@end

APUpdateUserLocalNameChanged *APUpdateUserLocalNameChanged_fromBytesWithByteArray_(IOSByteArray *data) {
  APUpdateUserLocalNameChanged_initialize();
  return ((APUpdateUserLocalNameChanged *) BSBser_parseWithBSBserObject_withByteArray_(new_APUpdateUserLocalNameChanged_init(), data));
}

void APUpdateUserLocalNameChanged_initWithInt_withNSString_(APUpdateUserLocalNameChanged *self, jint uid, NSString *localName) {
  (void) APUpdate_init(self);
  self->uid_ = uid;
  self->localName_ = localName;
}

APUpdateUserLocalNameChanged *new_APUpdateUserLocalNameChanged_initWithInt_withNSString_(jint uid, NSString *localName) {
  APUpdateUserLocalNameChanged *self = [APUpdateUserLocalNameChanged alloc];
  APUpdateUserLocalNameChanged_initWithInt_withNSString_(self, uid, localName);
  return self;
}

void APUpdateUserLocalNameChanged_init(APUpdateUserLocalNameChanged *self) {
  (void) APUpdate_init(self);
}

APUpdateUserLocalNameChanged *new_APUpdateUserLocalNameChanged_init() {
  APUpdateUserLocalNameChanged *self = [APUpdateUserLocalNameChanged alloc];
  APUpdateUserLocalNameChanged_init(self);
  return self;
}

J2OBJC_CLASS_TYPE_LITERAL_SOURCE(APUpdateUserLocalNameChanged)


text:
using System;
using System.Collections.Generic;
using Cardinal_System_Common;
using Cardinal_System_Shared;

namespace Cardinal_System_HeathCliff
{
    public class NetworkComponent
    {
        public long ComponentId { get; private set; }
        public ComponentType ComponentType { get; private set; }
        public ComponentConnection ComponentConnection { get; private set; }
        public DateTime LastHeartbeatReceived { get; set; }
        public Dictionary<long, NetworkComponent> ConnectedComponents { get; private set; }

        public NetworkComponent(long componentId, ComponentType componentType, ComponentConnection componentConnection)
        {
            ComponentId = componentId;
            ComponentType = componentType;
            ComponentConnection = componentConnection;
            LastHeartbeatReceived = DateTime.UtcNow;
            ConnectedComponents = new Dictionary<long, NetworkComponent>();
        }

        public void AddConnectionTo(NetworkComponent networkComponent)
        {
            ConnectedComponents[networkComponent.ComponentId] = networkComponent;
        }

        public void RemoveConnectionTo(NetworkComponent networkComponent)
        {
            ConnectedComponents.Remove(networkComponent.ComponentId);
        }
    }
}


text:
"""generate code for exceptions and for the types module"""

template1 = '        %(name)s = new PyString("%(name)s");'
template2 = '        dict.__setitem__("%(name)s", Py.%(name)s);'
template3 = '''\
        %(name)s = new PyTuple(new PyObject[]
            {%(values)s});
'''
template4 = '''\
        tmp = exceptions.__findattr__("%(name)s");
        if (tmp != null) %(name)s = tmp;'''
import exceptions, types, string

excs = {}
for name in dir(exceptions):
	c = getattr(exceptions, name)
	try:
		if issubclass(c, exceptions.Exception):
			excs[c] = {}
	except:
		pass

for key, value in excs.items():
	for base in key.__bases__:
		excs[base][key] = 1

import sys
fp = open('c:\\jpython\\JavaCode\\org\\python\\core\\excs.txt', 'w')
sys.stdout = fp

for exc in excs.keys():
	print template4 % {'name': exc.__name__}

print
print

for exc in excs.keys():
	print template2 % {'name': exc.__name__}

print
print

for exc, values in excs.items():
	if len(values) == 0:
		print template1 % {'name': exc.__name__}

for exc, values in excs.items():
	if len(values) != 0:
		vl = []
		for key in values.keys():
			vl.append('Py.'+key.__name__)

		print template3 % {'name': exc.__name__, 	'values':string.join(vl, ', ')}

print
print
sys.exit()
temp = """\
	public static PyObject %(name)s;
	public static PyException %(name)s(String message) {
	    return new PyException(Py.%(name)s, message);
	}
"""

for exc, values in excs.items():
	if len(values) == 0:
		print temp % {'name': exc.__name__}

print
print

types = ['ArrayType', 'BuiltinFunctionType', 'BuiltinMethodType', 'ClassType', 'CodeType', 'ComplexType',
 'DictType', 'DictionaryType', 'EllipsisType', 'FileType', 'FloatType', 'FrameType',
  'FunctionType', 'InstanceType', 'IntType', 'LambdaType', 'ListType', 'LongType',
  'MethodType', 'ModuleType', 'NoneType', 'SliceType', 'StringType',
  'TracebackType', 'TupleType', 'TypeType', 'UnboundMethodType', 'XRangeType']

line = '\t\tdict.__setitem__("%(name)sType", PyJavaClass.lookup(Py%(name)s.class));'

for name in types:
	name = name[:-4]
	print line % {'name':name}

fp.close()


text:
package org.mousephenotype.cda.solr.service;

import com.fasterxml.jackson.annotation.JsonProperty;

public class Design {
    @JsonProperty("id")
    private int id;
    @JsonProperty("design_id")
    private int designId;

    private String assembly;
    @JsonProperty("feature_type")
    private String featureType;
    @JsonProperty("oligo_sequence")
    private String oligoSequence;
    @JsonProperty("oligo_start")
    private int oligoStart;
    @JsonProperty("oligo_stop")
    private int oligoStop;

    public String getAssembly() {
        return assembly;
    }

    public void setAssembly(String assembly) {
        this.assembly = assembly;
    }

    public String getFeatureType() {
        return featureType;
    }

    public void setFeatureType(String featureType) {
        this.featureType = featureType;
    }

    public String getOligoSequence() {
        return oligoSequence;
    }

    public void setOligoSequence(String oligoSequence) {
        this.oligoSequence = oligoSequence;
    }

    public int getOligoStart() {
        return oligoStart;
    }

    public void setOligoStart(int oligoStart) {
        this.oligoStart = oligoStart;
    }

    public int getOligoStop() {
        return oligoStop;
    }

    public void setOligoStop(int oligoStop) {
        this.oligoStop = oligoStop;
    }

    private String chr;

    public String getChr() {
        return chr;
    }

    public void setChr(String chr) {
        this.chr = chr;
    }

    public String getStrand() {
        return strand;
    }

    public void setStrand(String strand) {
        this.strand = strand;
    }

    private String strand;

    public int getDesignId() {
        return designId;
    }

    public void setDesignId(int designId) {
        this.designId = designId;
    }

    @Override
    public String toString() {
        return "Design{" +
                "id="+id+
                "designId=" + designId +
                ", assembly='" + assembly + '\'' +
                ", featureType='" + featureType + '\'' +
                ", oligoSequence='" + oligoSequence + '\'' +
                ", oligoStart=" + oligoStart +
                ", oligoStop=" + oligoStop +
                ", chr='" + chr + '\'' +
                ", strand='" + strand + '\'' +
                '}';
    }
}


text:
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 21.1.3.3
description: >
  Returns abrupt from ToString(this)
info: >
  21.1.3.3 String.prototype.codePointAt ( pos )

  1. Let O be RequireObjectCoercible(this value).
  2. Let S be ToString(O).
  3. ReturnIfAbrupt(S).
---*/

var o = {
  toString: function() {
    throw new Test262Error();
  }
};

assert.throws(Test262Error, function() {
  String.prototype.codePointAt.call(o, 1);
});


text:
require 'test_helper'

class AppApiTest < Minitest::Unit::TestCase
  include Rack::Test::Methods

  def app
    Sinatra::Application
  end

  def setup
    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.start
    @resource = Resource.create( name: 'Computadora', description: 'Notebook con 4GB de RAM y 256 GB de espacio en disco con Linux')
    @booking = @resource.bookings.create(start: ("2013-10-26T10:00:00Z".to_time.utc.iso8601) , end: ("2013-10-26T11:00:00Z".to_time.utc.iso8601), status: 'pending')
    @booking.update(status: 'approved')
    @booking = @resource.bookings.create(start: "2013-10-26T11:00:00Z".to_time.utc.iso8601, end: ("2013-10-26T12:30:00Z".to_time.utc.iso8601), status: 'approved', user: 'otheruser@gmail.com')
    @booking_delete = @resource.bookings.create(start: "2013-10-26T11:00:00Z".to_time.utc.iso8601, end: ("2013-10-26T12:30:00Z".to_time.utc.iso8601), status: 'approved', user: 'otheruser@gmail.com')
  end

  def teardown
    DatabaseCleaner.clean
  end

  def assert_response_ok
    assert_equal 200, last_response.status
  end

  def assert_response_created
    assert_equal 201, last_response.status
  end

  def assert_response_bad_request
    assert_equal 400, last_response.status
  end

  def assert_response_not_found
    assert_equal 404, last_response.status
  end

  def assert_response_conflict
    assert_equal 409, last_response.status
  end

  def test_assert_get_resources
    get '/resources'
    assert_response_ok
  end

  def test_assert_get_one_resource
    get "/resources/#{@resource.id}"
    assert_response_ok
  end

  def test_fail_get_non_existent_resource
    get "/resources/#{Resource.last.id.to_i + 1}"
    assert_response_not_found
  end

  def assert_get_resource(verb)
    get "/resources/#{@resource.id}/#{verb}"
    assert_response_ok
  end

  def assert_non_existent_resource(verb)
    get "/resources/#{Resource.last.id.to_i + 1}/#{verb}"
    assert_response_not_found
  end

  def assert_get_resources_with_date_limit_status(verb, date=nil, limit=nil, status=nil)
    get "/resources/#{@resource.id}/#{verb}?date=#{date}&limit=#{limit}&status=#{status}"
    assert_response_ok
  end

  def refute_get_resources_with_date_limit_status(verb, date=nil, limit=nil, status=nil)
    get "/resources/#{@resource.id}/#{verb}?date=#{date}&limit=#{limit}&status=#{status}"
    assert_response_bad_request
  end

  def assert_get_resources_with_date(verb, date=nil)
    get "/resources/#{@resource.id}/#{verb}?date=#{date}"
    assert_response_ok
  end

  def assert_get_resources_with_limit(verb, limit=nil)
    get "/resources/#{@resource.id}/#{verb}?limit=#{limit}"
    assert_response_ok
  end

  def assert_get_resources_with_status(verb, status=nil)
    get "/resources/#{@resource.id}/#{verb}?status=#{status}"
    assert_response_ok
  end

  def test_assert_post_bookings_resource_without_params
    post "/resources/#{@resource.id}/bookings"
    assert_response_bad_request
  end

  def test_assert_post_bookings_resource_without_param_from
    post "/resources/#{@resource.id}/bookings?from=2014-03-03T01:00:00"
    assert_response_bad_request
  end

  def test_assert_post_bookings_resource_without_param_to
    post "/resources/#{@resource.id}/bookings?from=2014-03-03T01:00:00"
    assert_response_bad_request
  end

  def test_assert_post_bookings_resource_with_params
    post "/resources/#{@resource.id}/bookings?from=2011-03-03T01:00:00&to=2011-03-03T02:00:00"
    assert_response_created
  end

  def test_assert_post_bookings_resource_with_conflict
    post "/resources/#{@resource.id}/bookings?from=2013-09-26T10:00:00Z&to=2013-11-26T11:00:01Z"
    assert_response_conflict
  end

  def assert_put_resources_booking booking
    put "/resources/#{@resource.id}/bookings/#{booking.id}"
    assert_response_ok
  end

  def assert_get_resources_booking booking
    get "/resources/#{@resource.id}/bookings/#{booking.id}"
    assert_response_ok
  end

  def assert_delete_resources_booking booking
    delete "/resources/#{@resource.id}/bookings/#{booking.id}"
    assert_response_ok
  end

  def test_all_common_methods
    assert_get_resource 'bookings'
    assert_get_resource 'availability'

    assert_non_existent_resource 'bookings'
    assert_non_existent_resource 'availability'

    assert_get_resources_with_date_limit_status('bookings', '2013-10-26','365', 'pending')
    assert_get_resources_with_date_limit_status('availability', '2013-10-26','365', 'pending')

    refute_get_resources_with_date_limit_status('bookings', '2013-10-26','366', 'pending')
    refute_get_resources_with_date_limit_status('availability', '2013-10-26','366', 'pending')

    assert_get_resources_with_date('bookings','2013-10-26')
    assert_get_resources_with_date('availability','2013-10-26')

    assert_get_resources_with_limit('bookings','1')
    assert_get_resources_with_limit('availability','1')

    assert_get_resources_with_status('bookings','pending')
    assert_get_resources_with_status('availability','pending')

    assert_put_resources_booking @booking
    assert_get_resources_booking @booking
    assert_delete_resources_booking @booking_delete
  end

end


text:
package org.nnsoft.guice.gguava.eventbus;

import com.google.inject.matcher.Matcher;

/**
 * Allows specify level of matching for the binding Bus.
 */
public interface BusMatcher
{

    /**
     * Every bound classes will be registered to the bus.
     */
    void toAnyBoundClass();

    /**
     * Bound classes matching only with the input Matcher will be registered to the Bus.
     *
     * @param matcher the bound classes filter.
     */
    void to( Matcher<Object> matcher );

}


text:
package GrmMojo;

use strict;
use feature 'say';
use Data::Dumper;
use Mojo::Base 'Mojolicious';

# This method will run once at server start
sub startup {
    my $self = shift;

    # Documentation browser under "/perldoc"
    $self->plugin('PODRenderer');
    $self->plugin('tt_renderer');

    my $config = $self->plugin('yaml_config', {
        file => $self->home->rel_file('conf/grm_mojo.yaml'),
    });

#    $self->defaults(layout => 'default');

    $self->secret('Living is easy with eyes closed');

    # Router
    my $r = $self->routes;

    # Normal route to controller
    $r->get('/')->to('example#welcome');

    $r->get('/search')->name('search')->to('search#search');
#        controller => 'search',
#        action     => 'search',
#        format     => 'html',
#    );
}

1;


text:
<?php

declare(strict_types = 1);

use PHPUnit\Framework\TestCase;
use Sop\JWX\JWA\JWA;
use Sop\JWX\JWK\JWK;
use Sop\JWX\JWK\Parameter\AlgorithmParameter;
use Sop\JWX\JWK\Parameter\KeyTypeParameter;
use Sop\JWX\JWK\Parameter\KeyValueParameter;
use Sop\JWX\JWK\Symmetric\SymmetricKeyJWK;
use Sop\JWX\JWS\Algorithm\HMACAlgorithm;
use Sop\JWX\JWT\Header\Header;

/**
 * @group jws
 * @group hmac
 *
 * @internal
 */
class HMACAlgorithmTest extends TestCase
{
    public function testFromJWK()
    {
        $jwk = new JWK(new AlgorithmParameter(JWA::ALGO_HS256),
            new KeyTypeParameter(KeyTypeParameter::TYPE_OCT),
            new KeyValueParameter('key'));
        $algo = HMACAlgorithm::fromJWK($jwk, new Header());
        $this->assertInstanceOf(HMACAlgorithm::class, $algo);
    }

    public function testFromJWKUnsupportedAlgo()
    {
        $jwk = SymmetricKeyJWK::fromKey('key')->withParameters(
            new AlgorithmParameter('nope'));
        $this->expectException(\UnexpectedValueException::class);
        HMACAlgorithm::fromJWK($jwk, new Header());
    }

    /**
     * @requires PHP < 8
     */
    public function testComputeFails()
    {
        $algo = new HMACAlgorithmTest_InvalidAlgo('key');
        $this->expectException(\RuntimeException::class);
        $algo->computeSignature('data');
    }

    /**
     * @requires PHP >= 8
     */
    public function testComputeFailsPhp8()
    {
        $algo = new HMACAlgorithmTest_InvalidAlgo('key');
        $this->expectException(\ValueError::class);
        $algo->computeSignature('data');
    }
}

class HMACAlgorithmTest_InvalidAlgo extends HMACAlgorithm
{
    public function algorithmParamValue(): string
    {
        return $this->_hashAlgo();
    }

    protected function _hashAlgo(): string
    {
        return 'nope';
    }
}


text:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    global $json,$current_user;

    if ($_REQUEST['object_type'] == "Meeting")
    {
        $focus = new Meeting();
        $focus->id = $_REQUEST['object_id'];
        $test = $focus->set_accept_status($current_user, $_REQUEST['accept_status']);
    }
    else if ($_REQUEST['object_type'] == "Call")
    {
        $focus = new Call();
        $focus->id = $_REQUEST['object_id'];
        $test = $focus->set_accept_status($current_user, $_REQUEST['accept_status']);
    }
    print 1;
    exit;
?>


text:
module IRConnect
  # represents an IRC Command received from the server
  class Command
    attr_reader :prefix, :command, :params, :last_param

    # IRC message format:
    # :<prefix> <command> <params> :<trailing>
    # info on parsing commands:
    # http://goo.gl/N3YGLq
    def initialize(command_string)
      fail 'Bad IRC command format' unless command_string =~ /
          \A (?::([^\040]+)\040)?  # prefix
          ([A-Za-z]+|\d{3})        # command
          ((?:\040[^:][^\040]+)*)  # all but the last param
          (?:\040:?(.*))?          # last param
          \Z
        /x
      @prefix, @command = Regexp.last_match(1), Regexp.last_match(2)
      parse_params(Regexp.last_match(3), Regexp.last_match(4))
    end

    def ==(other)
      prefix == other.prefix &&
        command == other.command &&
        params == other.params
    end

    private

    def parse_params(param, param_last)
      if param.empty?
        @params = []
      else
        @params = param.split
        @params << param_last unless param_last.nil?
      end
      @last_param = params.last
    end
  end
end


text:
@implementation OCRAccomplishmentTableViewCell

CGFloat const kOCRAccomplishmentTableViewCellDefaultHeight = 155.0f;

@end


text:
layout: post
title: "Disclosure & Sam Smith - Hotline Bling Cover"
modified:
categories: Music
excerpt:
tags: [Music]
image:
  feature:
date: 2015-09-16T15:45:20-07:00
---
<iframe width="100%" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/224157146&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true"></iframe>


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="192dp"
    android:background="?attr/colorPrimaryDark"
    android:padding="16dp"
    android:theme="@style/ThemeOverlay.AppCompat.Dark"
    android:orientation="vertical"
    android:gravity="bottom">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="72dp"
        android:layout_height="72dp"

        android:src="@mipmap/ic_logo" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:id="@+id/id_username_label"
        android:textAppearance="@style/TextAppearance.AppCompat.Body1" />

    <TextView
        android:id="@+id/textViewDrawerAct1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/textViewDrawerAct1" />

</LinearLayout>


text:
const std::vector<Geodetic2D*>* GEO2DPolygonGeometry::getCoordinates() const {
  return _polygonData->getCoordinates();
}

const std::vector<std::vector<Geodetic2D*>*>* GEO2DPolygonGeometry::getHolesCoordinatesArray() const {
  return _polygonData->getHolesCoordinatesArray();
}

GEO2DPolygonGeometry::~GEO2DPolygonGeometry() {
  delete _polygonData;

//  const int coordinatesCount = _coordinates->size();
//  for (int i = 0; i < coordinatesCount; i++) {
//    Geodetic2D* coordinate = _coordinates->at(i);
//    delete coordinate;
//  }
//  delete _coordinates;
//
//
//  if (_holesCoordinatesArray != NULL) {
//    const int holesCoordinatesArraySize = _holesCoordinatesArray->size();
//    for (int j = 0; j < holesCoordinatesArraySize; j++) {
//      const std::vector<Geodetic2D*>* holeCoordinates = _holesCoordinatesArray->at(j);
//
//      const int holeCoordinatesCount = holeCoordinates->size();
//      for (int i =0; i < holeCoordinatesCount; i++) {
//        const Geodetic2D* holeCoordinate = holeCoordinates->at(i);
//
//        delete holeCoordinate;
//      }
//
//      delete holeCoordinates;
//    }
//    delete _holesCoordinatesArray;
//  }

#ifdef JAVA_CODE
  super.dispose();
#endif

}

std::vector<GEOSymbol*>* GEO2DPolygonGeometry::createSymbols(const GEOSymbolizer* symbolizer) const {
  return symbolizer->createSymbols(this);
}


text:
"use strict";

var io = require('./libs/socket.io');

var Socket = function () {
  this.io = null;
};

Socket.prototype.connect = function () {
  this.io = io();
};

Socket.prototype.on = function (eventName, handler) {
  this.io.on(eventName, handler);
};

Socket.prototype.emit = function (eventName, data) {
  this.io.emit(eventName, data);
};

Socket.prototype.propagate = function (eventName) {
  var that = this;
  this.on(eventName, function (data) {
    that.emit(eventName, data);
  });
};

module.exports = Socket;


text:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Accela.WindowsStoreSDK
{
    /// <summary>
    /// Model to store and retrive user information
    /// </summary>
    internal class NativeUserInfo : BindableBase
    {
        private string _agency;

        private string _username;

        private string _password;

        private string _environment;

        private ObservableCollection<string> _env = new ObservableCollection<string>() {
            "PROD",
            "TEST"
        };

        public ObservableCollection<string> EnvList
        {
            get { return _env; }
        }

        public string Agency
        {
            get { return _agency; }
            set { SetProperty(ref _agency, value); }
        }

        public string UserName
        {
            get { return _username; }
            set { SetProperty(ref _username, value); }
        }

        public string Password
        {
            get { return _password; }
            set { SetProperty(ref _password, value); }
        }

        public string Enviroment
        {
            get { return _environment; }
            set { SetProperty(ref _environment, value); }
        }
        /// <summary>
        /// construct method to init the default agency/username/environment
        /// </summary>
        public NativeUserInfo()
        {
#if DEBUG
            this._agency = "islandton";
            this._password = "accela";
            this._username = "mdeveloper";
            this._environment = this._env[0];
#endif
        }
    }
}