text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System.Diagnostics;

namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename
{
    internal class RenameShortcutKey
    {
        public static string RenameOverloads { get; }
        public static string SearchInStrings { get; }
        public static string SearchInComments { get; }
        public static string PreviewChanges { get; }
        public static string Apply { get; }
        public static string RenameFile { get; }

        static RenameShortcutKey()
        {
            RenameOverloads = ExtractAccessKey(EditorFeaturesResources.Include_overload_s, "O");
            SearchInStrings = ExtractAccessKey(EditorFeaturesResources.Include_strings, "S");
            SearchInComments = ExtractAccessKey(EditorFeaturesResources.Include_comments, "C");
            PreviewChanges = ExtractAccessKey(EditorFeaturesResources.Preview_changes1, "P");
            Apply = ExtractAccessKey(EditorFeaturesResources.Apply1, "A");
            RenameFile = ExtractAccessKey(EditorFeaturesResources.Rename_file, "F");
        }

        /// <summary>
        /// Given a localized label, searches for _ and extracts the accelerator key. If none found,
        /// returns defaultValue.
        /// </summary>
        private static string ExtractAccessKey(string localizedLabel, string defaultValue)
        {
            var underscoreIndex = localizedLabel.IndexOf('_');

            if (underscoreIndex >= 0 && underscoreIndex < localizedLabel.Length - 1)
            {
                return new string(new char[] { char.ToUpperInvariant(localizedLabel[underscoreIndex + 1]) });
            }

            Debug.Fail("Could not locate accelerator for " + localizedLabel + " for the rename dashboard");
            return defaultValue;
        }
    }
}


text:
/**
 * \file   lt_eigen.hh
 * \brief  We need to implement the < operator for eigen's vectors/matrices so cj::term can be stored in ordered containers.
 */
#ifndef STD_LT_EIGEN_HH_
#define STD_LT_EIGEN_HH_

#include "cj/common.hh"

namespace Eigen {

template<typename T>
inline auto operator<(Matrix<T, Dynamic, Dynamic> const& lhs, Matrix<T, Dynamic, Dynamic> const& rhs) -> bool {
  if (lhs.size() != rhs.size()) {
    return lhs.size() < rhs.size();
  }
  if (lhs.cols() != rhs.cols()) {
    return lhs.cols() < rhs.cols();
  }
  auto l = lhs.data(), r = rhs.data();
  for (auto i = 0u; i < lhs.size(); ++i, ++l, ++r) {
    if (*l != *r) {
      return *l < *r;
    }
  }
  return false;
}

}

#endif

redpajama_set_name: RedPajamaGithub


text:
Use the following instructions to install ZOO-Project on Ubuntu distributions.

```bash
sudo apt-get install flex bison libfcgi-dev libxml2 libxml2-dev
sudo apt-get install curl openssl autoconf apache2 python-software-properties subversion libmozjs185-dev python-dev build-essential libxslt1-dev
sudo apt-get install gdal-bin python-gdal libgdal1-dev libproj-dev libmozjs185-dev
sudo apt-get install libxslt1-dev python-libxslt1
sudo apt-get install libcgic2

sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install libgdal1-dev

svn checkout http://svn.zoo-project.org/svn/trunk zoo-project

cd zoo-project/thirds/cgic206/
make

cd ../../zoo-project/zoo-kernel/
autoconf

./configure ./configure --with-js --with-python --with-xsltconfig=/usr/bin/xslt-config --with-gdal-config=/usr/bin/gdal-config --with-proj

make

sudo make install

sudo cp main.cfg /usr/lib/cgi-bin
sudo cp zoo_loader.cgi /usr/lib/cgi-bin

sudo cp ../zoo-services/hello-py/cgi-env/*.zcfg /usr/lib/cgi-bin
sudo cp ../zoo-services/hello-py/cgi-env/*.py /usr/lib/cgi-bin/

sudo nano /usr/lib/cgi-bin/main.cfg
- serverAddress = http://127.0.0.1

sudo a2enmod cgi
sudo service apache2 restart

sudo ldconfig
ldd zoo_loader.cgi

sudo a2enmod cgi
sudo service apache2 restart

```
# Test the ZOO-Kernel installation with the following requests:

```bash
http://127.0.0.1/cgi-bin/zoo_loader.cgi?ServiceProvider=&metapath=&Service=WPS&Request=GetCapabilities&Version=1.0.0

http://127.0.0.1/cgi-bin/zoo_loader.cgi?ServiceProvider=&metapath=&Service=WPS&Request=DescribeProcess&Version=1.0.0&Identifier=HelloPy

http://127.0.0.1/cgi-bin/zoo_loader.cgi?ServiceProvider=&metapath=&Service=WPS&Request=Execute&Version=1.0.0&Identifier=HelloPy&DataInputs=a=Chingchai
```

# GRASS GIS 7
https://grasswiki.osgeo.org/wiki/Compile_and_Install_Ubuntu
```bash
# 1. Users of LTS Ubuntu release: Add Ubuntu Unstable PPA:
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable

# 2. Then update cache and install GRASS GIS
sudo apt-get update
sudo apt-get install grass

# you need to enter all following lines
sudo add-apt-repository ppa:ubuntugis/ubuntugis-stable
sudo apt-get update
sudo apt-get install grass
```

# PHP 7.0
```bash
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0
sudo apt-cache search php7-*

sudo apt-get install libapache2-mod-php7.0 php7.0-mysql php7.0-curl php7.0-json libapache2-mod-php7.0 php7.0-mysql php7.0-curl php7.0-json php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php7.0-mcrypt php-memcache  php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-mbstring php-gettext php7.0-pgsql

sudo apt-get install libcurl3 php7.0-curl

sudo nano /var/www/html/phpinfo.php
<?php
phpinfo();
?>
sudo service apache2 restart
```

# QGIS
```bash
sudo nano /etc/apt/sources.list

## Add QGIS Repo
deb http://qgis.org/ubuntugis-ltr trusty main
deb-src http://qgis.org/ubuntugis-ltr trusty main

sudo apt-get update
wget -O - https://qgis.org/downloads/qgis-2017.gpg.key | gpg --import
gpg --fingerprint CAEB3DC3BDF7FB45

## Should output:
pub   2048R/BDF7FB45 2017-08-16 [expires: 2019-08-16]
      Key fingerprint = 61E0 A086 749E 463E DE50  2255 CAEB 3DC3 BDF7 FB45
uid                  QGIS Archive Automatic Signing Key (2017) <qgis-developer@lists.osgeo.org>
sub   2048R/E959BBCF 2017-08-16 [expires: 2019-08-16]
## End output

gpg --export --armor CAEB3DC3BDF7FB45 | sudo apt-key add -

sudo apt-get update
sudo apt-get install qgis python-qgis qgis-plugin-grass
```

# Reference
1. http://zoo-project.org/docs/install/debian.html
2. https://code.google.com/archive/p/wps-grass-bridge/wikis/ZOO_WPS_Integration.wiki
3. https://github.com/All4Gis/ZooWPS
4. http://pynmac.blogspot.com/2016/11/zooloadercgi-not-found.html


text:
require 'test_helper'

class ModelsTest < Minitest::Test

  def test_it_builds_url_as_expected
    expected_url = "https://webapi.nhtsa.gov/api/Recalls/vehicle/1991/Mitsubishi?format=json"

    assert_equal expected_url, Nhtsa::Recalls::Models.new(1991, "Mitsubishi").url
  end

  def test_models_returns_an_array_of_models
    model_names = ["3000GT", "DIAMANTE", "ECLIPSE", "ECLIPSE SPYDER", "GALANT", "MIRAGE", "MONTERO", "MONTERO SPORT", "NATIVA", "SPYDER"]

    assert_equal model_names, Nhtsa::Recalls::Models.new(1998, "Mitsubishi").models
  end

end


text:
class EmailsController < ApplicationController
  before_filter :find_project
  before_filter :find_email, only: :destroy
  respond_to :json

  # Returns a list of the first 10 Emails belonging to the current User,
  # optionally only those under a {Project}.
  #
  # Routes
  # ------
  #
  # * `GET /account/emails.json`
  # * `GET /projects/:project_id/membership/emails.json`
  #
  # Path Parameters
  # ---------------
  #
  # |              |                       |
  # |:-------------|:----------------------|
  # | `project_id` | The {Project}'s slug. |
  #
  # Query Parameters
  # ----------------
  #
  # |         |                                                                                |
  # |:--------|:-----------------------------------------------------------------------------------------|
  # | `query` | If set, includes only those Emails whose address begins with `query` (case-insensitive). |

  def index
    @emails = current_user.emails.redirected.
        where(project_id: @project.try!(:id)).
        order('email ASC').
        limit(10).
        includes(:user)
    @emails = @emails.where('LOWER(email) LIKE ?', params[:query].downcase + '%') if params[:query].present?

    respond_with @emails do |format|
      format.json { render json: decorate(@emails) }
    end
  end

  # Adds a redirecting (non-primary) Email to the current User, optionally
  # limited to a Project.
  #
  # Routes
  # ------
  #
  # * `POST /account/emails.json`
  # * `POST /projects/:project_id/membership/emails.json`
  #
  # Path Parameters
  # ---------------
  #
  # |              |                       |
  # |:-------------|:----------------------|
  # | `project_id` | The {Project}'s slug. |
  #
  # Body Parameters
  # ---------------
  #
  # |         |                                                   |
  # |:--------|:--------------------------------------------------|
  # | `email` | Parameterized hash of new Email attribute values. |

  def create
    @email = current_user.emails.build(email_params)
    @email.project = @project
    @email.save
    respond_with @email, location: nil
  end

  # Removes a redirecting (non-primary) Email from the current User.
  #
  # Routes
  # ------
  #
  # * `DELETE /account/emails/:id.json`
  #
  # Path Parameters
  # ---------------
  #
  # |      |                    |
  # |:-----|:-------------------|
  # | `id` | The email address. |

  def destroy
    @email.destroy
    respond_with @email
  end

  private

  def find_project
    @project = Project.find_from_slug!(params[:project_id]) if params.include?('project_id')
  end

  def find_email
    @email = current_user.emails.redirected.by_email(params[:id]).first!
  end

  def decorate(emails)
    emails.map do |email|
      email.as_json.merge(
          url: account_email_url(email)
      )
    end
  end

  def email_params
    params.require(:email).permit(:email)
  end
end


text:
#ifndef BIPED_H
#define BIPED_H

#include "../../src/Base3DObject.h"

class Biped : public Base3DObject
{

public:
	Biped( opal::Simulator* sim, opal::real size,
		const opal::Matrix44r& transform=opal::Matrix44r() );

	~Biped();

	virtual void Draw();

	virtual void Update( opal::real dt );

	const opal::Matrix44r& getTransform();

	opal::Solid* getSolid()const;

	verve::NeuralNet* getNetwork()const;

	void moveLeg( bool left );

private:
	opal::Simulator* mSim;

	opal::Solid* mPelvis;
	opal::Solid* mLeftUpperLeg;
	opal::Solid* mRightUpperLeg;
	opal::Solid* mLeftLowerLeg;
	opal::Solid* mRightLowerLeg;
	opal::Solid* mLeftFoot;
	opal::Solid* mRightFoot;

	opal::HingeJoint* mLeftHip;
	opal::HingeJoint* mRightHip;
	opal::HingeJoint* mLeftKnee;
	opal::HingeJoint* mRightKnee;
	opal::HingeJoint* mLeftAnkle;
	opal::HingeJoint* mRightAnkle;

	opal::Vec3r mPelvisDimensions;
	opal::real mUpperLegLength;
	opal::real mUpperLegRadius;
	opal::real mLowerLegLength;
	opal::real mLowerLegRadius;
	opal::Vec3r mFootDimensions;

	opal::ServoMotor* mLeftHipMotor;
	opal::ServoMotor* mRightHipMotor;
	opal::ServoMotor* mLeftAnkleMotor;
	opal::ServoMotor* mRightAnkleMotor;

	verve::NeuralNet* mNetwork;
};

#endif


text:
package com.github.javalbert.sqlbuilder;

import java.util.Objects;

public class LiteralNumber extends Literal<Number> {
	@Override
	public int getType() {
		return TYPE_LITERAL_NUMBER;
	}
	@Override
	public void setValue(Number value) {
		super.setValue(Objects.requireNonNull(value, "value cannot be null"));
	}

	public LiteralNumber(LiteralNumber literal) {
		super(literal.getValue());
		alias = literal.getAlias();
	}

	public LiteralNumber(Number value) {
		this.value = Objects.requireNonNull(value, "value cannot be null");
	}

	@Override
	public LiteralNumber immutable() {
		return new ImmutableLiteralNumber(this);
	}

	@Override
	public LiteralNumber mutable() {
		return new LiteralNumber(this);
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project name="RancherPHP" default="build">

    <property name="toolsdir" value="${basedir}/bin"/>

    <target name="build"
            depends="prepare,lint,phploc-ci,pdepend,phpmd-ci,phpcs-ci,phpcpd-ci,phpunit,phpdoc"
            description="Run all targets"/>

    <target name="clean"
            unless="clean.done"
            description="Clean up build folder">
        <delete dir="${basedir}/build/api"/>
        <delete dir="${basedir}/build/coverage"/>
        <delete dir="${basedir}/build/logs"/>
        <delete dir="${basedir}/build/pdepend"/>
        <property name="clean.done" value="true"/>
    </target>

    <target name="prepare"
            unless="prepare.done"
            depends="clean"
            description="Prepare build folder">
        <mkdir dir="${basedir}/build/api"/>
        <mkdir dir="${basedir}/build/coverage"/>
        <mkdir dir="${basedir}/build/logs"/>
        <mkdir dir="${basedir}/build/pdepend"/>
        <property name="prepare.done" value="true"/>
    </target>

    <target name="lint"
            description="Check for syntax error">
        <apply executable="php" failonerror="true">
            <arg value="-l"/>

            <fileset dir="${basedir}/src">
                <include name="**/*.php"/>
                <modified/>
            </fileset>
        </apply>
    </target>

    <target name="phploc"
            description="Count lines of code">
        <exec executable="${toolsdir}/phploc">
            <arg value="--count-tests"/>
            <arg path="${basedir}/src"/>
        </exec>
    </target>

    <target name="phploc-ci"
            depends="prepare"
            description="Print lines of code for continuous integration">
        <exec executable="${toolsdir}/phploc" output="/dev/null">
            <arg value="--count-tests"/>
            <arg value="--log-csv"/>
            <arg path="${basedir}/build/logs/phploc.csv"/>
            <arg value="--log-xml"/>
            <arg path="${basedir}/build/logs/phploc.xml"/>
            <arg path="${basedir}/src"/>
        </exec>
    </target>

    <target name="pdepend"
            depends="prepare"
            description="Check dependency graph">
        <exec executable="${toolsdir}/pdepend">
            <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml"/>
            <arg value="--jdepend-chart=${basedir}/build/logs/dependencies.svg"/>
            <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
            <arg path="${basedir}/src" />
        </exec>
    </target>

    <target name="phpmd"
            description="Detect messy code">
        <exec executable="${toolsdir}/phpmd">
            <arg path="${basedir}/src"/>
            <arg value="text"/>
            <arg value="${basedir}/phpmd.xml"/>
        </exec>
    </target>

    <target name="phpmd-ci"
            description="Detect messy code for continuous integration">
        <exec executable="${toolsdir}/phpmd" output="/dev/null">
            <arg path="${basedir}/src"/>
            <arg value="xml"/>
            <arg value="${basedir}/phpmd.xml"/>
            <arg value="--reportfile"/>
            <arg path="${basedir}/build/logs/pmd.xml"/>
        </exec>
    </target>

    <target name="phpcs"
            description="Run PHP CodeSniffer">
        <exec executable="${toolsdir}/phpcs">
            <arg value="--standard=PSR2"/>
            <arg value="--extensions=php"/>
            <arg path="${basedir}/src"/>
        </exec>
    </target>

    <target name="phpcs-ci"
            depends="prepare"
            description="Run PHP CodeSniffer for continuous integration">
        <exec executable="${toolsdir}/phpcs" output="/dev/null">
            <arg value="--report=checkstyle"/>
            <arg value="--report-file=${basedir}/build/logs/checkstyle.xml"/>
            <arg value="--standard=PSR2"/>
            <arg value="--extensions=php"/>
            <arg path="${basedir}/src"/>
        </exec>
    </target>

    <target name="phpcpd"
            description="Copy and Paste detection">
        <exec executable="${toolsdir}/phpcpd">
            <arg path="${basedir}/src"/>
        </exec>
    </target>

    <target name="phpcpd-ci"
            depends="prepare"
            description="Copy and Paste detection for continuous integration">
        <exec executable="${toolsdir}/phpcpd" output="/dev/null">
            <arg value="--log-pmd"/>
            <arg path="${basedir}.build/logs/pmd-cpd.xml"/>
            <arg path="${basedir}/src"/>
        </exec>
    </target>

    <target name="phpunit"
            depends="prepare"
            description="Run unit tests">
        <exec executable="${toolsdir}/phpunit" failonerror="true">
            <arg value="--configuration"/>
            <arg path="${basedir}/phpunit.xml.dist"/>
        </exec>
    </target>

    <target name="phpdoc"
            depends="prepare"
            description="Generate API documentation">
        <exec executable="${toolsdir}/phpdoc">
            <arg line="-d ${basedir}/src"/>
            <arg line="-t ${basedir}/build/api"/>
        </exec>
    </target>
</project>


text:
body {
  padding-top: 70px;  /* Move body of page below navbar. */
}

.page-content {
  padding: 10px;
  text-align: center;
  background-color: black;
}

h1{
  color:#666;
}

.navbar {
  font-family: Lucida Grande, sans-serif;
  font-size: 1.25em;
  font-weight: bold;
  color: #E5EDDC;

}

.navbar-brand {
  padding: 0;
}
.navbar-carbon {
  background: url('../images/bg-carbon.jpg');
  background-size: repeat;
}
.navbar .navbar-inverse .navbar-fixed-top .navbar-carbon {
  background-color: transparent;
}

.pueo {
  background-image:url('../images/pueo-canoes-front.jpg');
  background-size: cover;
  background-position: center;
  height: 385px;
}


text:
'use strict';

/**
 * @ngdoc overview
 * @name resourceManagementApp
 * @description
 * # resourceManagementApp
 *
 * Main module of the application.
 */
angular.module('resourceManagementApp', [
    'ngAnimate',
    'ngCookies',
    'ngResource',
    'ngRoute',
    'ngSanitize',
    'ngTouch',
    'firebase',
    'firebase.ref',
    'firebase.auth',
    'ui.bootstrap',
    'angularMoment',
    'ui.router',
    'ui.router.tabs'
  ]);


text:
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

'use strict';

/**
 * @fileoverview Factory methods for the supported locator strategies.
 */

/**
 * Short-hand expressions for the primary element locator strategies.
 * For example the following two statements are equivalent:
 *
 *     var e1 = driver.findElement(By.id('foo'));
 *     var e2 = driver.findElement({id: 'foo'});
 *
 * Care should be taken when using JavaScript minifiers (such as the
 * Closure compiler), as locator hashes will always be parsed using
 * the un-obfuscated properties listed.
 *
 * @typedef {(
 *     {className: string}|
 *     {css: string}|
 *     {id: string}|
 *     {js: string}|
 *     {linkText: string}|
 *     {name: string}|
 *     {partialLinkText: string}|
 *     {tagName: string}|
 *     {xpath: string})}
 */
var ByHash;

/**
 * Error thrown if an invalid character is encountered while escaping a CSS
 * identifier.
 * @see https://drafts.csswg.org/cssom/#serialize-an-identifier
 */
class InvalidCharacterError extends Error {
  constructor() {
    super();
    this.name = this.constructor.name;
  }
}

/**
 * Escapes a CSS string.
 * @param {string} css the string to escape.
 * @return {string} the escaped string.
 * @throws {TypeError} if the input value is not a string.
 * @throws {InvalidCharacterError} if the string contains an invalid character.
 * @see https://drafts.csswg.org/cssom/#serialize-an-identifier
 */
function escapeCss(css) {
  if (typeof css !== 'string') {
    throw new TypeError('input must be a string');
  }
  let ret = '';
  const n = css.length;
  for (let i = 0; i  < n; i++) {
    const c = css.charCodeAt(i);
    if (c == 0x0) {
      throw new InvalidCharacterError();
    }

    if ((c >= 0x0001 && c <= 0x001F)
        || c == 0x007F
        || (i == 0 && c >= 0x0030 && c <= 0x0039)
        || (i == 1 && c >= 0x0030 && c <= 0x0039
            && css.charCodeAt(0) == 0x002D)) {
      ret += '\\' + c.toString(16);
      continue;
    }

    if (i == 0 && c == 0x002D && n == 1) {
      ret += '\\' + css.charAt(i);
      continue;
    }

    if (c >= 0x0080
        || c == 0x002D                      // -
        || c == 0x005F                      // _
        || (c >= 0x0030 && c <= 0x0039)     // [0-9]
        || (c >= 0x0041 && c <= 0x005A)     // [A-Z]
        || (c >= 0x0061 && c <= 0x007A)) {  // [a-z]
      ret += css.charAt(i);
      continue;
    }

    ret += '\\' + css.charAt(i);
  }
  return ret;
}

/**
 * Describes a mechanism for locating an element on the page.
 * @final
 */
class By {
  /**
   * @param {string} using the name of the location strategy to use.
   * @param {string} value the value to search for.
   */
  constructor(using, value) {
    /** @type {string} */
    this.using = using;

    /** @type {string} */
    this.value = value;
  }

  /**
   * Locates elements that have a specific class name.
   *
   * @param {string} name The class name to search for.
   * @return {!By} The new locator.
   * @see http://www.w3.org/TR/2011/WD-html5-20110525/elements.html#classes
   * @see http://www.w3.org/TR/CSS2/selector.html#class-html
   */
  static className(name) {
    let names = name.split(/\s+/g)
        .filter(s => s.length > 0)
        .map(s => escapeCss(s));
    return By.css('.' + names.join('.'));
  }

  /**
   * Locates elements using a CSS selector.
   *
   * @param {string} selector The CSS selector to use.
   * @return {!By} The new locator.
   * @see http://www.w3.org/TR/CSS2/selector.html
   */
  static css(selector) {
    return new By('css selector', selector);
  }

  /**
   * Locates eleemnts by the ID attribute. This locator uses the CSS selector
   * `*[id="$ID"]`, _not_ `document.getElementById`.
   *
   * @param {string} id The ID to search for.
   * @return {!By} The new locator.
   */
  static id(id) {
    return By.css('*[id="' + escapeCss(id) + '"]');
  }

  /**
   * Locates link elements whose
   * {@linkplain webdriver.WebElement#getText visible text} matches the given
   * string.
   *
   * @param {string} text The link text to search for.
   * @return {!By} The new locator.
   */
  static linkText(text) {
    return new By('link text', text);
  }

  /**
   * Locates an elements by evaluating a
   * {@linkplain webdriver.WebDriver#executeScript JavaScript expression}.
   * The result of this expression must be an element or list of elements.
   *
   * @param {!(string|Function)} script The script to execute.
   * @param {...*} var_args The arguments to pass to the script.
   * @return {function(!./webdriver.WebDriver): !./promise.Promise}
   *     A new JavaScript-based locator function.
   */
  static js(script, var_args) {
    let args = Array.prototype.slice.call(arguments, 0);
    return function(driver) {
      return driver.executeScript.apply(driver, args);
    };
  }

  /**
   * Locates elements whose `name` attribute has the given value.
   *
   * @param {string} name The name attribute to search for.
   * @return {!By} The new locator.
   */
  static name(name) {
    return By.css('*[name="' + escapeCss(name) + '"]');
  }

  /**
   * Locates link elements whose
   * {@linkplain webdriver.WebElement#getText visible text} contains the given
   * substring.
   *
   * @param {string} text The substring to check for in a link's visible text.
   * @return {!By} The new locator.
   */
  static partialLinkText(text) {
    return new By('partial link text', text);
  }

  /**
   * Locates elements with a given tag name.
   *
   * @param {string} name The tag name to search for.
   * @return {!By} The new locator.
   * @deprecated Use {@link By.css() By.css(tagName)} instead.
   */
  static tagName(name) {
    return By.css(name);
  }

  /**
   * Locates elements matching a XPath selector. Care should be taken when
   * using an XPath selector with a {@link webdriver.WebElement} as WebDriver
   * will respect the context in the specified in the selector. For example,
   * given the selector `//div`, WebDriver will search from the document root
   * regardless of whether the locator was used with a WebElement.
   *
   * @param {string} xpath The XPath selector to use.
   * @return {!By} The new locator.
   * @see http://www.w3.org/TR/xpath/
   */
  static xpath(xpath) {
    return new By('xpath', xpath);
  }

  /** @override */
  toString() {
    // The static By.name() overrides this.constructor.name.  Shame...
    return `By(${this.using}, ${this.value})`;
  }
}

/**
 * Checks if a value is a valid locator.
 * @param {!(By|Function|ByHash)} locator The value to check.
 * @return {!(By|Function)} The valid locator.
 * @throws {TypeError} If the given value does not define a valid locator
 *     strategy.
 */
function check(locator) {
  if (locator instanceof By || typeof locator === 'function') {
    return locator;
  }
  for (let key in locator) {
    if (locator.hasOwnProperty(key) && By.hasOwnProperty(key)) {
      return By[key](locator[key]);
    }
  }
  throw new TypeError('Invalid locator');
}

// PUBLIC API

module.exports = {
  By: By,
  checkedLocator: check,
};


text:
#ifndef BX_ENDIAN_H_HEADER_GUARD
#define BX_ENDIAN_H_HEADER_GUARD

#include "bx.h"

namespace bx
{
	///
	int16_t endianSwap(int16_t _in);

	///
	uint16_t endianSwap(uint16_t _in);

	///
	int32_t endianSwap(int32_t _in);

	///
	uint32_t endianSwap(uint32_t _in);

	///
	int64_t endianSwap(int64_t _in);

	///
	uint64_t endianSwap(uint64_t _in);

	/// Input argument is encoded as little endian, convert it if neccessary
	/// depending on host CPU endianess.
	template <typename Ty>
	Ty toLittleEndian(const Ty _in);

	/// Input argument is encoded as big endian, convert it if neccessary
	/// depending on host CPU endianess.
	template <typename Ty>
	Ty toBigEndian(const Ty _in);

	/// If _littleEndian is true, converts input argument to from little endian
	/// to host CPU endiness.
	template <typename Ty>
	Ty toHostEndian(const Ty _in, bool _fromLittleEndian);

} // namespace bx

#include "inline/endian.inl"

#endif // BX_ENDIAN_H_HEADER_GUARD


text:
<project name="Anagram" default="makejar" basedir=".">
   <description>
      compiles the Anagram solver
   </description>

   <property name="src" location="src/"/>
   <property name="bin" location="bin/"/>
   <property name="res" location="res/"/>

   <target name="bin">
      <mkdir dir="${bin}"/>
   </target>

   <target name="compile" depends="bin">
      <javac
         source="1.5"
         target="1.5"
         srcdir="${src}"
         destdir="${bin}"
         includeantruntime="false"
         listfiles="true" />
   </target>

   <target name="makejar" depends="compile">
      <jar destfile="Anagram.jar">
         <fileset dir="${bin}">
            <include name="**/*.class"/>
         </fileset>
         <fileset dir="${res}" />
         <manifest>
            <attribute name="Main-Class" value="Anagram"/>
         </manifest>
      </jar>
   </target>

   <target name="clean">
      <delete dir="${bin}" verbose="true" failonerror="false"/>
   </target>
</project>


text:
class QMapWidget;
class FpsRenderingLayer;
class RenderingLayerManager;

class QMapView : public QGraphicsWebView
{
  Q_OBJECT
public:
  QMapView(QPointF coords, int level=15, QWidget *parent=0);
  ~QMapView();

  void setMapType(const QString &type);

  QPointF mapFromGeoLocation(QPointF geoCoords) const;
  QPointF mapToGeoLocation(QPointF viewCoords) const;

  int     zoomLevel() const;
  void    setZoomLevel(int level);
  QPointF center() const;
  void    setCenter(QPointF p);
  void    setView(QPointF p, int level);

  void    showMap(bool show);
  void    showFps(bool show);

  void            addRenderingLayer(RenderingLayer *layer, float depth=-1);
  RenderingLayer* getRenderingLayer(int stackingOrder);
  QList<RenderingLayer*> getRenderingLayers();

signals:
  void viewChanged(QPointF center, int level);
  void doneUpdating();

public slots:
  void loadFinished(bool ok);
  void updateView();
  void syncView();

protected:
  void initView();
  void initGL();
  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

  void keyPressEvent(QKeyEvent *event);
  void mousePressEvent(QGraphicsSceneMouseEvent *event);
  void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
  void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
  void resizeEvent(QGraphicsSceneResizeEvent *event);
  void wheelEvent(QGraphicsSceneWheelEvent *event);
  bool sceneEvent(QEvent *event);

  int  getMapZoomLevel();
  void setMapZoomLevel(int zoom);
  QPointF getMapCenter();
  void setMapCenter(QPointF p);
  void panMapCenter(QPointF p);
  void invalidateZoomLevel();

private slots:
  void deferredLoadFinished();

private:
  QVariant     js(const QString &cmd);
  bool         glInitialized;
  bool         showMapEnabled;
  int          lastButtonPressed;
  QPoint       lastPos;
  QPointF      mapCenter;
  int          mapLevel;
  QPointF      lastCenter;
  int          lastLevel;
  int          startedPinchZoomLevel;
  QMapWidget  *mapWidget;

  FpsRenderingLayer *fpsRenderingLayer;
  RenderingLayerManager *layers;
};

#endif


text:
#import "FPriorityIndex.h"

#import "FNode.h"
#import "FUtilities.h"
#import "FNamedNode.h"
#import "FEmptyNode.h"
#import "FLeafNode.h"
#import "FMaxNode.h"

// TODO: Abstract into some common base class?

@implementation FPriorityIndex

- (NSComparisonResult) compareKey:(NSString *)key1
                          andNode:(id<FNode>)node1
                       toOtherKey:(NSString *)key2
                          andNode:(id<FNode>)node2
{
    id<FNode> child1 = [node1 getPriority];
    id<FNode> child2 = [node2 getPriority];
    NSComparisonResult indexCmp = [child1 compare:child2];
    if (indexCmp == NSOrderedSame) {
        return [FUtilities compareKey:key1 toKey:key2];
    } else {
        return indexCmp;
    }
}

- (NSComparisonResult) compareKey:(NSString *)key1
                          andNode:(id<FNode>)node1
                       toOtherKey:(NSString *)key2
                          andNode:(id<FNode>)node2
                          reverse:(BOOL)reverse
{
    if (reverse) {
        return [self compareKey:key2 andNode:node2 toOtherKey:key1 andNode:node1];
    } else {
        return [self compareKey:key1 andNode:node1 toOtherKey:key2 andNode:node2];
    }
}

- (NSComparisonResult) compareNamedNode:(FNamedNode *)namedNode1 toNamedNode:(FNamedNode *)namedNode2
{
    return [self compareKey:namedNode1.name andNode:namedNode1.node toOtherKey:namedNode2.name andNode:namedNode2.node];
}

- (BOOL)isDefinedOn:(id <FNode>)node {
    return !node.getPriority.isEmpty;
}

- (BOOL)indexedValueChangedBetween:(id <FNode>)oldNode and:(id <FNode>)newNode {
    id<FNode> oldValue = [oldNode getPriority];
    id<FNode> newValue = [newNode getPriority];
    return ![oldValue isEqual:newValue];
}

- (FNamedNode *)minPost {
    return FNamedNode.min;
}

- (FNamedNode *)maxPost {
    return [self makePost:[FMaxNode maxNode] name:[FUtilities maxName]];
}

- (FNamedNode*)makePost:(id<FNode>)indexValue name:(NSString*)name {
    id<FNode> node = [[FLeafNode alloc] initWithValue:@"[PRIORITY-POST]" withPriority:indexValue];
    return [[FNamedNode alloc] initWithName:name andNode:node];
}

- (NSString *)queryDefinition {
    return @".priority";
}

- (NSString *)description {
    return @"FPriorityIndex";
}

- (id)copyWithZone:(NSZone *)zone {
    // Safe since we're immutable.
    return self;
}

- (BOOL) isEqual:(id)other {
    return [other isKindOfClass:[FPriorityIndex class]];
}

- (NSUInteger) hash {
    // chosen by a fair dice roll. Guaranteed to be random
    return 3155577;
}

+ (id<FIndex>) priorityIndex {
    static id<FIndex> index;
    static dispatch_once_t once;
    dispatch_once(&once, ^{
        index = [[FPriorityIndex alloc] init];
    });

    return index;
}

@end


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.noctapuru.puzzlehuntmodel.model;

import cz.noctapuru.puzzlehuntmodel.math.MonteCarloResult;

/**
 * Simple result container. The only point of this is encapsulation.
 *
 * @author viktor
 */
public class CheckpointResult {
    private MonteCarloResult openingTime;
    private MonteCarloResult closingTime;
    private MonteCarloResult reachedByTeams;

    public CheckpointResult(int size) {
        this.openingTime = new MonteCarloResult(size);
        this.closingTime = new MonteCarloResult(size);
        this.reachedByTeams = new MonteCarloResult(size);
    }

    public MonteCarloResult getClosingTime() {
        return closingTime;
    }

    public MonteCarloResult getOpeningTime() {
        return openingTime;
    }

    public MonteCarloResult getReachedByTeams() {
        return reachedByTeams;
    }
}


text:
package com.skynav.ttv.verifier.ttml.style;

import java.util.List;

import javax.xml.namespace.QName;

import org.xml.sax.Locator;

import com.skynav.ttv.model.Model;
import com.skynav.ttv.model.value.Length;
import com.skynav.ttv.model.value.Measure;
import com.skynav.ttv.util.Location;
import com.skynav.ttv.util.Reporter;
import com.skynav.ttv.verifier.StyleValueVerifier;
import com.skynav.ttv.verifier.VerifierContext;
import com.skynav.ttv.verifier.util.Extents;
import com.skynav.ttv.verifier.util.Keywords;
import com.skynav.ttv.verifier.util.Lengths;
import com.skynav.ttv.verifier.util.Measures;
import com.skynav.ttv.verifier.util.MixedUnitsTreatment;
import com.skynav.ttv.verifier.util.NegativeTreatment;

public class ExtentVerifier implements StyleValueVerifier {

    public boolean verify(Object value, Location location, VerifierContext context) {
        boolean failed;
        assert value instanceof String;
        String s = (String) value;
        Integer[] minMax = new Integer[] { 2, 2 };
        Object[] treatments = new Object[] { NegativeTreatment.Error, MixedUnitsTreatment.Allow };
        Model model = context.getModel();
        if (model.isTTMLVersion(1)) {
            if (Keywords.isAuto(s))
                failed = false;
            else if (Lengths.isLengths(s, location, context, minMax, treatments, null))
                failed = false;
            else {
                Lengths.badLengths(s, location, context, minMax, treatments);
                failed = true;
            }
        } else if (model.isTTMLVersion(2)) {
            if (Keywords.isAuto(s))
                failed = false;
            else if (Extents.isContain(s))
                failed = false;
            else if (Extents.isCover(s))
                failed = false;
            else if (Measures.isMeasures(s, location, context, minMax, treatments, null))
                failed = false;
            else {
                Measures.badMeasures(s, location, context, minMax, treatments);
                failed = true;
            }
        } else
            failed = true;
        if (!failed) {
            Object content = location.getContent();
            if ((content instanceof com.skynav.ttv.model.ttml1.tt.TimedText) || (content instanceof com.skynav.ttv.model.ttml2.tt.TimedText))
                failed = !verifyRootExtent(value, location, context);
        }
        return !failed;
    }

    private boolean verifyRootExtent(Object value, Location location, VerifierContext context) {
        boolean failed = false;
        assert value instanceof String;
        String s = (String) value;
        Model model = context.getModel();
        Length.Unit wUnits = null;
        Length.Unit hUnits = null;
        if (model.isTTMLVersion(1)) {
            List<Length> lengths = new java.util.ArrayList<Length>();
            if (Lengths.isLengths(s, location, context, null, null, lengths)) {
                if (lengths.size() == 2) {
                    Length w = lengths.get(0);
                    wUnits = w.getUnits();
                    Length h = lengths.get(1);
                    hUnits = h.getUnits();
                }
            }
        } else if (model.isTTMLVersion(2)) {
            List<Measure> measures = new java.util.ArrayList<Measure>();
            if (Measures.isMeasures(s, location, context, null, null, measures)) {
                if (measures.size() == 2) {
                    Measure w = measures.get(0);
                    if (w.isLength())
                        wUnits = w.getUnits();
                    Measure h = measures.get(1);
                    if (h.isLength())
                        hUnits = h.getUnits();
                }
            }
        } else
            failed = true;
        if (!failed) {
            Length.Unit pxUnits = Length.Unit.Pixel;
            Reporter reporter = context.getReporter();
            Locator locator = location.getLocator();
            QName styleName = location.getAttributeName();
            if ((wUnits != null) && (wUnits != pxUnits)) {
                reporter.logInfo(reporter.message(locator, "*KEY*",
                    "Bad units on {0} width on root element, got ''{1}'', expected ''{2}''.",
                    styleName, wUnits.shorthand(), pxUnits.shorthand()));
                failed = true;
            }
            if ((hUnits != null) && (hUnits != pxUnits)) {
                reporter.logInfo(reporter.message(locator, "*KEY*",
                    "Bad units on {0} height on root element, got ''{1}'', expected ''{2}''.",
                    styleName, hUnits.shorthand(), pxUnits.shorthand()));
                failed = true;
            }
        }
        return !failed;
    }

}


text:
using System;
using System.Threading.Tasks;
using CoreDocker.Dal.Models.Base;
using Bumbershoot.Utilities.Helpers;

namespace CoreDocker.Dal.Persistence
{
    public static class RepositoryHelper
    {
        public static async Task<T> FindOrThrow<T>(this IRepository<T> repo, string requestId)
            where T : IBaseDalModelWithId
        {
            var foundUser = await repo.FindOne(x => x.Id == requestId);
            return foundUser.ExistsOrThrow(requestId);
        }

        public static T ExistsOrThrow<T>(this T? found, string requestId) where T : IBaseDalModelWithId
        {
            if (found == null)
                throw new ReferenceException(
                    $"Invalid {typeof(T).Name.UnderScoreAndCamelCaseToHumanReadable()} id [{requestId}].");
            return found;
        }
    }
}


text:
#pragma once
#include <aws/ds/DirectoryService_EXPORTS.h>
#include <aws/ds/DirectoryServiceRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace DirectoryService
{
namespace Model
{

  /**
   */
  class AWS_DIRECTORYSERVICE_API ListIpRoutesRequest : public DirectoryServiceRequest
  {
  public:
    ListIpRoutesRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "ListIpRoutes"; }

    Aws::String SerializePayload() const override;

    Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;

    /**
     *
Identifier (ID) of the directory for which you want to retrieve the IP
     * addresses.

     */
    inline const Aws::String& GetDirectoryId() const{ return m_directoryId; }

    /**
     *
Identifier (ID) of the directory for which you want to retrieve the IP
     * addresses.

     */
    inline void SetDirectoryId(const Aws::String& value) { m_directoryIdHasBeenSet = true; m_directoryId = value; }

    /**
     *
Identifier (ID) of the directory for which you want to retrieve the IP
     * addresses.

     */
    inline void SetDirectoryId(Aws::String&& value) { m_directoryIdHasBeenSet = true; m_directoryId = std::move(value); }

    /**
     *
Identifier (ID) of the directory for which you want to retrieve the IP
     * addresses.

     */
    inline void SetDirectoryId(const char* value) { m_directoryIdHasBeenSet = true; m_directoryId.assign(value); }

    /**
     *
Identifier (ID) of the directory for which you want to retrieve the IP
     * addresses.

     */
    inline ListIpRoutesRequest& WithDirectoryId(const Aws::String& value) { SetDirectoryId(value); return *this;}

    /**
     *
Identifier (ID) of the directory for which you want to retrieve the IP
     * addresses.

     */
    inline ListIpRoutesRequest& WithDirectoryId(Aws::String&& value) { SetDirectoryId(std::move(value)); return *this;}

    /**
     *
Identifier (ID) of the directory for which you want to retrieve the IP
     * addresses.

     */
    inline ListIpRoutesRequest& WithDirectoryId(const char* value) { SetDirectoryId(value); return *this;}

    /**
     *
The ListIpRoutes.NextToken value from a previous call to
     * ListIpRoutes. Pass null if this is the first call.

     */
    inline const Aws::String& GetNextToken() const{ return m_nextToken; }

    /**
     *
The ListIpRoutes.NextToken value from a previous call to
     * ListIpRoutes. Pass null if this is the first call.

     */
    inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; }

    /**
     *
The ListIpRoutes.NextToken value from a previous call to
     * ListIpRoutes. Pass null if this is the first call.

     */
    inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); }

    /**
     *
The ListIpRoutes.NextToken value from a previous call to
     * ListIpRoutes. Pass null if this is the first call.

     */
    inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); }

    /**
     *
The ListIpRoutes.NextToken value from a previous call to
     * ListIpRoutes. Pass null if this is the first call.

     */
    inline ListIpRoutesRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}

    /**
     *
The ListIpRoutes.NextToken value from a previous call to
     * ListIpRoutes. Pass null if this is the first call.

     */
    inline ListIpRoutesRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}

    /**
     *
The ListIpRoutes.NextToken value from a previous call to
     * ListIpRoutes. Pass null if this is the first call.

     */
    inline ListIpRoutesRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;}

    /**
     *
Maximum number of items to return. If this value is zero, the maximum number
     * of items is specified by the limitations of the operation.

     */
    inline int GetLimit() const{ return m_limit; }

    /**
     *
Maximum number of items to return. If this value is zero, the maximum number
     * of items is specified by the limitations of the operation.

     */
    inline void SetLimit(int value) { m_limitHasBeenSet = true; m_limit = value; }

    /**
     *
Maximum number of items to return. If this value is zero, the maximum number
     * of items is specified by the limitations of the operation.

     */
    inline ListIpRoutesRequest& WithLimit(int value) { SetLimit(value); return *this;}

  private:

    Aws::String m_directoryId;
    bool m_directoryIdHasBeenSet;

    Aws::String m_nextToken;
    bool m_nextTokenHasBeenSet;

    int m_limit;
    bool m_limitHasBeenSet;
  };

} // namespace Model
} // namespace DirectoryService
} // namespace Aws


text:
namespace llvm {

template <typename T> class ArrayRef;
class MCInst;
class raw_ostream;
class MCAsmInfo;
class MCInstrInfo;
class MCRegisterInfo;
class MCSubtargetInfo;
class StringRef;

/// Convert `Bytes' to a hex string and output to `OS'
void dumpBytes(ArrayRef<uint8_t> Bytes, raw_ostream &OS);

namespace HexStyle {

enum Style {
  C,  ///< 0xff
  Asm ///< 0ffh
};

} // end namespace HexStyle

/// \brief This is an instance of a target assembly language printer that
/// converts an MCInst to valid target assembly syntax.
class MCInstPrinter {
protected:
  /// \brief A stream that comments can be emitted to if desired.  Each comment
  /// must end with a newline.  This will be null if verbose assembly emission
  /// is disable.
  raw_ostream *CommentStream;
  const MCAsmInfo &MAI;
  const MCInstrInfo &MII;
  const MCRegisterInfo &MRI;

  /// True if we are printing marked up assembly.
  bool UseMarkup;

  /// True if we are printing immediates as hex.
  bool PrintImmHex;

  /// Which style to use for printing hexadecimal values.
  HexStyle::Style PrintHexStyle;

  /// Utility function for printing annotations.
  void printAnnotation(raw_ostream &OS, StringRef Annot);

public:
  MCInstPrinter(const MCAsmInfo &mai, const MCInstrInfo &mii,
                const MCRegisterInfo &mri)
      : CommentStream(nullptr), MAI(mai), MII(mii), MRI(mri), UseMarkup(false),
        PrintImmHex(false), PrintHexStyle(HexStyle::C) {}

  virtual ~MCInstPrinter();

  /// \brief Specify a stream to emit comments to.
  void setCommentStream(raw_ostream &OS) { CommentStream = &OS; }

  /// \brief Print the specified MCInst to the specified raw_ostream.
  virtual void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot,
                         const MCSubtargetInfo &STI) = 0;

  /// \brief Return the name of the specified opcode enum (e.g. "MOV32ri") or
  /// empty if we can't resolve it.
  StringRef getOpcodeName(unsigned Opcode) const;

  /// \brief Print the assembler register name.
  virtual void printRegName(raw_ostream &OS, unsigned RegNo) const;

  bool getUseMarkup() const { return UseMarkup; }
  void setUseMarkup(bool Value) { UseMarkup = Value; }

  /// Utility functions to make adding mark ups simpler.
  StringRef markup(StringRef s) const;
  StringRef markup(StringRef a, StringRef b) const;

  bool getPrintImmHex() const { return PrintImmHex; }
  void setPrintImmHex(bool Value) { PrintImmHex = Value; }

  HexStyle::Style getPrintHexStyle() const { return PrintHexStyle; }
  void setPrintHexStyle(HexStyle::Style Value) { PrintHexStyle = Value; }

  /// Utility function to print immediates in decimal or hex.
  format_object<int64_t> formatImm(int64_t Value) const {
    return PrintImmHex ? formatHex(Value) : formatDec(Value);
  }

  /// Utility functions to print decimal/hexadecimal values.
  format_object<int64_t> formatDec(int64_t Value) const;
  format_object<int64_t> formatHex(int64_t Value) const;
  format_object<uint64_t> formatHex(uint64_t Value) const;
};

} // end namespace llvm

#endif // LLVM_MC_MCINSTPRINTER_H


text:
<?php

/**
 *  @see FBAInboundServiceMWS_Model
 */

require_once (dirname(__FILE__) . '/../Model.php');

/**
 * FBAInboundServiceMWS_Model_TransportHeader
 *
 * Properties:
 *

 *
 *
SellerId: string

 *
ShipmentId: string

 *
IsPartnered: bool

 *
ShipmentType: string

 *
 *

 */

 class FBAInboundServiceMWS_Model_TransportHeader extends FBAInboundServiceMWS_Model {

    public function __construct($data = null)
    {
    $this->_fields = array (
    'SellerId' => array('FieldValue' => null, 'FieldType' => 'string'),
    'ShipmentId' => array('FieldValue' => null, 'FieldType' => 'string'),
    'IsPartnered' => array('FieldValue' => null, 'FieldType' => 'bool'),
    'ShipmentType' => array('FieldValue' => null, 'FieldType' => 'string'),
    );
    parent::__construct($data);
    }

    /**
     * Get the value of the SellerId property.
     *
     * @return String SellerId.
     */
    public function getSellerId()
    {
        return $this->_fields['SellerId']['FieldValue'];
    }

    /**
     * Set the value of the SellerId property.
     *
     * @param string sellerId
     * @return this instance
     */
    public function setSellerId($value)
    {
        $this->_fields['SellerId']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Check to see if SellerId is set.
     *
     * @return true if SellerId is set.
     */
    public function isSetSellerId()
    {
                return !is_null($this->_fields['SellerId']['FieldValue']);
            }

    /**
     * Set the value of SellerId, return this.
     *
     * @param sellerId
     *             The new value to set.
     *
     * @return This instance.
     */
    public function withSellerId($value)
    {
        $this->setSellerId($value);
        return $this;
    }

    /**
     * Get the value of the ShipmentId property.
     *
     * @return String ShipmentId.
     */
    public function getShipmentId()
    {
        return $this->_fields['ShipmentId']['FieldValue'];
    }

    /**
     * Set the value of the ShipmentId property.
     *
     * @param string shipmentId
     * @return this instance
     */
    public function setShipmentId($value)
    {
        $this->_fields['ShipmentId']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Check to see if ShipmentId is set.
     *
     * @return true if ShipmentId is set.
     */
    public function isSetShipmentId()
    {
                return !is_null($this->_fields['ShipmentId']['FieldValue']);
            }

    /**
     * Set the value of ShipmentId, return this.
     *
     * @param shipmentId
     *             The new value to set.
     *
     * @return This instance.
     */
    public function withShipmentId($value)
    {
        $this->setShipmentId($value);
        return $this;
    }

    /**
     * Check the value of IsPartnered.
     *
     * @return true if IsPartnered is set to true.
     */
    public function isIsPartnered()
    {
        return $this->_fields['IsPartnered']['FieldValue'];
    }

    /**
     * Get the value of the IsPartnered property.
     *
     * @return boolean IsPartnered.
     */
    public function getIsPartnered()
    {
        return $this->_fields['IsPartnered']['FieldValue'];
    }

    /**
     * Set the value of the IsPartnered property.
     *
     * @param bool isPartnered
     * @return this instance
     */
    public function setIsPartnered($value)
    {
        $this->_fields['IsPartnered']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Check to see if IsPartnered is set.
     *
     * @return true if IsPartnered is set.
     */
    public function isSetIsPartnered()
    {
                return !is_null($this->_fields['IsPartnered']['FieldValue']);
            }

    /**
     * Set the value of IsPartnered, return this.
     *
     * @param isPartnered
     *             The new value to set.
     *
     * @return This instance.
     */
    public function withIsPartnered($value)
    {
        $this->setIsPartnered($value);
        return $this;
    }

    /**
     * Get the value of the ShipmentType property.
     *
     * @return String ShipmentType.
     */
    public function getShipmentType()
    {
        return $this->_fields['ShipmentType']['FieldValue'];
    }

    /**
     * Set the value of the ShipmentType property.
     *
     * @param string shipmentType
     * @return this instance
     */
    public function setShipmentType($value)
    {
        $this->_fields['ShipmentType']['FieldValue'] = $value;
        return $this;
    }

    /**
     * Check to see if ShipmentType is set.
     *
     * @return true if ShipmentType is set.
     */
    public function isSetShipmentType()
    {
                return !is_null($this->_fields['ShipmentType']['FieldValue']);
            }

    /**
     * Set the value of ShipmentType, return this.
     *
     * @param shipmentType
     *             The new value to set.
     *
     * @return This instance.
     */
    public function withShipmentType($value)
    {
        $this->setShipmentType($value);
        return $this;
    }

}


text:
/* tslint:disable:no-jquery-raw-elements TODO(tslint): get rid of jquery html() calls */

namespace pxt.runner {

    export interface ClientRenderOptions {
        snippetClass?: string;
        signatureClass?: string;
        blocksClass?: string;
        blocksXmlClass?: string;
        projectClass?: string;
        blocksAspectRatio?: number;
        simulatorClass?: string;
        linksClass?: string;
        namespacesClass?: string;
        codeCardClass?: string;
        tutorial?: boolean;
        snippetReplaceParent?: boolean;
        simulator?: boolean;
        hex?: boolean;
        hexName?: string;
        pxtUrl?: string;
        packageClass?: string;
        package?: string;
        showEdit?: boolean;
        showJavaScript?: boolean; // default is to show blocks first
        downloadScreenshots?: boolean;
        split?: boolean; // split in multiple divs if too big
    }

    export interface WidgetOptions {
        showEdit?: boolean;
        showJs?: boolean;
        hideGutter?: boolean;
        run?: boolean;
        hexname?: string;
        hex?: string;
    }

    function appendBlocks($parent: JQuery, $svg: JQuery) {
        $parent.append($('
').append($svg));
    }

    function appendJs($parent: JQuery, $js: JQuery, woptions: WidgetOptions) {
        $parent.append($('
').append($js));
        if (typeof hljs !== "undefined")
            $js.find('code.highlight').each(function (i, block) {
                hljs.highlightBlock(block);
            });
    }

    function fillWithWidget(
        options: ClientRenderOptions,
        $container: JQuery,
        $js: JQuery,
        $svg: JQuery,
        decompileResult: DecompileResult,
        woptions: WidgetOptions = {}
    ) {
        const cdn = pxt.webConfig.commitCdnUrl
        let images = cdn + "images"
        let $h = $('
'
            + '

');
        let $c = $('

');
        let $menu = $h.find('.right.menu');

        const theme = pxt.appTarget.appTheme || {};
        if (woptions.showEdit && !theme.hideDocsEdit) { // edit button
            const $editBtn = $(`<a class="item" role="button" tabindex="0" aria-label="${lf("edit")}"><i role="presentation" aria-hidden="true" class="edit icon"></i></a>`).click(() => {
                decompileResult.package.compressToFileAsync(options.showJavaScript ? pxt.JAVASCRIPT_PROJECT_NAME : pxt.BLOCKS_PROJECT_NAME)
                    .done(buf => window.open(`${getEditUrl(options)}/#project:${ts.pxtc.encodeBase64(Util.uint8ArrayToString(buf))}`, 'pxt'))
            })
            $menu.append($editBtn);
        }

        if (options.showJavaScript || !$svg) {
            // blocks
            $c.append($js);

            // js menu
            if ($svg) {
                const $svgBtn = $(`<a class="item blocks" role="button" tabindex="0" aria-label="${lf("Blocks")}"><i role="presentation" aria-hidden="true" class="puzzle icon"></i></a>`).click(() => {
                    if ($c.find('.blocks')[0])
                        $c.find('.blocks').remove();
                    else {
                        if ($js) appendBlocks($js.parent(), $svg);
                        else appendBlocks($c, $svg);
                    }
                })
                $menu.append($svgBtn);
            }
        } else {
            // blocks
            $c.append($svg);

            // js menu
            if (woptions.showJs) {
                appendJs($c, $js, woptions);
            } else {
                const $jsBtn = $(`<a class="item js" role="button" tabindex="0" aria-label="${lf("JavaScript")}"><i role="presentation" aria-hidden="true" class="align left icon"></i></a>`).click(() => {
                    if ($c.find('.js')[0])
                        $c.find('.js').remove();
                    else {
                        if ($svg) appendJs($svg.parent(), $js, woptions);
                        else appendJs($c, $js, woptions);
                    }
                })
                $menu.append($jsBtn);
            }
        }

        // runner menu
        if (woptions.run && !theme.hideDocsSimulator) {
            let $runBtn = $(`<a class="item" role="button" tabindex="0" aria-label="${lf("run")}"><i role="presentation" aria-hidden="true" class="play icon"></i></a>`).click(() => {
                if ($c.find('.sim')[0])
                    $c.find('.sim').remove(); // remove previous simulators
                else {
                    let padding = '81.97%';
                    if (pxt.appTarget.simulator) padding = (100 / pxt.appTarget.simulator.aspectRatio) + '%';
                    let $embed = $(`

`);
                    $c.append($embed);
                }
            })
            $menu.append($runBtn);
        }

        if (woptions.hexname && woptions.hex) {
            let $hexBtn = $(`<a class="item" role="button" tabindex="0" aria-label="${lf("download")}"><i role="presentation" aria-hidden="true" class="download icon"></i></a>`).click(() => {
                BrowserUtils.browserDownloadBinText(woptions.hex, woptions.hexname, pxt.appTarget.compile.hexMimeType);
            })
            $menu.append($hexBtn);
        }

        let r = [$c];
        // don't add menu if empty
        if ($menu.children().length) r.push($h);

        // inject container
        $container.replaceWith(r as any);

        // download screenshots
        if (options.downloadScreenshots && woptions.hexname) {
            pxt.debug("Downloading screenshot for: " + woptions.hexname);
            let filename = woptions.hexname.substr(0, woptions.hexname.lastIndexOf('.'));
            let fontSize = window.getComputedStyle($svg.get(0).getElementsByClassName("blocklyText").item(0)).getPropertyValue("font-size");
            let svgElement = $svg.get(0) as any;
            let bbox = $svg.get(0).getBoundingClientRect();
            pxt.blocks.layout.svgToPngAsync(svgElement, 0, 0, bbox.width, bbox.height, 4)
                .done(uri => {
                    if (uri)
                        BrowserUtils.browserDownloadDataUri(
                            uri,
                            (name || `${pxt.appTarget.nickname || pxt.appTarget.id}-${filename}`) + ".png");
                });
        }
    }

    let renderQueue: {
        el: JQuery;
        source: string;
        options: blocks.BlocksRenderOptions;
        render: (container: JQuery, r: pxt.runner.DecompileResult) => void;
    }[] = [];
    function consumeRenderQueueAsync(): Promise<void> {
        const job = renderQueue.shift();
        if (!job) return Promise.resolve(); // done

        const { el, options, render } = job;
        return pxt.runner.decompileToBlocksAsync(el.text(), options)
            .then((r) => {
                const errors = r.compileJS && r.compileJS.diagnostics && r.compileJS.diagnostics.filter(d => d.category == pxtc.DiagnosticCategory.Error);
                if (errors && errors.length)
                    errors.forEach(diag => pxt.reportError("docs.decompile", "" + diag.messageText, { "code": diag.code + "" }));
                render(el, r);
                el.removeClass("lang-shadow");
                return consumeRenderQueueAsync();
            }).catch(e => {
                pxt.reportException(e);
                el.append($('
').addClass("ui segment warning").text(e.message));
                el.removeClass("lang-shadow");
                return consumeRenderQueueAsync();
            });
    }

    function renderNextSnippetAsync(cls: string,
        render: (container: JQuery, r: pxt.runner.DecompileResult) => void,
        options?: pxt.blocks.BlocksRenderOptions): Promise<void> {
        if (!cls) return Promise.resolve();

        let $el = $("." + cls).first();
        if (!$el[0]) return Promise.resolve();

        if (!options.emPixels) options.emPixels = 18;
        if (!options.layout) options.layout = pxt.blocks.BlockLayout.Align;
        options.splitSvg = true;

        renderQueue.push({ el: $el, source: $el.text(), options, render });
        $el.addClass("lang-shadow");
        $el.removeClass(cls);
        return renderNextSnippetAsync(cls, render, options);
    }

    function renderSnippetsAsync(options: ClientRenderOptions): Promise<void> {
        if (options.tutorial) {
            // don't render chrome for tutorials
            return renderNextSnippetAsync(options.snippetClass, (c, r) => {
                const s = r.blocksSvg;
                if (options.snippetReplaceParent) c = c.parent();
                const segment = $('
').append(s);
                c.replaceWith(segment);
            }, { package: options.package, snippetMode: false, aspectRatio: options.blocksAspectRatio });
        }

        let snippetCount = 0;
        return renderNextSnippetAsync(options.snippetClass, (c, r) => {
            const s = r.compileBlocks && r.compileBlocks.success ? $(r.blocksSvg) : undefined;
            const js = $('').text(c.text().trim());
            if (options.snippetReplaceParent) c = c.parent();
            const compiled = r.compileJS && r.compileJS.success;
            // TODO should this use pxt.outputName() and not pxtc.BINARY_HEX
            const hex = options.hex && compiled && r.compileJS.outfiles[pxtc.BINARY_HEX]
                ? r.compileJS.outfiles[pxtc.BINARY_HEX] : undefined;
            const hexname = `${appTarget.nickname || appTarget.id}-${options.hexName || ''}-${snippetCount++}.hex`;
            fillWithWidget(options, c, js, s, r, {
                showEdit: options.showEdit,
                run: options.simulator && compiled,
                hexname: hexname,
                hex: hex,
            });
        }, { package: options.package, aspectRatio: options.blocksAspectRatio });
    }

    function decompileCallInfo(stmt: ts.Statement): pxtc.CallInfo {
        if (!stmt || stmt.kind != ts.SyntaxKind.ExpressionStatement)
            return null;

        let estmt = stmt as ts.ExpressionStatement;
        if (!estmt.expression || estmt.expression.kind != ts.SyntaxKind.CallExpression)
            return null;

        let call = estmt.expression as ts.CallExpression;
        let info = (<any>call).callInfo as pxtc.CallInfo;

        return info;
    }

    function renderSignaturesAsync(options: ClientRenderOptions): Promise<void> {
        return renderNextSnippetAsync(options.signatureClass, (c, r) => {
            let cjs = r.compileJS;
            if (!cjs) return;
            let file = r.compileJS.ast.getSourceFile("main.ts");
            let info = decompileCallInfo(file.statements[0]);
            if (!info || !r.apiInfo) return;
            const symbolInfo = r.apiInfo.byQName[info.qName];
            if (!symbolInfo) return;
            let block = Blockly.Blocks[symbolInfo.attributes.blockId];
            let xml = block && block.codeCard ? block.codeCard.blocksXml : undefined;

            const s = xml ? $(pxt.blocks.render(xml)) : r.compileBlocks && r.compileBlocks.success ? $(r.blocksSvg) : undefined;
            let sig = info.decl.getText().replace(/^export/, '');
            sig = sig.slice(0, sig.indexOf('{')).trim() + ';';
            let js = $('').text(sig);
            if (options.snippetReplaceParent) c = c.parent();
            fillWithWidget(options, c, js, s, r, { showJs: true, hideGutter: true });
        }, { package: options.package, snippetMode: true, aspectRatio: options.blocksAspectRatio });
    }

    function renderBlocksAsync(options: ClientRenderOptions): Promise<void> {
        return renderNextSnippetAsync(options.blocksClass, (c, r) => {
            const s = r.blocksSvg;
            if (options.snippetReplaceParent) c = c.parent();
            const segment = $('
').append(s);
            c.replaceWith(segment);
        }, { package: options.package, snippetMode: true, aspectRatio: options.blocksAspectRatio });
    }

    function renderBlocksXmlAsync(opts: ClientRenderOptions): Promise<void> {
        if (!opts.blocksXmlClass) return Promise.resolve();
        const cls = opts.blocksXmlClass;
        function renderNextXmlAsync(cls: string,
            render: (container: JQuery, r: pxt.runner.DecompileResult) => void,
            options?: pxt.blocks.BlocksRenderOptions): Promise<void> {
            let $el = $("." + cls).first();
            if (!$el[0]) return Promise.resolve();

            if (!options.emPixels) options.emPixels = 18;
            options.splitSvg = true;
            return pxt.runner.compileBlocksAsync($el.text(), options)
                .then((r) => {
                    try {
                        render($el, r);
                    } catch (e) {
                        pxt.reportException(e)
                        $el.append($('
').addClass("ui segment warning").text(e.message));
                    }
                    $el.removeClass(cls);
                    return Promise.delay(1, renderNextXmlAsync(cls, render, options));
                })
        }

        return renderNextXmlAsync(cls, (c, r) => {
            const s = r.blocksSvg;
            if (opts.snippetReplaceParent) c = c.parent();
            const segment = $('
').append(s);
            c.replaceWith(segment);
        }, { package: opts.package, snippetMode: true, aspectRatio: opts.blocksAspectRatio });
    }

    function renderNamespaces(options: ClientRenderOptions): Promise<void> {
        if (pxt.appTarget.id == "core") return Promise.resolve();

        return pxt.runner.decompileToBlocksAsync('', options)
            .then((r) => {
                let res: pxt.Map<string> = {};
                const info = r.compileBlocks.blocksInfo;
                info.blocks.forEach(fn => {
                    const ns = (fn.attributes.blockNamespace || fn.namespace).split('.')[0];
                    if (!res[ns]) {
                        const nsn = info.apis.byQName[ns];
                        if (nsn && nsn.attributes.color)
                            res[ns] = nsn.attributes.color;
                    }
                });
                let nsStyleBuffer = '';
                Object.keys(res).forEach(ns => {
                    const color = res[ns] || '#dddddd';
                    nsStyleBuffer += `
                        span.docs.${ns.toLowerCase()} {
                            background-color: ${color} !important;
                            border-color: ${pxt.toolbox.fadeColor(color, 0.1, false)} !important;
                        }
                    `;
                })
                return nsStyleBuffer;
            })
            .then((nsStyleBuffer) => {
                Object.keys(pxt.toolbox.blockColors).forEach((ns) => {
                    const color = pxt.toolbox.blockColors[ns] as string;
                    nsStyleBuffer += `
                        span.docs.${ns.toLowerCase()} {
                            background-color: ${color} !important;
                            border-color: ${pxt.toolbox.fadeColor(color, 0.1, false)} !important;
                        }
                    `;
                })
                return nsStyleBuffer;
            })
            .then((nsStyleBuffer) => {
                // Inject css
                let nsStyle = document.createElement('style');
                nsStyle.id = "namespaceColors";
                nsStyle.type = 'text/css';
                let head = document.head || document.getElementsByTagName('head')[0];
                head.appendChild(nsStyle);
                nsStyle.appendChild(document.createTextNode(nsStyleBuffer));
            });
    }

    function renderInlineBlocksAsync(options: pxt.blocks.BlocksRenderOptions): Promise<void> {
        options = Util.clone(options);
        options.emPixels = 18;
        options.snippetMode = true;

        const $els = $(`:not(pre) > code`);
        let i = 0;
        function renderNextAsync(): Promise<void> {
            if (i >= $els.length) return Promise.resolve();
            const $el = $($els[i++]);
            const text = $el.text();
            const mbtn = /^(\|+)([^\|]+)\|+$/.exec(text);
            if (mbtn) {
                const mtxt = /^(([^\:\.]*?)[\:\.])?(.*)$/.exec(mbtn[2]);
                const ns = mtxt[2] ? mtxt[2].trim().toLowerCase() : '';
                const lev = mbtn[1].length == 1 ? `docs inlinebutton ${ns}` : `docs inlineblock ${ns}`;
                const txt = mtxt[3].trim();
                $el.replaceWith($(`<span class="${lev}"/>`).text(U.rlf(txt)));
                return renderNextAsync();
            }

            const m = /^\[([^\]]+)\]$/.exec(text);
            if (!m) return renderNextAsync();

            const code = m[1];
            return pxt.runner.decompileToBlocksAsync(code, options)
                .then(r => {
                    if (r.blocksSvg) {
                        let $newel = $('').append(r.blocksSvg);
                        const file = r.compileJS.ast.getSourceFile("main.ts");
                        const stmt = file.statements[0];
                        const info = decompileCallInfo(stmt);
                        if (info && r.apiInfo) {
                            const symbolInfo = r.apiInfo.byQName[info.qName];
                            if (symbolInfo && symbolInfo.attributes.help) {
                                $newel = $(`<a class="ui link"/>`).attr("href", `/reference/${symbolInfo.attributes.help}`).append($newel);
                            }
                        }
                        $el.replaceWith($newel);
                    }
                    return Promise.delay(1, renderNextAsync());
                });
        }

        return renderNextAsync();
    }

    function renderProjectAsync(options: ClientRenderOptions): Promise<void> {
        if (!options.projectClass) return Promise.resolve();

        function render(): Promise<void> {
            let $el = $("." + options.projectClass).first();
            let e = $el[0];
            if (!e) return Promise.resolve();

            $el.removeClass(options.projectClass);

            let id = pxt.Cloud.parseScriptId(e.innerText);
            if (id) {
                if (options.snippetReplaceParent) {
                    e = e.parentElement;
                    // create a new div to host the rendered code
                    let d = document.createElement("div");
                    e.parentElement.insertBefore(d, e);
                    e.parentElement.removeChild(e);

                    e = d;
                }
                return pxt.runner.renderProjectAsync(e, id)
                    .then(() => render());
            }
            else return render();
        }

        return render();
    }

    function renderLinksAsync(options: ClientRenderOptions, cls: string, replaceParent: boolean, ns: boolean): Promise<void> {
        return renderNextSnippetAsync(cls, (c, r) => {
            const cjs = r.compileJS;
            if (!cjs) return;
            const file = r.compileJS.ast.getSourceFile("main.ts");
            const stmts = file.statements.slice(0);
            const ul = $('
').addClass('ui cards');
            ul.attr("role", "listbox");
            const addItem = (card: pxt.CodeCard) => {
                if (!card) return;
                const mC = /^\/(v\d+)/.exec(card.url);
                const mP = /^\/(v\d+)/.exec(window.location.pathname);
                const inEditor = /#doc/i.test(window.location.href);
                if (card.url && !mC && mP && !inEditor) card.url = `/${mP[1]}/${card.url}`;
                ul.append(pxt.docs.codeCard.render(card, { hideHeader: true, shortName: true }));
            }
            stmts.forEach(stmt => {
                let info = decompileCallInfo(stmt);
                if (info && r.apiInfo && r.apiInfo.byQName[info.qName]) {
                    const attributes = r.apiInfo.byQName[info.qName].attributes;
                    let block = Blockly.Blocks[attributes.blockId];
                    if (ns) {
                        let ii = r.compileBlocks.blocksInfo.apis.byQName[info.qName];
                        let nsi = r.compileBlocks.blocksInfo.apis.byQName[ii.namespace];
                        addItem({
                            name: nsi.attributes.blockNamespace || nsi.name,
                            url: nsi.attributes.help || ("reference/" + (nsi.attributes.blockNamespace || nsi.name).toLowerCase()),
                            description: nsi.attributes.jsDoc,
                            blocksXml: block && block.codeCard
                                ? block.codeCard.blocksXml
                                : attributes.blockId
                                    ? `<xml xmlns="http://www.w3.org/1999/xhtml"><block type="${attributes.blockId}"></block></xml>`
                                    : undefined
                        })
                    } else if (block) {
                        let card = U.clone(block.codeCard) as pxt.CodeCard;
                        if (card) {
                            addItem(card);
                        }
                    } else {
                        // no block available here
                        addItem({
                            name: info.qName,
                            description: attributes.jsDoc,
                            url: attributes.help || undefined
                        })
                    }
                } else
                    switch (stmt.kind) {
                        case ts.SyntaxKind.ExpressionStatement:
                            let es = stmt as ts.ExpressionStatement;
                            switch (es.expression.kind) {
                                case ts.SyntaxKind.TrueKeyword:
                                case ts.SyntaxKind.FalseKeyword:
                                    addItem({
                                        name: "Boolean",
                                        url: "blocks/logic/boolean",
                                        description: lf("True or false values"),
                                        blocksXml: '<xml xmlns="http://www.w3.org/1999/xhtml"><block type="logic_boolean"><field name="BOOL">TRUE</field></block></xml>'
                                    });
                                    break;
                                default:
                                    pxt.debug(`card expr kind: ${es.expression.kind}`);
                                    break;
                            }
                            break;
                        case ts.SyntaxKind.IfStatement:
                            addItem({
                                name: ns ? "Logic" : "if",
                                url: "blocks/logic" + (ns ? "" : "/if"),
                                description: ns ? lf("Logic operators and constants") : lf("Conditional statement"),
                                blocksXml: '<xml xmlns="http://www.w3.org/1999/xhtml"><block type="controls_if"></block></xml>'
                            });
                            break;
                        case ts.SyntaxKind.WhileStatement:
                            addItem({
                                name: ns ? "Loops" : "while",
                                url: "blocks/loops" + (ns ? "" : "/while"),
                                description: ns ? lf("Loops and repetition") : lf("Repeat code while a condition is true."),
                                blocksXml: '<xml xmlns="http://www.w3.org/1999/xhtml"><block type="device_while"></block></xml>'
                            });
                            break;
                        case ts.SyntaxKind.ForOfStatement:
                            addItem({
                                name: ns ? "Loops" : "for of",
                                url: "blocks/loops" + (ns ? "" : "/for-of"),
                                description: ns ? lf("Loops and repetition") : lf("Repeat code for each item in a list."),
                                blocksXml: '<xml xmlns="http://www.w3.org/1999/xhtml"><block type="controls_for_of"></block></xml>'
                            });
                            break;
                        case ts.SyntaxKind.ForStatement:
                            let fs = stmt as ts.ForStatement;
                            // look for the 'repeat' loop style signature in the condition expression, explicitly: (let i = 0; i < X; i++)
                            // for loops will have the '<=' conditional.
                            let forloop = true;
                            if (fs.condition.getChildCount() == 3) {
                                forloop = !(fs.condition.getChildAt(0).getText() == "0" ||
                                    fs.condition.getChildAt(1).kind == ts.SyntaxKind.LessThanToken);
                            }
                            if (forloop) {
                                addItem({
                                    name: ns ? "Loops" : "for",
                                    url: "blocks/loops" + (ns ? "" : "/for"),
                                    description: ns ? lf("Loops and repetition") : lf("Repeat code for a given number of times using an index."),
                                    blocksXml: '<xml xmlns="http://www.w3.org/1999/xhtml"><block type="controls_simple_for"></block></xml>'
                                });
                            } else {
                                addItem({
                                    name: ns ? "Loops" : "repeat",
                                    url: "blocks/loops" + (ns ? "" : "/repeat"),
                                    description: ns ? lf("Loops and repetition") : lf("Repeat code for a given number of times."),
                                    blocksXml: '<xml xmlns="http://www.w3.org/1999/xhtml"><block type="controls_repeat_ext"></block></xml>'
                                });
                            }
                            break;
                        case ts.SyntaxKind.VariableStatement:
                            addItem({
                                name: ns ? "Variables" : "variable declaration",
                                url: "blocks/variables" + (ns ? "" : "/assign"),
                                description: ns ? lf("Variables") : lf("Assign a value to a named variable."),
                                blocksXml: '<xml xmlns="http://www.w3.org/1999/xhtml"><block type="variables_set"></block></xml>'
                            });
                            break;
                        default:
                            pxt.debug(`card kind: ${stmt.kind}`)
                    }
            })

            if (replaceParent) c = c.parent();
            c.replaceWith(ul)
        }, { package: options.package, aspectRatio: options.blocksAspectRatio })
    }

    function fillCodeCardAsync(c: JQuery, cards: pxt.CodeCard[], options: pxt.docs.codeCard.CodeCardRenderOptions): Promise<void> {
        if (!cards || cards.length == 0) return Promise.resolve();

        if (cards.length == 0) {
            let cc = pxt.docs.codeCard.render(cards[0], options)
            c.replaceWith(cc);
        } else {
            let cd = document.createElement("div")
            cd.className = "ui cards";
            cd.setAttribute("role", "listbox")
            cards.forEach(card => {
                // patch card url with version if necessary, we don't do this in the editor because that goes through the backend and passes the targetVersion then
                const mC = /^\/(v\d+)/.exec(card.url);
                const mP = /^\/(v\d+)/.exec(window.location.pathname);
                const inEditor = /#doc/i.test(window.location.href);
                if (card.url && !mC && mP && !inEditor) card.url = `/${mP[1]}${card.url}`;
                const cardEl = pxt.docs.codeCard.render(card, options);
                cd.appendChild(cardEl)
                // automitcally display package icon for approved packages
                if (card.cardType == "package") {
                    const repoId = pxt.github.parseRepoId((card.url || "").replace(/^\/pkg\//, ''));
                    if (repoId) {
                        pxt.packagesConfigAsync()
                            .then(pkgConfig => {
                                const status = pxt.github.repoStatus(repoId, pkgConfig);
                                switch (status) {
                                    case pxt.github.GitRepoStatus.Banned:
                                        cardEl.remove(); break;
                                    case pxt.github.GitRepoStatus.Approved:
                                        // update card info
                                        card.imageUrl = pxt.github.mkRepoIconUrl(repoId);
                                        // inject
                                        cd.insertBefore(pxt.docs.codeCard.render(card, options), cardEl);
                                        cardEl.remove();
                                        break;
                                }
                            })
                            .catch(e => {
                                // swallow
                                pxt.reportException(e);
                                pxt.debug(`failed to load repo ${card.url}`)
                            })
                    }
                }
            });
            c.replaceWith(cd);
        }

        return Promise.resolve();
    }

    function renderNextCodeCardAsync(cls: string, options: ClientRenderOptions): Promise<void> {
        if (!cls) return Promise.resolve();

        let $el = $("." + cls).first();
        if (!$el[0]) return Promise.resolve();

        $el.removeClass(cls);
        let cards: pxt.CodeCard[];
        try {
            let js: any = JSON.parse($el.text());
            if (!Array.isArray(js)) js = [js];
            cards = js as pxt.CodeCard[];
        } catch (e) {
            pxt.reportException(e);
            $el.append($('
').addClass("ui segment warning").text(e.messageText));
        }

        if (options.snippetReplaceParent) $el = $el.parent();
        return fillCodeCardAsync($el, cards, { hideHeader: true })
            .then(() => Promise.delay(1, renderNextCodeCardAsync(cls, options)));
    }

    function getRunUrl(options: ClientRenderOptions): string {
        return options.pxtUrl ? options.pxtUrl + '/--run' : pxt.webConfig && pxt.webConfig.runUrl ? pxt.webConfig.runUrl : '/--run';
    }

    function getEditUrl(options: ClientRenderOptions): string {
        const url = options.pxtUrl || pxt.appTarget.appTheme.homeUrl;
        return (url || "").replace(/\/$/, '');
    }

    function mergeConfig(options: ClientRenderOptions) {
        // additional config options
        if (!options.packageClass) return;
        $('.' + options.packageClass).each((i, c) => {
            let $c = $(c);
            let name = $c.text().split('\n').map(s => s.replace(/\s*/g, '')).filter(s => !!s).join(',');
            options.package = options.package ? `${options.package},${name}` : name;
            if (options.snippetReplaceParent) $c = $c.parent();
            $c.remove();
        });
        $('.lang-config').each((i, c) => {
            let $c = $(c);
            if (options.snippetReplaceParent) $c = $c.parent();
            $c.remove();
        })
    }

    function renderTypeScript(options?: ClientRenderOptions) {
        const woptions: WidgetOptions = {
            showEdit: !!options.showEdit,
            run: !!options.simulator
        }

        function render(e: Node, ignored: boolean) {
            if (typeof hljs !== "undefined") {
                $(e).text($(e).text().replace(/^\s*\r?\n/, ''))
                hljs.highlightBlock(e)
            }
            const opts = pxt.U.clone(woptions);
            if (ignored) {
                opts.run = false;
                opts.showEdit = false;
            }
            fillWithWidget(options, $(e).parent(), $(e), undefined, undefined, opts);
        }

        $('code.lang-typescript').each((i, e) => {
            render(e, false);
            $(e).removeClass('lang-typescript');
        });
        $('code.lang-typescript-ignore').each((i, e) => {
            $(e).removeClass('lang-typescript-ignore');
            $(e).addClass('lang-typescript');
            render(e, true);
            $(e).removeClass('lang-typescript');
        });
        $('code.lang-typescript-invalid').each((i, e) => {
            $(e).removeClass('lang-typescript-invalid');
            $(e).addClass('lang-typescript');
            render(e, true);
            $(e).removeClass('lang-typescript');
            $(e).parent('div').addClass('invalid');
            $(e).parent('div').prepend($("", { "class": "icon ban" }));
            $(e).addClass('invalid');
        });
        $('code.lang-typescript-valid').each((i, e) => {
            $(e).removeClass('lang-typescript-valid');
            $(e).addClass('lang-typescript');
            render(e, true);
            $(e).removeClass('lang-typescript');
            $(e).parent('div').addClass('valid');
            $(e).parent('div').prepend($("", { "class": "icon check" }));
            $(e).addClass('valid');
        });
    }

    export function renderAsync(options?: ClientRenderOptions): Promise<void> {
        pxt.analytics.enable();
        if (!options) options = {}
        if (options.pxtUrl) options.pxtUrl = options.pxtUrl.replace(/\/$/, '');
        if (options.showEdit) options.showEdit = !pxt.BrowserUtils.isIFrame();

        mergeConfig(options);
        if (options.simulatorClass) {
            // simulators
            $('.' + options.simulatorClass).each((i, c) => {
                let $c = $(c);
                let padding = '81.97%';
                if (pxt.appTarget.simulator) padding = (100 / pxt.appTarget.simulator.aspectRatio) + '%';
                let $sim = $(`

`)
                $sim.find("iframe").attr("src", getRunUrl(options) + "#nofooter=1&code=" + encodeURIComponent($c.text().trim()));
                if (options.snippetReplaceParent) $c = $c.parent();
                $c.replaceWith($sim);
            });
        }

        renderQueue = [];
        renderTypeScript(options);
        return Promise.resolve()
            .then(() => renderNextCodeCardAsync(options.codeCardClass, options))
            .then(() => renderNamespaces(options))
            .then(() => renderInlineBlocksAsync(options))
            .then(() => renderLinksAsync(options, options.linksClass, options.snippetReplaceParent, false))
            .then(() => renderLinksAsync(options, options.namespacesClass, options.snippetReplaceParent, true))
            .then(() => renderSignaturesAsync(options))
            .then(() => renderSnippetsAsync(options))
            .then(() => renderBlocksAsync(options))
            .then(() => renderBlocksXmlAsync(options))
            .then(() => renderProjectAsync(options))
            .then(() => consumeRenderQueueAsync())
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
org.owasp.html (OWASP Java HTML Sanitizer)
</TITLE>

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

org.owasp.html

Interfaces

AttributePolicy

ElementPolicy

Handler

HtmlChangeListener

HtmlSanitizer.Policy

HtmlStreamEventReceiver

Classes

AttributePolicy.Util

CssSchema

ElementPolicy.Util

FilterUrlByProtocolAttributePolicy

HtmlChangeReporter

HtmlPolicyBuilder

HtmlSanitizer

HtmlStreamRenderer

PolicyFactory

Sanitizers

TagBalancingHtmlStreamEventReceiver

Enums

HtmlTextEscapingMode

Annotation Types

TCB


text:
package battlesys;

import battlesys.exception.BattleTooLongException;
import battlesys.io.BattleSysLogger;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.Arrays;
import java.util.logging.Level;
import javax.imageio.ImageIO;
import org.jibble.simpleftp.*;

/**
 * Recording the complete course of battle and draw, save and upload the line graph
 * @author Peter
 */
public final class BattleRecord {

    private final int[][] result;
    private final String gTitle;
    //Maximum HP Value for the whole battle
    private int maxValue = 0;
    private int totalRoundNo = 0;
    private final String filePath;
    private final String teamName;
    private final PlayerList p;
    private static final int MAX_ROUND = 1000;

    /**
     * Constructor. Also set data for round zero.
     * @param s String of the file path where the battle record graphs
     * @param p Array of players involved in this battle
     * @param title The title of the graph generated
     */
    public BattleRecord(String s, PlayerList p, String title) {
        result = new int[p.size()][MAX_ROUND];
        filePath = s;
        gTitle = title;

        this.p = p;
        teamName = p.get(0).getTeamName();

        for (int i = 0; i < p.size(); ++i) {
            result[i][0] = p.get(i).getHp();
            if (p.get(i).getHp() > maxValue) {
                maxValue = p.get(i).getHp();
            }
        }
    }

    public BattleRecord(BattleRecord r) {
        result = new int[r.result.length][];
        for (int i = 0; i < r.result.length; ++i) {
            result[i] = Arrays.copyOf(r.result[i], r.result[i].length);
        }
        gTitle = r.gTitle;
        maxValue = r.maxValue;
        totalRoundNo = r.totalRoundNo;
        filePath = r.filePath;
        teamName = r.teamName;
        p = r.p;
    }

    /**
     * Set the battle record for all other rounds.
     * @param round Round number of the game being run
     * @throws BattleTooLongException if the battle is too long.
     */
    public void setBattleRecord(int round) {
        if (round >= MAX_ROUND){
            throw new BattleTooLongException();
        }
        for (int i = 0; i < p.size(); ++i) {
            //result[i][round] = Math.max(p[i].getHP(),0);
            result[i][round] = p.get(i).getHp();
            if (p.get(i).getHp() > maxValue) {
                maxValue = p.get(i).getHp();
            }
            if (round > totalRoundNo) {
                totalRoundNo = round;
            }
        }
    }

    /**
     * @return the complete network path to the image (to be) generated
     */
    public String getFilePath(){
        return "http://hksan.net/randomsurname/battleSysImage/results/" + Main.gametime + Main.hf + "/" + filePath.replace("%", "%25") + ".png";
    }

    /**
     * Generate the broken line graph for this record, save the image, upload it, and add the corresponding
     * IMG line.
     * @return network path to the file uploaded
     */
    public String generateGraph(File baseFilePath) {
        final int IMAGE_WIDTH = 640;
        final int IMAGE_HEIGHT = 480;

        BufferedImage graph = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT,
                java.awt.image.BufferedImage.TYPE_INT_RGB);
        Graphics2D drawer = graph.createGraphics();

        //title
        Font titleFont = new Font("微軟正黑體", java.awt.Font.PLAIN, 16);
        drawer.setFont(titleFont);
        String title = gTitle;
        drawer.drawString(title, (int) (IMAGE_WIDTH / 2 - titleFont.getStringBounds(title, drawer.getFontRenderContext()).getCenterX()), 30);

        //axis
        Font axisFont = new Font("微軟正黑體", java.awt.Font.PLAIN, 10);
        drawer.setFont(axisFont);
        //y-axis
        drawer.drawLine(30, 60, 30, 450);
        for (int y = 450, i = 0; y >= 60; y -= 39, i += maxValue / 10) {
            drawer.drawLine(30, y, 25, y);
            drawer.drawString(Integer.toString(i), 0, y + 5);
        }
        //x-axis
        drawer.drawLine(30, 450, 600, 450);
        int lastMark = -100; //Marking position of last mark, the first mark is always drawn
        for (int x = 30, i = 0; i <= totalRoundNo; i++, x += (600 - 30) / totalRoundNo) {
            //If the position is too close to the last mark, don't draw this mark - unless it is the last mark
            if (x - lastMark < 30 && i != totalRoundNo) {
                continue;
            }
            drawer.drawLine(x, 450, x, 455);
            drawer.drawString(Integer.toString(i), x - 5, 470);
            lastMark = x;
        }

        //broken lines for each players
        for (int k = 0; k < result.length; ++k) {
            if (p.get(k).getTeamName().equals(teamName)) {
                drawer.setColor(java.awt.Color.CYAN);
            } else {
                drawer.setColor(java.awt.Color.MAGENTA);
            }
            int lx = -100, ly = 0, x, y;
            for (int i = 0; i <= totalRoundNo; ++i) {
                x = 30 + (600 - 30) / totalRoundNo * i;
                //If the position is too close to the last mark, don't draw this mark - unless it is the last mark
                if (x - lx < 30 && i != totalRoundNo) {
                    continue;
                }
                y = (int) (450 - (450 - 60.0) / maxValue * result[k][i]);
                drawer.drawLine(x - 4, y - 4, x + 4, y + 4);
                drawer.drawLine(x - 4, y + 4, x + 4, y - 4);
                if (i != 0) {
                    drawer.drawLine(lx, ly, x, y);
                }
                lx = x;
                ly = y;
            }
            drawer.drawString(p.get(k).getName(), lx + 5, ly - 5);
        }

        //save image onto disk
        try {
            ImageIO.write(graph, "png", new File(baseFilePath, filePath + ".png"));
        } catch (IOException ex) {
            System.err.println("Error writing file: " + filePath + ".png: " + ex.getMessage());
        }

        //read ftp username and password if not yet done.
        if (ftpUser == null || ftpPass == null || ftpHost == null){
            try {
                BufferedReader r = new BufferedReader(new FileReader("ftp.txt"));
                ftpHost = r.readLine();
                ftpUser = r.readLine();
                ftpPass = r.readLine();
                r.close();
            } catch (IOException ex) {
                BattleSysLogger.getLogger().log(Level.WARNING, "FTP failed - cannot read necessary information from ftp.txt", ex);
            }
        }

        //save image onto FTP server
        try {
            SimpleFTP ftp = new SimpleFTP();

            ftp.connect(ftpHost, 21, ftpUser, ftpPass);

            ftp.bin();

            ftp.cwd("battleSysImage/results/" + Main.gametime + Main.hf);

            ftp.stor(new File(baseFilePath, filePath + ".png"));

            ftp.disconnect();
        } catch (IOException ex) {
            System.err.println("Error uploading file: " + filePath + ".png: " + ex.getMessage());
        }

        return getFilePath();
    }
    private static String ftpUser, ftpPass, ftpHost;
}


text:
require_relative "stack"

# Implement a queue using two stacks

class StackQueue
  class UnderflowError < StandardError; end

  def initialize
    @stack_1 = Stack.new
    @stack_2 = Stack.new
  end

  def enqueue(item)
    @stack_1.push(item)

    self
  end

  def dequeue
    fail UnderflowError, "Queue is empty" if empty?
    empty_stack_2
    @stack_2.pop
  end

  def peek
    empty_stack_2
    @stack_2.peek
  end

  def empty?
    @stack_1.empty? && @stack_2.empty?
  end

  def size
    @stack_1.size + @stack_2.size
  end

  private

  def empty_stack_2
    if @stack_2.empty?
      stack_swap
    end
  end

  def stack_swap
    until @stack_1.empty?
      @stack_2.push(@stack_1.pop)
    end
  end
end


text:
package com.github.jeanadrien.evrythng.scala.rest

import com.github.jeanadrien.evrythng.scala.json.EvtJsonProtocol._
import com.github.jeanadrien.evrythng.scala.json.{Ref, SecretKey}
import com.typesafe.scalalogging.LazyLogging

/**
  *
  */
class ApplicationContext(projectId : Ref, applicationId : Ref, val apiKey : String) extends
    Environment with AuthorizedEnvironment with LazyLogging {

    val secretKey = new {
        def read = get[SecretKey](s"/projects/${projectId}/applications/${applicationId}/secretKey")
    }

}


text:
package org.synyx.urlaubsverwaltung.application.vacationtype;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.annotation.Transactional;
import org.synyx.urlaubsverwaltung.TestContainersBase;

import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
import static org.synyx.urlaubsverwaltung.application.vacationtype.VacationCategory.HOLIDAY;
import static org.synyx.urlaubsverwaltung.application.vacationtype.VacationCategory.OVERTIME;
import static org.synyx.urlaubsverwaltung.application.vacationtype.VacationTypeColor.YELLOW;

@SpringBootTest
@Transactional
class VacationTypeEntityRepositoryIT extends TestContainersBase {

    @Autowired
    private VacationTypeRepository sut;

    @Test
    void findByActiveIsTrue() {

        sut.deleteAll();

        final VacationTypeEntity active = new VacationTypeEntity();
        active.setId(1);
        active.setActive(true);
        active.setCategory(HOLIDAY);
        active.setMessageKey("message.key.active");
        active.setColor(YELLOW);
        sut.save(active);

        final VacationTypeEntity inactive = new VacationTypeEntity();
        inactive.setId(2);
        inactive.setActive(false);
        inactive.setCategory(OVERTIME);
        inactive.setMessageKey("message.key.inactive");
        inactive.setColor(YELLOW);
        sut.save(inactive);

        final List<VacationTypeEntity> activeVacationTypes = sut.findByActiveIsTrue();
        assertThat(activeVacationTypes)
            .hasSize(1)
            .contains(active);
    }
}


text:
<?php

/*
 * This file is part of the Sami utility.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Sami\RemoteRepository;

class GitLabRemoteRepository extends AbstractRemoteRepository
{
    protected $url = 'https://gitlab.com/';

    public function __construct($name, $localPath, $url = '')
    {
        if (!empty($url)) {
            $this->url = $url;
        }

        parent::__construct($name, $localPath);
    }

    public function getFileUrl($projectVersion, $relativePath, $line)
    {
        $url = $this->url.$this->name.'/blob/'.str_replace('\\', '/', $projectVersion.$relativePath);

        if (null !== $line) {
            $url .= '#L'.(int) $line;
        }

        return $url;
    }
}