text:
namespace WootzJs.Compiler.JsAst
{
    public class JsBinaryExpression : JsExpression
    {
        public JsBinaryOperator Operator { get; set; }
        public JsExpression Left { get; set; }
        public JsExpression Right { get; set; }

        public JsBinaryExpression()
        {
        }

        public JsBinaryExpression(JsBinaryOperator @operator, JsExpression left, JsExpression right)
        {
            Operator = @operator;
            Left = left;
            Right = right;
        }

        public override void Accept(IJsVisitor visitor)
        {
            visitor.Visit(this);
        }

        public override T Accept<T>(IJsVisitor<T> visitor)
        {
            return visitor.Visit(this);
        }
    }
}


text:
package object;
//: object/Documentation2.java
/**
* <pre>
* System.out.println(new Date());
* </pre>
*/
public class Documentation2 {}
///:~

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
class Version20140227212614 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'.");

        $this->addSql("CREATE TABLE media_gallery (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, context VARCHAR(64) NOT NULL, default_format VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
        $this->addSql("CREATE TABLE media_gallery_media (id INT AUTO_INCREMENT NOT NULL, position INT NOT NULL, enabled TINYINT(1) NOT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
        $this->addSql("CREATE TABLE media_media (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, enabled TINYINT(1) NOT NULL, provider_name VARCHAR(255) NOT NULL, provider_status INT NOT NULL, provider_reference VARCHAR(255) NOT NULL, provider_metadata LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)', width INT DEFAULT NULL, height INT DEFAULT NULL, length NUMERIC(10, 0) DEFAULT NULL, content_type VARCHAR(64) DEFAULT NULL, content_size INT DEFAULT NULL, copyright VARCHAR(255) DEFAULT NULL, author_name VARCHAR(255) DEFAULT NULL, context VARCHAR(64) DEFAULT NULL, cdn_is_flushable TINYINT(1) DEFAULT NULL, cdn_flush_at DATETIME DEFAULT NULL, cdn_status INT DEFAULT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
    }

    public function down(Schema $schema)
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'.");

        $this->addSql("DROP TABLE media_gallery");
        $this->addSql("DROP TABLE media_gallery_media");
        $this->addSql("DROP TABLE media_media");
    }
}


text:
layout: page
title: "HIST 1061: The Rise and Fall of Ancient Rome Statistics"
comments: true
description: "blanks"
keywords: "HIST,1061,CU,Boulder"
---

#### GRADE AND WORKLOAD STATISTICS

**Percent withdrawn**: 2.0%

**Percent incomplete**: 0.12%

**Average grade** (4.0 scale): 3.14

**Standard deviation in grades** (4.0 scale): 0.22

**Average workload** (raw): 2.09

**Standard deviation in workload** (raw): 0.31

#### COURSE AND INSTRUCTOR RATINGS/INFORMATION

**Average course rating** (6 point scale): 4.51

**Standard deviation in course rating** (6 point scale): 0.47

**Average instructor rating** (6 point scale): 4.9

**Standard deviation in instructor rating** (6 point scale): 0.49

**Instructors**: Robert Hohlfelder, Nicole Jobin, Dirk Rohmann, Alfred Terrell

#### GENERAL CLASS INFORMATION

**Years provided**: Spring 2007, Fall 2007, Spring 2008, Spring 2009, Spring 2010, Spring 2011, Fall 2011, Spring 2012, Spring 2013, Spring 2014, Spring 2015, Spring 2016, Spring 2017

**Credits**: 3

**RAP/Honors class?** Neither

**Number of Sections**: 16

**Department**: HIST

**College**: College of Arts and Sciences

**A&S Division**: Arts and Humanities

**Level**: Lower

**Activity**: LEC - Lecture


text:
/**
 *
cc.TileMapAtlas is a subclass of cc.AtlasNode.

 *
 *
It knows how to render a map based of tiles.

 * The tiles must be in a .PNG format while the map must be a .TGA file.

 *
 *
For more information regarding the format, please see this post:

 * http://www.cocos2d-iphone.org/archives/27

 *
 *
All features from cc.AtlasNode are valid in cc.TileMapAtlas

 *
 *
IMPORTANT:

 * This class is deprecated. It is maintained for compatibility reasons only.

 * You SHOULD not use this class.

 * Instead, use the newer TMX file format: cc.TMXTiledMap

 * @class
 * @extends cc.AtlasNode
 */
cc.TileMapAtlas = cc.AtlasNode.extend(/** @lends cc.TileMapAtlas# */{
    _TGAInfo:null,
    indices:null,
    //numbers of tiles to render
    _itemsToRender:0,
    //x,y to altas dictionary
    _posToAtlasIndex:null,

    /**
     * @return {cc.ImageTGA}
     */
    getTGAInfo:function () {
        return this._TGAInfo;
    },

    /**
     * @param  {cc.ImageTGA} Var
     */
    setTGAInfo:function (Var) {
        this._TGAInfo = Var;
    },

    /**
     * Initializes a cc.TileMap with a tile file (atlas) with a map file and the width and height of each tile in points.

     * The file will be loaded using the TextureMgr.
     * @param {String} tile
     * @param {String} mapFile
     * @param {Number} tileWidth
     * @param {Number} tileHeight
     * @return {Boolean}
     * @example
     * //example
     * var tmpAtlas = new cc.TileMapAtlas();
     * tmpAtlas.initWithTileFile("hello.png", "hello.tga", 16, 16);
     */
    initWithTileFile:function (tile, mapFile, tileWidth, tileHeight) {
        this._loadTGAfile(mapFile);
        this._calculateItemsToRender();
        if (this.initWithTileFile(tile, tileWidth, tileHeight, this._itemsToRender)) {
            this._color = cc.white();
            this._posToAtlasIndex = {};
            this._updateAtlasValues();
            this.setContentSize(cc.size((this._TGAInfo.width * this._itemWidth),
                (this._TGAInfo.height * this._itemHeight)));
            return true;
        }
        return false;
    },

    /**
     *
Returns a tile from position x,y.

     * For the moment only channel R is used.

     * @param {cc.Point} position
     * @return {cc.Sprite}
     */
    tileAt:function (position) {
        cc.Assert(this._TGAInfo != null, "tgaInfo must not be nil");
        cc.Assert(position.x < this._TGAInfo.width, "Invalid position.x");
        cc.Assert(position.y < this._TGAInfo.height, "Invalid position.y");

        var colorPos = position.x * 3 + position.y * this._TGAInfo.width * 3;
        return new cc.Color3B(this._TGAInfo.imageData[colorPos], this._TGAInfo.imageData[colorPos + 1], this._TGAInfo.imageData[colorPos + 2]);
    },

    /**
     * Sets a tile at position x,y.
     * For the moment only channel R is used
     * @param {cc.Color3B} tile
     * @param {cc.Point} position
     */
    setTile:function (tile, position) {
        cc.Assert(this._TGAInfo != null, "tgaInfo must not be nil");
        cc.Assert(this._posToAtlasIndex != null, "posToAtlasIndex must not be nil");
        cc.Assert(position.x < this._TGAInfo.width, "Invalid position.x");
        cc.Assert(position.y < this._TGAInfo.height, "Invalid position.x");
        cc.Assert(tile.r != 0, "R component must be non 0");

        var colorPos = position.x * 3 + position.y * this._TGAInfo.width * 3;
        if (this._TGAInfo.imageData[colorPos] == 0)
            cc.log("cocos2d: Value.r must be non 0.");
        else {
            this._TGAInfo.imageData[colorPos] = tile.r;
            this._TGAInfo.imageData[colorPos + 1] = tile.g;
            this._TGAInfo.imageData[colorPos + 2] = tile.b;

            var num = this._posToAtlasIndex[position.x + "_" + position.y];
            this._updateAtlasValueAt(position, tile, num);
        }
    },

    /**
     * Dealloc the map from memory
     */
    releaseMap:function () {
        if (this._TGAInfo) {
            cc.tgaDestroy(this._TGAInfo);
        }
        this._TGAInfo = null;
    },

    _loadTGAfile:function (file) {
        cc.Assert(file != null, "file must be non-nil");

        //	//Find the path of the file
        //	NSBundle *mainBndl = [cc.Director sharedDirector].loadingBundle;
        //	cc.String *resourcePath = [mainBndl resourcePath];
        //	cc.String * path = [resourcePath stringByAppendingPathComponent:file];

        this._TGAInfo = cc.tgaLoad(cc.FileUtils.getInstance().fullPathFromRelativePath(file));
        if (this._TGAInfo.status != cc.TGA_OK) {
            cc.Assert(0, "TileMapAtlasLoadTGA : TileMapAtas cannot load TGA file");
        }
    },

    _calculateItemsToRender:function () {
        cc.Assert(this._TGAInfo != null, "tgaInfo must be non-nil");

        this._itemsToRender = 0;
        for (var x = 0; x < this._TGAInfo.width; x++) {
            for (var y = 0; y < this._TGAInfo.height; y++) {
                if (this._TGAInfo.imageData[x * 3 + y * this._TGAInfo.width * 3])
                    ++this._itemsToRender;
            }
        }
    },

    /**
     * @param {cc.Point|cc.GridSize} pos
     * @param {cc.Color3B} value
     * @param {Number} index
     * @private
     */
    _updateAtlasValueAt:function (pos, value, index) {
        var quad = new cc.V3F_C4B_T2F_Quad();

        var x = pos.x;
        var y = pos.y;
        var row = (value.r % this._itemsPerRow);
        var col = (value.r / this._itemsPerRow);

        var textureWide = this._textureAtlas.getTexture().getPixelsWide();
        var textureHigh = this._textureAtlas.getTexture().getPixelsHigh();

        var itemWidthInPixels = this._itemWidth * cc.CONTENT_SCALE_FACTOR();
        var itemHeightInPixels = this._itemHeight * cc.CONTENT_SCALE_FACTOR();

        var left, right, top, bottom;
        if (cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL) {
            left = (2 * row * itemWidthInPixels + 1) / (2 * textureWide);
            right = left + (itemWidthInPixels * 2 - 2) / (2 * textureWide);
            top = (2 * col * itemHeightInPixels + 1) / (2 * textureHigh);
            bottom = top + (itemHeightInPixels * 2 - 2) / (2 * textureHigh);
        } else {
            left = (row * itemWidthInPixels) / textureWide;
            right = left + itemWidthInPixels / textureWide;
            top = (col * itemHeightInPixels) / textureHigh;
            bottom = top + itemHeightInPixels / textureHigh;
        }

        quad.tl.texCoords.u = left;
        quad.tl.texCoords.v = top;
        quad.tr.texCoords.u = right;
        quad.tr.texCoords.v = top;
        quad.bl.texCoords.u = left;
        quad.bl.texCoords.v = bottom;
        quad.br.texCoords.u = right;
        quad.br.texCoords.v = bottom;

        quad.bl.vertices.x = (x * this._itemWidth);
        quad.bl.vertices.y = (y * this._itemHeight);
        quad.bl.vertices.z = 0.0;
        quad.br.vertices.x = (x * this._itemWidth + this._itemWidth);
        quad.br.vertices.y = (y * this._itemHeight);
        quad.br.vertices.z = 0.0;
        quad.tl.vertices.x = (x * this._itemWidth);
        quad.tl.vertices.y = (y * this._itemHeight + this._itemHeight);
        quad.tl.vertices.z = 0.0;
        quad.tr.vertices.x = (x * this._itemWidth + this._itemWidth);
        quad.tr.vertices.y = (y * this._itemHeight + this._itemHeight);
        quad.tr.vertices.z = 0.0;

        var color = new cc.Color4B(this._color.r, this._color.g, this._color.b, this._opacity);
        quad.tr.colors = color;
        quad.tl.colors = color;
        quad.br.colors = color;
        quad.bl.colors = color;

        this._textureAtlas.updateQuad(quad, index);
    },

    _updateAtlasValues:function () {
        cc.Assert(this._TGAInfo != null, "tgaInfo must be non-nil");

        var total = 0;
        for (var x = 0; x < this._TGAInfo.width; x++) {
            for (var y = 0; y < this._TGAInfo.height; y++) {
                if (total < this._itemsToRender) {
                    var colorPos = x * 3 + y * this._TGAInfo.width * 3;
                    var value = new cc.Color3B(this._TGAInfo.imageData[colorPos], this._TGAInfo.imageData[colorPos + 1], this._TGAInfo.imageData[colorPos + 2]);
                    if (value.r != 0) {
                        this._updateAtlasValueAt(cc.g(x, y), value, total);
                        this._posToAtlasIndex[x + "_" + y] = total;
                        total++;
                    }
                }
            }
        }
    }
});

/**
 *
Creates a cc.TileMap with a tile file (atlas) with a map file and the width and height of each tile in points.

 * The tile file will be loaded using the TextureMgr.

 * @param {String} tile
 * @param {String} mapFile
 * @param {Number} tileWidth
 * @param {Number} tileHeight
 * @return {Boolean|Null}
 * @example
 * //example
 * var tmpAtlas = new cc.TileMapAtlas();
 *  tmpAtlas.initWithTileFile("hello.png", "hello.tga", 16, 16);
 */
cc.TileMapAtlas.create = function (tile, mapFile, tileWidth, tileHeight) {
    var ret = new cc.TileMapAtlas();
    if (ret.initWithTileFile(tile, mapFile, tileWidth, tileHeight)) {
        return ret;
    }
    return null;
};


text:
package org.linqs.psl.test;

import org.linqs.psl.model.predicate.model.SupportingModel;

import java.io.File;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;

public abstract class NeuralPSLTest extends PSLBaseTest {
    public static final String SAVED_MODELS_DIRNAME = "saved-models";

    public static final String MODELS_DIRNAME = "model";

    public static final String DATA_DIRNAME = "data";
    public static final String FEATURES_FILENAME = "features.txt";
    public static final String LABELS_FILENAME = "labels.txt";
    public static final String OBSERVATIONS_FILENAME = "observations.txt";

    public static final String SIGN_MODEL_ID = "sign";

    protected final String SAVED_MODELS_DIR;

    public NeuralPSLTest() {
        SAVED_MODELS_DIR = Paths.get(RESOURCE_DIR, SAVED_MODELS_DIRNAME).toString();
    }

    public Map<String, String> getModelConfig(String modelID) {
        Map<String, String> config = new HashMap<String, String>();

        config.put(SupportingModel.CONFIG_MODEL, Paths.get(SAVED_MODELS_DIR, modelID, MODELS_DIRNAME).toString());

        config.put(SupportingModel.CONFIG_FEATURES, Paths.get(SAVED_MODELS_DIR, modelID, DATA_DIRNAME, FEATURES_FILENAME).toString());
        config.put(SupportingModel.CONFIG_LABELS, Paths.get(SAVED_MODELS_DIR, modelID, DATA_DIRNAME, LABELS_FILENAME).toString());
        config.put(SupportingModel.CONFIG_OBSERVATIONS, Paths.get(SAVED_MODELS_DIR, modelID, DATA_DIRNAME, OBSERVATIONS_FILENAME).toString());

        return config;
    }
}


text:
module Types
  class MergeRequestType < BaseObject
    graphql_name 'MergeRequest'

    authorize :read_merge_request

    expose_permissions Types::PermissionTypes::MergeRequest

    present_using MergeRequestPresenter

    field :id, GraphQL::ID_TYPE, null: false
    field :iid, GraphQL::ID_TYPE, null: false
    field :title, GraphQL::STRING_TYPE, null: false
    field :description, GraphQL::STRING_TYPE, null: true
    field :state, MergeRequestStateEnum, null: false
    field :created_at, Types::TimeType, null: false
    field :updated_at, Types::TimeType, null: false
    field :source_project, Types::ProjectType, null: true
    field :target_project, Types::ProjectType, null: false
    # Alias for target_project
    field :project, Types::ProjectType, null: false
    field :project_id, GraphQL::INT_TYPE, null: false, method: :target_project_id
    field :source_project_id, GraphQL::INT_TYPE, null: true
    field :target_project_id, GraphQL::INT_TYPE, null: false
    field :source_branch, GraphQL::STRING_TYPE, null: false
    field :target_branch, GraphQL::STRING_TYPE, null: false
    field :work_in_progress, GraphQL::BOOLEAN_TYPE, method: :work_in_progress?, null: false
    field :merge_when_pipeline_succeeds, GraphQL::BOOLEAN_TYPE, null: true
    field :diff_head_sha, GraphQL::STRING_TYPE, null: true
    field :merge_commit_sha, GraphQL::STRING_TYPE, null: true
    field :user_notes_count, GraphQL::INT_TYPE, null: true
    field :should_remove_source_branch, GraphQL::BOOLEAN_TYPE, method: :should_remove_source_branch?, null: true
    field :force_remove_source_branch, GraphQL::BOOLEAN_TYPE, method: :force_remove_source_branch?, null: true
    field :merge_status, GraphQL::STRING_TYPE, null: true
    field :in_progress_merge_commit_sha, GraphQL::STRING_TYPE, null: true
    field :merge_error, GraphQL::STRING_TYPE, null: true
    field :allow_collaboration, GraphQL::BOOLEAN_TYPE, null: true
    field :should_be_rebased, GraphQL::BOOLEAN_TYPE, method: :should_be_rebased?, null: false
    field :rebase_commit_sha, GraphQL::STRING_TYPE, null: true
    field :rebase_in_progress, GraphQL::BOOLEAN_TYPE, method: :rebase_in_progress?, null: false
    field :merge_commit_message, GraphQL::STRING_TYPE, method: :default_merge_commit_message, null: true, deprecation_reason: "Renamed to defaultMergeCommitMessage"
    field :default_merge_commit_message, GraphQL::STRING_TYPE, null: true
    field :merge_ongoing, GraphQL::BOOLEAN_TYPE, method: :merge_ongoing?, null: false
    field :source_branch_exists, GraphQL::BOOLEAN_TYPE, method: :source_branch_exists?, null: false
    field :mergeable_discussions_state, GraphQL::BOOLEAN_TYPE, null: true
    field :web_url, GraphQL::STRING_TYPE, null: true
    field :upvotes, GraphQL::INT_TYPE, null: false
    field :downvotes, GraphQL::INT_TYPE, null: false
    field :subscribed, GraphQL::BOOLEAN_TYPE, method: :subscribed?, null: false

    field :head_pipeline, Types::Ci::PipelineType, null: true, method: :actual_head_pipeline
    field :pipelines, Types::Ci::PipelineType.connection_type,
          resolver: Resolvers::MergeRequestPipelinesResolver
  end
end


text:
layout: page
title: Ice Wild Software Dinner
date: 2016-05-24
author: Sharon Ingram
tags: weekly links, java
status: published
summary: Suspendisse potenti. Nullam augue ante, dapibus et volutpat feugiat.
banner: images/banner/leisure-03.jpg
booking:
  startDate: 01/03/2016
  endDate: 01/05/2016
  ctyhocn: TOLPGHX
  groupCode: IWSD
published: true
---
Praesent convallis ante sit amet venenatis luctus. Nunc ac sodales purus, et dignissim nisi. Donec varius vehicula massa maximus bibendum. Vivamus in auctor nunc. Maecenas justo sem, laoreet non placerat vel, tempus at odio. Proin porta sollicitudin lacus et condimentum. In egestas nibh dignissim sem consectetur semper. Maecenas eu consequat est, eu molestie nibh. Pellentesque mollis enim non sodales posuere. Phasellus metus risus, auctor in metus vitae, feugiat dictum purus. In efficitur imperdiet elementum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ut nunc a lectus blandit luctus.

* Aenean et ipsum eget sapien ullamcorper sollicitudin non nec lorem
* Quisque ut dui ac ex ultricies euismod sed eget odio
* Mauris quis nunc et felis egestas euismod ullamcorper et quam.

Nulla nunc metus, volutpat eget egestas a, elementum ac urna. Vivamus sed bibendum arcu, ac malesuada orci. Phasellus vulputate elit quis sodales pellentesque. Nunc laoreet convallis quam sed gravida. Phasellus ex diam, malesuada et placerat quis, rhoncus tincidunt orci. Quisque sollicitudin posuere consequat. Vivamus et nunc vel felis imperdiet placerat tristique porta elit. Duis venenatis sem quis pulvinar cursus. Donec nec scelerisque diam, et bibendum nunc. Suspendisse sapien dui, venenatis ac ex et, pretium convallis elit. Etiam ut lobortis nulla. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Praesent consequat felis nec sodales volutpat. Ut id blandit erat.


text:
begin;

update ncaa_pbp.box_scores_pitching
set position=''
where position is null;

commit;


text:
import os
import sys

# import all names from core conf:
#   sphinx injects a global named `tags` into the conf.py namespace. Therefore, simply importing all names from the core config
#   file (`from conf_core import *`) does not suffice because core_conf.py then lacks access to this global. Instead we follow a
#   similar approach to sphinx itself (although a bit simpler because we're just proxying): exec the core config file with a
#   shared globals namespace, both so conf_core.py can access the tags global and so all names from conf_core.py get get bound
#   to this module's namespace.
#   (sphinx implementation for reference: https://github.com/sphinx-doc/sphinx/blob/799385f5558a888d1a143bf703d06b66d6717fe4/sphinx/config.py#L329)
core_conf_file: str = os.path.abspath(os.path.join(os.path.dirname(__file__), "conf_core.py"))
with open(core_conf_file, "r") as f:
    code = compile(f.read(), core_conf_file, "exec")
    # share this file's globals namespace (both for reading and for writing)
    exec(code, globals())

# override exclude patterns: don't exclude anything for product docs
exclude_patterns = []


text:
#!/bin/bash

# Pass --help option for getting useful information

set -o nounset
set -o errexit

function show_help {
	echo "Usage: update_site_scripts.sh mode version path/to/private/key <key-url mapping with windows offline-online first, linux32 - second and linux64 - last>"
	echo "Example: update_site_scripts.sh latest 3.0.0-rc2 TRIKStudio-3.0.0-rc2-offline-windows-installer https://docs.google.com/file/d/0B-NmiVtuyhyiWkgycTkzWXJ3TVk TRIKStudio-3.0.0-rc2-online-windows-installer https://docs.google.com/file/d/0B-NmiVtuyhyiMEU0WjR0MEp1YkU"
	echo ""
	echo "Clones http://github.com/qreal/tools, edits siteScripts folder contents an pushes back changes to the remote repository and then uploads to production site server."
	echo "The first argument is mode: 'latest' or 'experimental'. In the latest mode all latest references will be updated to windows offline installer. In the exprimental mode latest link will not be replaced but experimental will be."
	echo "Version must be specified in '3.0.0-rc2' format."
	echo "In the tails there must be 2N arguments where N is uploaded installers count. The first argument of each pair is the key of linksMap, second is an installer URL."
	echo "Windows offline installer pair must go first (it will be written into latest and/or experimental sections)."
	echo "Code will be pushed using ~/.ssh/id_rsa. For uploading downloads couter to production server however another ssh key must be used."
	echo "It must be specified as the third parameter. Public key may be stored next to private one and must be named with the same name as private but with .pub suffix."
	echo "~/.ssh/id_rsa and ~/.ssh/id_rsa.pub may be temporaly renamed into ~/.ssh/old_id_rsa and ~/.ssh/old_id_rsa.pub during the uploading process."
	exit 1;
}

[ "$#" -lt 5 ] && show_help || :

echo "Updating site scripts..."

MODE=$1
VERSION=$2
SSH_KEY=$3
TOOLS_DIR=$PWD/temp_tools_clone
DOWNLOADS_COUNTER=$TOOLS_DIR/siteScripts/downloadCounter.html
REMOTE_SERVER=hosting_jzuken@neon.locum.ru:/home/hosting_jzuken/projects/qreal/htdocs

shift 3

WINDOWS_OFFLINE_LINK=$2
LINUX_32_OFFLINE_LINK=$6
LINUX_64_OFFLINE_LINK=${10}

rm -rf $TOOLS_DIR
git clone git@github.com:qreal/tools.git $TOOLS_DIR
cd $TOOLS_DIR

function create_map {

	RESULT="\n"
	while (( "$#" )); do

		RESULT=$RESULT"\n\ \ \ \ \ \ \ \ \ \ \ \ linksMap[\"$1\"] = \"$2\";"
		shift 2

	done

	echo "$RESULT";

}

function replace_slashes { echo $1 | sed 's/\//\\\//g'; }
function entry_to_find { echo "linksMap\\[\"$1\"\\] = `replace_slashes $2`;"; }
function entry_to_replace { echo "linksMap[\"$1\"] = \"`replace_slashes \"$2\"`"; }
function links_map_pattern { echo "s/`entry_to_find $1 '".*"'`/`entry_to_replace $1 \"$2\";`/g"; }
function main_pattern { links_map_pattern $1 $2'";'; }
function last_pattern { links_map_pattern linux-x64-experimental "$LINUX_64_OFFLINE_LINK\";`echo '\n';create_map $@`"; }
function latest_pattern { main_pattern trikStudio-latest $WINDOWS_OFFLINE_LINK;main_pattern latest $WINDOWS_OFFLINE_LINK;main_pattern linux-x86-latest $LINUX_32_OFFLINE_LINK;main_pattern linux-x64-latest $LINUX_64_OFFLINE_LINK; }
function experimental_pattern { main_pattern experimental $WINDOWS_OFFLINE_LINK;main_pattern linux-x86-experimental $LINUX_32_OFFLINE_LINK;last_pattern $@ ; }

function href_pattern { echo "s//<a href='`replace_slashes $WINDOWS_OFFLINE_LINK`'>/g"; }

if [[ $MODE == "latest" ]]; then
	echo "Replacing all latest links to $WINDOWS_OFFLINE_LINK..."
	SED_PATTERN=`href_pattern;latest_pattern;experimental_pattern $@`
else
	echo "Replacing only experimental link to $WINDOWS_OFFLINE_LINK..."
	SED_PATTERN=`experimental_pattern $@`
fi

sed -i "$SED_PATTERN" $DOWNLOADS_COUNTER

git add $DOWNLOADS_COUNTER
git commit -m "Downloads conter extended with version TRIKStudio-$VERSION"

CURRENT_PRIVATE_KEY=~/.ssh/id_rsa
CURRENT_PUBLIC_KEY=$CURRENT_PRIVATE_KEY.pub
TEMP_PRIVATE_KEY=~/.ssh/old_id_rsa
TEMP_PUBLIC_KEY=$TEMP_PRIVATE_KEY.pub
if [[ -f $CURRENT_PRIVATE_KEY ]]; then
	echo "Temporary renaming $TEMP_PRIVATE_KEY to $CURRENT_PRIVATE_KEY"
	mv $CURRENT_PRIVATE_KEY $TEMP_PRIVATE_KEY
	[ -f $CURRENT_PUBLIC_KEY ] && mv $CURRENT_PUBLIC_KEY $TEMP_PUBLIC_KEY || :
fi
echo "Using $SSH_KEY for uploading to the production server..."
cp $SSH_KEY $CURRENT_PRIVATE_KEY
chmod 700 $CURRENT_PRIVATE_KEY
[ -f $SSH_KEY.pub ] && cp $SSH_KEY.pub $CURRENT_PUBLIC_KEY || :

scp -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null $DOWNLOADS_COUNTER $REMOTE_SERVER

if [[ -f $TEMP_PRIVATE_KEY ]]; then
	echo "Restoring old ssh key"
	mv $TEMP_PRIVATE_KEY $CURRENT_PRIVATE_KEY
	[ -f $TEMP_PUBLIC_KEY ] && mv $TEMP_PUBLIC_KEY $CURRENT_PUBLIC_KEY || :
else
	rm $CURRENT_PRIVATE_KEY
	[ -f $CURRENT_PUBLIC_KEY ] && rm $CURRENT_PUBLIC_KEY || :
fi

echo "Pushing changes to qreal/tools repository..."
git push origin master
echo "Removing temporary files..."
cd ..
rm -rf $TOOLS_DIR
echo "Site scripts updated."


text:
import { browser, by, element } from 'protractor';

export class CompleteGuideDePage {
  navigateTo() {
    return browser.get('/');
  }

  getParagraphText() {
    return element(by.css('app-root h1')).getText();
  }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.guutong.chapter2;

/**
 *
 * @author GuutonG
 */
public class StringPattern {
    public static void main(String[] args) {
        String input = "1234-5647-890";
        String split[] = input.split("-");
        System.out.println(split[0]+","+split[1]+","+split[2]);
        System.out.println(split[0].length()+","+split[1].length()+","+split[2].length());
    }
}


text:
import {Component} from 'react';
import {connect} from 'react-redux';

import {loadCookie, loadLoginInfo} from './features/auth/actions';
import {loadSchema} from './features/schema/actions';
import {userSelector, loginInfoSelector} from './features/auth/selectors';

class App extends Component {
  componentWillMount() {
    this.props.loadCookie();
    this.props.loadLoginInfo();
  }

  componentWillReceiveProps(nextProps) {
    if (nextProps.user && nextProps.user !== this.props.user) {
      this.props.loadSchema();
      return;
    }

    if (nextProps.loginInfo !== this.props.loginInfo && !nextProps.loginInfo.required) {
      this.props.loadSchema();
    }
  }

  render() {
    return this.props.children;
  }
}

const mapStateToProps = state =>
({
  user: userSelector(state),
  loginInfo: loginInfoSelector(state),
});

export default connect(mapStateToProps, {loadCookie, loadLoginInfo, loadSchema})(App);


text:
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Data.Entity;
using MVCForum.Data.Context;
using MVCForum.Domain.DomainModel;
using MVCForum.Domain.Interfaces;
using MVCForum.Domain.Interfaces.Repositories;
using MVCForum.Utilities;

namespace MVCForum.Data.Repositories
{
    public class PermissionRepository : IPermissionRepository
    {
        private readonly MVCForumContext _context;

        public PermissionRepository(IMVCForumContext context)
        {
            _context = context as MVCForumContext;
        }

        public IEnumerable<Permission> GetAll()
        {
            return _context.Permission
                .OrderBy(x => x.Name)
                .ToList();
        }

        public Permission Add(Permission permission)
        {
            return _context.Permission.Add(permission);
        }

        public Permission Get(Guid id)
        {
            return _context.Permission.FirstOrDefault(x => x.Id == id);
        }

        public void Delete(Permission item)
        {
            _context.Permission.Remove(item);
        }

        public void Update(Permission item)
        {
            // Check there's not an object with same identifier already in context
            if (_context.Permission.Local.Select(x => x.Id == item.Id).Any())
            {
                throw new ApplicationException("Object already exists in context - you do not need to call Update. Save occurs on Commit");
            }
            _context.Entry(item).State = EntityState.Modified;
        }
    }
}


text:
<?php

namespace TheIconic\Synopsis\Formatter;

use TheIconic\Synopsis\AbstractSynopsis;

/**
 * formats a synopsis tree in a format suitable for log files
 *
 * @package TheIconic\Synopsis\Formatter
 */
class LogFileFormatter extends AbstractFormatter
{
    /**
     * @var int the current level in the tree
     */
    protected $level = 0;

    /**
     * formats a synopsis object
     *
     * @param AbstractSynopsis $synopsis
     * @param string|null $key
     * @return string
     */
    public function format(AbstractSynopsis $synopsis, $key = null)
    {
        $formatted = array();

        if ($synopsis->hasChildren()) {
            $formatted[] = $this->formatTreeSynopsis($synopsis, $key);
        } else {
            $formatted[] = $this->formatScalarSynopsis($synopsis, $key);
        }

        return implode(PHP_EOL, $formatted);
    }

    /**
     * formats a synopsis object with children
     *
     * @param AbstractSynopsis $synopsis
     * @param string|null $key
     * @return string
     */
    protected function formatTreeSynopsis(AbstractSynopsis $synopsis, $key)
    {
        $formatted = array(
            sprintf('%s (%s [%d]): %s', $key, $synopsis->getType(), $synopsis->getLength(), $synopsis->getValue()),
        );

        $this->level++;
        foreach ($synopsis->getChildren() as $k => $v) {
            $formatted[] = str_repeat(' ', $this->level * 2) . $this->format($v, $k);
        }
        $this->level--;

        return implode(PHP_EOL, $formatted);
    }

    /**
     * formats a synopsis object without children
     *
     * @param AbstractSynopsis $synopsis
     * @param $key
     * @return string
     */
    protected function formatScalarSynopsis(AbstractSynopsis $synopsis, $key)
    {
        return sprintf('%s (%s [%d]): %s', $key, $synopsis->getType(), $synopsis->getLength(), $synopsis->getValue());
    }
}


text:
'use strict';

angular.module('seacloudsDashboard.projects', ['ngRoute', 'ngFitText',
    'seacloudsDashboard.projects.project'])
    .config(['$routeProvider', function ($routeProvider) {
        $routeProvider.when('/projects', {
            templateUrl: 'projects/projects.html'
        })
    }])
    .controller('ProjectsCtrl', function ($scope, $interval) {

        $scope.isViewActive = function (route) {
            return $location.path().startsWith(route);
        };
        $scope.Page.setTitle('SeaClouds Dashboard - SeaCloudsApi overview');

        $scope.projects = [];
        $scope.updateFunction = undefined;

        $scope.SeaCloudsApi.getProjects().
            success(function (projects) {
                $scope.projects = projects;
            }).
            error(function () {
                //TODO: Handle the error better than showing a notification
                notificationService.error("Unable to retrieve the projects");

            })

        $scope.updateFunction = $interval(function () {
            $scope.SeaCloudsApi.getProjects().
                success(function (projects) {
                    $scope.projects = projects;
                }).
                error(function () {
                    //TODO: Handle the error better than showing a notification
                    notificationService.error("Unable to retrieve the projects");

                })
        }, 5000);

        $scope.$on('$destroy', function () {
            if($scope.updateFunction){
                $interval.cancel($scope.updateFunction);
            }
        });

        var appUp = "The application is up";
        var appDown = "The application is down";
        $scope.getUpTooltip = function (project){
            if(project.serviceUp){
                return appUp;
            }else{
                return appDown;
            }
        }

        var slaOK = "The application is satisfying the SLA's";
        var slaFAILED = "There are some violations in SLA's";

        $scope.getSLATooltip = function (project) {
            if (project.slaStatus == "OK") {
                return slaOK;
            } else {
                return slaFAILED;
            }
        }

        var statusOK = "The application is running";
        var statusSTARTING = "The application is starting";
        var statusRECONFIGURING = "The application needs to be reconfigured";
        var statusFAILURE = "The application failed during the execution";

        $scope.getStatusTooltip = function (project) {
            if (project.serviceState == "running") {
                return statusOK;
            } else if (project.serviceState == "starting") {
                return statusSTARTING;
            } else if (project.serviceState == "reconfiguring") {
                return statusRECONFIGURING;
            } else {
                return statusFAILURE;
            }

        }
    });


text:
/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later
 * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
 */
package org.hibernate.query.sqm.tree.expression;

import javax.persistence.metamodel.Type;

/**
 * Indicates a problem during {@link ImpliedTypeSqmExpression#impliedType(Type)} execution
 *
 * @author Steve Ebersole
 */
public class TypeInferenceException extends RuntimeException {
	public TypeInferenceException(String message) {
		super( message );
	}

	public TypeInferenceException(String message, Throwable cause) {
		super( message, cause );
	}
}


text:
/**
 * Modal dialog prompts
 * @module Ink.UI.Modal_1
 * @version 1
 */
Ink.createModule('Ink.UI.Modal', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.Dom.Css_1','Ink.Dom.Element_1','Ink.Dom.Selector_1','Ink.Util.Array_1'], function(Common, Event, Css, InkElement, Selector, InkArray ) {
    'use strict';

    var opacitySupported = (function (div) {
        div.style.opacity = 'invalid';
        return div.style.opacity !== 'invalid';
    }(InkElement.create('div', {style: 'opacity: 1'})));

    /**
     * @class Ink.UI.Modal
     * @constructor
     * @version 1
     * @param {String|DOMElement}   selector                        Element or ID
     * @param {Object}              [options]                       Options object, containing:
     * @param {String}              [options.width]                 Default/Initial width. Ex: '600px'
     * @param {String}              [options.height]                Default/Initial height. Ex: '400px'
     * @param {String}              [options.shadeClass]            Custom class to be added to the div.ink-shade
     * @param {String}              [options.modalClass]            Custom class to be added to the div.ink-modal
     * @param {String}              [options.trigger]               CSS Selector for target elements that will trigger the Modal.
     * @param {Boolean}             [options.autoDisplay]           Displays the Modal automatically when constructed.
     * @param {String}              [options.markup]                Markup to be placed in the Modal when created
     * @param {Function}            [options.onShow]                Callback function to run when the Modal is opened.
     * @param {Function}            [options.onDismiss]             Callback function to run when the Modal is closed. Return `false` to cancel dismissing the Modal.
     * @param {Boolean}             [options.closeOnClick]          Flag to close the modal when clicking outside of it.
     * @param {Boolean}             [options.closeOnEscape]         Determines if the Modal should close when "Esc" key is pressed. Defaults to true.
     * @param {Boolean}             [options.responsive]            Determines if the Modal should behave responsively (adapt to smaller viewports).
     * @param {Boolean}             [options.disableScroll]         Determines if the Modal should 'disable' the page's scroll (not the Modal's body).
     * @param {String}              [options.triggerEvent]          (advanced) Trigger's event to be listened. Defaults to 'click'.
     *
     * @sample Ink_UI_Modal_1.html
     */

    function upName(dimension) {
        // omg IE
        var firstCharacter = dimension.match(/^./)[0];
        return firstCharacter.toUpperCase() + dimension.replace(/^./, '');
    }
    function maxName(dimension) {
        return 'max' + upName(dimension);
    }

    var openModals = [];

    var Modal = function(selector, options) {
        if (!selector) {
            this._element = null;
        } else {
            this._element = Common.elOrSelector(selector, 'Ink.UI.Modal markup');
        }

        this._options = {
            /**
             * Width, height and markup really optional, as they can be obtained by the element
             */
            width:        undefined,
            height:       undefined,

            /**
             * To add extra classes
             */
            shadeClass: undefined,
            modalClass: undefined,

            /**
             * Optional trigger properties
             */
            trigger:      undefined,
            triggerEvent: 'click',
            autoDisplay:  true,

            /**
             * Remaining options
             */
            markup:       undefined,
            onShow:       undefined,
            onDismiss:    undefined,
            closeOnClick: false,
            closeOnEscape: true,
            responsive:    true,
            disableScroll: true
        };

        this._handlers = {
            click:   Ink.bindEvent(this._onShadeClick, this),
            keyDown: Ink.bindEvent(this._onKeyDown, this),
            resize:  Ink.bindEvent(this._onResize, this)
        };

        this._wasDismissed = false;

        /**
         * Modal Markup
         */
        if( this._element ){
            this._markupMode = Css.hasClassName(this._element,'ink-modal'); // Check if the full modal comes from the markup
        } else {
            this._markupMode = false;
        }

        if( !this._markupMode ){
            this._modalShadow      = document.createElement('div');
            this._modalShadowStyle = this._modalShadow.style;

            this._modalDiv         = document.createElement('div');
            this._modalDivStyle    = this._modalDiv.style;

            if( !!this._element ){
                this._options.markup = this._element.innerHTML;
            }

            /**
             * Not in full markup mode, let's set the classes and css configurations
             */
            Css.addClassName( this._modalShadow,'ink-shade' );
            Css.addClassName( this._modalDiv,'ink-modal ink-space' );

            /**
             * Applying the main css styles
             */
            // this._modalDivStyle.position = 'absolute';
            this._modalShadow.appendChild( this._modalDiv);
            document.body.appendChild( this._modalShadow );
        } else {
            this._modalDiv         = this._element;
            this._modalDivStyle    = this._modalDiv.style;
            this._modalShadow      = this._modalDiv.parentNode;
            this._modalShadowStyle = this._modalShadow.style;

            this._contentContainer = Selector.select(".modal-body", this._modalDiv)[0];
            if( !this._contentContainer){
                throw new Error('Ink.UI.Modal: Missing div with class "modal-body"');
            }

            this._options.markup = this._contentContainer.innerHTML;

            /**
             * First, will handle the least important: The dataset
             */
            this._options = Ink.extendObj(this._options,InkElement.data(this._element));

        }

        /**
         * Now, the most important, the initialization options
         */
        this._options = Ink.extendObj(this._options,options || {});

        if( !this._markupMode ){
            this.setContentMarkup(this._options.markup);
        }

        if( typeof this._options.shadeClass === 'string' ){
            Css.addClassName(this._modalShadow, this._options.shadeClass);
        }

        if( typeof this._options.modalClass === 'string' ){
            Css.addClassName(this._modalDiv, this._options.modalClass);
        }

        if( this._options.trigger ) {
            var triggerElements = Common.elsOrSelector(this._options.trigger, '');
            Event.observeMulti(triggerElements, this._options.triggerEvent, Ink.bindEvent(this.open, this));
        } else if ( this._options.autoDisplay.toString() === "true" ) {
            this.open();
        }
    };

    Modal.prototype = {

        /**
         * Responsible for repositioning the modal
         *
         * @method _reposition
         * @private
         */
        _reposition: function(){
            this._modalDivStyle.marginTop = (-InkElement.elementHeight(this._modalDiv)/2) + 'px';
            this._modalDivStyle.marginLeft = (-InkElement.elementWidth(this._modalDiv)/2) + 'px';
        },

        /**
         * Responsible for resizing the modal
         *
         * @method _onResize
         * @param {Boolean|Event} runNow Its executed in the begining to resize/reposition accordingly to the viewport. But usually it's an event object.
         * @private
         */
        _onResize: function( runNow ){
            if( typeof runNow === 'boolean' ){
                this._timeoutResizeFunction.call(this);
            } else if( !this._resizeTimeout && (runNow && typeof runNow === 'object') ){
                this._resizeTimeout = setTimeout(Ink.bind(this._timeoutResizeFunction, this),250);
            }
        },

        /**
         * Timeout Resize Function
         *
         * @method _timeoutResizeFunction
         * @private
         */
        _timeoutResizeFunction: function(){
            /**
             * Getting the current viewport size
             */
            var isPercentage = {
                width: ('' + this._options.width).indexOf('%') !== -1,
                height: ('' + this._options.height).indexOf('%') !== -1
            };
            var currentViewport = {
                height: InkElement.viewportHeight(),
                width: InkElement.viewportWidth()
            };

            InkArray.forEach(['height', 'width'], Ink.bind(function (dimension) {
                // Not used for percentage measurements
                if (isPercentage[dimension]) { return; }

                if (currentViewport[dimension] > this.originalStatus[dimension]) {
                    this._modalDivStyle[dimension] = this._modalDivStyle[maxName(dimension)];
                } else {
                    this._modalDivStyle[dimension] = Math.round(currentViewport[dimension] * 0.9) + 'px';
                }
            }, this));

            this._resizeContainer();
            this._reposition();
            this._resizeTimeout = undefined;
        },

        /**
         * Handle clicks on the shade element.
         *
         * @method _onShadeClick
         * @param {Event} ev
         * @private
         */
        _onShadeClick: function(ev) {
            var tgtEl = Event.element(ev);

            if (Css.hasClassName(tgtEl, 'ink-close') || Css.hasClassName(tgtEl, 'ink-dismiss') ||
                InkElement.findUpwardsBySelector(tgtEl, '.ink-close,.ink-dismiss') ||
                (
                    this._options.closeOnClick &&
                    (!InkElement.descendantOf(this._shadeElement, tgtEl) || (tgtEl === this._shadeElement))
                )
            ) {
                var alertsInTheModal = Selector.select('.ink-alert', this._shadeElement),
                    alertsLength = alertsInTheModal.length;
                for( var i = 0; i < alertsLength; i++ ){
                    if( InkElement.descendantOf(alertsInTheModal[i], tgtEl) ){
                        return;
                    }
                }

                this.dismiss();

                // Only stop the event if this dismisses this modal
                if (this._wasDismissed) {
                    Event.stop(ev);
                }
            }
        },

        /**
         * Responsible for handling the escape key pressing.
         *
         * @method _onKeyDown
         * @param  {Event} ev
         * @private
         */
        _onKeyDown: function(ev) {
            if (ev.keyCode !== 27 || this._wasDismissed) { return; }
            if (this._options.closeOnEscape.toString() === 'true' &&
                    openModals[openModals.length - 1] === this) {
                this.dismiss();
                if (this._wasDismissed) {
                    Event.stop(ev);
                }
            }
        },

        /**
         * Responsible for setting the size of the modal (and position) based on the viewport.
         *
         * @method _resizeContainer
         * @private
         */
        _resizeContainer: function() {
            // [3.0.0] drop this because everyone should have the new CSS now, which has this rule already with .ink-modal-is-open.
            this._contentElement.style.overflow = this._contentElement.style.overflowX = this._contentElement.style.overflowY = 'hidden';
            var containerHeight = InkElement.elementHeight(this._modalDiv);

            this._modalHeader = Selector.select('.modal-header',this._modalDiv)[0];
            if( this._modalHeader ){
                containerHeight -= InkElement.elementHeight(this._modalHeader);
            }

            this._modalFooter = Selector.select('.modal-footer',this._modalDiv)[0];
            if( this._modalFooter ){
                containerHeight -= InkElement.elementHeight(this._modalFooter);
            }

            this._contentContainer.style.height = containerHeight + 'px';
            if( containerHeight !== InkElement.elementHeight(this._contentContainer) ){
                this._contentContainer.style.height = ~~(containerHeight - (InkElement.elementHeight(this._contentContainer) - containerHeight)) + 'px';
            }

            if( this._markupMode ){ return; }

            this._contentContainer.style.overflow = this._contentContainer.style.overflowX = 'hidden';
            this._contentContainer.style.overflowY = 'auto';
            this._contentElement.style.overflow = this._contentElement.style.overflowX = this._contentElement.style.overflowY = 'visible';
        },

        /**
         * Responsible for 'disabling' the page scroll
         *
         * @method _disableScroll
         * @private
         */
        _disableScroll: function() {
            var htmlEl = document.documentElement;
            this._oldHtmlOverflows = [ htmlEl.style.overflowX,
                htmlEl.style.overflowY ];
            htmlEl.style.overflowX = htmlEl.style.overflowY = 'hidden';
        },

        /**************
         * PUBLIC API *
         **************/

        /**
         * Opens this Modal.
         * Use this if you created the modal with `autoOpen: false`
         * to open the modal when you want to.
         * @method open
         * @param {Event} [event] (internal) In case its fired by the internal trigger.
         */
        open: function(event) {

            if( event ){ Event.stop(event); }

            var elem = (document.compatMode === "CSS1Compat") ?  document.documentElement : document.body;

            this._resizeTimeout    = null;

            Css.addClassName( this._modalShadow,'ink-shade' );
            this._modalShadowStyle.display = this._modalDivStyle.display = 'block';
            setTimeout(Ink.bind(function() {
                Css.addClassName( this._modalShadow, 'visible' );
                Css.addClassName( this._modalDiv, 'visible' );
            }, this), 100);

            /**
             * Fallback to the old one
             */
            this._contentElement = this._modalDiv;
            this._shadeElement   = this._modalShadow;

            if( !this._markupMode ){
                /**
                 * Setting the content of the modal
                 */
                this.setContentMarkup( this._options.markup );
            }

            /**
             * If any size has been user-defined, let's set them as max-width and max-height
             */

            var isPercentage = {
                width: ('' + this._options.width).indexOf('%') !== -1,
                height: ('' + this._options.height).indexOf('%') !== -1
            };

            InkArray.forEach(['width', 'height'], Ink.bind(function (dimension) {
                if (this._options[dimension] !== undefined) {
                    this._modalDivStyle[dimension] = this._options[dimension];
                    if (!isPercentage[dimension]) {
                        this._modalDivStyle[maxName(dimension)] =
                            InkElement['element' + upName(dimension)](this._modalDiv) + 'px';
                    }
                } else {
                    this._modalDivStyle[maxName(dimension)] = InkElement['element' + upName(dimension)](this._modalDiv) + 'px';
                }

                if (isPercentage[dimension] && parseInt(elem['client' + maxName(dimension)], 10) <= parseInt(this._modalDivStyle[dimension], 10) ) {
                    this._modalDivStyle[dimension] = Math.round(parseInt(elem['client' + maxName(dimension)], 10) * 0.9) + 'px';
                }
            }, this));

            this.originalStatus = {
                viewportHeight:     InkElement.elementHeight(elem),
                viewportWidth:      InkElement.elementWidth(elem),
                height:             InkElement.elementHeight(this._modalDiv),
                width:              InkElement.elementWidth(this._modalDiv)
            };

            /**
             * Let's 'resize' it:
             */
            if( this._options.responsive.toString() === 'true' ) {
                this._onResize(true);
                Event.observe( window,'resize',this._handlers.resize );
            } else {
                this._resizeContainer();
                this._reposition();
            }

            if (this._options.onShow) {
                this._options.onShow(this);
            }

            if(this._options.disableScroll.toString() === 'true') {
                this._disableScroll();
            }

            // subscribe events
            Event.observe(this._shadeElement, 'click', this._handlers.click);
            if (this._options.closeOnEscape.toString() === 'true') {
                Event.observe(document, 'keydown', this._handlers.keyDown);
            }

            Common.registerInstance(this, this._shadeElement, 'modal');

            this._wasDismissed = false;
            openModals.push(this);

            Css.addClassName(document.documentElement, 'ink-modal-is-open');
        },

        /**
         * Closes the modal
         *
         * @method dismiss
         * @public
         */
        dismiss: function() {
            if (this._wasDismissed) { /* Already dismissed. WTF IE. */ return; }

            if (this._options.onDismiss) {
                var ret = this._options.onDismiss(this);
                if (ret === false) { return; }
            }

            this._wasDismissed = true;

            if( this._options.responsive ){
                Event.stopObserving(window, 'resize', this._handlers.resize);
            }

            // this._modalShadow.parentNode.removeChild(this._modalShadow);

            if( !this._markupMode ){
                this._modalShadow.parentNode.removeChild(this._modalShadow);
                this.destroy();
            } else {
                Css.removeClassName( this._modalDiv, 'visible' );
                Css.removeClassName( this._modalShadow, 'visible' );

                this._waitForFade(this._modalShadow, Ink.bind(function () {
                    this._modalShadowStyle.display = 'none';
                }, this));
            }

            openModals = InkArray.remove(openModals, InkArray.keyValue(this, openModals), 1);

            if (openModals.length === 0) {  // Document level stuff now there are no modals in play.
                var htmlEl = document.documentElement;

                // Reenable scroll
                if(this._options.disableScroll) {
                    htmlEl.style.overflowX = this._oldHtmlOverflows[0];
                    htmlEl.style.overflowY = this._oldHtmlOverflows[1];
                }

                // Remove the class from the HTML element.
                Css.removeClassName(htmlEl, 'ink-modal-is-open');
            }
        },

        /**
         * Utility function to listen to the onTransmissionEnd event, or wait using setTimeouts
         *
         * Specific to this._element
         */
        _waitForFade: function (elem, callback) {
            if (!opacitySupported) { return callback(); }

            var transitionEndEventNames = [
                'transitionEnd', 'oTransitionEnd', 'webkitTransitionEnd'];
            var classicName;
            var evName;
            for (var i = 0, len = transitionEndEventNames.length; i < len; i++) {
                evName = transitionEndEventNames[i];
                classicName = 'on' + evName.toLowerCase();
                if (classicName in elem) {
                    Event.observeOnce(elem, evName, callback);
                    return;
                }
            }
            var fadeChecker = function () {
                if( +Css.getStyle(elem, 'opacity') > 0 ){
                    setTimeout(fadeChecker, 250);
                } else {
                    callback();
                }
            };
            setTimeout(fadeChecker, 500);
        },

        /**
         * Removes the modal from the DOM
         *
         * @method destroy
         * @public
         */
        destroy: function() {
            Common.unregisterInstance(this._instanceId);
        },

        /**
         * Returns the content DOM element
         *
         * @method getContentElement
         * @return {DOMElement} Modal main cointainer.
         * @public
         */
        getContentElement: function() {
            return this._contentContainer;
        },

        /**
         * Replaces the content markup
         *
         * @method setContentMarkup
         * @param {String} contentMarkup
         * @public
         */
        setContentMarkup: function(contentMarkup) {
            if( !this._markupMode ){
                this._modalDiv.innerHTML = [contentMarkup].join('');
                this._contentContainer = Selector.select(".modal-body",this._modalDiv);
                if( !this._contentContainer.length ){
                    // throw 'Missing div with class "modal-body"';
                    var tempHeader = Selector.select(".modal-header",this._modalDiv);
                    var tempFooter = Selector.select(".modal-footer",this._modalDiv);

                    InkArray.each(tempHeader, InkElement.remove);
                    InkArray.each(tempFooter, InkElement.remove);

                    var body = document.createElement('div');
                    Css.addClassName(body,'modal-body');
                    body.innerHTML = this._modalDiv.innerHTML;
                    this._modalDiv.innerHTML = '';

                    var toAdd = tempHeader.concat([body]).concat(tempFooter);
                    InkArray.each(toAdd, Ink.bindMethod(this._modalDiv, 'appendChild'));

                    this._contentContainer = Selector.select(".modal-body",this._modalDiv);
                }
                this._contentContainer = this._contentContainer[0];
            } else {
                this._contentContainer.innerHTML = contentMarkup;
            }
            this._contentElement = this._modalDiv;
            this._resizeContainer();
        }

    };

    return Modal;

});


text:
/*global defineSuite*/
defineSuite([
        'Widgets/VRButton/VRButtonViewModel',
        'Core/Fullscreen',
        'Specs/createScene'
    ], function(
        VRButtonViewModel,
        Fullscreen,
        createScene) {
    'use strict';

    var scene;

    beforeEach(function() {
        scene = createScene();
    });

    afterEach(function() {
        scene.destroyForSpecs();
    });

    it('constructor sets default values', function() {
        var viewModel = new VRButtonViewModel(scene);
        expect(viewModel.vrElement).toBe(document.body);
        expect(viewModel.isDestroyed()).toEqual(false);
        viewModel.destroy();
        expect(viewModel.isDestroyed()).toEqual(true);
    });

    it('constructor sets expected values', function() {
        var testElement = document.createElement('span');
        var viewModel = new VRButtonViewModel(scene, testElement);
        expect(viewModel.vrElement).toBe(testElement);
        viewModel.destroy();
    });

    it('constructor can take an element id', function() {
        var testElement = document.createElement('span');
        testElement.id = 'testElement';
        document.body.appendChild(testElement);
        var viewModel = new VRButtonViewModel(scene, 'testElement');
        expect(viewModel.vrElement).toBe(testElement);
        viewModel.destroy();
        document.body.removeChild(testElement);
    });

    it('isVREnabled work as expected', function() {
        var viewModel = new VRButtonViewModel(scene);
        expect(viewModel.isVREnabled).toEqual(Fullscreen.enabled);
        viewModel.isVREnabled = false;
        expect(viewModel.isVREnabled).toEqual(false);
        viewModel.destroy();
    });

    it('can get and set vrElement', function() {
        var testElement = document.createElement('span');
        var viewModel = new VRButtonViewModel(scene);
        expect(viewModel.vrElement).not.toBe(testElement);
        viewModel.vrElement = testElement;
        expect(viewModel.vrElement).toBe(testElement);
    });

    it('throws when constructed without a scene', function() {
        expect(function() {
            return new VRButtonViewModel();
        }).toThrowDeveloperError();
    });

    it('throws is setting vrElement is not an Element', function() {
        var viewModel = new VRButtonViewModel(scene);
        expect(function() {
            viewModel.vrElement = {};
        }).toThrowDeveloperError();
    });
});


text:
/////////////////////////////////////////////////////////////////////////////
// Name:        src/common/colourcmn.cpp
// Purpose:     wxColourBase implementation
// Author:      Francesco Montorsi
// Modified by:
// Created:     20/4/2006
// Copyright:   (c) Francesco Montorsi
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
    #pragma hdrstop
#endif

#include "wx/colour.h"

#ifndef WX_PRECOMP
    #include "wx/log.h"
    #include "wx/utils.h"
    #include "wx/gdicmn.h"
    #include "wx/wxcrtvararg.h"
#endif

#if wxUSE_VARIANT
IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLEXPORT)
#endif

// ----------------------------------------------------------------------------
// XTI
// ----------------------------------------------------------------------------

#if wxUSE_EXTENDED_RTTI

#include <string.h>

template<> void wxStringReadValue(const wxString &s, wxColour &data )
{
    if ( !data.Set(s) )
    {
        wxLogError(_("String To Colour : Incorrect colour specification : %s"),
                   s.c_str() );
        data = wxNullColour;
    }
}

template<> void wxStringWriteValue(wxString &s, const wxColour &data )
{
    s = data.GetAsString(wxC2S_HTML_SYNTAX);
}

wxTO_STRING_IMP( wxColour )
wxFROM_STRING_IMP( wxColour )

wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( wxColour, wxObject,  \
                                                      "wx/colour.h",  &wxTO_STRING( wxColour ), &wxFROM_STRING( wxColour ))
//WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxColour>)
wxBEGIN_PROPERTIES_TABLE(wxColour)
wxREADONLY_PROPERTY( Red, unsigned char, Red, wxEMPTY_PARAMETER_VALUE, \
                    0 /*flags*/, wxT("Helpstring"), wxT("group"))
wxREADONLY_PROPERTY( Green, unsigned char, Green, wxEMPTY_PARAMETER_VALUE, \
                    0 /*flags*/, wxT("Helpstring"), wxT("group"))
wxREADONLY_PROPERTY( Blue, unsigned char, Blue, wxEMPTY_PARAMETER_VALUE, \
                    0 /*flags*/, wxT("Helpstring"), wxT("group"))
wxEND_PROPERTIES_TABLE()

wxDIRECT_CONSTRUCTOR_3( wxColour, unsigned char, Red, \
                       unsigned char, Green, unsigned char, Blue )

wxEMPTY_HANDLERS_TABLE(wxColour)
#else

#if wxCOLOUR_IS_GDIOBJECT
wxIMPLEMENT_DYNAMIC_CLASS(wxColour, wxGDIObject);
#else
wxIMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject);
#endif

#endif

// ============================================================================
// wxString <-> wxColour conversions
// ============================================================================

bool wxColourBase::FromString(const wxString& str)
{
    if ( str.empty() )
        return false;       // invalid or empty string

    if ( wxStrnicmp(str, wxT("RGB"), 3) == 0 )
    {
        // CSS-like RGB specification
        // according to http://www.w3.org/TR/css3-color/#colorunits
        // values outside 0-255 range are allowed but should be clipped
        int red, green, blue,
            alpha = wxALPHA_OPAQUE;
        if ( str.length() > 3 && (str[3] == wxT('a') || str[3] == wxT('A')) )
        {
            // We can't use sscanf() for the alpha value as sscanf() uses the
            // current locale while the floating point numbers in CSS always
            // use point as decimal separator, regardless of locale. So parse
            // the tail of the string manually by putting it in a buffer and
            // using wxString::ToCDouble() below. Notice that we can't use "%s"
            // for this as it stops at white space and we need "%c" to avoid
            // this and really get all the rest of the string into the buffer.

            const unsigned len = str.length(); // always big enough
            wxCharBuffer alphaBuf(len);
            char * const alphaPtr = alphaBuf.data();

            for ( unsigned n = 0; n < len; n++ )
                alphaPtr[n] = '\0';

            // Construct the format string which ensures that the last argument
            // receives all the rest of the string.
            wxString formatStr;
            formatStr << wxS("( %d , %d , %d , %") << len << 'c';

            // Notice that we use sscanf() here because if the string is not
            // ASCII it can't represent a valid RGB colour specification anyhow
            // and like this we can be sure that %c corresponds to "char *"
            // while with wxSscanf() it depends on the type of the string
            // passed as first argument: if it is a wide string, then %c
            // expects "wchar_t *" matching parameter under MSW for example.
            if ( sscanf(str.c_str() + 4,
                        formatStr.mb_str(),
                        &red, &green, &blue, alphaPtr) != 4 )
                return false;

            // Notice that we must explicitly specify the length to get rid of
            // trailing NULs.
            wxString alphaStr(alphaPtr, wxStrlen(alphaPtr));
            if ( alphaStr.empty() || alphaStr.Last() != ')' )
                return false;

            alphaStr.RemoveLast();
            alphaStr.Trim();

            double a;
            if ( !alphaStr.ToCDouble(&a) )
                return false;

            alpha = wxRound(a * 255);
        }
        else // no 'a' following "rgb"
        {
            if ( wxSscanf(str.wx_str() + 3, wxT("( %d , %d , %d )"),
                                                &red, &green, &blue) != 3 )
                return false;
        }

        Set((unsigned char)wxClip(red, 0, 255),
            (unsigned char)wxClip(green, 0, 255),
            (unsigned char)wxClip(blue, 0, 255),
            (unsigned char)wxClip(alpha, 0, 255));
    }
    else if ( str[0] == wxT('#') && wxStrlen(str) == 7 )
    {
        // hexadecimal prefixed with # (HTML syntax)
        unsigned long tmp;
        if (wxSscanf(str.wx_str() + 1, wxT("%lx"), &tmp) != 1)
            return false;

        Set((unsigned char)(tmp >> 16),
            (unsigned char)(tmp >> 8),
            (unsigned char)tmp);
    }
    else if (wxTheColourDatabase) // a colour name ?
    {
        // we can't do
        // *this = wxTheColourDatabase->Find(str)
        // because this place can be called from constructor
        // and 'this' could not be available yet
        wxColour clr = wxTheColourDatabase->Find(str);
        if (clr.IsOk())
            Set((unsigned char)clr.Red(),
                (unsigned char)clr.Green(),
                (unsigned char)clr.Blue());
    }

    if (IsOk())
        return true;

    wxLogDebug(wxT("wxColour::Set - couldn't set to colour string '%s'"), str);
    return false;
}

wxString wxColourBase::GetAsString(long flags) const
{
    wxString colName;

    const bool isOpaque = Alpha() == wxALPHA_OPAQUE;

    // we can't use the name format if the colour is not opaque as the alpha
    // information would be lost
    if ( (flags & wxC2S_NAME) && isOpaque )
    {
        colName = wxTheColourDatabase->FindName(
                    static_cast<const wxColour &>(*this)).MakeLower();
    }

    if ( colName.empty() )
    {
        const int red = Red(),
                  blue = Blue(),
                  green = Green();

        if ( flags & wxC2S_CSS_SYNTAX )
        {
            // no name for this colour; return it in CSS syntax
            if ( isOpaque )
            {
                colName.Printf(wxT("rgb(%d, %d, %d)"), red, green, blue);
            }
            else // use rgba() form
            {
                colName.Printf(wxT("rgba(%d, %d, %d, %s)"),
                               red, green, blue,
                               wxString::FromCDouble(Alpha() / 255., 3));
            }
        }
        else if ( flags & wxC2S_HTML_SYNTAX )
        {
            wxASSERT_MSG( isOpaque, "alpha is lost in HTML syntax" );

            // no name for this colour; return it in HTML syntax
            colName.Printf(wxT("#%02X%02X%02X"), red, green, blue);
        }
    }

    // this function should alway returns a non-empty string
    wxASSERT_MSG(!colName.empty(),
                 wxT("Invalid wxColour -> wxString conversion flags"));

    return colName;
}

// static
void wxColourBase::MakeMono(unsigned char* r, unsigned char* g, unsigned char* b,
                            bool on)
{
    *r = *g = *b = on ? 255 : 0;
}

// static
void wxColourBase::MakeGrey(unsigned char* r, unsigned char* g, unsigned char* b
                            /*, unsigned char brightness */
                           )
{
    *r = *g = *b = (wxByte)(((*b)*117UL + (*g)*601UL + (*r)*306UL) >> 10);
}

// static
void wxColourBase::MakeGrey(unsigned char* r, unsigned char* g, unsigned char* b,
                            double weight_r, double weight_g, double weight_b)
{
    double luma = (*r) * weight_r + (*g) * weight_g + (*b) * weight_b;
    *r = *g = *b = (wxByte)wxRound(luma);
}

// static
void wxColourBase::MakeDisabled(unsigned char* r, unsigned char* g, unsigned char* b,
                                unsigned char brightness)
{
    //MakeGrey(r, g, b, brightness); // grey no-blend version
    *r = AlphaBlend(*r, brightness, 0.4);
    *g = AlphaBlend(*g, brightness, 0.4);
    *b = AlphaBlend(*b, brightness, 0.4);
}

wxColour& wxColourBase::MakeDisabled(unsigned char brightness)
{
    unsigned char r = Red(),
                  g = Green(),
                  b = Blue();
    MakeDisabled(&r, &g, &b, brightness);
    Set(r, g, b, Alpha());
    return static_cast<wxColour&>(*this);
}

// AlphaBlend is used by ChangeLightness and MakeDisabled

// static
unsigned char wxColourBase::AlphaBlend(unsigned char fg, unsigned char bg,
                                       double alpha)
{
    double result = bg + (alpha * (fg - bg));
    result = wxMax(result,   0.0);
    result = wxMin(result, 255.0);
    return (unsigned char)result;
}

// ChangeLightness() is a utility function that simply darkens
// or lightens a color, based on the specified percentage
// ialpha of 0 would be completely black, 100 completely white
// an ialpha of 100 returns the same colour

// static
void wxColourBase::ChangeLightness(unsigned char* r, unsigned char* g, unsigned char* b,
                                   int ialpha)
{
    if (ialpha == 100) return;

    // ialpha is 0..200 where 0 is completely black
    // and 200 is completely white and 100 is the same
    // convert that to normal alpha 0.0 - 1.0
    ialpha = wxMax(ialpha,   0);
    ialpha = wxMin(ialpha, 200);
    double alpha = ((double)(ialpha - 100.0))/100.0;

    unsigned char bg;
    if (ialpha > 100)
    {
        // blend with white
        bg = 255;
        alpha = 1.0 - alpha;  // 0 = transparent fg; 1 = opaque fg
    }
    else
    {
        // blend with black
        bg = 0;
        alpha = 1.0 + alpha;  // 0 = transparent fg; 1 = opaque fg
    }

    *r = AlphaBlend(*r, bg, alpha);
    *g = AlphaBlend(*g, bg, alpha);
    *b = AlphaBlend(*b, bg, alpha);
}

wxColour wxColourBase::ChangeLightness(int ialpha) const
{
    wxByte r = Red();
    wxByte g = Green();
    wxByte b = Blue();
    ChangeLightness(&r, &g, &b, ialpha);
    return wxColour(r,g,b);
}

// wxColour <-> wxString utilities, used by wxConfig
wxString wxToString(const wxColourBase& col)
{
    return col.IsOk() ? col.GetAsString(wxC2S_CSS_SYNTAX)
                      : wxString();
}

bool wxFromString(const wxString& str, wxColourBase *col)
{
    wxCHECK_MSG( col, false, wxT("NULL output parameter") );

    if ( str.empty() )
    {
        *col = wxNullColour;
        return true;
    }

    return col->Set(str);
}


text:
package com.bazaarvoice.emodb.event.db.astyanax;

import java.nio.ByteBuffer;
import java.util.concurrent.atomic.AtomicInteger;

import static java.util.Objects.requireNonNull;

public class SlabRef {
    private final String _channel;
    private final ByteBuffer _slabId;
    private final ManifestPersister _persister;
    private final AtomicInteger _refCount = new AtomicInteger(1);

    SlabRef(String channel, ByteBuffer slabId, ManifestPersister persister) {
        _channel = requireNonNull(channel);
        _slabId = requireNonNull(slabId);
        _persister = requireNonNull(persister);
        _persister.open(_channel, _slabId);
    }

    public ByteBuffer getSlabId() {
        return _slabId;
    }

    public SlabRef addRef() {
        _refCount.incrementAndGet();
        return this;
    }

    public void release() {
        if (_refCount.decrementAndGet() == 0) {
            _persister.close(_channel, _slabId);
        }
    }
}


text:
var jwt = require('jsonwebtoken');

exports.session = function(req, res, next) {
  var token = req.query.access_token || req.headers['x-access-token'] || req.query.state;
  if (!token) {
    var error = new Error("Access token missing");
    error.status = 403;
    return next(error);
  }
  jwt.verify(token, req.$.session.secret, function(err, obj) {
    if (err) {
      var error = new Error("Invalid access token");
      error.status = 403;
      return next(error);
    } else {
      req.db.User.findOne({bizid: obj.bizid || obj.device_id}).lean().exec(function(err, user) {
        if (!user) {
          req.user = {device_id: obj.device_id};
        }
        else {
          req.user = user;
          req.user.device_id = obj.device_id;
        }
        req.user.access_token = token;
        return next(err);
      });
    }
  });
};

exports.rawBody = function(req, res, next) {
  var data = '';

  req.setEncoding('utf8');

  req.on('data', function(chunk) {
    data += chunk;
  });

  req.on('end', function() {
    req.body = data;
    next();
  });
};


text:
/**
 * Created by Wayne on 6/17/2015.
 */

var app = {
    clock: undefined,
    selector: '#countdown',
    totalSeconds: 20,
    lastSeconds: 8,
    remainingSeconds: undefined
};

app.init = function () {
    app.clock = $(app.selector).FlipClock(app.totalSeconds, {
        clockFace: 'HourlyCounter',
        countdown: true,
        autoStart: false,
        callbacks: {
            interval: function () {
                var time = this.factory.getTime().time;
                if (time) {
                    app.playAudioInLastTenSeconds(time);
                    app.remainingSeconds = time;

                    // hack, ring last bell 1 second later
                    if (time == 1) {
                        setTimeout(function () {
                            var $audio = $('#finalTickSoundTrack')[0];
                            app.stopCurrentAudioAndPlayAgain($audio);
                        }, 1000);
                    }
                }
            }, stop: function () {
                app.applyPausedStyle();
            }
        }
    });
    app.bindEvents();
    app.applyPausedStyle();
};

app.bindEvents = function () {
    $('#startButton').click(function () {
        if (app.clock.running) {
            app.clock.stop();
            app.applyPausedStyle();
        }
        else {
            if (app.remainingSeconds <= 1) {
                app.clock.setTime(app.totalSeconds);
            }
            app.clock.start();
            app.applyRunningStyle();
        }
    });

    $('#resetButton').click(function () {
        app.clock.stop();
        app.clock.setTime(app.totalSeconds);
        app.applyPausedStyle();
    });

    $('#setTotalSeconds').click(function () {

        bootbox.prompt({
            title: "Set Total Seconds of clock",
            value: app.totalSeconds,
            callback: function (result) {
                if (result === null) {
                    //Example.show("Prompt dismissed");
                } else {
                    var parsedResult = parseInt(result);
                    if (parsedResult) {
                        app.totalSeconds = parsedResult;
                        app.clock.stop();
                        app.clock.setTime(app.totalSeconds);
                    }
                }
            }
        });
    });

    $('#setFinalSeconds').click(function () {
        bootbox.prompt({
            title: "Set Final Seconds of clock",
            value: app.lastSeconds,
            callback: function (result) {
                if (result === null) {
                    //Example.show("Prompt dismissed");
                }
                else {
                    var parsedResult = parseInt(result);
                    if (parsedResult) {
                        app.lastSeconds = parsedResult;
                        app.clock.stop();
                    }
                }
            }
        });
    });

};

app.applyRunningStyle = function () {
    if (!app.clock.running)
        return;

    $('#startButton').text('PAUSE')
    $('#resetButton').removeAttr('disabled');
    $('#advancedButtonsContainer').hide('fast');
    $('#resetButton').show('fast');
};

app.applyPausedStyle = function () {
    if (app.clock.running)
        return;

    $('#startButton').text('START');
    $('#resetButton').attr('disabled', 'disabled');
    $('#resetButton').hide('fast');
    $('#advancedButtonsContainer').show('fast');
};

app.playAudioInLastTenSeconds = function (seconds) {
    var $audio = $('#tickingSoundTrack')[0];
    if (seconds > app.lastSeconds)
        return;
    app.stopCurrentAudioAndPlayAgain($audio);
};

app.stopCurrentAudioAndPlayAgain = function ($audio) {
    $audio.pause();
    $audio.currentTime = 0;
    $audio.play();
};

(function () {
    app.init();
})();


text:
import React from 'react';
import request from 'superagent';

const ajax = {
  get  : (url, params, callback) => {
    request
      .get(url)
      .query(params)
      .end((err, res) => callback(err, res))
  },
  post : (url, params, callback) => {
    request
      .post(url)
      .send(params)
      .end((err, res) => callback(err, res))
  }
};

export default ajax;


text:
Indexing and Basic Search

    <form class="form-search" id="search-box">
      <input id="search-text" type="text" class="input-xxlarge search-query"
             placeholder="Search for news articles ex. LA Times politics"
             autocomplete="off">
      <button type="submit" class="btn">Search</button>
    </form>

                Search Results
                Publisher
                Category
                Url