text:
<?php
/**
 * Created by PhpStorm.
 * User: IGOR
 * Date: 10/06/2016
 * Time: 13:19
 */

namespace DetalhePeriodoLetivo\Form;

use Estrutura\Form\AbstractForm;
use Estrutura\Form\FormObject;
use Zend\Form\Element;
use Zend\InputFilter\InputFilter;

class DetalhePeriodoLetivoForm  extends  AbstractForm{

    public function __construct($options=[]){
        parent::__construct('detalheperiodoletivoform');

        $this->inputFilter = new InputFilter();
        $objForm = new FormObject('detalheperiodoletivoform',$this,$this->inputFilter);
        $objForm->hidden("id")->required(false)->label("Id");
        $objForm->text("id_periodo_letivo")
            ->setAttribute('disabled','disabled')
            ->required(false)
            ->label("ID PERIODO LETIVO");
        $objForm->date('dt_encontro')->required(true)
            ->setAttribute('class', 'data')
            ->label("Data de encontro");

        $this->formObject = $objForm;
    }

    public function getInputFilter()
    {
        return $this->inputFilter;
    }
}


text:
import $ from "jquery";
import publish from "../../core/decorators/publish";
import User from "./user";

export default class LoginManager {
  constructor() {
    this.lunaStatusUrl = "https://auth.lonelyplanet.com/users/status.json";
    this.dotcomConnectStatusUrl = "https://connect.lonelyplanet.com/users/status.json";
    this.dotcomConnectMigrateUrl = "https://connect.lonelyplanet.com/users/migrate";
    this.feedUrl = "https://www.lonelyplanet.com/thorntree/users/feed";

    if (window.lp.auth && window.lp.auth.host) {
      this.dotcomConnectStatusUrl = `${window.lp.auth.host}/users/status.json`;
      this.dotcomConnectMigrateUrl = `${window.lp.auth.host}/users/migrate`;
    }

    this.checkStatus();
  }
  /**
   * Check to see if the user is currently logged in.
   * @return {jQuery.Deferred}
   */
  checkStatus() {
    return $.when(
      $.ajax({
        url: this.lunaStatusUrl,
        dataType: "jsonp",
        error: this.error.bind(this)
      }),
      $.ajax({
        url: this.dotcomConnectStatusUrl,
        dataType: "jsonp",
        error: this.error.bind(this)
      })
    ).done(([lunaUser], [connectUser]) => {
      let user = Object.assign({}, connectUser, { "connect": true });
      if (lunaUser.id) {
        user = Object.assign({}, lunaUser, { "luna": true });

        if(!this.isLunaPage()) {
          $.post({
            url: this.dotcomConnectMigrateUrl,
            xhrFields: {
              withCredentials: true
           },
          })
          .fail(function(xhr, status, error) {
            throw `Error migrating luna session: ${error}`;
          });
        }

      }

      this.statusFetched(user);
    });
  }

  isLunaPage() {
    const full = window.location.host;
    const parts = full.split(".");
    const subDomain = parts[0];

    return subDomain === "auth";
  }

   /**
   * Sets user id to dataLayer for analytics
   * @return null
   */
  setDataLayer(id) {
    if(
      window &&
      window.lp &&
      window.lp.analytics &&
      window.lp.analytics.dataLayer &&
      window.lp.analytics.dataLayer.length
    ){
      window.lp.analytics.dataLayer[0].accountId = id;
    }
  }

  /**
   * Callback from checking the user's login status.
   * If the user is not logged in, it will publish a user with a null id.
   * Will check for user notifications if the user is logged in.
   * @param  {Object} user User login information
   */
  statusFetched(user) {
    // When swapping UI components through _v cookie being set with a specific value
    // We need to instantiante the user with any variants being sent from the status check
    this.user = (user.username ? new User(user) : new User({ variant: user.variant }));

    if (!user.id) {
      return this._updateStatus();
    }

    this.setDataLayer(user.id);
    this._updateStatus();
  }

  @publish("user.status.update")
  _updateStatus() {
    return this.user.toJSON();
  }

  error() {
    throw "Error retrieving luna login information";
  }
}

redpajama_set_name: RedPajamaGithub


text:
const fs = require('fs');
const { validateXML } = require('validate-with-xmllint');

const [nodePath, executorPath, filename] = process.argv;

const file = fs.readFileSync(filename);
const xml = file.toString();

validateXML(xml).then(response => {
  console.log(filename, 'PASS');
}).catch(error => {
  console.error(error.message);
  process.exit(1);
});


text:
package com.lib.Quartz.Simple;

import java.util.Map;

import org.ppl.net.MailSender;
import org.ppl.plug.Quartz.SimpleQuartz;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import com.alibaba.fastjson.JSON;

/**
 *
 * @author vyouzhi
 *
 * @see 用作注册激活发送邮件, iregister_action 类调用它
 */

public class ActiveEmail extends SimpleQuartz implements Job{
	private Map<String, Object> Msg=null;
	public ActiveEmail() {
		// TODO Auto-generated constructor stub
        String className = null;
        className = this.getClass().getCanonicalName();
        super.GetSubClassName(className);
	}

	@Override
	public String getGroup() {
		// TODO Auto-generated method stub
		return "Group_"+SliceName(stdClass);
	}

	@Override
	public int withRepeatCount() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int withIntervalInSeconds() {
		// TODO Auto-generated method stub
		return 10;
	}

	private void SendEmail() {
		if(Msg == null){
			echo("msg is null");
			return;
		}

		MailSender mSender = new MailSender();
		mSender.setTls(false);
		mSender.setSubject(Msg.get("subject").toString());
		mSender.setText(Msg.get("text").toString());
		mSender.To(Msg.get("email").toString());
	}

	@SuppressWarnings("unchecked")
	@Override
	public void execute(JobExecutionContext context)
			throws JobExecutionException {
		// TODO Auto-generated method stub
		JobDataMap map = context.getJobDetail().getJobDataMap();
		String json = map.getString(getArg());
		if(json==null){
			echo("json is null");
			return ;
		}
		Msg = JSON.parseObject(json, Map.class);

		SendEmail();
	}

}


text:
require 'gm_plugin/key'
require 'gm_plugin/mapping'
require 'gm_plugin/map'
require 'gm_plugin/control'
require 'gm_plugin/point'
require 'gm_plugin/overlay'
require 'gm_plugin/layer'
require 'gm_plugin/helper'
require 'gm_plugin/geocoding'

include Ym4r::GmPlugin


text:
package com;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * Created by zhangbing on 16/12/8.
 */
@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}


text:
"""Search views."""
import collections
import logging

from django.conf import settings
from django.shortcuts import get_object_or_404, render
from django.views import View

from readthedocs.builds.constants import LATEST
from readthedocs.projects.models import Feature, Project
from readthedocs.search.faceted_search import (
    ALL_FACETS,
    PageSearch,
    ProjectSearch,
)

from .serializers import (
    PageSearchSerializer,
    ProjectData,
    ProjectSearchSerializer,
    VersionData,
)

log = logging.getLogger(__name__)
LOG_TEMPLATE = '(Elastic Search) [%(user)s:%(type)s] [%(project)s:%(version)s:%(language)s] %(msg)s'

UserInput = collections.namedtuple(
    'UserInput',
    (
        'query',
        'type',
        'project',
        'version',
        'language',
        'role_name',
    ),
)

class SearchViewBase(View):

    http_method_names = ['get']
    max_search_results = 50

    def _search(self, *, user_input, projects, use_advanced_query):
        """Return search results and facets given a `user_input` and `projects` to filter by."""
        if not user_input.query:
            return [], {}

        filters = {}
        for avail_facet in ALL_FACETS:
            value = getattr(user_input, avail_facet, None)
            if value:
                filters[avail_facet] = value

        search_facets = {
            'project': ProjectSearch,
            'file': PageSearch,
        }
        faceted_search_class = search_facets.get(
            user_input.type,
            ProjectSearch,
        )
        search = faceted_search_class(
            query=user_input.query,
            filters=filters,
            projects=projects,
            use_advanced_query=use_advanced_query,
        )
        results = search[:self.max_search_results].execute()
        facets = results.facets

        # Make sure the selected facets are displayed,
        # even when they return 0 results.
        for facet in facets:
            value = getattr(user_input, facet, None)
            if value and value not in (name for name, *_ in facets[facet]):
                facets[facet].insert(0, (value, 0, True))

        return results, facets

class ProjectSearchView(SearchViewBase):

    """
    Search view of the ``search`` tab.

    Query params:

    - q: search term
    - version: version to filter by
    - role_name: sphinx role to filter by
    """

    def _get_project(self, project_slug):
        queryset = Project.objects.public(self.request.user)
        project = get_object_or_404(queryset, slug=project_slug)
        return project

    def _get_project_data(self, project, version_slug):
        docs_url = project.get_docs_url(version_slug=version_slug)
        version_data = VersionData(
            slug=version_slug,
            docs_url=docs_url,
        )
        project_data = {
            project.slug: ProjectData(
                alias=None,
                version=version_data,
            )
        }
        return project_data

    def get_serializer_context(self, project, version_slug):
        context = {
            'projects_data': self._get_project_data(project, version_slug),
        }
        return context

    def get(self, request, project_slug):
        project_obj = self._get_project(project_slug)
        use_advanced_query = not project_obj.has_feature(
            Feature.DEFAULT_TO_FUZZY_SEARCH,
        )

        user_input = UserInput(
            query=request.GET.get('q'),
            type='file',
            project=project_slug,
            version=request.GET.get('version', LATEST),
            role_name=request.GET.get('role_name'),
            language=None,
        )

        results, facets = self._search(
            user_input=user_input,
            projects=[user_input.project],
            use_advanced_query=use_advanced_query,
        )

        context = self.get_serializer_context(project_obj, user_input.version)
        results = PageSearchSerializer(results, many=True, context=context).data

        template_context = user_input._asdict()
        template_context.update({
            'results': results,
            'facets': facets,
            'project_obj': project_obj,
        })

        return render(
            request,
            'search/elastic_search.html',
            template_context,
        )

class GlobalSearchView(SearchViewBase):

    """
    Global search enabled for logged out users and anyone using the dashboard.

    Query params:

    - q: search term
    - type: type of document to search (project or file)
    - project: project to filter by
    - language: project language to filter by
    - version: version to filter by
    - role_name: sphinx role to filter by
    """

    def get(self, request):
        user_input = UserInput(
            query=request.GET.get('q'),
            type=request.GET.get('type', 'project'),
            project=request.GET.get('project'),
            version=request.GET.get('version', LATEST),
            language=request.GET.get('language'),
            role_name=request.GET.get('role_name'),
        )

        projects = []
        # If we allow private projects,
        # we only search on projects the user belongs or have access to.
        if settings.ALLOW_PRIVATE_REPOS:
            projects = list(
                Project.objects.for_user(request.user)
                .values_list('slug', flat=True)
            )

        # Make sure we always have projects to filter by if we allow private projects.
        if settings.ALLOW_PRIVATE_REPOS and not projects:
            results, facets = [], {}
        else:
            results, facets = self._search(
                user_input=user_input,
                projects=projects,
                use_advanced_query=True,
            )

        serializers = {
            'project': ProjectSearchSerializer,
            'file': PageSearchSerializer,
        }
        serializer = serializers.get(user_input.type, ProjectSearchSerializer)
        results = serializer(results, many=True).data

        template_context = user_input._asdict()
        template_context.update({
            'results': results,
            'facets': facets,
        })

        return render(
            request,
            'search/elastic_search.html',
            template_context,
        )


text:
@interface JSONQueryTests : XCTestCase

@end

@implementation JSONQueryTests

- (void)setUp {
    [super setUp];
    // Put setup code here. This method is called before the invocation of each test method in the class.
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
}

- (void)testExample {
    // This is an example of a functional test case.
    NSDictionary *testObject = @{@"name": @"PonyCui"};
    testObject = [testObject formatWithPlist:@"Hello"];
    XCTAssert([testObject[@"name"] isEqualToString:@"PonyCui"], @"Pass");
}

- (void)testNull {
    NSDictionary *testObject = @{@"name": [NSNull null]};
    testObject = [testObject formatWithPlist:@"Hello"];
    XCTAssert([testObject[@"name"] isKindOfClass:[NSString class]], @"Pass");
    XCTAssert([testObject[@"name"] isEqualToString:@"DefaultValue"], @"Pass");
}

- (void)testErrorType {
    NSDictionary *testObject = @{@"name": @46709394};
    testObject = [testObject formatWithPlist:@"Hello"];
    XCTAssert([testObject[@"name"] isKindOfClass:[NSString class]], @"Pass");
    XCTAssert([testObject[@"name"] isEqualToString:@"46709394"], @"Pass");
}

- (void)testFloatString {
    NSDictionary *testObject = @{@"name": @666.66};
    testObject = [testObject formatWithPlist:@"Hello"];
    XCTAssert([testObject[@"name"] isKindOfClass:[NSString class]], @"Pass");
    XCTAssert([testObject[@"name"] isEqualToString:@"666.66"], @"Pass");
}

- (void)testAge {
    NSDictionary *testObject = @{@"age": @25};
    testObject = [testObject formatWithPlist:@"Hello"];
    XCTAssert([testObject[@"age"] isKindOfClass:[NSNumber class]], @"Pass");
    XCTAssert([testObject[@"age"] isEqualToNumber:@25], @"Pass");
}

- (void)testStringAge {
    NSDictionary *testObject = @{@"age": @"25"};
    testObject = [testObject formatWithPlist:@"Hello"];
    XCTAssert([testObject[@"age"] isKindOfClass:[NSNumber class]], @"Pass");
    XCTAssert([testObject[@"age"] isEqualToNumber:@25], @"Pass");
}

- (void)testDecimalAge {
    NSDictionary *testObject = @{@"age": @"25.5"};
    testObject = [testObject formatWithPlist:@"Hello"];
    XCTAssert([testObject[@"age"] isKindOfClass:[NSNumber class]], @"Pass");
    XCTAssert([testObject[@"age"] isEqualToNumber:@25.5], @"Pass");
}

#pragma mark - Child Dictionary

- (void)testSon {
    NSDictionary *testObject = @{@"name": @"Pony", @"age": @25, @"son": @{@"name": @"Bobby", @"age": @"1.5"}};
    testObject = [testObject formatWithPlist:@"Hello"];
    XCTAssert([testObject[@"son"][@"age"] isKindOfClass:[NSNumber class]], @"Pass");
    XCTAssert([testObject[@"son"][@"age"] isEqualToNumber:@1.5], @"Pass");
}

- (void)testJSONNotExistedKey {
    NSDictionary *testObject = @{@"name": @"Pony", @"son": @{@"name": @"Bobby", @"age": @"1.5"}};
    testObject = [testObject formatWithPlist:@"Hello"];
    XCTAssert([testObject[@"age"] isEqualToNumber:@0], @"Pass");
}

#pragma mark - Array

- (void)testArray {
    NSDictionary *testObject = @{@"name": @"Pony",
                                 @"age": @"25",
                                 @"children": @[
                                         @{@"name": @"Tom", @"age":@"8"},
                                         @{@"name": @1111, @"age":@5},
                                         @{@"name": [NSNull null], @"age": [NSNull null]}
                                         ]};
    testObject = [testObject formatWithPlist:@"Hello"];
    XCTAssert([testObject[@"children"][0][@"age"] isKindOfClass:[NSNumber class]], @"Pass");
    XCTAssert([testObject[@"children"][0][@"age"] isEqualToNumber:@8], @"Pass");
    XCTAssert([testObject[@"children"][1][@"name"] isKindOfClass:[NSString class]], @"Pass");
    XCTAssert([testObject[@"children"][1][@"name"] isEqualToString:@"1111"], @"Pass");
    XCTAssert([testObject[@"children"][2][@"name"] isKindOfClass:[NSString class]], @"Pass");
    XCTAssert([testObject[@"children"][2][@"age"] isKindOfClass:[NSNumber class]], @"Pass");
    XCTAssert(testObject[@"children"][3][@"name"] == nil, @"Pass");//never crash if array is out of bounds
}

- (void)testErrorTypeArray {
    NSDictionary *testObject = @{@"name": @"Pony",
                                 @"age": @"25",
                                 @"children": @[
                                         @{@"name": @"Tom", @"age":@"8"},
                                         @{@"name": @1111, @"age":@5},
                                         @{@"name": [NSNull null], @"age": [NSNull null]}
                                         ]};
    testObject = [testObject formatWithPlist:@"Hello"];
}

- (void)testForgot {
    NSDictionary *testObject = @{@"name": @"Pony",
                                 @"age": @"25",
                                 @"children": @{},
                                 @"forgot": @"this"};
    testObject = [testObject formatWithPlist:@"Hello"];
    XCTAssert([testObject[@"children"] isKindOfClass:[NSArray class]], @"Pass");
}

//- (void)testShouldNeverPass {
//    NSDictionary *testObject = @{@"notExistedKey": @""};
//    testObject = [testObject formatWithPlist:@"Hello"];
//    XCTAssert(testObject[@"notExistedKey"], @"Fail");
//}

@end


text:
Mini - A Small JavaScript Framework

The Mini framework operates similar to other rendering frameworks. While having similar
features and capabilities to other frameworks, it uses a much simpler
programming approach which produces a much smaller footprint. If you know or have used
other rendering frameworks, Mini's features will look familiar to you.

Mini is written using es6 style and features. No code from any other framework was used or copied.
Selective features were implemented thus producing a much smaller size. There are restrictions and
limitations to some of these features, however these limitations
should not impede the development of small websites.

Below are details of Mini:

* total size is 15KB

* supports declarative rendering {{ message }}

* data-for directive for element creation using an array

* data-html directive for plain and html text insertion

* data-top directive to scroll area to top before insertion of data

* data-focus directive for input elements

* data-if and data-show conditionals

* data-model for 2 way binding, supports both character and loss of focus input

* data-click for event handler control

* data-att for rendering html attributes

* life cycle events

* css insertion during startup

* existing css elements are dynamically changeable

* existing data values are dynamically changeable

* on event and emit event methods allow for internal event communications

* $_mini proxy allows for external updates to data elements within the class object

* $_mini proxy allows for external calls to methods within the class object

* template support

* templates are asynchronous

* templates can contain html elements, a style directive or imported directive for css elements

* style elements can be either global or scoped to a template

* getTemplate method allows for the async insertion of a template after loading is completed

* components (templates with JavaScript) are supported.


text:
      <select ng-model="award.settings.type" ng-disabled="!editMode" class="guiInputText">
        <option value="0">Subtotal price</option>
        <option value="1">Shipment price</option>
        <option value="2">Payment price</option>
        <option value="3">Total price</option>
      </select>

        <input type="radio" value="true" ng-model="award.settings.usePercentage" ng-disabled="!editMode" id="awardPercentage{{$index}}" />Percentage
        <input type="radio" value="false" ng-model="award.settings.usePercentage" ng-disabled="!editMode" id="awardAmount{{$index}}" />Amount

        <input type="text" ng-model="award.settings.percentage" ng-disabled="!editMode" placeholder="Percentage" class="guiInputText" />%

                  {{currency.name}}
                  <input type="text" ng-model="currency.amount" ng-disabled="!editMode" placeholder="Price" class="guiInputText form-control" />

      Edit
      Delete
      Save


text:
from logging import getLogger
from platform import platform, release, system
from threading import Thread
from time import sleep, time
from uuid import uuid1

from pkg_resources import DistributionNotFound
from pkg_resources import get_distribution
from requests import ConnectionError, post
from simplejson import loads

from thingsboard_gateway.tb_utility.tb_utility import TBUtility

log = getLogger("service")

UPDATE_SERVICE_BASE_URL = "https://updates.thingsboard.io"

class TBUpdater(Thread):
    def __init__(self):
        super().__init__()

        try:
            self.__version = {"current_version": get_distribution('thingsboard_gateway').version,
                              "latest_version": get_distribution('thingsboard_gateway').version}
        except DistributionNotFound:
            self.__version = {"current_version": "0", "latest_version": "0"}

        self.__instance_id = str(uuid1())
        self.__platform = system()
        self.__release = release()
        self.__os_version = platform()
        self.__previous_check = 0
        self.__check_period = 3600.0
        self.__request_timeout = 5
        self.__stopped = True
        self.start()

    def run(self):
        self.__stopped = False
        while not self.__stopped:
            if time() >= self.__previous_check + self.__check_period:
                self.check_for_new_version()
                self.__previous_check = time()
            else:
                sleep(1)

    def stop(self):
        self.__stopped = True

    def get_version(self):
        return self.__version

    def get_platform(self):
        return self.__platform

    def get_release(self):
        return self.__release

    def check_for_new_version(self):
        log.debug("Checking for new version")
        request_args = self.form_request_params()
        try:
            response = post(**request_args)
            content = None
            content = loads(response.content)
            if content is not None and content.get("updateAvailable", False):
                new_version = content["message"].replace("New version ", "").replace(" is available!", "")
                if new_version > self.__version["current_version"]:
                    log.info(content["message"])
                    self.__version["latest_version"] = new_version
                    log.info("\n\n[===UPDATE===]\n\n New version %s is available! \n\n[===UPDATE===]\n",
                             self.__version["latest_version"])
        except ConnectionRefusedError:
            log.warning("Cannot connect to the update service. PLease check your internet connection.")
        except ConnectionError:
            log.warning("Cannot connect to the update service. PLease check your internet connection.")
        except Exception as e:
            log.exception(e)

    def form_request_params(self):
        json_data = {
            "version": self.__version["current_version"],
            "platform": self.__platform,
            "instanceId": self.__instance_id,
            "osVersion": self.__os_version,
            }
        url = UPDATE_SERVICE_BASE_URL + "/api/tb-gateway/updates"
        request_args = {
            "url": url,
            "json": json_data,
            "timeout": self.__request_timeout

            }
        return request_args

    def update(self):
        if self.__version["latest_version"] != self.__version["current_version"]:
            result = TBUtility.install_package("thingsboard-gateway", self.__version["latest_version"])
        else:
            result = "Congratulations! You have the latest version."
        return result

if __name__ == '__main__':
    updater = TBUpdater()


text:
MARIONETTE_TIMEOUT = 20000;

SpecialPowers.addPermission("mobileconnection", true, document);

let mobileConnection = navigator.mozMobileConnection;
let emulatorStartLac = 0;
let emulatorStartCid = 0;

function verifyInitialState() {
  log("Verifying initial state.");
  ok(mobileConnection instanceof MozMobileConnection,
      "mobileConnection is instanceof " + mobileConnection.constructor);
  testStartingCellLocation();
}

function testStartingCellLocation() {
  // Get the current emulator data cell location
  log("Getting the starting GSM location from the emulator.");

  runEmulatorCmd("gsm location", function(result) {
    log("Emulator callback.");
    is(result[0].substring(0,3), "lac", "lac output");
    is(result[1].substring(0,2), "ci", "ci output");
    is(result[2], "OK", "emulator ok");

    emulatorStartLac = result[0].substring(5);
    log("Emulator GSM location LAC is '" + emulatorStartLac + "'.");
    emulatorStartCid = result[1].substring(4);
    log("Emulator GSM location CID is '" + emulatorStartCid + "'.");

    log("mobileConnection.data.cell.gsmLocationAreaCode is '"
        + mobileConnection.data.cell.gsmLocationAreaCode + "'.");
    log("mobileConnection.data.cell.gsmCellId is '"
        + mobileConnection.data.cell.gsmCellId + "'.");

    // Verify the mobileConnection.data.cell location matches emulator values
    if (emulatorStartLac == -1) {
      // Emulator initializes LAC to -1, corresponds to these values
      is(mobileConnection.data.cell.gsmLocationAreaCode,
          65535, "starting LAC");
    } else {
      // A previous test changed the LAC, so verify API matches emulator
      is(mobileConnection.data.cell.gsmLocationAreaCode,
          emulatorStartLac, "starting LAC");
    }
    if (emulatorStartCid == -1) {
      // Emulator initializes CID to -1, corresponds to these values
      is(mobileConnection.data.cell.gsmCellId, 268435455, "starting CID");
    } else {
      // A previous test changed the CID, so verify API matches emulator
      is(mobileConnection.data.cell.gsmCellId,
          emulatorStartCid, "starting CID");
    }

    // Now test changing the GSM location
    testChangeCellLocation(emulatorStartLac, emulatorStartCid);
  });
}

function testChangeCellLocation() {
  // Change emulator GSM location and verify mobileConnection.data.cell values
  let newLac = 1000;
  let newCid = 2000;
  let gotCallback = false;

  // Ensure values will actually be changed
  if (newLac == emulatorStartLac) { newLac++; };
  if (newCid == emulatorStartCid) { newCid++; };

  // Setup 'ondatachange' event listener
  mobileConnection.addEventListener("datachange", function ondatachange() {
    mobileConnection.removeEventListener("datachange", ondatachange);
    log("Received 'ondatachange' event.");
    log("mobileConnection.data.cell.gsmLocationAreaCode is now '"
        + mobileConnection.data.cell.gsmLocationAreaCode + "'.");
    log("mobileConnection.data.cell.gsmCellId is now '"
        + mobileConnection.data.cell.gsmCellId + "'.");
    is(mobileConnection.data.cell.gsmLocationAreaCode, newLac,
        "data.cell.gsmLocationAreaCode");
    is(mobileConnection.data.cell.gsmCellId, newCid, "data.cell.gsmCellId");
    waitFor(restoreLocation, function() {
      return(gotCallback);
    });
  });

  // Use emulator command to change GSM location
  log("Changing emulator GSM location to '" + newLac + ", " + newCid
      + "' and waiting for 'ondatachange' event.");
  gotCallback = false;
  runEmulatorCmd("gsm location " + newLac + " " + newCid, function(result) {
    is(result[0], "OK");
    log("Emulator callback on location change.");
    gotCallback = true;
  });
}

function restoreLocation() {
  // Restore the emulator GSM location back to what it was originally
  log("Restoring emulator GSM location back to '" + emulatorStartLac + ", "
      + emulatorStartCid + "'.");
  runEmulatorCmd("gsm location " + emulatorStartLac + " " + emulatorStartCid,
      function(result) {
    log("Emulator callback on restore.");
    is(result[0], "OK");
    cleanUp();
  });
}

function cleanUp() {
  mobileConnection.ondatachange = null;
  SpecialPowers.removePermission("mobileconnection", document);
  finish();
}

// Start the test
verifyInitialState();


text:
using System.Text.Json;
using Azure.Core;

namespace Azure.ResourceManager.Attestation.Models
{
    public partial class AttestationProviderPatch : IUtf8JsonSerializable
    {
        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
        {
            writer.WriteStartObject();
            if (Optional.IsCollectionDefined(Tags))
            {
                writer.WritePropertyName("tags");
                writer.WriteStartObject();
                foreach (var item in Tags)
                {
                    writer.WritePropertyName(item.Key);
                    writer.WriteStringValue(item.Value);
                }
                writer.WriteEndObject();
            }
            if (Optional.IsDefined(Properties))
            {
                writer.WritePropertyName("properties");
                writer.WriteObjectValue(Properties);
            }
            writer.WriteEndObject();
        }
    }
}


text:
require 'fileutils'
require 'multi_json'
require 'gherkin/rubify'
require 'gherkin/i18n'
require 'lucid/context'
require 'lucid/load_path'
require 'lucid/interface'
require 'lucid/formatter/duration'
require 'lucid/interface_io'
require 'lucid/spec_loader'
require 'lucid/results'
require 'lucid/orchestrator'

module Lucid
  class ContextLoader
    attr_reader :results, :orchestrator

    include Formatter::Duration
    include ContextLoader::InterfaceIO

    def initialize(context = Context.default)
      @current_scenario = nil
      @context = Context.parse(context)
      @orchestrator = Orchestrator.new(self, @context)
      @results = Results.new(@context)
    end

    # Used to take an existing Lucid operation context and change the
    # configuration of that context.
    def configure(new_context)
      @context = Context.parse(new_context)
      @orchestrator.configure(@context)
      @results.configure(@context)
    end

    def load_code_language(language)
      @orchestrator.load_code_language(language)
    end

    def execute
      load_execution_context
      fire_after_configuration_hook

      ast_walker = @context.establish_ast_walker(self)
      self.visitor = ast_walker

      load_spec_context.accept(ast_walker)
    end

    def specs_paths
      @context.spec_source
    end

    def step_visited(step)
      @results.step_visited(step)
    end

    def scenarios(status = nil)
      @results.scenarios(status)
    end

    def steps(status = nil)
      @results.steps(status)
    end

    def step_match(step_name, name_to_report=nil)
      @orchestrator.step_match(step_name, name_to_report)
    end

    def unmatched_step_definitions
      @orchestrator.unmatched_step_definitions
    end

    def matcher_text(step_keyword, step_name, multiline_arg_class)
      @orchestrator.matcher_text(Gherkin::I18n.code_keyword_for(step_keyword), step_name, multiline_arg_class)
    end

    def with_hooks(scenario, skip_hooks=false)
      around(scenario, skip_hooks) do
        before_and_after(scenario, skip_hooks) do
          yield scenario
        end
      end
    end

    def around(scenario, skip_hooks=false, &block)
      if skip_hooks
        yield
        return
      end

      @orchestrator.around(scenario, block)
    end

    def before_and_after(scenario, skip_hooks=false)
      before(scenario) unless skip_hooks
      yield scenario
      after(scenario) unless skip_hooks
      @results.scenario_visited(scenario)
    end

    def before(scenario)
      return if @context.dry_run? || @current_scenario
      @current_scenario = scenario
      @orchestrator.fire_hook(:before, scenario)
    end

    def after(scenario)
      @current_scenario = nil
      return if @context.dry_run?
      @orchestrator.fire_hook(:after, scenario)
    end

    def after_step #:nodoc:
      return if @context.dry_run?
      @orchestrator.fire_hook(:execute_after_step, @current_scenario)
    end

    def unknown_programming_language?
      @orchestrator.unknown_programming_language?
    end

    def write_testdefs_json
      if(@context.testdefs)
        stepdefs = []
        @orchestrator.step_definitions.sort{|a,b| a.to_hash['source'] <=> a.to_hash['source']}.each do |stepdef|
          stepdef_hash = stepdef.to_hash
          steps = []
          specs.each do |feature|
            feature.feature_elements.each do |feature_element|
              feature_element.raw_steps.each do |step|
                args = stepdef.arguments_from(step.name)
                if(args)
                  steps << {
                    'name' => step.name,
                    'args' => args.map do |arg|
                      {
                        'offset' => arg.offset,
                        'val' => arg.val
                      }
                    end
                  }
                end
              end
            end
          end
          stepdef_hash['file_colon_line'] = stepdef.file_colon_line
          stepdef_hash['steps'] = steps.uniq.sort {|a,b| a['name'] <=> b['name']}
          stepdefs << stepdef_hash
        end
        if !File.directory?(@context.testdefs)
          FileUtils.mkdir_p(@context.testdefs)
        end
        File.open(File.join(@context.testdefs, 'testdefs.json'), 'w') do |io|
          io.write(MultiJson.dump(stepdefs, :pretty => true))
        end
      end
    end

    def doc_string(non_docstring, content_type='', line_offset=0)
      Lucid::AST::DocString.new(non_docstring, content_type)
    end

    private

    def fire_after_configuration_hook
      @orchestrator.fire_hook(:after_configuration, @context)
    end

    # The specs is used to begin loading the executable specs. This is as
    # opposed to loading the execution context (code files), which was
    # already handled. A SpecsLoader instance is created and this is what
    # makes sure that a spec file can be turned into a code construct
    # (a SpecFile instance) which in turn can be broken down into an AST.
    #
    # @return [Object] Instance of Lucid::AST::Spec
    def load_spec_context
      @loader ||= Lucid::ContextLoader::SpecLoader.new(
        @context.spec_context,
        @context.filters,
        @context.tag_expression)
      @loader.load_specs
    end

    # Determines what files should be included as part of the execution
    # context for Lucid as it runs executable specs. The "library" refers
    # to code that will be common to all specs while "definition" refers
    # to page/activity definitions as well as test definitions, which are
    # usually referred to as steps.
    def load_execution_context
      files = @context.library_context + @context.definition_context
      @orchestrator.load_files(files)
    end

    def log
      Lucid.logger
    end
  end

end


text:
require File.expand_path('../metric', __FILE__)

module Drone
  module Metrics

    ##
    # A Counter store a number which can go up or down,
    # the counter can change a counter value with
    # the methods increment and decrement aliased
    # as inc and dec
    #
    class Counter < Metric

      def initialize(name, initial_value = 0)
        super(name)

        @value = Drone::request_number("#{name}:value", initial_value)
      end

      def value
        @value.get
      end

      def increment(n = 1)
        @value.inc(n)
      end
      alias :inc :increment

      def decrement(n = 1)
        @value.dec(n)
      end
      alias :dec :decrement

      def clear
        @value.set(0)
      end
    end

  end
end


text:
/**
 * Determine if an object contains any properties.
 *
 * @private
 * @returns {boolean} True if empty
 *
 * @example
 *
 * console.log(isObjectEmpty({}));
 */

export function _isObjectEmpty(props) {
	return Object.keys(props).length === 0 && props.constructor === Object
}

/**
 * Removes the innerHTML of an element.
 *
 * @private
 * @param {Element} el The element.
 *
 * @example
 *
 * _removeHTML(document.getElementById("root"));
 *
 */
export function _removeHTML(el) {
	if(typeof el.firstChild !== "undefined") {
		while(el.firstChild) {
			el.removeChild(el.firstChild);
		}
	}
}

/**
 * Replaces the innerHTML of an element.
 *
 * @private
 * @param {Element} el The element.
 * @param {string} html The HTML.
 * @param {boolean} append Reserved for possible future use.
 *
 * @example
 *
 * _removeHTML(document.getElementById("root"));
 *
 */
export function _replaceHTML(el, html, append = false) {
	if(append == false) {
		_removeHTML(el);
	}

	el.insertAdjacentHTML("beforeEnd", html);
}


text:
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require_self
 *= require_tree .
 */

#footer {
  color: #999;
  background-color: #f8f8f8;
  border-top: 1px solid #e7e7e7;
}


text:
package org.knowm.xchange.bitstamp.service.polling;

import static org.knowm.xchange.dto.Order.OrderType.BID;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.knowm.xchange.Exchange;
import org.knowm.xchange.bitstamp.BitstampAdapters;
import org.knowm.xchange.bitstamp.dto.BitstampException;
import org.knowm.xchange.bitstamp.dto.trade.BitstampOrder;
import org.knowm.xchange.currency.CurrencyPair;
import org.knowm.xchange.dto.Order;
import org.knowm.xchange.dto.Order.OrderType;
import org.knowm.xchange.dto.trade.LimitOrder;
import org.knowm.xchange.dto.trade.MarketOrder;
import org.knowm.xchange.dto.trade.OpenOrders;
import org.knowm.xchange.dto.trade.UserTrades;
import org.knowm.xchange.exceptions.ExchangeException;
import org.knowm.xchange.exceptions.NotAvailableFromExchangeException;
import org.knowm.xchange.exceptions.NotYetImplementedForExchangeException;
import org.knowm.xchange.service.polling.trade.PollingTradeService;
import org.knowm.xchange.service.polling.trade.params.DefaultTradeHistoryParamPaging;
import org.knowm.xchange.service.polling.trade.params.TradeHistoryParamPaging;
import org.knowm.xchange.service.polling.trade.params.TradeHistoryParams;
import org.knowm.xchange.utils.Assert;

/**
 * @author Matija Mazi
 */
// TODO Convert BitstampExceptions to ExchangeException at the Raw level. Do not leak them out of this class.
public class BitstampTradeService extends BitstampTradeServiceRaw implements PollingTradeService {

  /**
   * Constructor
   *
   * @param exchange
   */
  public BitstampTradeService(Exchange exchange) {

    super(exchange);
  }

  @Override
  public OpenOrders getOpenOrders() throws IOException, BitstampException {

    BitstampOrder[] openOrders = getBitstampOpenOrders();

    List<LimitOrder> limitOrders = new ArrayList<LimitOrder>();
    for (BitstampOrder bitstampOrder : openOrders) {
      OrderType orderType = bitstampOrder.getType() == 0 ? OrderType.BID : OrderType.ASK;
      String id = Integer.toString(bitstampOrder.getId());
      BigDecimal price = bitstampOrder.getPrice();
      limitOrders.add(new LimitOrder(orderType, bitstampOrder.getAmount(), CurrencyPair.BTC_USD, id, bitstampOrder.getTime(), price));
    }
    return new OpenOrders(limitOrders);
  }

  @Override
  public String placeMarketOrder(MarketOrder marketOrder) throws IOException, BitstampException {

    throw new NotAvailableFromExchangeException();
  }

  @Override
  public String placeLimitOrder(LimitOrder limitOrder) throws IOException, BitstampException {

    Assert.isTrue(limitOrder.getCurrencyPair().equals(CurrencyPair.BTC_USD), "Currency Pair must be USD/BTC!!!");

    BitstampOrder bitstampOrder;
    if (limitOrder.getType() == BID) {
      bitstampOrder = buyBitStampOrder(limitOrder.getTradableAmount(), limitOrder.getLimitPrice());
    } else {
      bitstampOrder = sellBitstampOrder(limitOrder.getTradableAmount(), limitOrder.getLimitPrice());
    }
    if (bitstampOrder.getErrorMessage() != null) {
      throw new ExchangeException(bitstampOrder.getErrorMessage());
    }

    return Integer.toString(bitstampOrder.getId());
  }

  @Override
  public boolean cancelOrder(String orderId) throws IOException, BitstampException {

    return cancelBitstampOrder(Integer.parseInt(orderId));
  }

  /**
   * Required parameter types: {@link TradeHistoryParamPaging#getPageLength()}
   */
  @Override
  public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException {

    return BitstampAdapters.adaptTradeHistory(getBitstampUserTransactions(Long.valueOf(((TradeHistoryParamPaging) params).getPageLength())));
  }

  @Override
  public TradeHistoryParams createTradeHistoryParams() {

    return new DefaultTradeHistoryParamPaging(1000);
  }

  @Override
  public Collection<Order> getOrder(String... orderIds)
      throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException {
    throw new NotYetImplementedForExchangeException();
  }

}


text:
#region Licence

#endregion

namespace WmcSoft.Arithmetics
{
    /// <summary>
    /// Represents an algorithm to implement the integration of a function between two points.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IIntegralRule<T>
    {
        T Integrate<TFunction>(TFunction f, T a, T b) where TFunction : IFunction<T>;
    }
}


text:
import React from 'react';
import { browserHistory } from 'react-router';
import MediaQuery from 'react-responsive';

import axios from '../axios-config';
import DenounceBox from './DenounceBox';
import DesktopNavbar from './Navbar/Desktop';
import Header from './Header';
import Main from './Main';
import MobileNavbar from './Navbar/Mobile';

import baseTheme from 'material-ui/styles/baseThemes/lightBaseTheme';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import injectTapEventPlugin from 'react-tap-event-plugin';

injectTapEventPlugin();

const desktopNavbarUrlList = [
    'cardList',
    'cardList?stage=0',
    'create',
    'myCardList?stage=1',
    'myCardList?stage=2',
    'myCardList?stage=3',
    'myCardList?stage=0',
    'tutorial',
];

const mobileNavbarUrlList = [
    'cardList',
    'cardList?stage=0',
    'create',
    'myCardList',
    'logout',
    'tutorial',
];

const getSelectedIndex = (subDomain, navbarUrlList) => {
    let selectedIndex = navbarUrlList.findIndex((navbarUrl) => (subDomain === navbarUrl));
    if (selectedIndex === -1) {
        selectedIndex = navbarUrlList.findIndex((navbarUrl) => (subDomain.includes(navbarUrl)));
        return selectedIndex;
    } else {
        return selectedIndex;
    }
};

export default class App extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            currentAuth: null,
            currentLudoId: '',
            currentLudoReportData: [],
            currentTargetCommentId: '',
            currentTargetLudoId: '',
            currentTargetReportId: '',
            currentUserId: '',
            denounceType: 100,
            email: '',
            hasGotNewReport: false,
            isCardListFetched: false,
            isDenounceBoxOpen: false,
            isInfiniteLoading: false,
            isLoadingCardList: false,
            isNavbarVisible: false,
            isOpeningReportPage: false,
            isOpeningCreateFormPage: false,
            isOpeningLudoListPage: false,
            isPersonalCardListVisible: false,
            lastEvaluatedKey: '',
            ludoList: [],
            navbarSelectedIndex: 0,
            searchFilter: 'title',
            searchStage: '1',
            shouldLudoListUpdate: false,
            shouldReportUpdate: false,
            shouldUserBasicDataUpdate: false,
            userBasicData: {},
        };
        this.clearCurrentFormValue = this.clearCurrentFormValue.bind(this);
        this.getCurrentLudoData = this.getCurrentLudoData.bind(this);
        this.getFilteredLudoList = this.getFilteredLudoList.bind(this);
        this.getNavbarSelectedIndex = this.getNavbarSelectedIndex.bind(this);
        this.getReportOfCurrentLudo = this.getReportOfCurrentLudo.bind(this);
        this.getUpComingLudoList = this.getUpComingLudoList.bind(this);
        this.getUserBasicData = this.getUserBasicData.bind(this);
        this.handleDenounceBoxRequestClose = this.handleDenounceBoxRequestClose.bind(this);
        this.handleDenounceBoxOpen = this.handleDenounceBoxOpen.bind(this);
        this.handleHasGotNewReport = this.handleHasGotNewReport.bind(this);
        this.handleIsOpeningCreateFormPage = this.handleIsOpeningCreateFormPage.bind(this);
        this.handleIsOpeningLudoListPage = this.handleIsOpeningLudoListPage.bind(this);
        this.handleIsOpeningReportPage = this.handleIsOpeningReportPage.bind(this);
        this.handleNavbarClose = this.handleNavbarClose.bind(this);
        this.handleNavbarToggle = this.handleNavbarToggle.bind(this);
        this.handlePersonalCardListClose = this.handlePersonalCardListClose.bind(this);
        this.handlePersonalCardListToggle = this.handlePersonalCardListToggle.bind(this);
        this.handleScrollEvent = this.handleScrollEvent.bind(this);
        this.handleShouldLudoListUpdate = this.handleShouldLudoListUpdate.bind(this);
        this.handleShouldReportUpdate = this.handleShouldReportUpdate.bind(this);
        this.handleShouldUserBasicDataUpdate = this.handleShouldUserBasicDataUpdate.bind(this);
        this.resetEvaluatedKey = this.resetEvaluatedKey.bind(this);
        this.setSearchFilter = this.setSearchFilter.bind(this);
        this.updateCurrentFormValue = this.updateCurrentFormValue.bind(this);
    }

    clearCurrentFormValue() {
        this.setState({
            currentAuth: null,
            currentFormValue: {
                category_id: 0,
                checkpoint: [],
                duration: 0,
                introduction: '',
                marbles: 0,
                tags: [],
                title: ''
            }
        });
    }

    componentDidMount() {
        this.getUserBasicData();
        window.addEventListener('scroll', this.handleScrollEvent);
        const { location } = this.props;
        this.getNavbarSelectedIndex(location);
        if (location.pathname.includes('search')) {
            this.setSearchFilter(location.search);
        }
    }

    componentDidUpdate() {
        const {
            currentUserId,
            isOpeningLudoListPage,
            shouldLudoListUpdate,
            shouldUserBasicDataUpdate
        } = this.state;

        const { isOpeningReportPage, shouldReportUpdate } = this.state;
        if (isOpeningReportPage && shouldReportUpdate) {
            this.getReportOfCurrentLudo(this.props.params.ludo_id);
            this.handleShouldReportUpdate(false);
        }

        if (shouldUserBasicDataUpdate) {
            this.getUserBasicData();
            this.handleShouldUserBasicDataUpdate(false);
        }
    }

    componentWillReceiveProps(nextProps) {
        if (this.props.location !== nextProps.location) {
            this.getNavbarSelectedIndex(nextProps.location);
            if (nextProps.location.pathname.includes('search')) {
                this.setSearchFilter(nextProps.location.search);
            }
        }
    }

    componentWillUnmount() {
        window.removeEventListener('scroll', this.handleScrollEvent);
    }

    getChildContext() {
        return { muiTheme: getMuiTheme(baseTheme) };
    }

    getCurrentLudoData(ludo_id) {
        axios.get(`/apis/ludo/${ludo_id}`)
        .then((response) => {
            if (response.data.status === '200') {
                this.setState({
                    currentAuth: response.data.auth,
                    currentFormValue: response.data.ludo,
                    currentLudoId: ludo_id
                });
            } else {
                console.error('app getCurrentLudoData else response from server: ', response);
                console.error('app getCurrentLudoData else message from server: ', response.data.message);
            }
        })
        .catch((error) => {
            console.error('app getCurrentLudoData error', error);
        });
    }

    getFilteredLudoList(filterCondition) {
        this.setState({
            isLoadingCardList: true,
        });
        let api = '';
        if (filterCondition) {
            api = `/apis/ludo?${filterCondition}`;
        } else {
            api = '/apis/ludo';
        }
        axios.get(api)
        .then((response) => {
            if (response.data.status === '200') {
                this.setState({
                    isCardListFetched: true,
                    isLoadingCardList: false,
                    ludoList: response.data.ludoList.Items,
                });
                if (response.data.ludoList.LastEvaluatedKey) {
                    const lastEvaluatedKey = JSON.stringify(response.data.ludoList.LastEvaluatedKey);
                    if (Object.getOwnPropertyNames(lastEvaluatedKey).length !== 0) {
                        this.setState({ lastEvaluatedKey });
                        this.getUpComingLudoList(filterCondition, lastEvaluatedKey);
                    }
                }
            } else {
                if (window.confirm('取得卡片列表資訊時伺服器未回傳正確資訊,請點擊「確定」回報此問題給開發團隊')) {
                    window.open("https://www.facebook.com/messages/t/ludonow");
                }
            }
        })
        .catch((error) => {
            console.error(error);
            if (window.confirm('取得卡片列表資訊時發生錯誤,請點擊「確定」回報此問題給開發團隊')) {
                window.open("https://www.facebook.com/messages/t/ludonow");
            }
        });
    }

    getNavbarSelectedIndex(location) {
        let navbarUrlList = [];
        const width = window.innerWidth || document.body.clientWidth;
        if (width >= 768) {
            navbarUrlList = desktopNavbarUrlList;
        } else {
            navbarUrlList = mobileNavbarUrlList;
        }
        this.setState({
            navbarSelectedIndex: getSelectedIndex(location.pathname.substring(1) + location.search, navbarUrlList)
        });
    }

    getReportOfCurrentLudo(ludo_id) {
        axios.get(`/apis/report?ludo_id=${ludo_id}`)
        .then((response) => {
            if (response.data.status === '200') {
                this.setState({
                    currentLudoReportData: response.data.reportList,
                    hasGotNewReport: true
                });
            } else {
                console.error('app getReportOfCurrentLudo else response from server: ', response);
                console.error('app getReportOfCurrentLudo else message from server: ', response.data.message);
            }
        })
        .catch((error) => {
            console.error(error);
        });
    }

    getUpComingLudoList(filterCondition, lastEvaluatedKey) {
        let apiUrl = '';
        if (!filterCondition && !lastEvaluatedKey) {
            apiUrl = `/apis/ludo`;
        } else if (!filterCondition && lastEvaluatedKey) {
            apiUrl = `/apis/ludo?startkey=${lastEvaluatedKey}`;
        } else if (filterCondition && !lastEvaluatedKey) {
            apiUrl = `/apis/ludo?${filterCondition}`;
        } else {
            apiUrl = `/apis/ludo?${filterCondition}&startkey=${lastEvaluatedKey}`;
        }
        axios.get(apiUrl)
        .then((response) => {
            if (response.data.status === '200') {
                const newLudoList = [];
                newLudoList.push.apply(newLudoList, this.state.ludoList);
                newLudoList.push.apply(newLudoList, response.data.ludoList.Items);
                this.setState({
                    isInfiniteLoading: false,
                    ludoList: newLudoList,
                });
                if (response.data.ludoList.LastEvaluatedKey) {
                    const lastEvaluatedKey = JSON.stringify(response.data.ludoList.LastEvaluatedKey);
                    if (Object.getOwnPropertyNames(lastEvaluatedKey).length !== 0) {
                        this.setState({ lastEvaluatedKey });
                    }
                }
            } else {
                console.error(response);
                this.setState({
                    isInfiniteLoading: false
                });
                if (window.confirm('取得其他卡片列表資訊時伺服器未回傳正確資訊,請點擊「確定」回報此問題給開發團隊')) {
                    window.open("https://www.facebook.com/messages/t/ludonow");
                }
            }
        })
        .catch((error) => {
            console.error(error);
            this.setState({
                isInfiniteLoading: false
            });
            if (window.confirm('取得其他卡片列表資訊時發生錯誤,請點擊「確定」回報此問題給開發團隊')) {
                window.open("https://www.facebook.com/messages/t/ludonow");
            }
        });
    }

    getUserBasicData() {
        axios.get('/apis/user')
        .then((response) => {
            if (response.data.status === '200') {
                const { user } = response.data;
                const {
                    email,
                    user_id,
                } = user;
                this.setState({
                    currentUserId: user_id,
                    email,
                    userBasicData: user,
                });
            }
        })
        .catch((error) => {
            if (window.confirm('取得使用者資訊時發生錯誤,請點擊「確定」回報此問題給開發團隊')) {
                window.open("https://www.facebook.com/messages/t/ludonow");
            }
        });
    }

    handleDenounceBoxRequestClose() {
        this.setState({
            isDenounceBoxOpen: false
        });
    }

    handleDenounceBoxOpen(currentTargetObject) {
        const { currentTargetCommentId, currentTargetLudoId, currentTargetReportId } = currentTargetObject;
        if (currentTargetLudoId) {
            this.setState({
                currentTargetLudoId,
                denounceType: 0,
                isDenounceBoxOpen: true
            });
        } else if (currentTargetReportId && !currentTargetCommentId) {
            this.setState({
                currentTargetReportId,
                denounceType: 1,
                isDenounceBoxOpen: true
            });
        } else if (currentTargetReportId && currentTargetCommentId) {
            this.setState({
                currentTargetCommentId,
                currentTargetReportId,
                denounceType: 2,
                isDenounceBoxOpen: true
            });
        } else {
            console.error('handleDenounceBoxOpen id error');
        }
    }

    handleDenounceComment(event) {
        this.setState({
            currentTargetCommentId
        });
    }

    handleDenounceLudo(event) {
        this.setState({
            currentTargetLudoId
        });
    }

    handleDenounceReport(event) {
        this.setState({
            currentTargetReportId
        });
    }

    handleHasGotNewReport(boolean) {
        this.setState({
            hasGotNewReport: boolean
        });
    }

    handleIsOpeningReportPage(boolean) {
        this.setState({
            isOpeningReportPage: boolean
        });
    }

    handleIsOpeningCreateFormPage(boolean) {
        this.setState({
            isOpeningCreateFormPage: boolean
        });
    }

    handleIsOpeningLudoListPage(boolean) {
        this.setState({
            isOpeningLudoListPage: boolean
        });
    }

    handleNavbarClose() {
        this.setState({
            isNavbarVisible: false
        });
    }

    handleNavbarToggle(boolean) {
        this.setState({
            isNavbarVisible: boolean
        });
    }

    handlePersonalCardListClose() {
        this.setState({
            isPersonalCardListVisible: false
        });
    }

    handlePersonalCardListToggle(boolean) {
        this.setState({
            isPersonalCardListVisible: boolean
        });
    }

    handleScrollEvent(event) {
        const edgeOffsetY = 250;
        const {
            isInfiniteLoading,
            isOpeningLudoListPage,
            lastEvaluatedKey,
            ludoList,
        } = this.state;

        /* ref: http://blog.xuite.net/vexed/tech/27786189-document.body.scrollTop+%E6%B0%B8%E9%81%A0%E6%98%AF+0 */
        const scrollTop = document.documentElement.scrollTop || document.body.scrollTop || 0;
        const scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight || 0;
        if (
            isOpeningLudoListPage &&
            !isInfiniteLoading &&
            lastEvaluatedKey &&
            scrollTop + edgeOffsetY >= scrollHeight - window.innerHeight
        ) {
            this.setState({
                isInfiniteLoading: true
            });
            const filterCondition = this.props.location.search.replace('?', '');
            this.getUpComingLudoList(filterCondition, lastEvaluatedKey);
        }
    }

    handleShouldLudoListUpdate(boolean) {
        this.setState({
            shouldLudoListUpdate: boolean
        });
    }

    handleShouldReportUpdate(boolean) {
        this.setState({
            shouldReportUpdate: boolean
        });
    }

    handleShouldUserBasicDataUpdate(boolean) {
        this.setState({
            shouldUserBasicDataUpdate: boolean
        });
    }

    resetEvaluatedKey() {
        this.setState({
            lastEvaluatedKey: '',
        });
    }

    setSearchFilter(search) {
        const searchParamList = search.split(/stage=(\d+)&(\S+)=(\S+)/i);
        this.setState({
            searchFilter: searchParamList[2],
            searchStage: searchParamList[1],
        });
    }

    updateCurrentFormValue(ludoForm) {
        this.setState({
            currentFormValue: ludoForm
        });
    }

    render() {
        const {
            currentUserId,
            isCardListFetched,
            isNavbarVisible,
            isOpeningCreateFormPage,
            isOpeningLudoListPage,
            isPersonalCardListVisible,
            navbarSelectedIndex,
            searchFilter,
            searchStage,
            userBasicData,
        } = this.state;
        const {
            location,
            params,
            route,
            router_currentFormValue,
        } = this.props;

        const { path } = route;

        return (
            <div>
                <Header
                    getFilteredLudoList={this.getFilteredLudoList}
                    handleNavbarToggle={this.handleNavbarToggle}
                    handlePersonalCardListToggle={this.handlePersonalCardListToggle}
                    isNavbarVisible={isNavbarVisible}
                    isOpeningLudoListPage={isOpeningLudoListPage}
                    isPersonalCardListVisible={isPersonalCardListVisible}
                    pathName={location.pathname}
                    searchFilter={searchFilter}
                    searchStage={searchStage}
                    userBasicData={userBasicData}
                />
                <MediaQuery minWidth={769}>
                    <DesktopNavbar
                        chatFuelId={userBasicData.chatfuel_id ? userBasicData.chatfuel_id : ''}
                        currentUserId={currentUserId}
                        handleNavbarClose={this.handleNavbarClose}
                        handleNavbarToggle={this.handleNavbarToggle}
                        isNavbarVisible={isNavbarVisible}
                        selectedIndex={navbarSelectedIndex}
                    />
                </MediaQuery>
                <MediaQuery maxWidth={768}>
                    <MobileNavbar
                        chatFuelId={userBasicData.chatfuel_id ? userBasicData.chatfuel_id : ''}
                        currentUserId={currentUserId}
                        handleNavbarClose={this.handleNavbarClose}
                        handleNavbarToggle={this.handleNavbarToggle}
                        isNavbarVisible={isNavbarVisible}
                        selectedIndex={navbarSelectedIndex}
                        userPhotoUrl={userBasicData.photo ? userBasicData.photo : ''}
                    />
                </MediaQuery>
                <Main handleScrollEvent={this.handleScrollEvent}>
                    {
                        React.cloneElement(this.props.children,
                            {
                                ...this.state,
                                currentTab: params.currentTab ? params.currentTab : '',
                                participantId: params.participantId ? params.participantId : '',
                                router_currentFormValue,
                                search: location.search,
                                clearCurrentFormValue: this.clearCurrentFormValue,
                                getCurrentLudoData: this.getCurrentLudoData,
                                getFilteredLudoList: this.getFilteredLudoList,
                                getReportOfCurrentLudo: this.getReportOfCurrentLudo,
                                getUserBasicData: this.getUserBasicData,
                                handleDenounceBoxOpen: this.handleDenounceBoxOpen,
                                handleHasGotNewReport: this.handleHasGotNewReport,
                                handleIsOpeningCreateFormPage: this.handleIsOpeningCreateFormPage,
                                handleIsOpeningLudoListPage: this.handleIsOpeningLudoListPage,
                                handleIsOpeningReportPage: this.handleIsOpeningReportPage,
                                handlePersonalCardListClose: this.handlePersonalCardListClose,
                                handleShouldLudoListUpdate: this.handleShouldLudoListUpdate,
                                handleShouldReportUpdate: this.handleShouldReportUpdate,
                                handleShouldUserBasicDataUpdate: this.handleShouldUserBasicDataUpdate,
                                resetEvaluatedKey: this.resetEvaluatedKey,
                                updateCurrentFormValue: this.updateCurrentFormValue
                            }
                        )
                    }
                </Main>
                <DenounceBox
                    currentTargetCommentId={this.state.currentTargetCommentId}
                    currentTargetLudoId={this.state.currentTargetLudoId}
                    currentTargetReportId={this.state.currentTargetReportId}
                    denounceType={this.state.denounceType}
                    isDenounceBoxOpen={this.state.isDenounceBoxOpen}
                    onRequestClose={this.handleDenounceBoxRequestClose}
                />
            </div>
        );
    }
}

App.childContextTypes = {
    muiTheme: React.PropTypes.object.isRequired,
};


text:
/*jslint browser: true, plusplus: true, vars: true, indent: 2 */
(function () {
  'use strict';

  var loadingClassRegexp = /(^|\s)indieconfig-loading(\s|$)/;

  var doTheAction = function (indieConfig) {
    var href, action, anchors;

    // Don't block the tag anymore as the queued action is now handled
    this.className = this.className.replace(loadingClassRegexp, ' ');

    // Pick the correct endpoint for the correct action
    action = this.getAttribute('do');

    if ((action === 'reply' || action === 'post') && indieConfig.reply) {
      href = indieConfig.reply;
    } else if (action === 'like' && indieConfig.like) {
      href = indieConfig.like;
    } else if (action === 'repost' && indieConfig.repost) {
      href = indieConfig.repost;
    } else if (action === 'tip' && indieConfig.tip) {
      href = indieConfig.tip;
    }

    // If no endpoint is found, try the URL of the first a-tag within it
    if (!href) {
      anchors = this.getElementsByTagName('a');
      if (anchors[0]) {
        href = anchors[0].href;
      }
    }

    // We have found an endpoint!
    if (href) {
      //Resolve a relative target
      var target = document.createElement('a');
      target.href = this.getAttribute('with');
      target = target.href;

      // Insert the target into the endpoint
      href = href.replace('{url}', encodeURIComponent(target || window.location.href));

      // And redirect to it
      window.location = href;
    }
  };

  // Event handler for a click on an indie-action tag
  var handleTheAction = function (e) {
    // Prevent the default of eg. any a-tag fallback within the indie-action tag
    e.preventDefault();

    // Make sure this tag hasn't already been queued for the indieconfig-load
    if (!loadingClassRegexp.test(this.className)) {
      this.className += ' indieconfig-loading';
      // Set "doTheAction" to be called when the indie-config has been loaded
      window.loadIndieConfig(doTheAction.bind(this));
    }
  };

  // Once the page is loased add click event listeners to all indie-action tags
  window.addEventListener('DOMContentLoaded', function () {
    var actions = document.querySelectorAll('indie-action'),
      i,
      length = actions.length;

    for (i = 0; i < length; i++) {
      actions[i].addEventListener('click', handleTheAction);
    }
  });
}());


text:
/* this file has been autogenerated by vtkNodeJsWrap */
/* editing this might proof futile */

#define VTK_WRAPPING_CXX
#define VTK_STREAMS_FWD_ONLY
#include <nan.h>

#include "vtkPointSetAlgorithmWrap.h"
#include "vtkTransformCoordinateSystemsWrap.h"
#include "vtkObjectWrap.h"
#include "vtkViewportWrap.h"
#include "../../plus/plus.h"

using namespace v8;

extern Nan::Persistent<v8::Object> vtkNodeJsNoWrap;
Nan::Persistent<v8::FunctionTemplate> VtkTransformCoordinateSystemsWrap::ptpl;

VtkTransformCoordinateSystemsWrap::VtkTransformCoordinateSystemsWrap()
{ }

VtkTransformCoordinateSystemsWrap::VtkTransformCoordinateSystemsWrap(vtkSmartPointer<vtkTransformCoordinateSystems> _native)
{ native = _native; }

VtkTransformCoordinateSystemsWrap::~VtkTransformCoordinateSystemsWrap()
{ }

void VtkTransformCoordinateSystemsWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkTransformCoordinateSystems").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("TransformCoordinateSystems").ToLocalChecked(), ConstructorGetter);
}

void VtkTransformCoordinateSystemsWrap::ConstructorGetter(
	v8::Local<v8::String> property,
	const Nan::PropertyCallbackInfo<v8::Value>& info)
{
	InitPtpl();
	info.GetReturnValue().Set(Nan::New(ptpl)->GetFunction());
}

void VtkTransformCoordinateSystemsWrap::InitPtpl()
{
	if (!ptpl.IsEmpty()) return;
	v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
	VtkPointSetAlgorithmWrap::InitPtpl( );
	tpl->Inherit(Nan::New<FunctionTemplate>(VtkPointSetAlgorithmWrap::ptpl));
	tpl->SetClassName(Nan::New("VtkTransformCoordinateSystemsWrap").ToLocalChecked());
	tpl->InstanceTemplate()->SetInternalFieldCount(1);

	Nan::SetPrototypeMethod(tpl, "GetClassName", GetClassName);
	Nan::SetPrototypeMethod(tpl, "getClassName", GetClassName);

	Nan::SetPrototypeMethod(tpl, "GetInputCoordinateSystem", GetInputCoordinateSystem);
	Nan::SetPrototypeMethod(tpl, "getInputCoordinateSystem", GetInputCoordinateSystem);

	Nan::SetPrototypeMethod(tpl, "GetMTime", GetMTime);
	Nan::SetPrototypeMethod(tpl, "getMTime", GetMTime);

	Nan::SetPrototypeMethod(tpl, "GetOutputCoordinateSystem", GetOutputCoordinateSystem);
	Nan::SetPrototypeMethod(tpl, "getOutputCoordinateSystem", GetOutputCoordinateSystem);

	Nan::SetPrototypeMethod(tpl, "GetViewport", GetViewport);
	Nan::SetPrototypeMethod(tpl, "getViewport", GetViewport);

	Nan::SetPrototypeMethod(tpl, "IsA", IsA);
	Nan::SetPrototypeMethod(tpl, "isA", IsA);

	Nan::SetPrototypeMethod(tpl, "NewInstance", NewInstance);
	Nan::SetPrototypeMethod(tpl, "newInstance", NewInstance);

	Nan::SetPrototypeMethod(tpl, "SafeDownCast", SafeDownCast);
	Nan::SetPrototypeMethod(tpl, "safeDownCast", SafeDownCast);

	Nan::SetPrototypeMethod(tpl, "SetInputCoordinateSystem", SetInputCoordinateSystem);
	Nan::SetPrototypeMethod(tpl, "setInputCoordinateSystem", SetInputCoordinateSystem);

	Nan::SetPrototypeMethod(tpl, "SetInputCoordinateSystemToDisplay", SetInputCoordinateSystemToDisplay);
	Nan::SetPrototypeMethod(tpl, "setInputCoordinateSystemToDisplay", SetInputCoordinateSystemToDisplay);

	Nan::SetPrototypeMethod(tpl, "SetInputCoordinateSystemToViewport", SetInputCoordinateSystemToViewport);
	Nan::SetPrototypeMethod(tpl, "setInputCoordinateSystemToViewport", SetInputCoordinateSystemToViewport);

	Nan::SetPrototypeMethod(tpl, "SetInputCoordinateSystemToWorld", SetInputCoordinateSystemToWorld);
	Nan::SetPrototypeMethod(tpl, "setInputCoordinateSystemToWorld", SetInputCoordinateSystemToWorld);

	Nan::SetPrototypeMethod(tpl, "SetOutputCoordinateSystem", SetOutputCoordinateSystem);
	Nan::SetPrototypeMethod(tpl, "setOutputCoordinateSystem", SetOutputCoordinateSystem);

	Nan::SetPrototypeMethod(tpl, "SetOutputCoordinateSystemToDisplay", SetOutputCoordinateSystemToDisplay);
	Nan::SetPrototypeMethod(tpl, "setOutputCoordinateSystemToDisplay", SetOutputCoordinateSystemToDisplay);

	Nan::SetPrototypeMethod(tpl, "SetOutputCoordinateSystemToViewport", SetOutputCoordinateSystemToViewport);
	Nan::SetPrototypeMethod(tpl, "setOutputCoordinateSystemToViewport", SetOutputCoordinateSystemToViewport);

	Nan::SetPrototypeMethod(tpl, "SetOutputCoordinateSystemToWorld", SetOutputCoordinateSystemToWorld);
	Nan::SetPrototypeMethod(tpl, "setOutputCoordinateSystemToWorld", SetOutputCoordinateSystemToWorld);

	Nan::SetPrototypeMethod(tpl, "SetViewport", SetViewport);
	Nan::SetPrototypeMethod(tpl, "setViewport", SetViewport);

#ifdef VTK_NODE_PLUS_VTKTRANSFORMCOORDINATESYSTEMSWRAP_INITPTPL
	VTK_NODE_PLUS_VTKTRANSFORMCOORDINATESYSTEMSWRAP_INITPTPL
#endif
	ptpl.Reset( tpl );
}

void VtkTransformCoordinateSystemsWrap::New(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	if(!info.IsConstructCall())
	{
		Nan::ThrowError("Constructor not called in a construct call.");
		return;
	}

	if(info.Length() == 0)
	{
		vtkSmartPointer<vtkTransformCoordinateSystems> native = vtkSmartPointer<vtkTransformCoordinateSystems>::New();
		VtkTransformCoordinateSystemsWrap* obj = new VtkTransformCoordinateSystemsWrap(native);
		obj->Wrap(info.This());
	}
	else
	{
		if(info[0]->ToObject() != vtkNodeJsNoWrap )
		{
			Nan::ThrowError("Parameter Error");
			return;
		}
	}

	info.GetReturnValue().Set(info.This());
}

void VtkTransformCoordinateSystemsWrap::GetClassName(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
	char const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetClassName();
	info.GetReturnValue().Set(Nan::New(r).ToLocalChecked());
}

void VtkTransformCoordinateSystemsWrap::GetInputCoordinateSystem(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetInputCoordinateSystem();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkTransformCoordinateSystemsWrap::GetMTime(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
	unsigned int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetMTime();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkTransformCoordinateSystemsWrap::GetOutputCoordinateSystem(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetOutputCoordinateSystem();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkTransformCoordinateSystemsWrap::GetViewport(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
	vtkViewport * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetViewport();
	VtkViewportWrap::InitPtpl();
	v8::Local<v8::Value> argv[1] =
		{ Nan::New(vtkNodeJsNoWrap) };
	v8::Local<v8::Function> cons =
		Nan::New<v8::FunctionTemplate>(VtkViewportWrap::ptpl)->GetFunction();
	v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
	VtkViewportWrap *w = new VtkViewportWrap();
	w->native = r;
	w->Wrap(wo);
	info.GetReturnValue().Set(wo);
}

void VtkTransformCoordinateSystemsWrap::IsA(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsString())
	{
		Nan::Utf8String a0(info[0]);
		int r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->IsA(
			*a0
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkTransformCoordinateSystemsWrap::NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
	vtkTransformCoordinateSystems * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->NewInstance();
	VtkTransformCoordinateSystemsWrap::InitPtpl();
	v8::Local<v8::Value> argv[1] =
		{ Nan::New(vtkNodeJsNoWrap) };
	v8::Local<v8::Function> cons =
		Nan::New<v8::FunctionTemplate>(VtkTransformCoordinateSystemsWrap::ptpl)->GetFunction();
	v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
	VtkTransformCoordinateSystemsWrap *w = new VtkTransformCoordinateSystemsWrap();
	w->native = r;
	w->Wrap(wo);
	info.GetReturnValue().Set(wo);
}

void VtkTransformCoordinateSystemsWrap::SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkObjectWrap::ptpl))->HasInstance(info[0]))
	{
		VtkObjectWrap *a0 = ObjectWrap::Unwrap<VtkObjectWrap>(info[0]->ToObject());
		vtkTransformCoordinateSystems * r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->SafeDownCast(
			(vtkObject *) a0->native.GetPointer()
		);
		VtkTransformCoordinateSystemsWrap::InitPtpl();
		v8::Local<v8::Value> argv[1] =
			{ Nan::New(vtkNodeJsNoWrap) };
		v8::Local<v8::Function> cons =
			Nan::New<v8::FunctionTemplate>(VtkTransformCoordinateSystemsWrap::ptpl)->GetFunction();
		v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
		VtkTransformCoordinateSystemsWrap *w = new VtkTransformCoordinateSystemsWrap();
		w->native = r;
		w->Wrap(wo);
		info.GetReturnValue().Set(wo);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkTransformCoordinateSystemsWrap::SetInputCoordinateSystem(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetInputCoordinateSystem(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkTransformCoordinateSystemsWrap::SetInputCoordinateSystemToDisplay(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->SetInputCoordinateSystemToDisplay();
}

void VtkTransformCoordinateSystemsWrap::SetInputCoordinateSystemToViewport(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->SetInputCoordinateSystemToViewport();
}

void VtkTransformCoordinateSystemsWrap::SetInputCoordinateSystemToWorld(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->SetInputCoordinateSystemToWorld();
}

void VtkTransformCoordinateSystemsWrap::SetOutputCoordinateSystem(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetOutputCoordinateSystem(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkTransformCoordinateSystemsWrap::SetOutputCoordinateSystemToDisplay(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->SetOutputCoordinateSystemToDisplay();
}

void VtkTransformCoordinateSystemsWrap::SetOutputCoordinateSystemToViewport(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->SetOutputCoordinateSystemToViewport();
}

void VtkTransformCoordinateSystemsWrap::SetOutputCoordinateSystemToWorld(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->SetOutputCoordinateSystemToWorld();
}

void VtkTransformCoordinateSystemsWrap::SetViewport(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTransformCoordinateSystemsWrap *wrapper = ObjectWrap::Unwrap<VtkTransformCoordinateSystemsWrap>(info.Holder());
	vtkTransformCoordinateSystems *native = (vtkTransformCoordinateSystems *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkViewportWrap::ptpl))->HasInstance(info[0]))
	{
		VtkViewportWrap *a0 = ObjectWrap::Unwrap<VtkViewportWrap>(info[0]->ToObject());
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetViewport(
			(vtkViewport *) a0->native.GetPointer()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}


text:
<?xml version="1.0" encoding="utf-8"?>
<Type Name="CCV2F_C4F_T2F_Quad" FullName="Cocos2D.CCV2F_C4F_T2F_Quad">
  <TypeSignature Language="C#" Value="public class CCV2F_C4F_T2F_Quad" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CCV2F_C4F_T2F_Quad extends System.Object" />
  <AssemblyInfo>
    <AssemblyName>cocos2d-xna</AssemblyName>
    <AssemblyVersion>2.0.3.0</AssemblyVersion>
  </AssemblyInfo>
  <Base>
    <BaseTypeName>System.Object</BaseTypeName>
  </Base>
  <Interfaces />
  <Docs>

      <para>4 Vertex2FTex2FColor4F Quad </para>

    <remarks>To be added.</remarks>
  </Docs>
  <Members>
    <Member MemberName=".ctor">
      <MemberSignature Language="C#" Value="public CCV2F_C4F_T2F_Quad ();" />
      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
      <MemberType>Constructor</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>2.0.3.0</AssemblyVersion>
      </AssemblyInfo>
      <Parameters />
      <Docs>
        To be added.
        <remarks>To be added.</remarks>
      </Docs>
    </Member>
    <Member MemberName="BottomLeft">
      <MemberSignature Language="C#" Value="public Cocos2D.CCV2F_C4F_T2F BottomLeft;" />
      <MemberSignature Language="ILAsm" Value=".field public class Cocos2D.CCV2F_C4F_T2F BottomLeft" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>2.0.3.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>Cocos2D.CCV2F_C4F_T2F</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
        <remarks>To be added.</remarks>
      </Docs>
    </Member>
    <Member MemberName="BottomRight">
      <MemberSignature Language="C#" Value="public Cocos2D.CCV2F_C4F_T2F BottomRight;" />
      <MemberSignature Language="ILAsm" Value=".field public class Cocos2D.CCV2F_C4F_T2F BottomRight" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>2.0.3.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>Cocos2D.CCV2F_C4F_T2F</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
        <remarks>To be added.</remarks>
      </Docs>
    </Member>
    <Member MemberName="TopLeft">
      <MemberSignature Language="C#" Value="public Cocos2D.CCV2F_C4F_T2F TopLeft;" />
      <MemberSignature Language="ILAsm" Value=".field public class Cocos2D.CCV2F_C4F_T2F TopLeft" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>2.0.3.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>Cocos2D.CCV2F_C4F_T2F</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
        <remarks>To be added.</remarks>
      </Docs>
    </Member>
    <Member MemberName="TopRight">
      <MemberSignature Language="C#" Value="public Cocos2D.CCV2F_C4F_T2F TopRight;" />
      <MemberSignature Language="ILAsm" Value=".field public class Cocos2D.CCV2F_C4F_T2F TopRight" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>2.0.3.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>Cocos2D.CCV2F_C4F_T2F</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
        <remarks>To be added.</remarks>
      </Docs>
    </Member>
  </Members>
</Type>


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class OniPunchManager : MonoBehaviour
//	Class must be parented to the Gameplay GameObject.
{
	[SerializeField]private OniPunchTiming timingChild;
	[SerializeField]private OniPunchCharging chargeChild;
	[SerializeField]private Animator gameANI;
	private int microGamePartsWon = 0;

	void Start()
	{
		chargeChild.activate(true);
		timingChild.activate(false);
	}

	public void winMicrogamePart()
	{
		microGamePartsWon++;
		switch(microGamePartsWon)
		{
			case 1:
				timingChild.activate(true);
				chargeChild.activate(false);
			break;

			case 2:
				timingChild.activate(false);
				MicrogameController.instance.setVictory(true);
				gameANI.SetTrigger("Success");
			break;
		}
	}
}


text:
package disk

import (
	"encoding/binary"
	"io"
	"reflect"

	"github.com/pkg/errors"
	"github.com/xephonhq/xephon-k/pkg/common"
	"github.com/xephonhq/xephon-k/pkg/encoding"
)

// TODO: allow adaptive encoding
type EncodingOption struct {
	TimeCodec        byte
	IntValueCodec    byte
	DoubleValueCodec byte
}

// https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis
func NewEncodingOption(options ...func(*EncodingOption)) (EncodingOption, error) {
	opt := EncodingOption{
		TimeCodec:        encoding.CodecRawBigEndian,
		IntValueCodec:    encoding.CodecVarInt,
		DoubleValueCodec: encoding.CodecVarInt,
	}
	for _, option := range options {
		option(&opt)
	}
	// valid if all the codec we use are already registered
	// TODO: also check if this codec supports encoding time, int, double value etc.
	if !encoding.IsRegisteredCodec(opt.TimeCodec) {
		return opt, errors.Errorf("codec %v is not registered, can't use it for time", opt.TimeCodec)
	}
	if !encoding.IsRegisteredCodec(opt.IntValueCodec) {
		return opt, errors.Errorf("codec %v is not registered, can't use it for int value", opt.IntValueCodec)
	}
	if !encoding.IsRegisteredCodec(opt.DoubleValueCodec) {
		return opt, errors.Errorf("codec %v is not registered, can't use it for double value", opt.DoubleValueCodec)
	}
	return opt, nil
}

// EncodeBlockTo encode the series data points and write to underlying writer
// It does not return bytes to avoid need less copying when concat encoded time and values
func EncodeBlockTo(series common.Series, opt EncodingOption, w io.Writer) (int, error) {
	N := 0
	n := 0
	var (
		factory        encoding.CodecFactory
		tenc           encoding.TimeEncoder
		venc           encoding.ValueEncoder
		tBytes, vBytes []byte
		err            error
	)
	blockHeader := make([]byte, 4)

	// encode time and value separately
	if factory, err = encoding.GetFactory(opt.TimeCodec); err != nil {
		return 0, errors.Wrapf(err, "unsupported codec %s for time encoder", encoding.CodecString(opt.TimeCodec))
	}
	if tenc, err = factory.NewTimeEncoder(); err != nil {
		return 0, errors.Wrapf(err, "codec %s does not have time encoder", encoding.CodecString(opt.TimeCodec))
	}

	// determine which kind of value are we encoding and read the correspond config
	switch series.GetSeriesType() {
	case common.TypeIntSeries:
		if factory, err = encoding.GetFactory(opt.IntValueCodec); err != nil {
			return 0, errors.Wrapf(err, "unsupported codec %s for int value encoder", encoding.CodecString(opt.IntValueCodec))
		}
		if venc, err = factory.NewIntValueEncoder(); err != nil {
			return 0, errors.Wrapf(err, "codec %s does not have int value encoder", encoding.CodecString(opt.IntValueCodec))
		}
	case common.TypeDoubleSeries:
		if factory, err = encoding.GetFactory(opt.DoubleValueCodec); err != nil {
			return 0, errors.Wrapf(err, "unsupported codec %s for double value encoder", encoding.CodecString(opt.DoubleValueCodec))
		}
		if venc, err = factory.NewDoubleValueEncoder(); err != nil {
			return 0, errors.Wrapf(err, "codec %s does not have double value encoder", encoding.CodecString(opt.DoubleValueCodec))
		}
	default:
		return 0, errors.Errorf("unsupported series type %s, no available codec in option",
			common.SeriesTypeString(series.GetSeriesType()))
	}

	// TODO: deal with columnar format
	switch series.GetSeriesType() {
	case common.TypeIntSeries:
		intSeries, ok := series.(*common.IntSeries)
		if !ok {
			return N, errors.Errorf("%s %v is marked as IntSeries but actually %s",
				series.GetName(), series.GetTags(), reflect.TypeOf(series))
		}
		for i := 0; i < len(intSeries.Points); i++ {
			tenc.WriteTime(intSeries.Points[i].T)
			venc.WriteInt(intSeries.Points[i].V)
		}
	case common.TypeDoubleSeries:
		doubleSeries, ok := series.(*common.DoubleSeries)
		if !ok {
			return N, errors.Errorf("%s %v is marked as DoubleSeries but actually %s",
				series.GetName(), series.GetTags(), reflect.TypeOf(series))
		}
		for i := 0; i < len(doubleSeries.Points); i++ {
			tenc.WriteTime(doubleSeries.Points[i].T)
			venc.WriteDouble(doubleSeries.Points[i].V)
		}
	default:
		return N, errors.Errorf("unsupported series type %d", series.GetSeriesType())
	}
	// NOTE: the encoder write encoding information at start of each block
	if tBytes, err = tenc.Bytes(); err != nil {
		return N, errors.Wrap(err, "can't get encoded time as bytes")
	}
	if vBytes, err = venc.Bytes(); err != nil {
		return N, errors.Wrap(err, "can't get encoded value as bytes")
	}

	// write block header
	binary.BigEndian.PutUint32(blockHeader, uint32(len(tBytes)))
	if n, err = w.Write(blockHeader); err != nil {
		return N, errors.Wrap(err, "can't write block header to buffer")
	}
	N += n
	// write encoded time and values, the encoding is in the bytes already, we don't need to prefix them
	if n, err = w.Write(tBytes); err != nil {
		return N, errors.Wrap(err, "cant write encoded time to buffer")
	}
	N += n
	if n, err = w.Write(vBytes); err != nil {
		return N, errors.Wrap(err, "can't write encoded value to buffer")
	}
	N += n
	return N, nil
}

func DecodeBlock(p []byte, meta common.SeriesMeta) (common.Series, error) {
	// read header
	// NOTE: currently we can only deal with time + value block, can't deal with time + value1 + value 2 ...
	timeBlockLength := binary.BigEndian.Uint32(p[:4])
	tBytes := p[4 : 4+timeBlockLength]
	vBytes := p[4+timeBlockLength:]

	var (
		s       common.Series
		factory encoding.CodecFactory
		tdec    encoding.TimeDecoder
		vdec    encoding.ValueDecoder
		err     error
	)
	if factory, err = encoding.GetFactory(tBytes[0]); err != nil {
		return nil, errors.Wrapf(err, "unknown codec %s", encoding.CodecString(tBytes[0]))
	}
	if tdec, err = factory.NewTimeDecoder(); err != nil {
		return nil, errors.Wrapf(err, "codec %s does not have time decoder", encoding.CodecString(tBytes[0]))
	}

	if factory, err = encoding.GetFactory(vBytes[0]); err != nil {
		return nil, errors.Wrapf(err, "unknown codec %s", encoding.CodecString(vBytes[0]))
	}
	switch meta.GetSeriesType() {
	case common.TypeIntSeries:
		if vdec, err = factory.NewIntValueDecoder(); err != nil {
			return nil, errors.Wrapf(err, "codec %s does not have int value decoder", encoding.CodecString(vBytes[0]))
		}
	case common.TypeDoubleSeries:
		if vdec, err = factory.NewDoubleValueDecoder(); err != nil {
			return nil, errors.Wrapf(err, "codec %s does not have double value decoder", encoding.CodecString(vBytes[0]))
		}
	default:
		return nil, errors.Errorf("unsupported series type %s", common.SeriesTypeString(meta.GetSeriesType()))
	}

	if err := tdec.Init(tBytes); err != nil {
		return nil, errors.Wrap(err, "can't initial time decoder")
	}
	if err := vdec.Init(vBytes); err != nil {
		return nil, errors.Wrap(err, "can't initial value decoder")
	}

	switch meta.GetSeriesType() {
	case common.TypeIntSeries:
		intSeries := common.NewIntSeries(meta.GetName())
		intSeries.SeriesMeta = meta
		// TODO: we can allocate the space directly if index entry record length
		for tdec.Next() && vdec.Next() {
			intSeries.Points = append(intSeries.Points,
				common.IntPoint{T: tdec.ReadTime(), V: vdec.ReadInt()})
		}
		s = intSeries
	case common.TypeDoubleSeries:
		doubleSeries := common.NewDoubleSeries(meta.GetName())
		doubleSeries.SeriesMeta = meta
		for tdec.Next() && vdec.Next() {
			doubleSeries.Points = append(doubleSeries.Points,
				common.DoublePoint{T: tdec.ReadTime(), V: vdec.ReadDouble()})
		}
		s = doubleSeries
	default:
		return nil, errors.Errorf("unsupported series type %s", common.SeriesTypeString(meta.GetSeriesType()))
	}
	return s, nil
}

//func DecodeBlockAsColunmar(p []byte, meta common.SeriesMeta) (common.SeriesColumnar, error) {
//
//}


text:
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });

var ball;
var tilesprite;
var cursors;

function preload() {

    game.load.image('starfield', 'assets/misc/starfield.jpg');
    game.load.image('ball', 'assets/sprites/pangball.png');

}

function create() {

    game.physics.startSystem(Phaser.Physics.ARCADE);

    game.physics.arcade.gravity.y = 200;

    ball = game.add.sprite(400, 0, 'ball');
    tilesprite = game.add.tileSprite(300, 450, 200, 100, 'starfield');

    game.physics.enable([ ball, tilesprite ], Phaser.Physics.ARCADE);

    ball.body.collideWorldBounds = true;
    ball.body.bounce.set(1);

    tilesprite.body.collideWorldBounds = true;
    tilesprite.body.immovable = true;
    tilesprite.body.allowGravity = false;

    cursors = game.input.keyboard.createCursorKeys();

}

function update() {

    game.physics.arcade.collide(ball, tilesprite);

    if (cursors.left.isDown)
    {
        tilesprite.body.x -= 8;
        tilesprite.tilePosition.x -= 8;
    }
    else if (cursors.right.isDown)
    {
        tilesprite.body.x += 8;
        tilesprite.tilePosition.x += 8;
    }

    if (cursors.up.isDown)
    {
        tilesprite.tilePosition.y += 8;
    }
    else if (cursors.down.isDown)
    {
        tilesprite.tilePosition.y -= 8;
    }

}

function render() {

    // game.debug.body(ball);
    // game.debug.body(tilesprite);

}


text:
using System;
using System.Runtime.Serialization;

namespace Umbraco.Web.Models.ContentEditing
{
    [DataContract(Name = "rollbackVersion", Namespace = "")]
    public class RollbackVersion
    {
        [DataMember(Name = "versionId")]
        public int VersionId { get; set; }

        [DataMember(Name = "versionDate")]
        public DateTime VersionDate { get; set; }

        [DataMember(Name = "versionAuthorId")]
        public int VersionAuthorId { get; set; }

        [DataMember(Name = "versionAuthorName")]
        public string VersionAuthorName { get; set; }
    }
}