text:
//-----------------------------------------------------------------------
// <copyright file="IPokerHandsChecker.cs" company="PokerCo">
//     PokerCo.
// </copyright>
// <summary>This is the IPokerHandsChecker interface.</summary>
//-----------------------------------------------------------------------
namespace Poker
{
    /// <summary>
    /// Interface for checking poker hands as defined in http://en.wikipedia.org/wiki/List_of_poker_hands.
    /// </summary>
    public interface IPokerHandsChecker
    {
        /// <summary>
        /// Checks if a hand is valid poker hand.
        /// </summary>
        /// <param name="hand">Hand to be checked.</param>
        /// <returns>True if the hand is valid poker hand.</returns>
        bool IsValidHand(IHand hand);

        /// <summary>
        /// Checks if a hand is in the Straight flush category.
        /// </summary>
        /// <param name="hand">Hand to be checked.</param>
        /// <returns>True if the hand is Straight flush.</returns>
        bool IsStraightFlush(IHand hand);

        /// <summary>
        /// Checks if a hand is in the Four of a kind category.
        /// </summary>
        /// <param name="hand">Hand to be checked.</param>
        /// <returns>True if the hand is Four of a kind.</returns>
        bool IsFourOfAKind(IHand hand);

        /// <summary>
        /// Checks if a hand is in the Full house category.
        /// </summary>
        /// <param name="hand">Hand to be checked.</param>
        /// <returns>True if the hand is Full house.</returns>
        bool IsFullHouse(IHand hand);

        /// <summary>
        /// Checks if a hand is in the Flush category.
        /// </summary>
        /// <param name="hand">Hand to be checked.</param>
        /// <returns>True if the hand is Flush.</returns>
        bool IsFlush(IHand hand);

        /// <summary>
        /// Checks if a hand is in the Straight category.
        /// </summary>
        /// <param name="hand">Hand to be checked.</param>
        /// <returns>True if the hand is Straight.</returns>
        bool IsStraight(IHand hand);

        /// <summary>
        /// Checks if a hand is in the Three of a kind category.
        /// </summary>
        /// <param name="hand">Hand to be checked.</param>
        /// <returns>True if the hand is Three of a kind.</returns>
        bool IsThreeOfAKind(IHand hand);

        /// <summary>
        /// Checks if a hand is in the Two pair category.
        /// </summary>
        /// <param name="hand">Hand to be checked.</param>
        /// <returns>True if the hand is Two pair.</returns>
        bool IsTwoPair(IHand hand);

        /// <summary>
        /// Checks if a hand is in the One pair category.
        /// </summary>
        /// <param name="hand">Hand to be checked.</param>
        /// <returns>True if the hand is One pair.</returns>
        bool IsOnePair(IHand hand);

        /// <summary>
        /// Checks if a hand is in the High Card category.
        /// </summary>
        /// <param name="hand">Hand to be checked.</param>
        /// <returns>True if the hand is High Card.</returns>
        bool IsHighCard(IHand hand);

        /// <summary>
        /// Compares which one of two poker hands is the winning hand.
        /// </summary>
        /// <param name="firstHand">First poker hand.</param>
        /// <param name="secondHand">Second poker hand.</param>
        /// <returns>Returns 1 if the first hand is the winning hand or -1 if the second is the winning hand or 0 if both hands are equal.</returns>
        int CompareHands(IHand firstHand, IHand secondHand);
    }
}

redpajama_set_name: RedPajamaGithub


text:
using Orchard.ContentManagement.MetaData;
using Orchard.Data.Migration;

namespace Markdown {
    public class Migrations : DataMigrationImpl {

        public int Create() {
            return 1;
        }
    }
}


text:
Use [CBPWordPress](https://github.com/kmonaghan/CBPWordPress) instead.

KMWordPress
===========

KMWordPress is an example iOS app that uses a JSON feed produced by the [JSON API plugin](http://wordpress.org/extend/plugins/json-api/) (you'll need to use my [fork](https://github.com/kmonaghan/wp-json-api) though) and displays it in a reasonable manner.

Currently, this example forms the basis for the [Broadsheet.ie](http://broadsheet.ie) [app](https://itunes.apple.com/ie/app/broadsheet.ie/id413093424?mt=8).  I've blogged about [how this version has improved](http://www.karlmonaghan.com/2013/03/01/broadsheet-ie-iphone-app-2-0/) over the [previous incarnation](https://github.com/kmonaghan/Broadsheet.ie-iOS).

## Getting Started
First you need to initialise all the submodules:
```
$ git submodule update --init --recursive
```

You'll also need the [Facebook SDK](https://github.com/facebook/facebook-ios-sdk) in the same folder you've cloned this project too (or manually change all the paths).

In [KMWordPressAPIClient.m](KMWordPress/blob/master/KMWordPress/Classes/KMWordPressAPIClient.m#L15) you need to change the base URL:
``` objective-c
static NSString * const kKMWordpressURLString =  @"http://www.broadsheet.ie/";
```

Open the project, compile it and you should see a feed of your posts.

You should change the app id used by Appirater and put in your own Google Analytics tracker before you distribute it to anyone.

### Icons
The icons used the live version of the app are from [Glyphish](http://www.glyphish.com/) so I can't distribute them.  I've replaced them with some free ones from [TWG](http://blog.twg.ca/2010/11/retina-display-icon-set/twg_retina_icons/) and [Gentleface](http://gentleface.com/free_icon_set.html) but kept the Glyphish icon names so you can drop them in if you want.

## Requirements

KMWordPress requires [iOS 5.0](http://developer.apple.com/library/ios/#releasenotes/General/WhatsNewIniOS/Articles/iOS5.html) and above.

### ARC
KMWordPress uses ARC.

## Creator

[Karl Monaghan](http://github.com/kmonaghan)
[@karlmonaghan](https://twitter.com/karlmonaghan)

## License

KMWordPress is available under the MIT license. See the LICENSE file for more info.


text:
describe('ui.grid.exporter uiGridExporterService', function () {
  var uiGridExporterService;
  var uiGridSelectionService;
  var uiGridExporterConstants;
  var uiGridSelectionConstants;
  var gridClassFactory;
  var grid;
  var $compile;
  var $scope;
  var $document;

  beforeEach(module('ui.grid.exporter', 'ui.grid.selection', 'ui.grid.pinning'));

  beforeEach(inject(function (_uiGridExporterService_, _uiGridSelectionService_, _uiGridPinningService_, _gridClassFactory_, _uiGridExporterConstants_,
                              _uiGridPinningConstants_,
                              _$compile_, _$rootScope_, _$document_, _uiGridSelectionConstants_) {
    uiGridExporterService = _uiGridExporterService_;
    uiGridSelectionService = _uiGridSelectionService_;
    uiGridExporterConstants = _uiGridExporterConstants_;
    gridClassFactory = _gridClassFactory_;
    $compile = _$compile_;
    $scope = _$rootScope_.$new();
    $document = _$document_;
    uiGridSelectionConstants = _uiGridSelectionConstants_;

    grid = gridClassFactory.createGrid({});
    grid.options.columnDefs = [
        {field: 'col1', name: 'col1', displayName: 'Col1', width: 50, pinnedLeft: true},
        {field: 'col2', name: 'col2', displayName: 'Col2', width: '*', type: 'number'},
        {field: 'col3', name: 'col3', displayName: 'Col3', width: 100},
        {field: 'col4', name: 'col4', displayName: 'Col4', width: 200}
    ];

    _uiGridExporterService_.initializeGrid(grid);
    _uiGridSelectionService_.initializeGrid(grid);
    _uiGridPinningService_.initializeGrid(grid);
    var data = [];
    for (var i = 0; i < 3; i++) {
        data.push({col1:'a_'+i, col2:'b_'+i, col3:'c_'+i, col4:'d_'+i});
    }
    grid.options.data = data;

    grid.buildColumns();
    grid.modifyRows(grid.options.data);
    grid.rows[1].visible = false;
    grid.columns[2].visible = false;
    grid.setVisibleRows(grid.rows);
    grid.setVisibleColumns(grid.columns);

    grid.api.selection.clearSelectedRows();
    grid.api.selection.selectRow(grid.rows[0].entity);

    grid.gridWidth = 500;
    grid.columns[0].drawnWidth = 50;
    grid.columns[1].drawnWidth = '*';
    grid.columns[2].drawnWidth = 100;
    grid.columns[3].drawnWidth = 200;

  }));

  describe('defaultGridOptions', function() {
    var options;
    beforeEach(function() {
      options = {};
    });

    it('set all options to default', function() {
      uiGridExporterService.defaultGridOptions(options);
      expect( options ).toEqual({
        exporterSuppressMenu: false,
        exporterMenuLabel: 'Export',
        exporterCsvColumnSeparator: ',',
        exporterCsvFilename: 'download.csv',
        exporterPdfFilename: 'download.pdf',
        exporterOlderExcelCompatibility: false,
        exporterPdfDefaultStyle : { fontSize : 11 },
        exporterPdfTableStyle : { margin : [ 0, 5, 0, 15 ] },
        exporterPdfTableHeaderStyle : { bold : true, fontSize : 12, color : 'black' },
        exporterPdfHeader: null,
        exporterPdfFooter: null,
        exporterPdfOrientation : 'landscape',
        exporterPdfPageSize : 'A4',
        exporterPdfMaxGridWidth : 720,
        exporterPdfCustomFormatter: jasmine.any(Function),
        exporterHeaderFilterUseName: false,
        exporterMenuAllData: true,
        exporterMenuCsv: true,
        exporterMenuPdf: true,
        exporterFieldCallback: jasmine.any(Function),
        exporterAllDataFn: null,
        exporterSuppressColumns: []
      });
    });

    it('set all options to non-default, including using deprecated exporterAllDataPromise', function() {
      var callback = function() {};
      options = {
        exporterSuppressMenu: true,
        exporterMenuLabel: 'custom export button',
        exporterCsvColumnSeparator: ';',
        exporterCsvFilename: 'myfile.csv',
        exporterPdfFilename: 'myfile.pdf',
        exporterOlderExcelCompatibility: true,
        exporterPdfDefaultStyle : { fontSize : 12 },
        exporterPdfTableStyle : { margin : [ 15, 5, 15, 15 ] },
        exporterPdfTableHeaderStyle : { bold : false, fontSize : 12, color : 'green' },
        exporterPdfHeader: "My Header",
        exporterPdfFooter: "My Footer",
        exporterPdfOrientation : 'portrait',
        exporterPdfPageSize : 'LETTER',
        exporterPdfMaxGridWidth : 670,
        exporterPdfCustomFormatter: callback,
        exporterHeaderFilterUseName: true,
        exporterMenuAllData: false,
        exporterMenuCsv: false,
        exporterMenuPdf: false,
        exporterFieldCallback: callback,
        exporterAllDataPromise: callback,
        exporterSuppressColumns: [ 'buttons' ]
      };
      uiGridExporterService.defaultGridOptions(options);
      expect( options ).toEqual({
        exporterSuppressMenu: true,
        exporterMenuLabel: 'custom export button',
        exporterCsvColumnSeparator: ';',
        exporterCsvFilename: 'myfile.csv',
        exporterPdfFilename: 'myfile.pdf',
        exporterOlderExcelCompatibility: true,
        exporterPdfDefaultStyle : { fontSize : 12 },
        exporterPdfTableStyle : { margin : [ 15, 5, 15, 15 ] },
        exporterPdfTableHeaderStyle : { bold : false, fontSize : 12, color : 'green' },
        exporterPdfHeader: "My Header",
        exporterPdfFooter: "My Footer",
        exporterPdfOrientation : 'portrait',
        exporterPdfPageSize : 'LETTER',
        exporterPdfMaxGridWidth : 670,
        exporterPdfCustomFormatter: callback,
        exporterHeaderFilterUseName: true,
        exporterMenuAllData: false,
        exporterMenuCsv: false,
        exporterMenuPdf: false,
        exporterFieldCallback: callback,
        exporterAllDataFn: callback,
        exporterAllDataPromise: callback,
        exporterSuppressColumns: [ 'buttons' ]
      });
    });
  });

  describe('getColumnHeaders', function() {
    it('gets visible headers', function() {
      expect(uiGridExporterService.getColumnHeaders(grid, uiGridExporterConstants.VISIBLE)).toEqual([
        {name: 'col1', displayName: 'Col1', width: 50, align: 'left'},
        {name: 'col2', displayName: 'Col2', width: '*', align: 'right'},
        {name: 'col4', displayName: 'Col4', width: 200, align: 'left'}
      ]);
    });

    it('gets all headers', function() {
      expect(uiGridExporterService.getColumnHeaders(grid, uiGridExporterConstants.ALL)).toEqual([
        {name: 'col1', displayName: 'Col1', width: 50, align: 'left'},
        {name: 'col2', displayName: 'Col2', width: '*', align: 'right'},
        {name: 'col3', displayName: 'Col3', width: 100, align: 'left'},
        {name: 'col4', displayName: 'Col4', width: 200, align: 'left'}
      ]);
    });

    it('ignores suppressed columns', function() {
      grid.columns[0].colDef.exporterSuppressExport = true;
      expect(uiGridExporterService.getColumnHeaders(grid, uiGridExporterConstants.ALL)).toEqual([
        {name: 'col2', displayName: 'Col2', width: '*', align: 'right'},
        {name: 'col3', displayName: 'Col3', width: 100, align: 'left'},
        {name: 'col4', displayName: 'Col4', width: 200, align: 'left'}
      ]);
    });

    it('ignores suppressed header', function() {
      grid.options.exporterSuppressColumns = [ 'col1'];
      expect(uiGridExporterService.getColumnHeaders(grid, uiGridExporterConstants.ALL)).toEqual([
        {name: 'col2', displayName: 'Col2', width: '*', align: 'right'},
        {name: 'col3', displayName: 'Col3', width: 100, align: 'left'},
        {name: 'col4', displayName: 'Col4', width: 200, align: 'left'}
      ]);
    });

    it('gets all headers using headerFilter', function() {
      grid.options.exporterHeaderFilter = function( displayName ){ return "mapped_" + displayName; };

      expect(uiGridExporterService.getColumnHeaders(grid, uiGridExporterConstants.ALL)).toEqual([
        {name: 'col1', displayName: 'mapped_Col1', width: 50, align: 'left'},
        {name: 'col2', displayName: 'mapped_Col2', width: '*', align: 'right'},
        {name: 'col3', displayName: 'mapped_Col3', width: 100, align: 'left'},
        {name: 'col4', displayName: 'mapped_Col4', width: 200, align: 'left'}
      ]);
    });

    it('gets all headers using headerFilter, passing name not displayName', function() {
      grid.options.exporterHeaderFilterUseName = true;
      grid.options.exporterHeaderFilter = function( name ){ return "mapped_" + name; };

      expect(uiGridExporterService.getColumnHeaders(grid, uiGridExporterConstants.ALL)).toEqual([
        {name: 'col1', displayName: 'mapped_col1', width: 50, align: 'left'},
        {name: 'col2', displayName: 'mapped_col2', width: '*', align: 'right'},
        {name: 'col3', displayName: 'mapped_col3', width: 100, align: 'left'},
        {name: 'col4', displayName: 'mapped_col4', width: 200, align: 'left'}
      ]);
    });
  });

  describe('getData', function() {
    it('gets all rows and columns', function() {
      expect(uiGridExporterService.getData(grid, uiGridExporterConstants.ALL, uiGridExporterConstants.ALL)).toEqual([
        [ {value: 'a_0'}, {value: 'b_0'}, {value: 'c_0'}, {value: 'd_0'} ],
        [ {value: 'a_1'}, {value: 'b_1'}, {value: 'c_1'}, {value: 'd_1'} ],
        [ {value: 'a_2'}, {value: 'b_2'}, {value: 'c_2'}, {value: 'd_2'} ]
      ]);
    });

    it('ignores selection row header column', function() {
      grid.columns[0].colDef.exporterSuppressExport = true;
      expect(uiGridExporterService.getData(grid, uiGridExporterConstants.ALL, uiGridExporterConstants.ALL)).toEqual([
        [ {value: 'b_0'}, {value: 'c_0'}, {value: 'd_0'} ],
        [ {value: 'b_1'}, {value: 'c_1'}, {value: 'd_1'} ],
        [ {value: 'b_2'}, {value: 'c_2'}, {value: 'd_2'} ]
      ]);
    });

    it('ignores suppressed column', function() {
      grid.options.exporterSuppressColumns = [ 'col1' ];
      expect(uiGridExporterService.getData(grid, uiGridExporterConstants.ALL, uiGridExporterConstants.ALL)).toEqual([
        [ {value: 'b_0'}, {value: 'c_0'}, {value: 'd_0'} ],
        [ {value: 'b_1'}, {value: 'c_1'}, {value: 'd_1'} ],
        [ {value: 'b_2'}, {value: 'c_2'}, {value: 'd_2'} ]
      ]);
    });

    it('ignores disabled row', function() {
      grid.rows[1].exporterEnableExporting = false;
      expect(uiGridExporterService.getData(grid, uiGridExporterConstants.ALL, uiGridExporterConstants.ALL)).toEqual([
        [ {value: 'a_0'}, {value: 'b_0'}, {value: 'c_0'}, {value: 'd_0'} ],
        [ {value: 'a_2'}, {value: 'b_2'}, {value: 'c_2'}, {value: 'd_2'} ]
      ]);
    });

    it('gets visible rows and columns', function() {
      expect(uiGridExporterService.getData(grid, uiGridExporterConstants.VISIBLE, uiGridExporterConstants.VISIBLE)).toEqual([
        [ {value: 'a_0'}, {value: 'b_0'}, {value: 'd_0'} ],
        [ {value: 'a_2'}, {value: 'b_2'}, {value: 'd_2'} ]
      ]);
    });

    it('gets selected rows and visible columns', function() {
      expect(uiGridExporterService.getData(grid, uiGridExporterConstants.SELECTED, uiGridExporterConstants.VISIBLE)).toEqual([
        [ {value: 'a_0'}, {value: 'b_0'}, {value: 'd_0'} ]
      ]);
    });

    it('maps data using objectCallback', function() {
      grid.options.exporterFieldCallback = function( grid, row, col, value ){
        if ( col.name === 'col2' ){
          return 'translated';
        } else {
          return value;
        }
      };

      expect(uiGridExporterService.getData(grid, uiGridExporterConstants.ALL, uiGridExporterConstants.ALL)).toEqual([
        [ { value: 'a_0' }, { value: 'translated' }, { value: 'c_0' }, { value: 'd_0' } ],
        [ { value: 'a_1' }, { value: 'translated' }, { value: 'c_1' }, { value: 'd_1' } ],
        [ { value: 'a_2' }, { value: 'translated' }, { value: 'c_2' }, { value: 'd_2' } ]
      ]);
    });
  });

  describe('formatAsCsv', function() {
    it('formats empty data as a csv', function() {
      var columnHeaders = [];
      var data = [];
      var separator = ',';

      expect(uiGridExporterService.formatAsCsv(columnHeaders, data, separator)).toEqual(
        "\n"
      );
    });

    it('formats a mix of data as a csv', function() {
      var columnHeaders = [
        {name: 'col1', displayName: 'Col1', width: 50, align: 'left'},
        {name: 'col2', displayName: 'Col2', width: '*', align: 'left'},
        {name: 'col3', displayName: 'Col3', width: 100, align: 'left'},
        {name: 'x', displayName: '12345234', width: 200, align: 'left'}
      ];

      var date = new Date(2014, 11, 12, 0, 0, 0, 0);

      var data = [
        [ {value: 'a string'}, {value: 'a string'}, {value: 'A string'}, {value: 'a string'} ],
        [ {value: ''}, {value: '45'}, {value: 'A string'}, {value: false} ],
        [ {value: date}, {value: 45}, {value: 'A string'}, {value: true} ]
      ];

      var separator = ',';

      expect(uiGridExporterService.formatAsCsv(columnHeaders, data, separator)).toEqual(
        '"Col1","Col2","Col3","12345234"\n"a string","a string","A string","a string"\n"","45","A string",FALSE\n"' + date.toISOString() + '",45,"A string",TRUE'
      );
    });

    it('formats a mix of data as a csv with custom separator', function() {
      var columnHeaders = [
        {name: 'col1', displayName: 'Col1', width: 50, align: 'left'},
        {name: 'col2', displayName: 'Col2', width: '*', align: 'left'},
        {name: 'col3', displayName: 'Col3', width: 100, align: 'left'},
        {name: 'x', displayName: '12345234', width: 200, align: 'left'}
      ];

      var date = new Date(2014, 11, 12, 0, 0, 0, 0);

      var data = [
        [ {value: 'a string'}, {value: 'a string'}, {value: 'A string'}, {value: 'a string'} ],
        [ {value: ''}, {value: '45'}, {value: 'A string'}, {value: false} ],
        [ {value: date}, {value: 45}, {value: 'A string'}, {value: true} ]
      ];

      var separator = ';';

      expect(uiGridExporterService.formatAsCsv(columnHeaders, data, separator)).toEqual(
        '"Col1";"Col2";"Col3";"12345234"\n"a string";"a string";"A string";"a string"\n"";"45";"A string";FALSE\n"' + date.toISOString() + '";45;"A string";TRUE'
      );
    });
  });

  describe( 'prepareAsPdf', function() {
    it( 'prepares standard grid using defaults', function() {
      /*
       * Note that you can test the results from prepareAsPdf using
       * http://pdfmake.org/playground.html#, which verifies
       * that it creates a genuine pdf
       */
      var columnHeaders = [
        {name: 'col1', displayName: 'Col1', width: 50, align: 'left'},
        {name: 'col2', displayName: 'Col2', width: '*', align: 'left'},
        {name: 'col3', displayName: 'Col3', width: 100, align: 'left'},
        {name: 'x', displayName: '12345234', width: 200, align: 'left'}
      ];

      var date = new Date(2014, 11, 12, 0, 0, 0, 0);

      var data = [
        [ {value: 'a string'}, {value: 'a string'}, {value: 'A string'}, {value: 'a string'} ],
        [ {value: ''}, {value: '45'}, {value: 'A string'}, {value: false} ],
        [ {value: date}, {value: 45}, {value: 'A string'}, {value: true} ]
      ];

      var result = uiGridExporterService.prepareAsPdf(grid, columnHeaders, data);
      expect(result).toEqual({
        pageOrientation : 'landscape',
        pageSize: 'A4',
        content : [{
          style : 'tableStyle',
          table : {
            headerRows : 1,
            widths: [50 * 720/450, '*', 100 * 720/450, 200 * 720/450],
            body : [
              [
                { text : 'Col1', style : 'tableHeader' },
                { text : 'Col2', style : 'tableHeader' },
                { text : 'Col3', style : 'tableHeader' },
                { text : '12345234', style : 'tableHeader' }
              ],
              [ 'a string', 'a string', 'A string', 'a string' ],
              [ '', '45', 'A string', 'FALSE' ],
              [ date.toISOString(), '45', 'A string', 'TRUE' ]
            ]
          }
        }],
        styles : {
          tableStyle : {
            margin : [ 0, 5, 0, 15 ]
          },
          tableHeader : {
            bold : true, fontSize : 12, color : 'black'
          }
        },
        defaultStyle : {
          fontSize : 11
        }
      });

    });

    it( 'prepares standard grid using overrides', function() {
      /*
       * Note that you can test the results from prepareAsPdf using
       * http://pdfmake.org/playground.html#, which verifies
       * that it creates a genuine pdf
       */

      grid.options.exporterPdfDefaultStyle = {fontSize: 10};
      grid.options.exporterPdfTableStyle = {margin: [30, 30, 30, 30]};
      grid.options.exporterPdfTableHeaderStyle = {fontSize: 11, bold: true, italic: true};
      grid.options.exporterPdfHeader = "My Header";
      grid.options.exporterPdfFooter = "My Footer";
      grid.options.exporterPdfCustomFormatter = function ( docDefinition ) {
        docDefinition.styles.headerStyle = { fontSize: 10 };
        return docDefinition;
      };
      grid.options.exporterPdfOrientation = 'portrait';
      grid.options.exporterPdfPageSize = 'LETTER';
      grid.options.exporterPdfMaxGridWidth = 500;

      var columnHeaders = [
        {name: 'col1', displayName: 'Col1', width: 100, exporterPdfAlign: 'right'},
        {name: 'col2', displayName: 'Col2', width: '*', exporterPdfAlign: 'left'},
        {name: 'col3', displayName: 'Col3', width: 100, exporterPdfAlign: 'center'},
        {name: 'x', displayName: '12345234', width: 200, align: 'left'}
      ];

      var date = new Date(2014, 12, 12, 0, 0, 0, 0);

      var data = [
        [ {value: 'a string', alignment: 'right'}, {value: 'a string', alignment: 'center'}, {value: 'A string', alignment: 'left'}, {value: 'a string'} ],
        [ {value: '', alignment: 'right'}, {value: '45', alignment: 'center'}, {value: 'A string', alignment: 'left'}, {value: false} ],
        [ {value: date, alignment: 'right'}, {value: 45, alignment: 'center'}, {value: 'A string', alignment: 'left'}, {value: true} ]
      ];

      var result = uiGridExporterService.prepareAsPdf(grid, columnHeaders, data);
      expect(result).toEqual({
        pageOrientation : 'portrait',
        pageSize: 'LETTER',
        content : [
          {
            style : 'tableStyle',
            table : {
              headerRows : 1,
              widths : [ 100, '*', 100, 200 ],
              body : [
                [
                  { text : 'Col1', style : 'tableHeader' },
                  { text : 'Col2', style : 'tableHeader' },
                  { text : 'Col3', style : 'tableHeader' },
                  { text : '12345234', style : 'tableHeader' }
                ],
                [ {text: 'a string', alignment: 'right'}, { text: 'a string', alignment: 'center'}, { text: 'A string', alignment: 'left'}, 'a string' ],
                [ {text: '', alignment: 'right'}, {text: '45', alignment: 'center'}, {text: 'A string', alignment: 'left'}, 'FALSE' ],
                [ {text: date.toISOString(), alignment: 'right'}, {text: '45', alignment: 'center'}, {text: 'A string', alignment: 'left'}, 'TRUE' ]
              ]
            }
          }
         ],
        header : "My Header",
        footer : "My Footer",
        styles : {
          tableStyle : {
            margin : [ 30, 30, 30, 30 ]
          },
          tableHeader : {
            fontSize : 11, bold : true, italic : true
          },
          headerStyle: { fontSize: 10 }
        },
        defaultStyle : {
          fontSize : 10
        }
      });

    });
  });

  describe( 'calculatePdfHeaderWidths', function() {
    it( 'calculates mix of widths', function() {
      var headers = [
        { width: '20%' },
        { width: '*' },
        { width: 150 },
        { width: 200 },
        { width: 150 },
        { width: 100 }
      ];

      grid.options.exporterPdfMaxGridWidth = 410;

      // baseGridWidth = 600
      // extra 120 for 20%
      // extra 100 for '*'
      // total gridWidth 820

      expect(uiGridExporterService.calculatePdfHeaderWidths( grid, headers)).toEqual(
        [60, '*', 75, 100, 75, 50]
      );
    });
  });

});


text:
exports.largestPrimeFactorOf600851475143 = function() {
    let nextDivisor = 2;
    let remaining = 600851475143;

    while (nextDivisor < remaining) {
        if (remaining % nextDivisor == 0) {
            remaining /= nextDivisor;
        }
        else {
            nextDivisor += 1;
        }
    }

    return remaining;
};


text:
namespace BarcodeData.Data
{
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Infrastructure;
    using System.Linq;

    using Models;
    using Migrations;

    public class BarcodeDbContext : DbContext,  IBarcodeDbContext
    {
        public BarcodeDbContext()
            : base("BarcodeDbConnection")
        {
        }

        public virtual IDbSet<Product> Products { get; set; }

        public virtual IDbSet<UPC> Barcodes { get; set; }

        public virtual IDbSet<Image> Images { get; set; }

        public static BarcodeDbContext Create()
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<BarcodeDbContext, Configuration>());
            return new BarcodeDbContext();
        }

        public override int SaveChanges()
        {
            return base.SaveChanges();
        }
    }
}


text:
<?php
/**
 * Created by PhpStorm.
 * User: dtome
 * Date: 11/03/17
 * Time: 23:10
 */

namespace Slx\UserInterface\Controllers\Task;

use Silex\Application;
use Silex\Controller;
use Slx\Application\Command\Task\CreateTaskCommand;
use Slx\Domain\Entity\User\User;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Form;
use Symfony\Component\Validator\Constraints as Assert;

class CreateTaskController extends Controller
{

    /**
     * @var Application
     */
    private $application;

    public function __construct(Application $application)
    {
        $this->application = $application;
    }

    public function indexAction()
    {
        /** @var Form $form */
        $form = $this->getForm($this->application['user_repository']->findAll());
        $form->handleRequest($this->application['request_stack']->getCurrentRequest());

        if ($form->isValid()) {
            $this->application['commandhandler.service']->execute(
              new CreateTaskCommand(
                  $form->get('title')->getData(),
                  $form->get('description')->getData(),
                  $form->get('users')->getData()
              )
            );
        }

        return $this->application['twig']->render('views/task/create.html.twig',
            [
                'form' => $form->createView(),
            ]
        );
    }

    private function getForm($users)
    {
        $formUsers = [];
        /** @var User $user */
        foreach ($users as $user) {
            $formUsers[$user->email()->email()] = $user->id()->id();
        }

        return $this->application['form.factory']->createBuilder(FormType::class, [])
            ->add('title', TextType::class, [
                'constraints' => [
                    new Assert\NotBlank(),
                ],
                'attr' => [
                    'class' => 'form-control'
                ]
            ])
            ->add('description', TextareaType::class, [
                'constraints' => [
                    new Assert\NotBlank()
                ],
                'attr' => [
                    'class' => 'form-control'
                ]
            ])
            ->add('users', ChoiceType::class, [
                'constraints' => [
                    new Assert\NotBlank()
                ],
                'attr' => [
                    'class' => 'form-control'
                ],
                'choices' => $formUsers
            ])
            ->getForm();
    }
}


text:
#ifndef ART_COMPILER_OPTIMIZING_BUILDER_H_
#define ART_COMPILER_OPTIMIZING_BUILDER_H_

#include "base/arena_object.h"
#include "dex_file.h"
#include "dex_file-inl.h"
#include "driver/compiler_driver.h"
#include "driver/dex_compilation_unit.h"
#include "optimizing_compiler_stats.h"
#include "primitive.h"
#include "utils/growable_array.h"
#include "nodes.h"

namespace art {

class Instruction;
class SwitchTable;

class HGraphBuilder : public ValueObject {
 public:
  HGraphBuilder(HGraph* graph,
                DexCompilationUnit* dex_compilation_unit,
                const DexCompilationUnit* const outer_compilation_unit,
                const DexFile* dex_file,
                CompilerDriver* driver,
                OptimizingCompilerStats* compiler_stats)
      : arena_(graph->GetArena()),
        branch_targets_(graph->GetArena(), 0),
        locals_(graph->GetArena(), 0),
        entry_block_(nullptr),
        exit_block_(nullptr),
        current_block_(nullptr),
        graph_(graph),
        dex_file_(dex_file),
        dex_compilation_unit_(dex_compilation_unit),
        compiler_driver_(driver),
        outer_compilation_unit_(outer_compilation_unit),
        return_type_(Primitive::GetType(dex_compilation_unit_->GetShorty()[0])),
        code_start_(nullptr),
        latest_result_(nullptr),
        compilation_stats_(compiler_stats) {}

  // Only for unit testing.
  HGraphBuilder(HGraph* graph, Primitive::Type return_type = Primitive::kPrimInt)
      : arena_(graph->GetArena()),
        branch_targets_(graph->GetArena(), 0),
        locals_(graph->GetArena(), 0),
        entry_block_(nullptr),
        exit_block_(nullptr),
        current_block_(nullptr),
        graph_(graph),
        dex_file_(nullptr),
        dex_compilation_unit_(nullptr),
        compiler_driver_(nullptr),
        outer_compilation_unit_(nullptr),
        return_type_(return_type),
        code_start_(nullptr),
        latest_result_(nullptr),
        compilation_stats_(nullptr) {}

  bool BuildGraph(const DexFile::CodeItem& code);

  static constexpr const char* kBuilderPassName = "builder";

  // The number of entries in a packed switch before we use a jump table.
  static constexpr uint16_t kSmallSwitchThreshold = 5;

 private:
  // Analyzes the dex instruction and adds HInstruction to the graph
  // to execute that instruction. Returns whether the instruction can
  // be handled.
  bool AnalyzeDexInstruction(const Instruction& instruction, uint32_t dex_pc);

  // Finds all instructions that start a new block, and populates branch_targets_ with
  // the newly created blocks.
  // As a side effect, also compute the number of dex instructions, blocks, and
  // branches.
  // Returns true if all the branches fall inside the method code, false otherwise.
  // (In normal cases this should always return true but someone can artificially
  // create a code unit in which branches fall-through out of it).
  bool ComputeBranchTargets(const uint16_t* start,
                            const uint16_t* end,
                            size_t* number_of_branches);
  void MaybeUpdateCurrentBlock(size_t index);
  HBasicBlock* FindBlockStartingAt(int32_t index) const;

  void InitializeLocals(uint16_t count);
  HLocal* GetLocalAt(int register_index) const;
  void UpdateLocal(int register_index, HInstruction* instruction, uint32_t dex_pc) const;
  HInstruction* LoadLocal(int register_index, Primitive::Type type, uint32_t dex_pc) const;
  void PotentiallyAddSuspendCheck(HBasicBlock* target, uint32_t dex_pc);
  void InitializeParameters(uint16_t number_of_parameters);
  bool NeedsAccessCheck(uint32_t type_index) const;

  template<typename T>
  void Unop_12x(const Instruction& instruction, Primitive::Type type, uint32_t dex_pc);

  template<typename T>
  void Binop_23x(const Instruction& instruction, Primitive::Type type, uint32_t dex_pc);

  template<typename T>
  void Binop_23x_shift(const Instruction& instruction, Primitive::Type type, uint32_t dex_pc);

  void Binop_23x_cmp(const Instruction& instruction,
                     Primitive::Type type,
                     ComparisonBias bias,
                     uint32_t dex_pc);

  template<typename T>
  void Binop_12x(const Instruction& instruction, Primitive::Type type, uint32_t dex_pc);

  template<typename T>
  void Binop_12x_shift(const Instruction& instruction, Primitive::Type type, uint32_t dex_pc);

  template<typename T>
  void Binop_22b(const Instruction& instruction, bool reverse, uint32_t dex_pc);

  template<typename T>
  void Binop_22s(const Instruction& instruction, bool reverse, uint32_t dex_pc);

  template<typename T> void If_21t(const Instruction& instruction, uint32_t dex_pc);
  template<typename T> void If_22t(const Instruction& instruction, uint32_t dex_pc);

  void Conversion_12x(const Instruction& instruction,
                      Primitive::Type input_type,
                      Primitive::Type result_type,
                      uint32_t dex_pc);

  void BuildCheckedDivRem(uint16_t out_reg,
                          uint16_t first_reg,
                          int64_t second_reg_or_constant,
                          uint32_t dex_pc,
                          Primitive::Type type,
                          bool second_is_lit,
                          bool is_div);

  void BuildReturn(const Instruction& instruction, Primitive::Type type, uint32_t dex_pc);

  // Builds an instance field access node and returns whether the instruction is supported.
  bool BuildInstanceFieldAccess(const Instruction& instruction, uint32_t dex_pc, bool is_put);

  // Builds a static field access node and returns whether the instruction is supported.
  bool BuildStaticFieldAccess(const Instruction& instruction, uint32_t dex_pc, bool is_put);

  void BuildArrayAccess(const Instruction& instruction,
                        uint32_t dex_pc,
                        bool is_get,
                        Primitive::Type anticipated_type);

  // Builds an invocation node and returns whether the instruction is supported.
  bool BuildInvoke(const Instruction& instruction,
                   uint32_t dex_pc,
                   uint32_t method_idx,
                   uint32_t number_of_vreg_arguments,
                   bool is_range,
                   uint32_t* args,
                   uint32_t register_index);

  // Builds a new array node and the instructions that fill it.
  void BuildFilledNewArray(uint32_t dex_pc,
                           uint32_t type_index,
                           uint32_t number_of_vreg_arguments,
                           bool is_range,
                           uint32_t* args,
                           uint32_t register_index);

  void BuildFillArrayData(const Instruction& instruction, uint32_t dex_pc);

  // Fills the given object with data as specified in the fill-array-data
  // instruction. Currently only used for non-reference and non-floating point
  // arrays.
  template <typename T>
  void BuildFillArrayData(HInstruction* object,
                          const T* data,
                          uint32_t element_count,
                          Primitive::Type anticipated_type,
                          uint32_t dex_pc);

  // Fills the given object with data as specified in the fill-array-data
  // instruction. The data must be for long and double arrays.
  void BuildFillWideArrayData(HInstruction* object,
                              const int64_t* data,
                              uint32_t element_count,
                              uint32_t dex_pc);

  // Builds a `HInstanceOf`, or a `HCheckCast` instruction.
  // Returns whether we succeeded in building the instruction.
  bool BuildTypeCheck(const Instruction& instruction,
                      uint8_t destination,
                      uint8_t reference,
                      uint16_t type_index,
                      uint32_t dex_pc);

  // Builds an instruction sequence for a packed switch statement.
  void BuildPackedSwitch(const Instruction& instruction, uint32_t dex_pc);

  // Build a switch instruction from a packed switch statement.
  void BuildSwitchJumpTable(const SwitchTable& table,
                            const Instruction& instruction,
                            HInstruction* value,
                            uint32_t dex_pc);

  // Builds an instruction sequence for a sparse switch statement.
  void BuildSparseSwitch(const Instruction& instruction, uint32_t dex_pc);

  void BuildSwitchCaseHelper(const Instruction& instruction, size_t index,
                             bool is_last_case, const SwitchTable& table,
                             HInstruction* value, int32_t case_value_int,
                             int32_t target_offset, uint32_t dex_pc);

  bool SkipCompilation(const DexFile::CodeItem& code_item, size_t number_of_branches);

  void MaybeRecordStat(MethodCompilationStat compilation_stat);

  // Returns the outer-most compiling method's class.
  mirror::Class* GetOutermostCompilingClass() const;

  // Returns the class whose method is being compiled.
  mirror::Class* GetCompilingClass() const;

  // Returns whether `type_index` points to the outer-most compiling method's class.
  bool IsOutermostCompilingClass(uint16_t type_index) const;

  HInvokeStaticOrDirect::DispatchInfo ComputeDispatchInfo(bool is_string_init,
                                                          int32_t string_init_offset,
                                                          MethodReference target_method,
                                                          uintptr_t direct_method,
                                                          uintptr_t direct_code);

  ArenaAllocator* const arena_;

  // A list of the size of the dex code holding block information for
  // the method. If an entry contains a block, then the dex instruction
  // starting at that entry is the first instruction of a new block.
  GrowableArray<HBasicBlock*> branch_targets_;

  GrowableArray<HLocal*> locals_;

  HBasicBlock* entry_block_;
  HBasicBlock* exit_block_;
  HBasicBlock* current_block_;
  HGraph* const graph_;

  // The dex file where the method being compiled is.
  const DexFile* const dex_file_;

  // The compilation unit of the current method being compiled. Note that
  // it can be an inlined method.
  DexCompilationUnit* const dex_compilation_unit_;

  CompilerDriver* const compiler_driver_;

  // The compilation unit of the outermost method being compiled. That is the
  // method being compiled (and not inlined), and potentially inlining other
  // methods.
  const DexCompilationUnit* const outer_compilation_unit_;

  // The return type of the method being compiled.
  const Primitive::Type return_type_;

  // The pointer in the dex file where the instructions of the code item
  // being currently compiled start.
  const uint16_t* code_start_;

  // The last invoke or fill-new-array being built. Only to be
  // used by move-result instructions.
  HInstruction* latest_result_;

  OptimizingCompilerStats* compilation_stats_;

  DISALLOW_COPY_AND_ASSIGN(HGraphBuilder);
};

}  // namespace art

#endif  // ART_COMPILER_OPTIMIZING_BUILDER_H_


text:
from __future__ import absolute_import

import pandas as pd
import pytest
from datadict.datadict_utils import *

@pytest.fixture
def datadict_df():
    df = pd.DataFrame.from_dict({
        "field_name": ["test1", "test2", "test3"],
        "form_name": ["form1", "form1", "form2"],
    })
    return df.set_index("field_name")

@pytest.fixture
def single_insert_df():
    df = pd.DataFrame.from_dict({
        "field_name": ["test4"],
        "form_name":  ["form1"]
    })
    return df.set_index("field_name")

def test_insert_rows_at(datadict_df, single_insert_df):
    #result = insert_rows_at(datadict_df(), "test1", single_insert_df(), insert_before=True)
    result = insert_rows_at(datadict_df, "test1", single_insert_df)
    assert result.index.tolist() == ["test4", "test1", "test2", "test3"]


text:
<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
  <reservationId>r-47a5402e</reservationId>
  <ownerId>AIDADH4IGTRXXKCD</ownerId>
  <groupSet>
    <item>
      <groupId>default</groupId>
    </item>
  </groupSet>
  <instancesSet>
    <item>
      <instanceId>i-2ba64344</instanceId>
      <instanceLifecycle>spot</instanceLifecycle>
      <imageId>ami-be3adfd7</imageId>
      <instanceState>
        0
        <name>pending</name>
      </instanceState>
      <privateDnsName></privateDnsName>
      <dnsName></dnsName>
      <keyName>example-key-name</keyName>
      <amiLaunchIndex>0</amiLaunchIndex>
      <instanceType>m1.small</instanceType>
      <launchTime>2007-08-07T11:51:50.000Z</launchTime>
      <placement>
        <availabilityZone>us-east-1b</availabilityZone>
      </placement>
      <monitoring>
        <enabled>true</enabled>
      </monitoring>
    </item>
  </instancesSet>
</RunInstancesResponse>


text:
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  src: local('Roboto Regular'), local('Roboto-Regular'), url(http://themes.googleusercontent.com/static/fonts/roboto/v10/grlryt2bdKIyfMSOhzd1eA.woff) format('woff');
}


text:
import chai from 'chai';
import MessageFactory from '../../src/services/message-factory.js';
import { Future } from 'ramda-fantasy';
import { SmsMessage } from '../../src/messages';
import { Typed } from 'typed-immutable';

chai.expect();

const expect = chai.expect;
const assert = chai.assert;

var reader, factory;
const message = {to:'to',message:'msg', from:'me'};

describe("Given a MessageFactory",function(){
  before(() => {
      reader = MessageFactory();
  });

  it("should be a Reader", () => expect(reader).to.respondTo('run'));

  describe("when run against an environment",function(){
    before(() => {
      const api = { next: () => '12345' };
      const env = { idGenerator: api };
      factory = reader.run(env);
    });
    it("should return an instantiated api",() => expect(factory).to.respondTo('create'));

    describe("MessageFactory ~> create", function() {
      it("should return an Observable", () => {
        expect(factory.create(SmsMessage, 'id', message)).to.respondTo('subscribe');
      });
      it("should create an SmsMessage", (done) => {
        factory.create(SmsMessage, 'id', message).subscribe(
          (resp) => {
            expect(resp[Typed.typeName]()).to.equal('SmsMessage');
            done();
          }
        );
      });
      it("should generate the id", (done) => {
        factory.create(SmsMessage, 'id', message).subscribe(
          (resp) => {
            expect(resp.id).to.equal('12345');
            done();
          }
        );
      });
      it("should fail the future if given bad data", (done) => {
        factory.create(SmsMessage, 'id', {}).subscribeOnError(
          (err) => {
            expect(err.toString()).to.contain("Invalid value");
            done();
          }
        );
      });
    })
  });
});


text:
angular.module('webdiagnostics.controllers').controller('OptionsCtrl', ['$scope', '$location', 'Options', function($scope, $location, optionsService) {

    $scope.options = {
        maxPages: 50,
        clearCacheEveryPage: true,
        pageWidth: 1024,
        pageHeight: 768,
        overridenUserAgent: ''
    };

    $scope.start = function() {
        optionsService.setOptions($scope.options);
        $location.path('/results');
    };

}]);


text:
package com.sjtools.tictactoe.board.ifc;

/**
 * Created by sjtools on 14.02.2017.
 */

public interface TicTacToeBoardActionsIfc {
    /**
     * Validate board size params
     * @param bRows
     * @param bColumns
     * @return TRUE if ok, FALSE otherwise
     */
    boolean validateBoardInitParams(int bRows, int bColumns);

    /**
     * Check cell.
     * Cell can be checked if params are valid and it is not checked yet
     * @param checkmark to use
     * @param cellRow   row coord to check
     * @param cellCol   cell coord to check
     * @return TRUE if successfully checked, FALSE otherwise
     */
    boolean checkCell(int checkmark, int cellRow, int cellCol);

    /**
     * clear board to initial state
     */
    void clearBoard();
}


text:
Strategy-Game
=============

Repository for Lawrence's group project

The project we are creating is a resource management strategy game in which the player creates armies, takes over land, and creates diplomatic relations with other nations.  The purpose of the game is to either acquire all opposing nations through warfare or create alliances such that there are no enemies to oppose you and your allies.

Features included in the Feature List section of the Wiki.


text:
#ifndef _ARROWVISUAL_PRIVATE_HH_
#define _ARROWVISUAL_PRIVATE_HH_

#include <string>
#include "gazebo/rendering/VisualPrivate.hh"

namespace ogre
{
  class SceneNode;
}

namespace gazebo
{
  namespace rendering
  {
    /// \brief Private data for the Arrow Visual class
    class ArrowVisualPrivate : public VisualPrivate
    {
      public: Ogre::SceneNode *headNode;
      public: Ogre::SceneNode *shaftNode;
      public: Ogre::SceneNode *rotationNode;
    };
  }
}
#endif


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('shortener', '0002_auto_20161028_0241'),
    ]

    operations = [
        migrations.AlterField(
            model_name='shorturl',
            name='short_url',
            field=models.CharField(db_index=True, max_length=128),
        ),
    ]


text:
package org.gearvrf;

import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.opengl.GLUtils;
import static android.opengl.GLES20.*;

/** Bitmap-based texture. */
public class GVRBitmapTexture extends GVRTexture {
    /**
     * Constructs a texture using a pre-existing {@link Bitmap}.
     *
     * @param gvrContext
     *            Current {@link GVRContext}
     * @param bitmap
     *            A non-null {@link Bitmap} instance.
     */
    public GVRBitmapTexture(GVRContext gvrContext, Bitmap bitmap) {
        this(gvrContext, bitmap, gvrContext.DEFAULT_TEXTURE_PARAMETERS);
    }

    /**
     * Constructs a texture using a pre-existing {@link Bitmap} and the user
     * defined filters {@link GVRTextureParameters}.
     *
     * @param gvrContext
     *            Current {@link GVRContext}
     * @param bitmap
     *            A non-null {@link Bitmap} instance.
     * @param textureParameters
     *            User defined object for {@link GVRTextureParameters} which may
     *            also contain default values.
     */
    public GVRBitmapTexture(GVRContext gvrContext, Bitmap bitmap,
            GVRTextureParameters textureParameters) {
        super(gvrContext, NativeBaseTexture.bareConstructor(textureParameters
                .getCurrentValuesArray()));
        update(bitmap);
    }

    /**
     * Constructs a texture by loading a bitmap from a PNG file in (or under)
     * the {@code assets} directory.
     *
     * This method uses a native code path to create a texture directly from a
     * {@code .png} file; it does not create an Android {@link Bitmap}. It may
     * thus be slightly faster than loading a {@link Bitmap} and creating a
     * texture with {@link #GVRBitmapTexture(GVRContext, Bitmap)}, and it should
     * reduce memory pressure, a bit.
     *
     * @param gvrContext
     *            Current {@link GVRContext}
     * @param pngAssetFilename
     *            The name of a {@code .png} file, relative to the assets
     *            directory. The assets directory may contain an arbitrarily
     *            complex tree of subdirectories; the file name can specify any
     *            location in or under the assets directory.
     */
    public GVRBitmapTexture(GVRContext gvrContext, String pngAssetFilename) {
        this(gvrContext, pngAssetFilename,
                gvrContext.DEFAULT_TEXTURE_PARAMETERS);
    }

    /**
     * Constructs a texture by loading a bitmap from a PNG file in (or under)
     * the {@code assets} directory and the user defined filters
     * {@link GVRTextureParameters}.
     *
     * This method uses a native code path to create a texture directly from a
     * {@code .png} file along with the filters defined by the calling API; it
     * does not create an Android {@link Bitmap}. It may thus be slightly faster
     * than loading a {@link Bitmap} and creating a texture with
     * {@link #GVRBitmapTexture(GVRContext, Bitmap)}, and it should reduce
     * memory pressure, a bit.
     *
     * @param gvrContext
     *            Current {@link GVRContext}
     * @param pngAssetFilename
     *            The name of a {@code .png} file, relative to the assets
     *            directory. The assets directory may contain an arbitrarily
     *            complex tree of subdirectories; the file name can specify any
     *            location in or under the assets directory.
     * @param textureParameters
     *            User defined object for {@link GVRTextureParameters} which may
     *            also contain default values.
     */
    public GVRBitmapTexture(GVRContext gvrContext, String pngAssetFilename,
            GVRTextureParameters textureParameters) {
        super(gvrContext, NativeBaseTexture.fileConstructor(gvrContext
                .getContext().getAssets(), pngAssetFilename, textureParameters
                .getCurrentValuesArray()));
    }

    /**
     * Create a new, grayscale texture, from an array of luminance bytes.
     *
     * @param gvrContext
     *            Current {@link GVRContext}
     * @param width
     *            Texture width, in pixels
     * @param height
     *            Texture height, in pixels
     * @param grayscaleData
     *            {@code width * height} bytes of gray scale data
     *
     * @throws IllegalArgumentException
     *             If {@code width} or {@code height} is {@literal <= 0,} or if
     *             {@code grayScaleData} is {@code null}, or if
     *             {@code grayscaleData.length < height * width}
     *
     * @since 1.6.3
     */
    public GVRBitmapTexture(GVRContext gvrContext, int width, int height,
            byte[] grayscaleData) throws IllegalArgumentException {
        this(gvrContext, width, height, grayscaleData,
                gvrContext.DEFAULT_TEXTURE_PARAMETERS);
    }

    /**
     * Create a new, grayscale texture, from an array of luminance bytes and the
     * user defined filters {@link GVRTextureParameters}.
     *
     * @param gvrContext
     *            Current {@link GVRContext}
     * @param width
     *            Texture width, in pixels
     * @param height
     *            Texture height, in pixels
     * @param grayscaleData
     *            {@code width * height} bytes of gray scale data
     * @param textureParameters
     *            User defined object for {@link GVRTextureParameters} which may
     *            also contain default values.
     *
     * @throws IllegalArgumentException
     *             If {@code width} or {@code height} is {@literal <= 0,} or if
     *             {@code grayScaleData} is {@code null}, or if
     *             {@code grayscaleData.length < height * width}
     */
    public GVRBitmapTexture(GVRContext gvrContext, int width, int height,
            byte[] grayscaleData, GVRTextureParameters textureParameters)
            throws IllegalArgumentException {
        super(gvrContext, NativeBaseTexture.bareConstructor(textureParameters
                .getCurrentValuesArray()));
        update(width, height, grayscaleData);
    }

    /**
     * Copy new luminance data to a grayscale texture.
     *
     * Creating a new {@link GVRTexture} is pretty cheap, but it's still not a
     * totally trivial operation: it does involve some memory management and
     * some GL hardware handshaking. Reusing the texture reduces this overhead
     * (primarily by delaying garbage collection). Do be aware that updating a
     * texture will affect any and all {@linkplain GVRMaterial materials}
     * (and/or {@link GVRPostEffect post effects)} that use the texture!
     *
     * @param width
     *            Texture width, in pixels
     * @param height
     *            Texture height, in pixels
     * @param grayscaleData
     *            {@code width * height} bytes of gray scale data
     * @return {@code true} if the update succeeded, and {@code false} if it
     *         failed. Updating a texture requires that the {@code bitmap}
     *         parameter has the exact same size and {@linkplain Config bit
     *         depth} as the original bitmap. In particular, you can't update a
     *         'normal' {@linkplain Config#ARGB_8888 32-bit} texture with
     *         grayscale data!
     * @throws IllegalArgumentException
     *             If {@code width} or {@code height} is {@literal <= 0,} or if
     *             {@code grayScaleData} is {@code null}, or if
     *             {@code grayscaleData.length < height * width}
     *
     * @since 1.6.3
     */
    public boolean update(int width, int height, byte[] grayscaleData)
            throws IllegalArgumentException {
        if (width <= 0 || height <= 0 || grayscaleData == null
                || grayscaleData.length < height * width) {
            throw new IllegalArgumentException();
        }
        return NativeBaseTexture.update(getNative(), width, height,
                grayscaleData);
    }

    /**
     * Copy a new {@link Bitmap} to the GL texture.
     *
     * Creating a new {@link GVRTexture} is pretty cheap, but it's still not a
     * totally trivial operation: it does involve some memory management and
     * some GL hardware handshaking. Reusing the texture reduces this overhead
     * (primarily by delaying garbage collection). Do be aware that updating a
     * texture will affect any and all {@linkplain GVRMaterial materials}
     * (and/or {@link GVRPostEffect post effects)} that use the texture!
     *
     * @param bitmap
     *            A standard Android {@link Bitmap}
     * @return {@code true} if the update succeeded, and {@code false} if it
     *         failed. Updating a texture requires that the {@code bitmap}
     *         parameter has the exact same size and {@linkplain Config bit
     *         depth} as the original bitmap. In particular, you can't update a
     *         grayscale texture with 'normal' {@linkplain Config#ARGB_8888
     *         32-bit} data!
     *
     * @since 1.6.3
     */
    public boolean update(Bitmap bitmap) {
        glBindTexture(GL_TEXTURE_2D, getId());
        GLUtils.texImage2D(GL_TEXTURE_2D, 0, bitmap, 0);
        return (glGetError() == GL_NO_ERROR);
    }
}

class NativeBaseTexture {
    static native long fileConstructor(AssetManager assetManager,
            String filename, int[] textureParameterValues);

    static native long bareConstructor(int[] textureParameterValues);

    static native boolean update(long pointer, int width, int height,
            byte[] grayscaleData);
}


text:
layout: page
title: About
---

About

My name is Gabriel Martinez. I'm a software engineer that currently specializes in web development.

I'm also a fan of many sports teams. Is there anything else that goes together as well as sports and technology?

Currently, I'm working at [Arizona State University](http://www.asu.edu/) developing [Drupal](https://www.drupal.org/) web applications and [custom modules](https://github.com/gabemartinez). Before that, I worked for a [company](http://teaminfographics.info/) that develops data visualizations for sports entities. I was responsible for the implementation of the system and framework encompassing the functionality used to create the graphics.

My educational background and work experience can be found on my always updated [LinkedIn profile](http://linkedin.com/in/martinezg).

In my spare time I continue to learn new techniques and technologies surrounding software development. Lately I've been working with [Ruby](https://www.ruby-lang.org/en/), [Swift](https://developer.apple.com/swift/) and many things [JavaScript](https://en.wikipedia.org/wiki/JavaScript) such as [Node.js](https://nodejs.org/en/), [npm](https://www.npmjs.com/), [React](https://facebook.github.io/react/), and others. I also publish projects on my [GitHub profile](https://github.com/gabemartinez/).

This blog will detail experiences I have with coding, application development, work, projects, and computer issues.

But, you might see some other things on here too.

Feel free to contact me via the social media links in the header.

Thanks for visiting.


text:
package org.apache.flink.streaming.api.functions.windowing.delta.extractor;

import org.apache.flink.annotation.Internal;
import org.apache.flink.api.java.tuple.Tuple;

/**
 * Extracts a single field out of a tuple.
 *
 * @param <OUT>
 *            The type of the extracted field.
 */
@Internal
public class FieldFromTuple<OUT> implements Extractor<Tuple, OUT> {

	/**
	 * Auto-gernated version id
	 */
	private static final long serialVersionUID = -5161386546695574359L;
	private int fieldId = 0;

	/**
	 * Extracts the first field (id 0) from the tuple
	 */
	public FieldFromTuple() {
		// noting to do => will use default 0
	}

	/**
	 * Extracts the field with the given id from the tuple.
	 *
	 * @param fieldId
	 *            The id of the field which will be extracted from the tuple.
	 */
	public FieldFromTuple(int fieldId) {
		this.fieldId = fieldId;
	}

	@Override
	public OUT extract(Tuple in) {
		return in.getField(fieldId);
	}

}


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

using System;
using System.Security.Cryptography;

using Internal.NativeCrypto;

namespace Internal.Cryptography
{
    internal static partial class OidLookup
    {
        private static string NativeOidToFriendlyName(string oid, OidGroup oidGroup, bool fallBackToAllGroups)
        {
            CRYPT_OID_INFO oidInfo = OidInfo.FindOidInfo(CryptOidInfoKeyType.CRYPT_OID_INFO_OID_KEY, oid, oidGroup, fallBackToAllGroups);
            return oidInfo.Name;
        }

        private static string NativeFriendlyNameToOid(string friendlyName, OidGroup oidGroup, bool fallBackToAllGroups)
        {
            CRYPT_OID_INFO oidInfo = OidInfo.FindOidInfo(CryptOidInfoKeyType.CRYPT_OID_INFO_NAME_KEY, friendlyName, oidGroup, fallBackToAllGroups);
            return oidInfo.OID;
        }

        private static string FindFriendlyNameAlias(string userValue)
        {
            foreach (FriendlyNameAlias alias in s_friendlyNameAliases)
            {
                if (userValue.Equals(alias.OpenSsl, StringComparison.OrdinalIgnoreCase))
                {
                    return alias.Windows;
                }
            }

            return null;
        }

        // -----------------------------
        // ---- PAL layer ends here ----
        // -----------------------------
    }
}


text:
require File.join(File.dirname(__FILE__), 'ng_on_rails_generator')
module NgOnRails
  class ResourceGenerator < NgOnRails::NgOnRailsGenerator
    desc "Creates NgOnRails-style AngularJS Resource Service"
    argument :full_model_name, type: :string, required: true, desc: "model name"

    def generate_layout
      option_template "#{ResourceGenerator.source_root}/resource_template.js.erb",
        "app/assets/javascripts/#{module_path}angular_app/services/#{resource_name}.js.coffee",
        "#{resource_name} resource"
    end
  end
end


text:
namespace llvm {

class AArch64RegisterBankInfo;

class AArch64TargetMachine : public LLVMTargetMachine {
protected:
  std::unique_ptr<TargetLoweringObjectFile> TLOF;
  mutable StringMap<std::unique_ptr<AArch64Subtarget>> SubtargetMap;

public:
  AArch64TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
                       StringRef FS, const TargetOptions &Options,
                       Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
                       CodeGenOpt::Level OL, bool JIT, bool IsLittleEndian);

  ~AArch64TargetMachine() override;
  const AArch64Subtarget *getSubtargetImpl(const Function &F) const override;
  // DO NOT IMPLEMENT: There is no such thing as a valid default subtarget,
  // subtargets are per-function entities based on the target-specific
  // attributes of each function.
  const AArch64Subtarget *getSubtargetImpl() const = delete;

  // Pass Pipeline Configuration
  TargetPassConfig *createPassConfig(PassManagerBase &PM) override;

  TargetTransformInfo getTargetTransformInfo(const Function &F) override;

  TargetLoweringObjectFile* getObjFileLowering() const override {
    return TLOF.get();
  }

private:
  bool isLittle;
};

// AArch64 little endian target machine.
//
class AArch64leTargetMachine : public AArch64TargetMachine {
  virtual void anchor();
public:
  AArch64leTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
                         StringRef FS, const TargetOptions &Options,
                         Optional<Reloc::Model> RM,
                         Optional<CodeModel::Model> CM, CodeGenOpt::Level OL,
                         bool JIT);
};

// AArch64 big endian target machine.
//
class AArch64beTargetMachine : public AArch64TargetMachine {
  virtual void anchor();
public:
  AArch64beTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
                         StringRef FS, const TargetOptions &Options,
                         Optional<Reloc::Model> RM,
                         Optional<CodeModel::Model> CM, CodeGenOpt::Level OL,
                         bool JIT);
};

} // end namespace llvm

#endif


text:
<?php namespace Pharin\Commands;

use Illuminate\Console\Command;

class VersionsCommand extends Command
{
    /**
     * {@inheritdoc}
     */
    protected $name = 'versions';

    /**
     * {@inheritdoc}
     */
    protected $description = 'Display available versions for a PHAR.';

    /**
     * {@inheritdoc}
     */
    public function fire()
    {
        $this->line('toto');
    }

}


text:
#Connecting everyone on Earth in < 0.25s !
PubNub is a cross-platform client-to-client (1:1 and 1:many) push service in the cloud, capable of broadcasting real-time messages to millions of web and mobile clients simultaneously, in less than a quarter second!

Optimized for both web and mobile, our scalable, global network of redundant data centers provides lightning-fast, reliable message delivery.  We're up to 100 messages/second faster than possible with WebSockets alone, and **cross-platform compatibility across all phones, tablets, browsers, programming languages, and APIs is always guaranteed!**

#Current Version
The current version number for communication with PubNub Cloud is 3.1.

#Supported Languages and Frameworks
The current list of supported languages and frameworks can be found on our [github page](http://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fpubnub%2Fpubnub-api&sa=D&sntz=1&usg=AFQjCNE-eofH-mEn6I8uFXa7P2y72ds02Q).

#Contact Us
Contact information for support, sales, and general purpose inquiries can found at http://www.pubnub.com/contact-us.

#Demo and Webcast Links

Vimeo: [https://vimeo.com/pubnub](https://vimeo.com/pubnub)

YouTube: [http://www.youtube.com/playlist?p=PLF0BA2B6DAAF4FBBF](http://www.youtube.com/playlist?p=PLF0BA2B6DAAF4FBBF)

Showcase: [http://www.pubnub.com/blog](http://www.pubnub.com/blog)

Interview: [http://techzinglive.com/?p=227](http://techzinglive.com/?p=227)

#Using Encryption with PubNub
For higher security applications, PubNub provides SSL and AES-based encryption features to help safeguard your data.  Additional information and higher-level overviews of [Cross-Platform AES Symmetric Key Encryption](http://www.google.com/url?q=http%3A%2F%2Fblog.pubnub.com%2Fpubnub-adds-cross-platform-aes-symmetric-key-encryption%2F&sa=D&sntz=1&usg=AFQjCNF3tjXOJ99EIJLMM-_2Vapd2NJElQ) in general can be found in our blog post.  A lower level diagram which details the [PubNub encryption-communication flow can be found here](http://www.google.com/url?q=http%3A%2F%2Fblog.pubnub.com%2Fwp-content%2Fuploads%2F2012%2F07%2FPubNubACLForPublishAndSubscribeRealTimeSystems-6.png&sa=D&sntz=1&usg=AFQjCNGA908A_y0YNRWU1HQ6XE_K0E4Jrw).
##HTTPS (SSL) 2048-bit Encryption
HTTPS is recommended for the highest level of security for REST requests to PubNub. Using REST over HTTPS is not required – however, for secure communication, you should make sure the client or REST toolkit you're using is configured to use SSL. The PubNub Cloud service will continue to support both HTTP and HTTPS.
##AES Encryption
To enable AES encryption, instantiate a PubNub instance with the presence of the optional cipher_key attribute. The instance will use the value of the cipher_key attribute as the cipher key.
##Message Signing with HMAC/SHA256
If the client is publishing, you must also include the secret_key attribute when instantiating the PubNub instance.  If the client will only be subscribing, you do not need to include the secret_key  attribute. The instance will use the value of the secret_key as the key to sign the message.
##Secure Key Exchange
The exchange of the cipher key (and if the client is publishing, the secret key) must occur using a secure communication system, external to PubNub, in order to maintain secrecy of the keys.

For an example of using encryption with the PubNub JavaScript API, check out the [PubNub Javascript Cryptography Demo](http://www.google.com/url?q=http%3A%2F%2Fpubnub.github.com%2Fpubnub-api%2Fcrypto%2Findex.html&sa=D&sntz=1&usg=AFQjCNE9NvQJbOVu6hn4H-FNirbNxxJyjA) page.  The demo shows usage of the Cipher Key + SSL at the same time.  There is not exchange however with a central authority server, which is a recommended step for distributing security keys.  [This example diagram with illustrate the recommended Central Authority Server model for proper Security Key Exchange](http://www.google.com/url?q=http%3A%2F%2Fblog.pubnub.com%2Fwp-content%2Fuploads%2F2012%2F07%2FPubNubACLForPublishAndSubscribeRealTimeSystems-6.png&sa=D&sntz=1&usg=AFQjCNGA908A_y0YNRWU1HQ6XE_K0E4Jrw).

#REST API Considerations
In addition to platform-specific APIs, PubNub also supports a REST API.
##Mandatory Headers
When using the REST API, it is **mandatory** to pass the following HTTP headers to the PubNub server for each request:

**V**: Version-Number

**User-Agent**: NAME-OF-THE-CLIENT-INTERFACE

**Accept**: \*/\*

###Example Headers###
V: 3.1

User-Agent: PHP

Accept: \*/\*

##Selecting a User-agent
Use one of the following User-Agents, based on your client platform, when making a REST-based request: *PHP, JavaScript, Node.JS, Ruby, Ruby-Rhomobile, Python, Python-Twisted, Python-Tornado, C-LibEV, C-LibEvent, C-Qt, VB, C#, Java, Java-Android, Erlang, Titanium, Corona, C-Arduino, C-Unity, C#-Mono, Lua, Obj-C-iOS, C#-WP7, Cocoa, Perl5, Perl6, Go-Google, Bash, Haskell*

###HTTP Request Example###
    GET /time/0 HTTP/1.1
    Host: pubsub.pubnub.com
    V: 3.1
    User-Agent: Java-Android
    Accept: */*

> **NOTE**: Only the **V**, **User-agent**, and **Accept** headers are recognized by the REST server. It is not recommended to send any other headers -- they will be ignored, and only serve to add latency to the request.

#API Reference
The following section details usage of native client and RESTful API calls. Native client examples are demonstrated in JavaScript.

#\#init(options)
Create a new PubNub Entity for Publishing/Subscribing. This entity associates itself with account-level credentials and a selected origin. Also Security Options are Specified. **options** is a hash (or similar object, based on platform) which contains initialization parameters, such as your publisher key, encryption options, and channel information.
>available in version 1+, cipher_key option available in version 3.1+

##Usage Example: Native Client

```javascript
var pubnub = PubNub.init({
    publish_key   : "CUSTOMER_PUBLISH_KEY",
    subscribe_key : "CUSTOMER_SUBSCRIBE_KEY",
    secret_key    : "CUSTOMER_SECRET_KEY", # Required only when client publishes.
    ssl           : true,
    origin        : "pubsub.pubnub.com",
    cipher_key    : "AES-Crypto-Cipher-Key" # Optional. Use to enable encryption.
})
```

##Usage Example: RESTful

> **NOTE**: This class method is only available when using the platform-specific API libraries – it is not available via the REST API.

#\#.time()
* * *
This function is a utility only and has not functional value other than a PING to the PubNub Cloud.
>available in version 1+

##Usage Example: Native Client

```javascript
PubNub.time(function(time){
    log(time)
})
```

##Usage Example: RESTful
###URL Params
/time/**JSONP_CALLBACK**

**JSONP_CALLBACK** is the name of the JSONP callback function. Use the JSONP callback's function name, or **0** if you are not using JSONP.
###Request Example
    GET /time/0 HTTP/1.1
###Response
[7529152783414]

#\#.uuid()
* * *
Utility function for generating a UUID. This is a utility function that is useful for creating random, unique channel IDs on the fly.
>available in version 1+

##Usage Example: Native Client
    PubNub.uuid(function(uuid){
        log(uuid)
    })

##Usage Example: RESTful

> **NOTE**: This instance method is only available when using the platform-specific API libraries – it is not available via the REST API.

#\#.publish(options)
* * *
Broadcast a message on a specific channel. options contains channel name, message, and callback values. The message may be any valid JSON type including objects, arrays, strings, and numbers.
>available in version 1+

##Usage Example: Native Client

```javascript
PubNub.publish({
    channel  : "hello_world",
    message  : "Hi.",
    callback : function(response) { log(response) }
})
```

##Usage Example: RESTful
When this request is made, the server will hold the connection until the message is successfully published.
###URL Params
/publish/**PUBLISH_KEY**/**SUBSCRIBE_KEY**/**SECRET_KEY**/**CHANNEL**/**JSONP_CALLBACK**/**JSON_MESSAGE**

**JSONP_CALLBACK** is the name of the JSONP callback function. Use the JSONP callback's function name, or **0** if you are not using JSONP.

**SECRET_KEY** is your secret key, available from your portal page. If you wish disable message signing, use **0**.

###Request Example
    GET /publish/demo/demo/e0991b12871de57b333fd0c992f7d3112577cf62/my-channel/0/{"msg":"hi"} HTTP/1.1

###Response Codes
The first element of the response array is a status code of type Boolean. **1** represents successful transmission, and **0** represents failed transmission.

In the case of a failed transmission, an explanation of the failure is provided in the second element of the response array.

In the case of a successful transmission, the second element will contain **Sent**, and the third element will contain a timetoken reference for the message.

###Successful Response
[1, "Sent", "1338832423234"]
###Failed Response
[0,"Reason for Failure Shown Here"]
###Possible Failure Reasons
* "Disconnected" - The network has gone away.
* "Message Too Big" - Max message size exceeded.
* "Invalid Publish Key" - Wrong Publish Key was Used.
* "Invalid Message Signature" - The message was SHA256 Signed incorrectly.

#\#.subscribe(options)
* * *
Listen for messages on a specified channel. options contains channel information, and callbacks for receiving messages, connecting, disconnecting, and reconnecting after an unintended disconnect.
>available in version 1+

##Native Client Usage Example

```javascript
PubNub.subscribe({
    channel    : "my-channel",
    callback   : function(message) { log(message) },
    connect    : function() { log("Connected") },
    disconnect : function() { log("Disconnected") },
    reconnect  : function() { log("Reconnected") },
    error      : function() { log("Network Error") },
    restore    : true # JavaScript only
})
```

##Connect, disconnect, reconnect callback lifecycles
Each time the PubNub client subscribes to a channel, a "subscription-based connection" is established to the PubNub cloud. During the lifecycle of this "subscription-based connection":

1. the callback event will fire each time a message is received.
1. the disconnect event will fire only once, if and when the connection is lost.
1. the reconnect event will fire only once, if and when the connection is re-established after a disconnect event.

##RESTful Usage Example
###Subscribe Process Lifecycle
In the REST paradigm, **subscribe** serves two purposes.  First, it indicates the client's intention of subscribing to a channel.  Second, it brings back all new messages since the last **subscribe** request was made.

In order for the server to know which messages should be considered new (and therefore sent to the client), a timetoken must be passed in each subsequent **subscribe** request. This timetoken acts as a "last sent" pointer in the channel's message stream.

The following is an example of the RESTful **subscribe** lifecycle:

 1\. The initial subscribe request is made.

###URL Params
/subscribe/**SUBSCRIBE_KEY**/**CHANNEL**/**JSONP_CALLBACK**/**TIMETOKEN**

**JSONP_CALLBACK** is the name of the JSONP callback function. Use the JSONP callback's function name, or **0** if you are not using JSONP.

If you do not yet have a value for **TIMETOKEN** (i.e., this is your first request), use the value **0**.

###First Request
    GET /subscribe/subscribe_key/my-channel/0/0 HTTP/1.1

###First Response
[[], "7529152783414"]

 2\. Extract the second element in the array, and store it in a variable called timetoken.
    The subsequent request is made with the newly acquired **timetoken**.

###Subsequent Request
    GET /subscribe/subscribe_key/my-channel/0/7529152783414 HTTP/1.1
The connection to the server will remain established for up to 300 seconds while it waits for new messages.  If after 300 seconds no new messages have been received, the server will return an empty message element with a new **timetoken**.
##Subsequent Response when there are no new messages since last request
[[],"75291527861853"]

If new message(s) are received within this 300 second window, the server will respond with the new message(s) and a new timetoken.

##Subsequent Response when there are new messages since last request
[[MSG,MSG,MSG],"75291527861853"]

 3\. Handle new messages (if present) from the first element of the response array.
 4\. Update the value of **timetoken** with the new value in the second element of the array.
 5\. Repeat from Step 3 to retrieve subsequent message updates.

#\#.unsubscribe(options)
* * *
Listen for messages on a specified channel. options contains the channel name.
>available in version 1+

##Native ClientUsage Example

```javascript
PubNub.unsubscribe({
    channel : "my-channel"
})
```

##RESTful Usage Example
> **NOTE**: This instance method is only available when using the platform-specific API libraries – it is not available via the REST API.

#\#.history(options)
* * *
Retrieve the last *n* messages published to this channel. **options** contains channel information, history limit, and callback.  Currently you can only fetch the last 100 messages. However, upcoming features will include forever-history fetching.
>available in version 1+

##Native Client Usage Example

```javascript
PubNub.history({
    channel  : "my-channel",
    limit    : 100,
    callback : (messages) { log(messages) }
})
```

##RESTful Usage Example
###URL Format
/history/**SUBSCRIBE_KEY**/**CHANNEL**/**JSONP_CALLBACK**/**LIMIT**

**JSONP_CALLBACK** is the name of the JSONP callback function. Use the JSONP callback's function name, or **0** if you are not using JSONP.

**LIMIT** is the maximum number of messages to return.

###Request Example
    GET /history/demo/my-channel/0/3 HTTP/1.1

###Response
[MSG,MSG,MSG]


text:
package serviceaccount

import (
	"fmt"

	log "github.com/sirupsen/logrus"

	"google.golang.org/api/iam/v1"
)

const saResourcePrefix = "projects/-/serviceAccounts/"

//Client provides data and methods for serviceaccount package.
type Client struct {
	iamservice IAM
	prefix     string
}

type ServiceAccount struct {
	Name  string                 `yaml:"name"`
	Roles []string               `yaml:"roles,omitempty"`
	Key   *iam.ServiceAccountKey `yaml:"key,omitempty"`
}

// IAM is a mockable interface for GCP IAM API.
type IAM interface {
	//TODO: Swap arguments order to match iam service method arguments order.
	CreateSA(request *iam.CreateServiceAccountRequest, projectname string) (*iam.ServiceAccount, error)
	CreateSAKey(sa string, request *iam.CreateServiceAccountKeyRequest) (*iam.ServiceAccountKey, error)
	DeleteSA(sa string) (*iam.Empty, error)
}

//
func NewClient(prefix string, iamservice IAM) *Client {
	return &Client{
		iamservice: iamservice,
		prefix:     prefix,
	}
}

// Creates GKE Service Account. SA name is trimed to 30 characters per GCP limits.
func (client *Client) CreateSA(name string, project string) (*iam.ServiceAccount, error) {
	if client.prefix != "" {
		name = fmt.Sprintf("%s-%s", client.prefix, name)
	}
	name = fmt.Sprintf("%.30s", name)
	project = fmt.Sprintf("projects/%s", project)
	request := &iam.CreateServiceAccountRequest{
		AccountId: name,
	}
	sa, err := client.iamservice.CreateSA(request, project)
	if err != nil {
		log.Printf("When creating %s serviceaccount in %s project got error: %w.", name, project, err)
		return nil, err
	} else {
		log.Printf("Created serviceaccount: %s", name)
		return sa, nil
	}
}

// safqdn should be serviceaccount mail. Pass here iam.ServiceAccount.Email returned by Client.CreateSA().
func (client *Client) CreateSAKey(safqdn string) (*iam.ServiceAccountKey, error) {
	//var gkey []byte
	//TODO: creating resource string should be package global function treated as helper function. It can be used in installer package in Cleaner.CleanALL method.
	resource := fmt.Sprintf("%s%s", saResourcePrefix, safqdn)
	request := &iam.CreateServiceAccountKeyRequest{}
	key, err := client.iamservice.CreateSAKey(resource, request)
	if err != nil {
		return nil, fmt.Errorf("When creating key for serviceaccount %s, got error: %w", safqdn, err)
	}
	log.Printf("Created key for serviceaccount: %s", safqdn)
	return key, nil
}

func (client *Client) Delete(name string) (*iam.Empty, error) {
	return client.iamservice.DeleteSA(name)
}


text:
#ifndef STDLIB_NUMBER_FLOAT64_BASE_SET_LOW_WORD_H
#define STDLIB_NUMBER_FLOAT64_BASE_SET_LOW_WORD_H

#include <stdint.h>

/*
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
*/
#ifdef __cplusplus
extern "C" {
#endif

/**
* Sets the less significant 32 bits of a double-precision floating-point number.
*/
void stdlib_base_float64_set_low_word( const uint32_t low, double *x );

#ifdef __cplusplus
}
#endif

#endif // !STDLIB_NUMBER_FLOAT64_BASE_SET_LOW_WORD_H


text:
using Advobot.Services.ImageResizing;

using Discord;
using Discord.Commands;

using ImageMagick;

namespace Advobot.Tests.Fakes.Services.ImageResizing;

public sealed class FakeImageContext : IImageContext
{
	public UserProvidedImageArgs Args => throw new NotImplementedException();
	public ulong GuildId { get; }
	public long MaxAllowedLengthInBytes => throw new NotImplementedException();
	public string Type => throw new NotImplementedException();
	public Uri Url => throw new NotImplementedException();

	public FakeImageContext(IGuild guild)
	{
		GuildId = guild.Id;
	}

	public IResult CanUseFormat(MagickFormat format)
		=> throw new NotImplementedException();

	public Task ReportAsync(string value)
		=> Task.CompletedTask;

	public Task SendFinalResponseAsync(IResult result)
		=> throw new NotImplementedException();

	public Task<IResult> UseStream(MemoryStream stream)
		=> throw new NotImplementedException();
}


text:
import React, { Component } from 'react';
import { Observable, Unsubscribable } from 'rxjs';

interface Props<T> {
  watch: Observable<T>;
  child: React.ComponentType<T>;
  initialSubProps: T;
}

interface State<T> {
  subProps: T;
}

export class ObservablePropsWrapper<T> extends Component<Props<T>, State<T>> {
  sub?: Unsubscribable;

  constructor(props: Props<T>) {
    super(props);
    this.state = {
      subProps: props.initialSubProps,
    };
  }

  componentDidMount() {
    this.sub = this.props.watch.subscribe({
      next: (subProps: T) => {
        //console.log('ObservablePropsWrapper:NEXT', subProps);
        this.setState({ subProps });
      },
      complete: () => {
        //console.log('ObservablePropsWrapper:complete');
      },
      error: (err) => {
        //console.log('ObservablePropsWrapper:error', err);
      },
    });
  }

  componentWillUnmount() {
    if (this.sub) {
      this.sub.unsubscribe();
    }
  }

  render() {
    const { subProps } = this.state;
    return <this.props.child {...subProps} />;
  }
}