text:
require('colors');
let morgan = require('morgan');
let express = require('express');
let app = express();
let expressRouter = express.Router;
let responseTime = require('response-time');

class Server {

  // Create a new Express server
  constructor(apiize, params = {}) {

    const defaults = {
      port: 1313,
      prefix: 'api'
    };

    this.apiize = apiize;
    this.params = Object.assign(defaults, params);
    app.use(responseTime());

    // Set json header
    app.use(function (req, res, next) {
      res.header('Content-Type', 'application/json');
      next();
    });

    app.use(morgan(this.apiize.params.verbose ? 'combined' : 'tiny'));

    this.server = false;
    this.routes = this.apiize.routes();

    // Mount routes
    app.use('/api', this.router());
    app.use(this.index());
    app.use(function (req, res) {
      res.status(404).json({error: 'Not found', message: `Unable to find route to ${req.path}`});
    });
  }

  // Handle root path
  index() {
    let router = expressRouter();

    router.get('/', (req, res) => {
      res.format({

        'text/html': function (){
          // The client requested an html page
          res.send(`

This api only respond to json, please try to request this endpoint with application/json Content Type.

          `);
        },
        default: () => {
          // Will print the index ouf available routes
          res.json(this.jsonIndex(this.routes));
        }
      });
    });

    // test route to make sure everything is working (accessed at GET http://localhost:8080/api)
    for (const route of this.routes) {
      router.get(route.route, route.callback);
    }

    return router;
  }

  // Create index ouf routes on the root path
  jsonIndex(routes) {
    if (!this.indexCache) {
      this.indexCache = {
        endpoints: routes.map((r) => {
          return {url: `/${this.params.prefix}${r.route}`, description: r.info};
        })
      };
    }
    return this.indexCache;
  }

  // Create routes
  router() {
    let router = expressRouter();
    // test route to make sure everything is working (accessed at GET http://localhost:8080/api)
    for (const route of this.routes) {
      router.get(route.route, route.callback);
    }

    return router;
  }

  // Stop the server
  stop() {
    if (this.server) {
      this.server.close();
      this.server = false;
    }
  }

  // Say hello and print routes
  hello() {
    console.log(`\n  ___        _ _         \n / _ \\      (_|_)        \n/ /_\\ \\_ __  _ _ _______ \n|  _  | '_ \\| | |_  / _ \\\n| | | | |_) | | |/ /  __/\n\\_| |_/ .__/|_|_/___\\___|\n      | |                \n      |_|                \n    `.rainbow);
    console.log('💫 ' + ` Express has taken the stage and is listening on port ${this.params.port}\n`.green);
    for (const route of this.routes) {
      let info = route.info ? ` ${route.info}`.grey : '';
      console.log('∙ '.green + `GET /${this.params.prefix}${route.route}` + info);
    }
  }

  // Start the server
  listen() {
    this.server = app.listen(this.params.port);
    this.hello();
  }

}

export default Server;


text:
package tmg.android.apps.recplayer;

import java.util.concurrent.atomic.AtomicBoolean;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.os.Bundle;
import android.os.Environment;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

public class PlayerActivity extends Activity {
  /** Is playing. */
  private final AtomicBoolean isPlaying = new AtomicBoolean();
  /** Surface holder. */
  private SurfaceHolder surfaceHolder;

  private long rec = 0;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_player);

    final String filename = Environment.getExternalStorageDirectory()
        + "/00000001.rec";

    rec = RecPlayer.open(filename);

    SurfaceView surfaceView = (SurfaceView) findViewById(R.id.surface_view);

    surfaceHolder = surfaceView.getHolder();
    surfaceHolder.addCallback(surfaceHolderCallback);

  }

  /**
   * Surface holder callback listens for surface events.
   */
  private final SurfaceHolder.Callback surfaceHolderCallback = new SurfaceHolder.Callback() {
    public void surfaceChanged(SurfaceHolder holder, int format, int width,
        int height) {
    }

    public void surfaceCreated(SurfaceHolder holder) {
      // Start playing since surface is ready
      isPlaying.set(true);
      // Start renderer on a separate thread
      new Thread(renderer).start();
    }

    public void surfaceDestroyed(SurfaceHolder holder) {
      // Stop playing since surface is destroyed
      isPlaying.set(false);
    }
  };

  /**
   * Renderer runnable renders the video frames from the AVI file to the surface
   * through a bitmap.
   */
  private final Runnable renderer = new Runnable() {
    public void run() {
      // Create a new bitmap to hold the frames
      Bitmap bitmap = Bitmap.createBitmap(RecPlayer.getWidth(rec),
          RecPlayer.getHeight(rec), Bitmap.Config.RGB_565);

      // Calculate the delay using the frame rate
      long frameDelay = (long) (1000 / RecPlayer.getFrameRate(rec));
      // Start rendering while playing
      while (isPlaying.get() && RecPlayer.render(rec, bitmap)) {
        // Lock canvas
        Canvas canvas = surfaceHolder.lockCanvas();

        // Draw the bitmap to the canvas
        canvas.drawBitmap(bitmap, 0, 0, null);

        // Post the canvas for displaying
        surfaceHolder.unlockCanvasAndPost(canvas);

        // Wait for the next frame
        try {
          Thread.sleep(frameDelay);
        } catch (InterruptedException e) {
          break;
        }
      }

      RecPlayer.close(rec);
    }
  };
}

redpajama_set_name: RedPajamaGithub


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by Cake.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Reflection;

[assembly: AssemblyProduct("Cake")]
[assembly: AssemblyVersion("0.35.0.0")]
[assembly: AssemblyFileVersion("0.35.0.0")]
[assembly: AssemblyInformationalVersion("0.35.0-beta.1+0.Branch.release-0.35.0.Sha.d4a0b3a07caa6a3873cb0da58766ffdb7ce22e11")]
[assembly: AssemblyCopyright("Copyright (c) .NET Foundation and Contributors")]


text:
package org.jamocha.filter;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.jamocha.languages.common.RuleCondition.EquivalenceClass;
import org.jamocha.languages.common.SingleFactVariable;
import org.jamocha.visitor.Visitable;

import java.util.Set;

/**
 * @author Fabian Ohler <fabian.ohler1@rwth-aachen.de>
 */
public interface ECFilterSet extends Visitable<ECFilterSetVisitor> {

    /**
     * @author Fabian Ohler <fabian.ohler1@rwth-aachen.de>
     */
    @RequiredArgsConstructor
    @Getter
    class ECExistentialSet implements ECFilterSet {
        final boolean positive;
        final SingleFactVariable initialFactVariable;
        final Set<SingleFactVariable> existentialFactVariables;
        final Set<EquivalenceClass> equivalenceClasses;
        final Set<ECFilterSet> purePart;
        final ECFilter existentialClosure;

        @Override
        public <V extends ECFilterSetVisitor> V accept(final V visitor) {
            visitor.visit(this);
            return visitor;
        }
    }
}


text:
package org.apache.commons.math3.stat.descriptive;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.math3.TestUtils;
import org.apache.commons.math3.util.FastMath;
import org.junit.Assert;
import org.junit.Test;

/**
 * Test cases for the {@link ListUnivariateImpl} class.
 *
 * @version $Id: ListUnivariateImplTest.java 1364030 2012-07-21 01:10:04Z erans $
 */

public final class ListUnivariateImplTest {

    private double one = 1;
    private float two = 2;
    private int three = 3;

    private double mean = 2;
    private double sumSq = 18;
    private double sum = 8;
    private double var = 0.666666666666666666667;
    private double std = FastMath.sqrt(var);
    private double n = 4;
    private double min = 1;
    private double max = 3;
    private double tolerance = 10E-15;

    /** test stats */
    @Test
    public void testStats() {
        List<Object> externalList = new ArrayList<Object>();

        DescriptiveStatistics u = new ListUnivariateImpl( externalList );

        Assert.assertEquals("total count",0,u.getN(),tolerance);
        u.addValue(one);
        u.addValue(two);
        u.addValue(two);
        u.addValue(three);
        Assert.assertEquals("N",n,u.getN(),tolerance);
        Assert.assertEquals("sum",sum,u.getSum(),tolerance);
        Assert.assertEquals("sumsq",sumSq,u.getSumsq(),tolerance);
        Assert.assertEquals("var",var,u.getVariance(),tolerance);
        Assert.assertEquals("std",std,u.getStandardDeviation(),tolerance);
        Assert.assertEquals("mean",mean,u.getMean(),tolerance);
        Assert.assertEquals("min",min,u.getMin(),tolerance);
        Assert.assertEquals("max",max,u.getMax(),tolerance);
        u.clear();
        Assert.assertEquals("total count",0,u.getN(),tolerance);
    }

    @Test
    public void testN0andN1Conditions() {
        List<Object> list = new ArrayList<Object>();

        DescriptiveStatistics u = new ListUnivariateImpl( list );

        Assert.assertTrue("Mean of n = 0 set should be NaN", Double.isNaN( u.getMean() ) );
        Assert.assertTrue("Standard Deviation of n = 0 set should be NaN", Double.isNaN( u.getStandardDeviation() ) );
        Assert.assertTrue("Variance of n = 0 set should be NaN", Double.isNaN(u.getVariance() ) );

        list.add( Double.valueOf(one));

        Assert.assertTrue( "Mean of n = 1 set should be value of single item n1", u.getMean() == one);
        Assert.assertTrue( "StdDev of n = 1 set should be zero, instead it is: " + u.getStandardDeviation(), u.getStandardDeviation() == 0);
        Assert.assertTrue( "Variance of n = 1 set should be zero", u.getVariance() == 0);
    }

    @Test
    public void testSkewAndKurtosis() {
        DescriptiveStatistics u = new DescriptiveStatistics();

        double[] testArray = { 12.5, 12, 11.8, 14.2, 14.9, 14.5, 21, 8.2, 10.3, 11.3, 14.1,
                                             9.9, 12.2, 12, 12.1, 11, 19.8, 11, 10, 8.8, 9, 12.3 };
        for( int i = 0; i < testArray.length; i++) {
            u.addValue( testArray[i]);
        }

        Assert.assertEquals("mean", 12.40455, u.getMean(), 0.0001);
        Assert.assertEquals("variance", 10.00236, u.getVariance(), 0.0001);
        Assert.assertEquals("skewness", 1.437424, u.getSkewness(), 0.0001);
        Assert.assertEquals("kurtosis", 2.37719, u.getKurtosis(), 0.0001);
    }

    @Test
    public void testProductAndGeometricMean() {
        ListUnivariateImpl u = new ListUnivariateImpl(new ArrayList<Object>());
        u.setWindowSize(10);

        u.addValue( 1.0 );
        u.addValue( 2.0 );
        u.addValue( 3.0 );
        u.addValue( 4.0 );

        Assert.assertEquals( "Geometric mean not expected", 2.213364, u.getGeometricMean(), 0.00001 );

        // Now test rolling - StorelessDescriptiveStatistics should discount the contribution
        // of a discarded element
        for( int i = 0; i < 10; i++ ) {
            u.addValue( i + 2 );
        }
        // Values should be (2,3,4,5,6,7,8,9,10,11)

        Assert.assertEquals( "Geometric mean not expected", 5.755931, u.getGeometricMean(), 0.00001 );

    }

    /** test stats */
    @Test
    public void testSerialization() {

        DescriptiveStatistics u = new ListUnivariateImpl();

        Assert.assertEquals("total count",0,u.getN(),tolerance);
        u.addValue(one);
        u.addValue(two);

        DescriptiveStatistics u2 = (DescriptiveStatistics)TestUtils.serializeAndRecover(u);

        u2.addValue(two);
        u2.addValue(three);

        Assert.assertEquals("N",n,u2.getN(),tolerance);
        Assert.assertEquals("sum",sum,u2.getSum(),tolerance);
        Assert.assertEquals("sumsq",sumSq,u2.getSumsq(),tolerance);
        Assert.assertEquals("var",var,u2.getVariance(),tolerance);
        Assert.assertEquals("std",std,u2.getStandardDeviation(),tolerance);
        Assert.assertEquals("mean",mean,u2.getMean(),tolerance);
        Assert.assertEquals("min",min,u2.getMin(),tolerance);
        Assert.assertEquals("max",max,u2.getMax(),tolerance);

        u2.clear();
        Assert.assertEquals("total count",0,u2.getN(),tolerance);
    }
}


text:
const uint32 BSSolarizedRGBBase03   = 0x002b36;

const uint32 BSSolarizedRGBBase02   = 0x073642;

const uint32 BSSolarizedRGBBase01   = 0x586e75;

const uint32 BSSolarizedRGBBase00   = 0x657b83;

const uint32 BSSolarizedRGBBase0    = 0x839496;

const uint32 BSSolarizedRGBBase1    = 0x839496;

const uint32 BSSolarizedRGBBase2    = 0xeee8d5;

const uint32 BSSolarizedRGBBase3    = 0xfdf6e3;

const uint32 BSSolarizedRGBYellow   = 0xb58900;

const uint32 BSSolarizedRGBOrange   = 0xcb4b16;

const uint32 BSSolarizedRGBRed      = 0xdc322f;

const uint32 BSSolarizedRGBMagenta  = 0xd33682;

const uint32 BSSolarizedRGBViolet   = 0x6c71c4;

const uint32 BSSolarizedRGBBlue     = 0x268bd2;

const uint32 BSSolarizedRGBCyan     = 0x2aa198;

const uint32 BSSolarizedRGBGreen    = 0x859900;

@implementation NSColor (SolarizedColors)

@end


text:
<?php

use Beepsend\Exception\InternalError;

class InternalErrorTest extends PHPUnit_Framework_TestCase
{
    /**
     * Test throwing InternalError exception
     * @expectedException Beepsend\Exception\InternalError
     * @expectedExceptionMessage There was some unexpected error.
     * @expectedExceptionCode 20
     */
    public function testInternalErrorException()
    {
        throw new InternalError('There was some unexpected error.', 20);
    }

}


text:
package presilo

import (
	"fmt"
	"regexp"
)

/*
  Generates valid mysql table creation/update query.

  SQL query generation is a bit different than other languages, it:
  - Generates one query file to represent all data structures
  - Uses "module" not as a harmless namespace, but as the DB name tables should be contained
  - Does not attempt to represent arrays
  - Assumes internationalized "nvarchar" for all strings
  - Provides a best guess for string column length based on constraints for min/max length
  - Does not provide a primary key!
  - Does not support regex constraints.
  - Uses 'bit' to represent booleans, with 0 = true, 1 = false.
*/
func GenerateMySQL(schema *ObjectSchema, module string, tabstyle string) string {

	var buffer *BufferedFormatString

	buffer = NewBufferedFormatString(tabstyle)
	generateMysqlCreate(schema, module, buffer)

	return buffer.String()
}

func ValidateMySQLModule(module string) bool {

	// ref: http://dev.mysql.com/doc/refman/5.7/en/identifiers.html
	pattern := "^[0-9a-zA-Z$_]+$"
	matched, err := regexp.MatchString(pattern, module)
	return err == nil && matched
}

func generateMysqlCreate(schema *ObjectSchema, module string, buffer *BufferedFormatString) {

	var subschema TypeSchema
	var propertyName string
	var required, firstProperty bool

	buffer.Printf("USE %s;\n", module)

	// create table
	buffer.Printf("CREATE TABLE %s\n(", schema.GetTitle())
	buffer.AddIndentation(1)
	generateMySQLPrimaryKey(schema, buffer)
	buffer.Printf("\n\n")

	firstProperty = true

	for _, propertyName = range schema.GetOrderedPropertyNames() {

		subschema = schema.Properties[propertyName]

		// determine nullability
		required = false
		for _, requiredProperty := range schema.RequiredProperties {

			if requiredProperty == propertyName && !subschema.GetNullable() {
				required = true
				break
			}
		}

		if firstProperty {
			firstProperty = false
		} else {
			buffer.Print(",\n")
		}

		switch subschema.GetSchemaType() {
		case SCHEMATYPE_BOOLEAN:
			generateMySQLBoolColumn(propertyName, required, subschema.(*BooleanSchema), buffer)
		case SCHEMATYPE_STRING:
			generateMySQLStringColumn(propertyName, required, subschema.(*StringSchema), buffer)
		case SCHEMATYPE_INTEGER:
			generateMySQLIntegerColumn(propertyName, required, subschema.(*IntegerSchema), buffer)
		case SCHEMATYPE_NUMBER:
			generateMySQLNumberColumn(propertyName, required, subschema.(*NumberSchema), buffer)
		case SCHEMATYPE_OBJECT:
			generateMySQLReferenceColumn(propertyName, required, subschema.(*ObjectSchema), buffer)
		case SCHEMATYPE_ARRAY:
			generateMySQLArrayColumn(propertyName, required, subschema.(*ArraySchema), buffer)
		}
	}

	buffer.AddIndentation(-1)
	buffer.Print("\n);")

	// execution.
	buffer.Print("\n\n")
}

func generateMySQLBoolColumn(name string, required bool, schema *BooleanSchema, buffer *BufferedFormatString) {

	buffer.Printf("\t%s bit", name)
	buffer.AddIndentation(1)

	if required {
		generateMySQLRequiredConstraint(buffer)
	}

	buffer.Printf("\nCHECK(%s = 0 OR %s = 1)", name, name)
	buffer.AddIndentation(-1)
}

func generateMySQLStringColumn(name string, required bool, schema *StringSchema, buffer *BufferedFormatString) {

	buffer.Printf("%s nvarchar(128)", name)
	buffer.AddIndentation(1)

	if required {
		generateMySQLRequiredConstraint(buffer)
	}

	if schema.MinLength != nil {
		generateMySQLRangeCheck(*schema.MinLength, name, "%d", false, "<", "", buffer)
	}

	if schema.MaxLength != nil {
		generateMySQLRangeCheck(*schema.MaxLength, name, "%d", false, ">", "", buffer)
	}

	if schema.Enum != nil {
		generateMySQLEnumCheck(schema, schema.GetEnum(), "'", "'", buffer)
	}

	buffer.AddIndentation(-1)
}

func generateMySQLIntegerColumn(name string, required bool, schema *IntegerSchema, buffer *BufferedFormatString) {

	buffer.Printf("%s int", name)
	buffer.AddIndentation(1)

	if required {
		generateMySQLRequiredConstraint(buffer)
	}

	generateMySQLNumericConstraints(name, schema, buffer)
	buffer.AddIndentation(-1)
}

func generateMySQLNumberColumn(name string, required bool, schema *NumberSchema, buffer *BufferedFormatString) {

	buffer.Printf("%s float", name)
	buffer.AddIndentation(1)

	if required {
		generateMySQLRequiredConstraint(buffer)
	}

	generateMySQLNumericConstraints(name, schema, buffer)
	buffer.AddIndentation(-1)
}

func generateMySQLReferenceColumn(name string, required bool, schema *ObjectSchema, buffer *BufferedFormatString) {

	buffer.Printf("%s__id int(4)", name)
	buffer.AddIndentation(1)

	if required {
		generateMySQLRequiredConstraint(buffer)
	}

	// add foreign key constraint.
	buffer.Printf(",\nFOREIGN KEY(%s__id)", name)
	buffer.AddIndentation(1)

	buffer.Printf("\nREFERENCES %s(__id)", schema.GetTitle())
	buffer.Printf("\nON DELETE CASCADE")

	buffer.AddIndentation(-1)
	buffer.AddIndentation(-1)
}

func generateMySQLPrimaryKey(schema *ObjectSchema, buffer *BufferedFormatString) {
	buffer.Printf("\n__id int NOT NULL,")
	buffer.AddIndentation(1)
	buffer.Printf("\nPRIMARY KEY(__id),")
	buffer.AddIndentation(-1)
}

func generateMySQLArrayColumn(name string, required bool, schema *ArraySchema, buffer *BufferedFormatString) {

	fmt.Println("Schema contains an array, which has no definite analogue in MySQL.")
}

func generateMySQLRequiredConstraint(buffer *BufferedFormatString) {

	buffer.Print("\nNOT NULL")
}

/*
	Generates code which throws an error if the given [parameter]'s value is not contained in the given [validValues].
*/
func generateMySQLEnumCheck(schema interface{}, enumValues []interface{}, prefix string, postfix string, buffer *BufferedFormatString) {

	var schemaName string
	var length int

	schemaName = ToJavaCase((schema.(TypeSchema)).GetTitle())
	length = len(enumValues)

	if length <= 0 {
		return
	}

	// write array of valid values
	buffer.Printf(",\nCONSTRAINT %sValuesCheck CHECK(%s in (%s%v%s", schemaName, schemaName, prefix, enumValues[0], postfix)

	for _, enumValue := range enumValues[1:length] {
		buffer.Printf(",%s%v%s", prefix, enumValue, postfix)
	}

	buffer.Print("))")
}

func generateMySQLNumericConstraints(name string, schema NumericSchemaType, buffer *BufferedFormatString) {

	if schema.HasMinimum() {
		generateMySQLRangeCheck(schema.GetMinimum(), "value", schema.GetConstraintFormat(), schema.IsExclusiveMinimum(), "<=", "<", buffer)
	}

	if schema.HasMaximum() {
		generateMySQLRangeCheck(schema.GetMaximum(), "value", schema.GetConstraintFormat(), schema.IsExclusiveMaximum(), ">=", ">", buffer)
	}

	if schema.HasEnum() {
		generateMySQLEnumCheck(schema, schema.GetEnum(), "", "", buffer)
	}

	if schema.HasMultiple() {
		buffer.Printf("\nCHECK(mod(%s, %v) = 0)", name, schema.GetMultiple())
	}
}

func generateMySQLRangeCheck(value interface{}, reference string, format string, exclusive bool, comparator, exclusiveComparator string, buffer *BufferedFormatString) {

	var compareString string

	if exclusive {
		compareString = exclusiveComparator
	} else {
		compareString = comparator
	}

	buffer.Printf("\nCHECK(%s %s %v)", reference, compareString, value)
}


text:
<tool id="Featured datasets4" name="Featured datasets">
  <description>(PSU prepared queries)</description>
  <command interpreter="python">import.py $data $output</command>
  <inputs>
	<display>$data</display>
	<param name="data" type="select" display="radio">
      <option value="eryth">Erythroid predicted cis-regulatory modules</option>
      <option value="exons">Exons of protein-coding genes in the mouse genome, assembly mm3</option>
      <option value="cishg16 ">Known cis-regulatory modules in the human HBB gene complex (hg16)</option>
      <option value="cishg17">Known cis-regulatory modules in the human HBB gene complex (hg17)</option>
      <option value="krhg16">Known regulatory regions (hg16)</option>
      <option value="krhg17">Known regulatory regions (hg17)</option>
      <option value="tARhg16mmc">Human (hg16) evolutionary cold region (vs mouse)</option>
      <option value="tARhg16mmm">Human (hg16) evolutionary medium region (vs mouse)</option>
      <option value="tARhg16mmh">Human (hg16) evolutionary hot region (vs mouse)</option>
      <option value="tARhg16rnc">Human (hg16) evolutionary cold region (vs rat)</option>
      <option value="tARhg16rnm">Human (hg16) evolutionary medium region (vs rat)</option>
      <option value="tARhg16rnh">Human (hg16) evolutionary hot region (vs rat)</option>
      <option value="phastConsHg16">phastCons hg16 (stringent, top ~5%) from UCSC</option>
      <option value="omimhg16">OMIM disorders (hg16)</option>
      <option value="omimhg17">OMIM disorders (hg17)</option>
    </param>
  </inputs>
  <outputs>
    <data format="bed" name="output" />
  </outputs>
</tool>


text:
package org.wso2.ballerina.core.flow.mediators.builtin.manipulators.log;

import java.util.Map;

/**
 * A class for represent property values within log
 */
public class LogMediatorProperty {

    private String key;
    private String value;
    private String expression;
    private Map<String, String> nameSpaceMap;

    LogMediatorProperty(String key, String value, String expression, Map<String, String> nameSpaceMap) {
        this.key = key;
        this.value = value;
        this.expression = expression;
        this.nameSpaceMap = nameSpaceMap;
    }

    LogMediatorProperty(String key, String value, String expression) {
        this.key = key;
        this.value = value;
        this.expression = expression;
    }

    public String getValue() {
        return value;
    }

    public String getKey() {
        return key;
    }

    public String getExpression() {
        return expression;
    }

    public Map<String, String> getNameSpaceMap() {
        return nameSpaceMap;
    }
}


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/monitoring/v3/alert.proto

namespace Google\Cloud\Monitoring\V3\AlertPolicy;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * A content string and a MIME type that describes the content string's
 * format.
 *
 * Generated from protobuf message google.monitoring.v3.AlertPolicy.Documentation
 */
class Documentation extends \Google\Protobuf\Internal\Message
{
    /**
     * The text of the documentation, interpreted according to `mime_type`.
     * The content may not exceed 8,192 Unicode characters and may not exceed
     * more than 10,240 bytes when encoded in UTF-8 format, whichever is
     * smaller. This text can be [templatized by using
     * variables](https://cloud.google.com/monitoring/alerts/doc-variables).
     *
     * Generated from protobuf field string content = 1;
     */
    private $content = '';
    /**
     * The format of the `content` field. Presently, only the value
     * `"text/markdown"` is supported. See
     * [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
     *
     * Generated from protobuf field string mime_type = 2;
     */
    private $mime_type = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $content
     *           The text of the documentation, interpreted according to `mime_type`.
     *           The content may not exceed 8,192 Unicode characters and may not exceed
     *           more than 10,240 bytes when encoded in UTF-8 format, whichever is
     *           smaller. This text can be [templatized by using
     *           variables](https://cloud.google.com/monitoring/alerts/doc-variables).
     *     @type string $mime_type
     *           The format of the `content` field. Presently, only the value
     *           `"text/markdown"` is supported. See
     *           [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Monitoring\V3\Alert::initOnce();
        parent::__construct($data);
    }

    /**
     * The text of the documentation, interpreted according to `mime_type`.
     * The content may not exceed 8,192 Unicode characters and may not exceed
     * more than 10,240 bytes when encoded in UTF-8 format, whichever is
     * smaller. This text can be [templatized by using
     * variables](https://cloud.google.com/monitoring/alerts/doc-variables).
     *
     * Generated from protobuf field string content = 1;
     * @return string
     */
    public function getContent()
    {
        return $this->content;
    }

    /**
     * The text of the documentation, interpreted according to `mime_type`.
     * The content may not exceed 8,192 Unicode characters and may not exceed
     * more than 10,240 bytes when encoded in UTF-8 format, whichever is
     * smaller. This text can be [templatized by using
     * variables](https://cloud.google.com/monitoring/alerts/doc-variables).
     *
     * Generated from protobuf field string content = 1;
     * @param string $var
     * @return $this
     */
    public function setContent($var)
    {
        GPBUtil::checkString($var, True);
        $this->content = $var;

        return $this;
    }

    /**
     * The format of the `content` field. Presently, only the value
     * `"text/markdown"` is supported. See
     * [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
     *
     * Generated from protobuf field string mime_type = 2;
     * @return string
     */
    public function getMimeType()
    {
        return $this->mime_type;
    }

    /**
     * The format of the `content` field. Presently, only the value
     * `"text/markdown"` is supported. See
     * [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
     *
     * Generated from protobuf field string mime_type = 2;
     * @param string $var
     * @return $this
     */
    public function setMimeType($var)
    {
        GPBUtil::checkString($var, True);
        $this->mime_type = $var;

        return $this;
    }

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Documentation::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Documentation::class);


text:
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>polyglot-java</groupId>
		<artifactId>polyglot-java</artifactId>
		<version>1.0-SNAPSHOT</version>
	</parent>

	<artifactId>xtend</artifactId>
	<packaging>jar</packaging>

	<build>
		<plugins>
			<plugin>
				<groupId>org.eclipse.xtend</groupId>
				<artifactId>xtend-maven-plugin</artifactId>
				<version>2.23.0</version>
				<configuration>
					<encoding>UTF-8</encoding>
					<outputDirectory>${project.build.directory}/generated-source</outputDirectory>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>compile</goal>
							<goal>testCompile</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<configuration>
					<mainClass>polyglot.HelloXtend</mainClass>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<dependency>
			<groupId>org.eclipse.xtend</groupId>
			<artifactId>org.eclipse.xtend.core</artifactId>
			<version>2.23.0</version>
		</dependency>

		<dependency>
			<groupId>org.eclipse.xtend</groupId>
			<artifactId>org.eclipse.xtend.lib</artifactId>
			<version>2.23.0</version>
		</dependency>
	</dependencies>
</project>


text:
'use strict';

const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
const resolve = require('resolve');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
const TerserPlugin = require('terser-webpack-plugin');
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const paths = require('./paths');
const getClientEnvironment = require('./env');
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpackPlugin');
const typescriptFormatter = require('react-dev-utils/typescriptFormatter');

const appPackageJson = require(paths.appPackageJson);

const imageInlineSizeLimit = parseInt(
  process.env.IMAGE_INLINE_SIZE_LIMIT || '10000'
);

const useTypeScript = fs.existsSync(paths.appTsConfig);

module.exports = function(webpackEnv) {
  const isEnvDevelopment = webpackEnv === 'development';
  const isEnvProduction = webpackEnv === 'production';

  const isEnvProductionProfile = isEnvProduction && process.argv.includes('--profile');

  const env = getClientEnvironment();

  return {
    mode: isEnvProduction ? 'production' : isEnvDevelopment && 'development',
    bail: isEnvProduction,
    devtool: isEnvProduction ? 'source-map' : isEnvDevelopment && 'cheap-module-source-map',
    entry: [ paths.appIndexJs ],

    output: {
      path: isEnvProduction ? paths.appBuild : undefined,
      pathinfo: isEnvDevelopment,
      filename: isEnvProduction
        ? 'static/js/[name].[contenthash:8].js'
        : isEnvDevelopment && 'static/js/bundle.js',
      futureEmitAssets: true,
      chunkFilename: isEnvProduction
        ? 'static/js/[name].[contenthash:8].chunk.js'
        : isEnvDevelopment && 'static/js/[name].chunk.js',
      publicPath: '/',
      devtoolModuleFilenameTemplate: isEnvProduction
        ? info =>
            path
              .relative(paths.appSrc, info.absoluteResourcePath)
              .replace(/\\/g, '/')
        : isEnvDevelopment &&
          (info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
      jsonpFunction: `webpackJsonp${appPackageJson.name}`,
      globalObject: 'this',
    },

    optimization: {
      minimize: isEnvProduction,
      minimizer: [
        new TerserPlugin({
          terserOptions: {
            parse: {
              ecma: 8,
            },
            compress: {
              ecma: 5,
              warnings: false,
              comparisons: false,
              inline: 2,
            },
            mangle: {
              safari10: true,
            },
            keep_classnames: isEnvProductionProfile,
            keep_fnames: isEnvProductionProfile,
            output: {
              ecma: 5,
              comments: false,
              ascii_only: true,
            },
          },
          sourceMap: true,
        }),
      ],
      splitChunks: {
        chunks: 'all',
        name: false,
      },
      runtimeChunk: {
        name: entrypoint => `runtime-${entrypoint.name}`,
      },
    },

    resolve: {
      modules: ['node_modules', paths.appNodeModules],
      extensions: paths.moduleFileExtensions
        .map(ext => `.${ext}`)
        .filter(ext => useTypeScript || !ext.includes('ts')),
      alias: {
        ...(isEnvProductionProfile && {
          'react-dom$': 'react-dom/profiling',
          'scheduler/tracing': 'scheduler/tracing-profiling',
        }),
      },
      plugins: [
        new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),
      ],
    },

    resolveLoader: {
      plugins: [],
    },

    module: {
      strictExportPresence: true,
      rules: [
        { parser: { requireEnsure: false } },
        {
          test: /\.(js|mjs|jsx|ts|tsx)$/,
          enforce: 'pre',
          use: [
            {
              options: {
                cache: true,
                formatter: require.resolve('react-dev-utils/eslintFormatter'),
                eslintPath: require.resolve('eslint'),
                resolvePluginsRelativeTo: __dirname,

              },
              loader: require.resolve('eslint-loader'),
            },
          ],
          include: paths.appSrc,
        },
        {
          oneOf: [
            {
              test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
              loader: require.resolve('url-loader'),
              options: {
                limit: imageInlineSizeLimit,
                name: 'static/media/[name].[hash:8].[ext]',
              },
            },
            {
              test: /\.(js|mjs|jsx|ts|tsx)$/,
              include: paths.appSrc,
              loader: require.resolve('babel-loader'),
              options: {
                customize: require.resolve(
                  'babel-preset-react-app/webpack-overrides'
                ),

                plugins: [
                  [
                    require.resolve('babel-plugin-named-asset-import'),
                    {
                      loaderMap: {
                        svg: {
                          ReactComponent:
                            '@svgr/webpack?-svgo,+titleProp,+ref![path]',
                        },
                      },
                    },
                  ],
                ],
                cacheDirectory: true,
                cacheCompression: false,
                compact: isEnvProduction,
              },
            },
            {
              test: /\.(js|mjs)$/,
              exclude: /@babel(?:\/|\\{1,2})runtime/,
              loader: require.resolve('babel-loader'),
              options: {
                babelrc: false,
                configFile: false,
                compact: false,
                presets: [
                  [
                    require.resolve('babel-preset-react-app/dependencies'),
                    { helpers: true },
                  ],
                ],
                cacheDirectory: true,
                cacheCompression: false,
                sourceMaps: true,
                inputSourceMap: true,
              },
            },
            {
              loader: require.resolve('file-loader'),
              exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
              options: {
                name: 'static/media/[name].[hash:8].[ext]',
              },
            },
            // ** STOP ** Are you adding a new loader?
            // Make sure to add the new loader(s) before the "file" loader.
          ],
        },
      ],
    },

    plugins: [
      new HtmlWebpackPlugin(
        Object.assign(
          {},
          {
            inject: true,
            template: paths.appHtml,
          },
          isEnvProduction ? {
                minify: {
                  removeComments: true,
                  collapseWhitespace: true,
                  removeRedundantAttributes: true,
                  useShortDoctype: true,
                  removeEmptyAttributes: true,
                  removeStyleLinkTypeAttributes: true,
                  keepClosingSlash: true,
                  minifyJS: true,
                  minifyCSS: true,
                  minifyURLs: true,
                },
              }
            : undefined
        )
      ),
      isEnvProduction && new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime-.+[.]js/]),
      new ModuleNotFoundPlugin(paths.appPath),
      new webpack.DefinePlugin(env.stringified),
      isEnvDevelopment && new webpack.HotModuleReplacementPlugin(),
      isEnvDevelopment && new CaseSensitivePathsPlugin(),
      isEnvDevelopment && new WatchMissingNodeModulesPlugin(paths.appNodeModules),
      useTypeScript && new ForkTsCheckerWebpackPlugin({
          typescript: resolve.sync('typescript', {
            basedir: paths.appNodeModules,
          }),
          async: isEnvDevelopment,
          useTypescriptIncrementalApi: true,
          checkSyntacticErrors: true,
          tsconfig: paths.appTsConfig,
          reportFiles: [
            '**',
            '!**/__tests__/**',
            '!**/?(*.)(spec|test).*',
          ],
          silent: true,
          formatter: isEnvProduction ? typescriptFormatter : undefined,
      }),
    ].filter(Boolean),

    node: {
      module: 'empty',
      dgram: 'empty',
      dns: 'mock',
      fs: 'empty',
      http2: 'empty',
      net: 'empty',
      tls: 'empty',
      child_process: 'empty',
    },

    performance: false,
  };
};


text:
__author__ = 'Claudio'

import yaml

class YamlHandler(object):
    """ I/O For Yaml
    """
    def __init__(self, path=None, filename=None):
        if path:
            self.path = path
        if filename:
            self.filename = filename

    def get(self):
        if self.path and self.filename:
            config = self.get_yaml(self.path, self.filename)
        else:
            config = None
        return config

    def get_yaml(self, path, filename):
        yaml_file = '{path}/{ad_skeleton}'.format(path=path, ad_skeleton=filename)
        with open(yaml_file, 'r') as f:
            yaml_file = yaml.load(f)
        return yaml_file


text:
[![Build status](https://ci.appveyor.com/api/projects/status/hth4oae2lhry8jls/branch/master?svg=true)](https://ci.appveyor.com/project/mxpv/security/branch/master)
[![GitHub license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/mxpv/Security/blob/master/LICENSE)

### NuGet packages
- [Extensions.AspNet.Authentication.Vkontakte](https://www.nuget.org/packages/Extensions.AspNet.Authentication.Vkontakte/)
- [Extensions.AspNet.Authentication.Instagram](https://www.nuget.org/packages/Extensions.AspNet.Authentication.Instagram/)


text:
<?xml version="1.0" encoding="UTF-8"?>
<module codename="org.netbeans.modules.projectapi/1">
    <module_version install_time="1370463665557" last="true" origin="installer" specification_version="1.50.1">
        <file crc="2566874220" name="config/ModuleAutoDeps/org-netbeans-modules-projectapi.xml"/>
        <file crc="1088517943" name="config/Modules/org-netbeans-modules-projectapi.xml"/>
        <file crc="508103605" name="modules/locale/org-netbeans-modules-projectapi_ja.jar"/>
        <file crc="3176059444" name="modules/locale/org-netbeans-modules-projectapi_pt_BR.jar"/>
        <file crc="3428796301" name="modules/locale/org-netbeans-modules-projectapi_ru.jar"/>
        <file crc="2251988742" name="modules/locale/org-netbeans-modules-projectapi_zh_CN.jar"/>
        <file crc="472777372" name="modules/org-netbeans-modules-projectapi.jar"/>
    </module_version>
</module>


text: export type EncodedValues = any;


text:
namespace blink {

// This enum is the cross product of two ad related status of an event: whether
// the event occurs on an ad frame, and whether it occurs with an ad script in
// the stack.
enum class FromAdState {
  // This is used for a UMA histogram. Please never alter existing values, only
  // append new ones and make sure to update enums.xml.
  kAdScriptAndAdFrame = 0,
  kNonAdScriptAndAdFrame = 1,
  kAdScriptAndNonAdFrame = 2,
  kNonAdScriptAndNonAdFrame = 3,
  kMaxValue = kNonAdScriptAndNonAdFrame,
};

// Returns the FromAdState corresponded to the cross product of |is_ad_subframe|
// and |is_ad_script_in_stack|.
FromAdState BLINK_COMMON_EXPORT GetFromAdState(bool is_ad_subframe,
                                               bool is_ad_script_in_stack);

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_PUBLIC_COMMON_FRAME_FROM_AD_STATE_H_


text:
package org.mule.modules.watsonalchemylanguage.automation.functional;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

import org.junit.Test;
import org.mule.modules.watsonalchemylanguage.model.DateExtractionRequest;

import com.ibm.watson.developer_cloud.alchemy.v1.model.Dates;

public class DateExtractionTestCases extends AbstractTestCases {

	private DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss a");

	@Test
	public void getDatesUsingText() {

		Dates dates = getConnector().dateExtraction(buildDateExtractionRequest(false));

		assertNotNull(dates);
		assertEquals("english", dates.getLanguage());
		assertEquals(1, dates.getTotalTransactions().intValue());
		assertEquals(1, dates.getDates().size());
		assertEquals("25/11/2014 12:00:00 AM", formatter.format(dates.getDates().get(0).getDate()));
	}

	@Test
	public void getDatesUsingHTML() {
		Dates dates = getConnector()
				.dateExtraction(buildDateExtractionRequest(true));

		assertNotNull(dates);
		assertEquals("english", dates.getLanguage());
		assertEquals(1, dates.getTotalTransactions().intValue());
		assertEquals(2, dates.getDates().size());
		assertEquals("10/11/2014 12:00:00 AM", formatter.format(dates.getDates().get(0).getDate()));
		assertEquals("31/10/2014 12:00:00 AM", formatter.format(dates.getDates().get(1).getDate()));
	}

	/**
	 * This method builds a DateExtractionRequest object
	 * @param isHtml true If source is using html format, false otherwise.
	 * @return Instance of DateExtractionRequest class
	 */
	public DateExtractionRequest buildDateExtractionRequest(boolean isHtml) {

		DateExtractionRequest dateExtractionRequest = new DateExtractionRequest();

		dateExtractionRequest.setShowSourceText(true);
		dateExtractionRequest.setSource("
Finally found it!!!

The Person was found alive on November 10,"
					+ " 2014 in Marsella.

The last time was on a party was October 31, 2014 at a ranch outside the City Lights.
");
		dateExtractionRequest.setAnchorDate(null);

		if(!isHtml) {
			dateExtractionRequest.setSource("The person was found alive on November 25, 2014 at a ranch on the outskirts of city light.");
		}

		return dateExtractionRequest;
	}
}


text:
<?php
declare(strict_types=1);

namespace stubbles\helper\rss;

/**
 * Helper class for the test.
 *
 * @RssFeedItem
 */
class MissingAllRssItemEntity
{
    // intentionally empty
}


text:
const LexemeReference = require('../LexemeReference');

class Variant extends LexemeReference {
  constructor(data) {
    super(data);
    if (!(this.variantType instanceof Object)) {
      throw new Error(`The variant must have a "variantType" property.`);
    }
  }
}

module.exports = Variant;


text:
package com.yahoo.athenz.zts.cert;

import com.yahoo.athenz.auth.Principal;

import java.security.cert.X509Certificate;

public interface CertRecordStore {

    /**
     * Get a new connection to the certificate record store. In case
     * of failure, a ResourceException is thrown.
     * @return CertRecordStoreConnection object
     */
    CertRecordStoreConnection getConnection();

    /**
     * Set the operation timeout in seconds
     * @param opTimeout timeout in seconds
     */
    void setOperationTimeout(int opTimeout);

    /**
     * Clear all connections to the cert record store
     */
    void clearConnections();

    /**
     * Log the certificate details. This method will be
     * called for all certificates issued by ZTS Server
     * regardless or not it is checked against cert
     * record details.
     * @param principal Principal who requested the certificate
     *     for initial register requests this will be null
     * @param ip IP address of the request
     * @param provider service responsible for attestation of csr
     * @param instanceId instance id if the certificate request
     *     is for a service as opposed to a role
     * @param x509Cert issued certificate
     */
    void log(final Principal principal, final String ip, final String provider,
             final String instanceId, final X509Certificate x509Cert);
}


text:
require 'studio_game/player'
require 'studio_game/game'

module StudioGame

describe Game do
  context "player with a health of 150" do
  before do
    @health = 150
    @player = Player.new("jeff", @health)
  end
  it "has a capitalized name" do
  @player.name.should == "Jeff"
  end
  it "has an initial health" do
  @health.should_not == nil
  end
  it "has a string representation" do
  @player.should_not == ""
  end
  it "computes a score as the sum of its health and length of name" do
  @player.score.should == (150)
  end
  it "increases health by 15 when w00ted" do
  @player.woot
  @player.health.should == (150 + 15)
  end
  it "decreases health by 10 when blammed" do
   @player.blam
   @player.health.should == (150 - 10)
  end
  it "assigns a treasure for points during a player's turn" do
    game = Game.new("Knuckleheads")
    player = Player.new("moe")

    game.add_player(player)

    game.play(1)

    player.points.should_not be_zero
  end
  it "computes total points as the sum of all player points" do
    game = Game.new("Knuckleheads")

    player1 = Player.new("moe")
    player2 = Player.new("larry")

    game.add_player(player1)
    game.add_player(player2)

    player1.found_treasure(Treasure.new(:hammer, 50))
    player1.found_treasure(Treasure.new(:hammer, 50))
    player2.found_treasure(Treasure.new(:crowbar, 400))

    game.total_points.should == 500
  end
end
  context "Testing for randomness" do
    before do
       @game = Game.new("Knuckleheads")

       @initial_health = 100
       @player = Player.new("moe", @initial_health)

       @game.add_player(@player)
     end
     it "w00ts when there is a high roll" do
       Die.any_instance.stub(:roll).and_return(5)
       @game.play(2)
       @player.health.should == @initial_health + (15 * 2)
     end
     it "blams when there is a low roll" do
       Die.any_instance.stub(:roll).and_return(1)
        @game.play(2)
        @player.health.should == @initial_health - (10*2)
     end
     it "should skip when it is a medium roll" do
       Die.any_instance.stub(:roll).and_return(3)
        @game.play(2)
        @player.health.should == @initial_health
     end
  end
end
end


text:
// you can use this file to add your custom webpack plugins, loaders and anything you like.
// This is just the basic way to add addional webpack configurations.
// For more information refer the docs: https://getstorybook.io/docs/configurations/custom-webpack-config

// IMPORTANT
// When you add this file, we won't add the default configurations which is similar
// to "React Create App". This only has babel loader to load JavaScript.

module.exports = {
  plugins: [
    // your custom plugins
  ],
  module: {
    loaders: [
      // add your custom loaders.
    ],
  },
};// you can use this file to add your custom webpack plugins, loaders and anything you like.
// This is just the basic way to add addional webpack configurations.
// For more information refer the docs: https://getstorybook.io/docs/configurations/custom-webpack-config

// IMPORTANT
// When you add this file, we won't add the default configurations which is similar
// to "React Create App". This only has babel loader to load JavaScript.

/*
module.exports = {
  plugins: [
    // your custom plugins
  ],
  module: {
    loaders: [
      // add your custom loaders.
    ],
  },
};

*/
const genDefaultConfig = require('@storybook/react/dist/server/config/defaults/webpack.config.js');
const path = require('path');

module.exports = function (config, env) {
    var config = genDefaultConfig(config, env);

    //config.module.loaders.push({ test: /\.css$/, use: ['style-loader', 'css-loader'] });
    //config.module.loaders.push({ test: /\.(jpe?g|png|gif|svg)$/i, loaders: [ 'file-loader?hash=sha512&digest=hex&name=[hash].[ext]']})
    config.externals = {
      'cheerio': 'window',
      'jsdom': 'window',
      'react/lib/ReactContext': 'window',
      'react/lib/ExecutionEnvironment': true,
      'react/addons': true,
      'react-dom/test-utils': true,
    }

    return config;
};


text:
<?php

use yii\helpers\Html;
use kartik\grid\GridView;
use yii\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\RiskstoreSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'ความเสี่ยงประจำ';
$this->params['breadcrumbs'][] = $this->title;
?>

                        <?php echo $this->render('_search', ['model' => $searchModel]); ?>

<?php Pjax::begin(); ?>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        //'filterModel' => $searchModel,
        'panel' => [
        'heading'=>'
 ความเสี่ยงประจำ
',
        'type'=>'success',
        'before'=>Html::a(' เพิ่มความเสี่ยงประจำ', ['create'], ['class' => 'btn btn-success']),
        'after'=>Html::a(' Reset', ['index'], ['class' => 'btn btn-default']),
        'footer'=>false
    ],
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            'name',
            'typename',
            'programname',
            'levelname',
            'groupname',
            'teamname',
            ['class' => 'yii\grid\ActionColumn',
                'template' => '{view}{update}{delete}'
            ],
        ],
    ]); ?>
<?php Pjax::end(); ?>

<?= \bluezed\scrollTop\ScrollTop::widget() ?>


text:
package unit.com.bitdubai.fermat_osa_addon.layer.android.file_system.developer.bitdubai.version_1.structure.AndroidPluginTextFile;

import static org.fest.assertions.api.Assertions.*;
import static org.robolectric.Shadows.shadowOf;

import android.app.Activity;
import android.content.Context;
import android.support.v13.BuildConfig;

import com.bitdubai.fermat_api.layer.osa_android.file_system.FileLifeSpan;
import com.bitdubai.fermat_api.layer.osa_android.file_system.FilePrivacy;
import com.bitdubai.fermat_osa_addon.layer.android.file_system.developer.bitdubai.version_1.structure.AndroidPluginTextFile;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;

import java.util.UUID;

/**
 * Created by jorgegonzalez on 2015.06.29..
 */
@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class)
public class ConstructionTest {

    private AndroidPluginTextFile testTextFile;

    private UUID testId;
    private Context testContext;
    private String testDirectory;
    private String testFileName;
    private FilePrivacy testPrivacyLevel;
    private FileLifeSpan testLifeSpan;

    @Before
    public void setUpValues(){
        testId = UUID.randomUUID();
        Activity mockActivity = Robolectric.setupActivity(Activity.class);
        testContext = shadowOf(mockActivity).getApplicationContext();
        testDirectory = "ROBOLECTRICTEST";
        testFileName = "TESTFILE.txt";
        testPrivacyLevel = FilePrivacy.PUBLIC;
        testLifeSpan = FileLifeSpan.TEMPORARY;
    }

    @Test
    public void Constructor_ValidValues_ObjectCreated() {
        testTextFile = new AndroidPluginTextFile(testId, testContext, testDirectory, testFileName, testPrivacyLevel, testLifeSpan);
        assertThat(testTextFile).isNotNull();
    }

    @Test
    public void Constructor_ValidValues_ValuesCanBeGet() {
        testTextFile = new AndroidPluginTextFile(testId, testContext, testDirectory, testFileName, testPrivacyLevel, testLifeSpan);
        assertThat(testTextFile.getOwnerId()).isEqualTo(testId);
        assertThat(testTextFile.getContext()).isEqualTo(testContext);
        assertThat(testTextFile.getDirectoryName()).isEqualTo(testDirectory);
        assertThat(testTextFile.getFileName()).isEqualTo(testFileName);
        assertThat(testTextFile.getPrivacyLevel()).isEqualTo(testPrivacyLevel);
        assertThat(testTextFile.getLifeSpan()).isEqualTo(testLifeSpan);
    }
}


text:
using Microsoft.Practices.Unity;
using WoodenMoose.Core.Models;
using WoodenMoose.ViewModels;
using WoodenMoose.ViewModels.UserControls;

namespace WoodenMoose.Helpers
{
    public static class MapperHelper
    {
        public static ApplicationUserControlViewModel ToViewModel(this Application application)
        {
            var viewModelLocator = (App.Current as App)?.UnityContainer?.Resolve<ViewModelLocator>();
            var viewModel = viewModelLocator?.ApplicationUserControlViewModel;

            if (viewModel != null)
            {
                viewModel.ApplicationId = application.Id;
                viewModel.Name = application.Name;
                viewModel.ImageUrl = application.ImageUrl;
                viewModel.Background = BrushHelper.ColorToBrush(application.Background);
                viewModel.AverageRating = application.AverageRating;
                viewModel.Ratings = application.TotalRatingsCount;
                viewModel.Reviews = application.TotalReviewsCount;
                viewModel.UnreadReviews = application.UnreadReviewsCount;
            }

            return viewModel;
        }

        public static MarketUserControlViewModel ToViewModel(this ApplicationMarket applicationMarket)
        {
            var viewModelLocator = (App.Current as App)?.UnityContainer?.Resolve<ViewModelLocator>();
            var viewModel = viewModelLocator?.MarketUserControlViewModel;

            if (viewModel != null)
            {
                viewModel.ApplicationId = applicationMarket.ApplicationId;
                viewModel.MarketId = applicationMarket.MarketId;
                viewModel.Name = ResourceHelper.GetString(applicationMarket.MarketId, ResourcesFileEnum.CountriesResources);
                viewModel.ImageUrl = $"ms-appx:///Assets/Flags/{applicationMarket.MarketId}.png";
                viewModel.AverageRating = applicationMarket.AverageRating;
                viewModel.Ratings = applicationMarket.TotalRatingsCount;
                viewModel.Reviews = applicationMarket.TotalReviewsCount;
                viewModel.UnreadReviews = applicationMarket.UnreadReviewsCount;
            }

            return viewModel;
        }

        public static ReviewUserControlViewModel ToViewModel(this Review review, string marketId, bool showMarketFlag)
        {
            var viewModelLocator = (App.Current as App)?.UnityContainer?.Resolve<ViewModelLocator>();
            var viewModel = viewModelLocator?.ReviewUserControlViewModel;

            if (viewModel != null)
            {
                viewModel.ReviewId = review.Id;
                viewModel.Title = review.Title;
                viewModel.Content = review.Content;
                viewModel.Rating = review.Rating;
                viewModel.Author = review.Author;
                viewModel.Date = review.Date;
                viewModel.IsNew = review.IsNew;
                viewModel.MarketImageUrl = $"ms-appx:///Assets/Flags/{marketId}.png";
                viewModel.ShowMarketFlag = showMarketFlag;
            }

            return viewModel;
        }
    }
}


text:
package org.xsaas.xstat.web.action.backend.list;

import java.util.LinkedList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.xsaas.xstat.web.bo.PlanHeaderInfo;
import org.xsaas.xstat.web.conf.SmgkConstants;
import org.xsaas.xstat.web.util.PaginationUtil;

import org.xsaas.xstat.business.IClientInfoService;
import org.xsaas.xstat.business.IInformantInfoService;
import org.xsaas.xstat.business.IInquisitionInfoService;
import org.xsaas.xstat.business.IIssueInfoService;
import org.xsaas.xstat.business.IPlanInfoService;
import org.xsaas.xstat.business.IProjectInfoService;
import org.xsaas.xstat.business.ISmgkInfoService;
import org.xsaas.xstat.po.ClientInfo;
import org.xsaas.xstat.po.InformantInfo;
import org.xsaas.xstat.po.InquisitionInfo;
import org.xsaas.xstat.po.IssueInfo;
import org.xsaas.xstat.po.PlanInfo;
import org.xsaas.xstat.po.ProjectInfo;
import org.xsaas.xstat.po.SmgkInfo;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class ListProjectAction extends ActionSupport {

	/**
	 *
	 */
	private static final long serialVersionUID = -2898380874870429052L;
	private static Log logger = LogFactory.getLog(ListProjectAction.class);

	private ISmgkInfoService smgkInfoService = null;
	private IPlanInfoService planInfoService = null;
	private IIssueInfoService issueInfoService = null;
	private IProjectInfoService projectInfoService = null;
	private IClientInfoService clientInfoService = null;
	private IInquisitionInfoService inquisitionInfoService = null;
	private IInformantInfoService informantInfoService = null;

	private Integer num = null;
	private List<PlanInfo> pageList = null;
	private Integer totalPageNum = null;
	private PaginationUtil pu = null;

	private LinkedList<PlanHeaderInfo> planHeaderList = new LinkedList<PlanHeaderInfo>();
	private LinkedList<IssueInfo> issueList = new LinkedList<IssueInfo>();

	@Override
	public String execute() throws Exception {
		try{
			String username = (String)ActionContext.getContext().getSession().get("LOGINUSERNAME");
			String password = (String)ActionContext.getContext().getSession().get("LOGINPASSWORD");
			if(username == null || password == null) {
				return LOGIN;
			}

			SmgkInfo smgkInfo = smgkInfoService.isLogin(username, password);
			if(smgkInfo == null) {
				return LOGIN;
			}
			int page = 1;
			if(num != null) {
				page = num.intValue();
			}

			pageList = planInfoService.findBySmgk(smgkInfo.getSmgkID());
			int total = 0;
			if(pageList != null) {
				total = pageList.size();
				pu = new PaginationUtil(total,page,SmgkConstants.PAGE_MAX_RESULT);
			}

			PlanHeaderInfo phi = null;
			planHeaderList.clear();
			issueList.clear();

			for(int i=0;i<total;i++) {
				PlanInfo pi = pageList.get(i);
				phi = new PlanHeaderInfo();
				IssueInfo issueInfo = null;
				if(pi != null && pi.getIssueID() != null) {
					issueInfo = issueInfoService.getIssueInfo(pi.getIssueID());
				}
				if(issueInfo != null) {
					phi.setIssue(""+issueInfo.getIssue());
					issueList.add(issueInfo);

					ClientInfo ci = clientInfoService.getClientInfo(issueInfo.getClientID());
					if(ci != null) {
						phi.setCompany(""+ci.getCompany());
					}
					ProjectInfo projectInfo = projectInfoService.getProjectInfo(issueInfo.getProjectID());
					if(projectInfo != null && projectInfo.getName() != null) {
						phi.setProjectName(""+projectInfo.getName());
					}

					if(issueInfo != null && issueInfo.getInquisitionID() != null) {
						InquisitionInfo ii = inquisitionInfoService.getInquisitionInfo(issueInfo.getInquisitionID());
						if(ii != null) {
							phi.setInquisition(""+ii.getTitle());
						}
					}

				}
				if(pi != null && pi.getInformantID() != null) {
					InformantInfo ii = informantInfoService.getInformantInfo(pi.getInformantID());
					phi.setInformantName(""+ii.getAliasName());
				}

				planHeaderList.add(phi);

			}
		}catch(Exception e) {
			logger.error(e.getMessage(),e.getCause());
		}

		return SUCCESS;
	}

	public void setSmgkInfoService(ISmgkInfoService smgkInfoService) {
		this.smgkInfoService = smgkInfoService;
	}

	public void setPlanInfoService(IPlanInfoService planInfoService) {
		this.planInfoService = planInfoService;
	}
	public void setIssueInfoService(IIssueInfoService issueInfoService) {
		this.issueInfoService = issueInfoService;
	}

	public void setProjectInfoService(IProjectInfoService projectInfoService) {
		this.projectInfoService = projectInfoService;
	}

	public void setClientInfoService(IClientInfoService clientInfoService) {
		this.clientInfoService = clientInfoService;
	}

	public void setInquisitionInfoService(
			IInquisitionInfoService inquisitionInfoService) {
		this.inquisitionInfoService = inquisitionInfoService;
	}
	public Integer getNum() {
		return num;
	}

	public void setNum(Integer num) {
		this.num = num;
	}

	public List<PlanInfo> getPageList() {
		return pageList;
	}

	public Integer getTotalPageNum() {
		return totalPageNum;
	}

	public PaginationUtil getPu() {
		return pu;
	}

	public LinkedList<IssueInfo> getIssueList() {
		return issueList;
	}

	public LinkedList<PlanHeaderInfo> getPlanHeaderList() {
		return planHeaderList;
	}

	public void setInformantInfoService(IInformantInfoService informantInfoService) {
		this.informantInfoService = informantInfoService;
	}

}


text:
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_EXPORTED_WEB_EMBEDDED_WORKER_IMPL_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_EXPORTED_WEB_EMBEDDED_WORKER_IMPL_H_

#include <memory>

#include "mojo/public/cpp/bindings/pending_remote.h"
#include "third_party/blink/public/mojom/cache_storage/cache_storage.mojom-blink-forward.h"
#include "third_party/blink/public/web/web_embedded_worker.h"
#include "third_party/blink/public/web/web_embedded_worker_start_data.h"
#include "third_party/blink/renderer/core/workers/global_scope_creation_params.h"
#include "third_party/blink/renderer/core/workers/worker_clients.h"
#include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_content_settings_proxy.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"

namespace blink {

class ServiceWorkerInstalledScriptsManager;
class ServiceWorkerThread;
struct CrossThreadFetchClientSettingsObjectData;

// The implementation of WebEmbeddedWorker. This is responsible for starting
// and terminating a service worker thread. Lives on a ThreadPool background
// thread.
//
// Because it lives on a ThreadPool thread, this class does not make
// GarbageCollected objects (https://crbug.com/988335).
class MODULES_EXPORT WebEmbeddedWorkerImpl final : public WebEmbeddedWorker {
 public:
  explicit WebEmbeddedWorkerImpl(WebServiceWorkerContextClient*);

  WebEmbeddedWorkerImpl(const WebEmbeddedWorkerImpl&) = delete;
  WebEmbeddedWorkerImpl& operator=(const WebEmbeddedWorkerImpl&) = delete;

  ~WebEmbeddedWorkerImpl() override;

  // WebEmbeddedWorker overrides.
  void StartWorkerContext(
      std::unique_ptr<WebEmbeddedWorkerStartData>,
      std::unique_ptr<WebServiceWorkerInstalledScriptsManagerParams>,
      CrossVariantMojoRemote<
          mojom::blink::WorkerContentSettingsProxyInterfaceBase>
          content_settings,
      CrossVariantMojoRemote<mojom::blink::CacheStorageInterfaceBase>
          cache_storage,
      CrossVariantMojoRemote<mojom::blink::BrowserInterfaceBrokerInterfaceBase>
          browser_interface_broker,
      scoped_refptr<base::SingleThreadTaskRunner> initiator_thread_task_runner)
      override;
  void TerminateWorkerContext() override;

  void WaitForShutdownForTesting();

 private:
  void StartWorkerThread(
      std::unique_ptr<WebEmbeddedWorkerStartData> worker_start_data,
      std::unique_ptr<ServiceWorkerInstalledScriptsManager>,
      std::unique_ptr<ServiceWorkerContentSettingsProxy>,
      mojo::PendingRemote<mojom::blink::CacheStorage>,
      mojo::PendingRemote<mojom::blink::BrowserInterfaceBroker>,
      scoped_refptr<base::SingleThreadTaskRunner> initiator_thread_task_runner);

  // Creates a cross-thread copyable outside settings object for top-level
  // worker script fetch.
  std::unique_ptr<CrossThreadFetchClientSettingsObjectData>
  CreateFetchClientSettingsObjectData(
      const KURL& script_url,
      const SecurityOrigin*,
      const HttpsState&,
      network::mojom::IPAddressSpace,
      const WebFetchClientSettingsObject& passed_settings_object);

  // Client must remain valid through the entire life time of the worker.
  WebServiceWorkerContextClient* const worker_context_client_;

  std::unique_ptr<ServiceWorkerThread> worker_thread_;

  bool asked_to_terminate_ = false;
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_EXPORTED_WEB_EMBEDDED_WORKER_IMPL_H_


text:
package vue;

import controleur.GameOption;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.stage.Stage;
import javafx.util.Callback;
import modele.baseObject.MilkInterface;
import modele.baseObject.MilkLanguage;

/**
 * The controller for the Game window.
 * @author Lyanel Pheles
 */
public class MilkOptionController extends MilkerController {

    @FXML
    private Label optionLab1;
    @FXML
    private Label optionLab2;
    @FXML
    private Label optionLab3;
    @FXML
    private ComboBox<MilkLanguage> optionSel1;
    @FXML
    private ComboBox<String> optionSel2;
  /*  @FXML
    private ChoiceBox optionSel2;
    @FXML
    private ChoiceBox optionSel3;*/
    @FXML
    private Button saveBT;
    @FXML
    private Button CancelBT;

	@FXML
    private void initialize() {initList();}

    public void initList() {
    	initOption1();
    	initOption2();

    	saveBT.setOnAction(new EventHandler<ActionEvent>() {
    	    @Override public void handle(ActionEvent e) {
    	    	GameOption.getOption().setLanguage(optionSel1.getSelectionModel().getSelectedItem());
    	    	GameOption.getOption().setCss(optionSel2.getSelectionModel().getSelectedItem());
    	    	getMainApp().setStageCss(getMainApp().getScene());
    	    	getMainApp().setStatutMessage(MilkInterface.getMilkStringsFromId(140).asText());
    	    	Stage stage = (Stage) CancelBT.getScene().getWindow();
    	        stage.close();
    	    }
    	});

    	CancelBT.setOnAction(new EventHandler<ActionEvent>() {
    	    @Override public void handle(ActionEvent e) {
    	    	Stage stage = (Stage) CancelBT.getScene().getWindow();
    	        stage.close();
    	    }
    	});

    }

    public void initOption1() {
    //	optionLab1.setText(MilkInterface.getStringsFromId(33));
    	optionLab1.textProperty().bind( MilkInterface.getMilkStringsFromId(33).getText()  );
    	optionSel1.setItems(MilkInterface.getListes());
    	optionSel1.setValue(MilkInterface.getMilkLanguage());

    	optionSel1.setButtonCell(
    		    new ListCell<MilkLanguage>() {
    		        @Override
    		        protected void updateItem(MilkLanguage item, boolean empty) {
    		            super.updateItem(item, empty);
	    		            if (empty) {
	    		                setText("");
	    		            } else {
	    		                setText(item.getName());
    		            }
    		        }
    		    });

    	optionSel1.setCellFactory(new Callback<ListView<MilkLanguage>, ListCell<MilkLanguage>>() {
    	    @SuppressWarnings("rawtypes")
			public ListCell call(ListView<MilkLanguage> p) {
                ListCell cell = new ListCell<MilkLanguage >() {
                    @Override
                    protected void updateItem(MilkLanguage item, boolean empty) {
                        super.updateItem(item, empty);
                        if (empty) {
                            setText("");
                        } else {
                            setText(item.getName());
                        }
                    }
                };
    	        return cell;
    	    }
    	});
    }

    public void initOption2() {
    //	optionLab2.setText(MilkInterface.getStringsFromId(33));
    	optionLab2.textProperty().bind( MilkInterface.getMilkStringsFromId(33).getText()  );
    	optionSel2.setItems(GameOption.getCssLists());

    	optionSel2.setButtonCell(
    		    new ListCell<String>() {
    		        @Override
    		        protected void updateItem(String item, boolean empty) {
    		            super.updateItem(item, empty);
	    		            if (empty) {
	    		                setText("");
	    		            } else {
	    		                setText(item);
    		            }
    		        }
    		    });

    	optionSel2.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {
    	    @SuppressWarnings("rawtypes")
			public ListCell call(ListView<String> p) {
                ListCell cell = new ListCell<String >() {
                    @Override
                    protected void updateItem(String item, boolean empty) {
                        super.updateItem(item, empty);
                        if (empty) {
                            setText("");
                        } else {
                            setText(item);
                        }
                    }
                };
    	        return cell;
    	    }
    	});
    	optionSel2.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> changeVar(newValue));
    	if(GameOption.getOption().getCss()!=null) optionSel2.setValue(GameOption.getOption().getCss());
    	else optionSel2.getSelectionModel().selectFirst();
    }

	public void changeVar(String css) {
		if (optionSel2.getScene()!=null){
			optionSel2.getScene().getStylesheets().clear();
			optionSel2.getScene().getStylesheets().add(GameOption.getCssUrl(css));
		}
	}
}


text:
/**
 * A client to the Google Cloud DNS.
 *
 *

 * Here are two simple usage examples from within Compute/App Engine.
 *
 * The first snippet shows how to create a zone resource. The complete source code can be found on
 *
 * CreateAndListZones.java. Note that you need to replace the {@code domainName} with a domain
 * name that you own and the ownership of which you verified with Google.
 *
 *
 {@code
 * Dns dns = DnsOptions.defaultInstance().service();
 * String zoneName = "my-unique-zone";
 * String domainName = "someexampledomain.com.";
 * String description = "This is a gcloud-java-dns sample zone.";
 * ZoneInfo zoneInfo = ZoneInfo.of(zoneName, domainName, description);
 * Zone createdZone = dns.create(zoneInfo);
 * }

 *
 *

 * The second example shows how to create records inside a zone. The complete code can be found on
 *
 * CreateAndListDnsRecords.java.
 *
 *
 {@code
 * Dns dns = DnsOptions.defaultInstance().service();
 * String zoneName = "my-unique-zone";
 * Zone zone = dns.getZone(zoneName);
 * String ip = "12.13.14.15";
 * RecordSet toCreate = RecordSet.builder("www.someexampledomain.com.", RecordSet.Type.A)
 *   .ttl(24, TimeUnit.HOURS)
 *   .addRecord(ip)
 *   .build();
 * ChangeRequestInfo changeRequest = ChangeRequestInfo.builder().add(toCreate).build();
 * zone.applyChangeRequest(changeRequest);
 * }

 *
 *

 * When using gcloud-java from outside of App/Compute Engine, you have to
 * specify a
 * project ID and
 * provide
 * credentials.
 *
 * @see Google Cloud DNS
 */
package com.google.cloud.dns;


text:
<!DOCTYPE HTML>

<meta charset="utf-8">
<title i18n-content="policyTitle"></title>
<link rel="stylesheet" href="chrome://resources/css/widgets.css">
<link rel="stylesheet" href="policy.css">

    <button id="fetch-policies-button" i18n-content="fetchPoliciesText">
    </button>

            <fieldset class="status-box" jsselect="deviceStatus"
                jsdisplay="display">
              <legend i18n-content="devicePoliciesBoxTitle"></legend>

            </fieldset>
            <fieldset class="status-box" jsselect="userStatus"
                jsdisplay="display">
              <legend i18n-content="userPoliciesBoxTitle"></legend>

            </fielset>

              <input id="toggle-unsent-policies" type="checkbox">

            <input id="search-field" type="search" incremental
                i18n-values="placeholder: filterPoliciesText">

                    <button class="link-button toggler expand"
                        i18n-content="showMoreText" hidden></button>

                    <button class="link-button toggler collapse"
                        i18n-content="hideText" hidden></button>

                    <button class="link-button toggler expand"
                        i18n-content="showMoreText" hidden></button>

                    <button class="link-button toggler collapse"
                        i18n-content="hideText" hidden></button>


text:
namespace NGSoftware.Common
{
	/// <summary>
	/// Direction to use during sorting.
	/// </summary>
	public enum SortDirection
	{
		Ascending,
		Descending
	}
}


text:
package orchestrator

import (
	"testing"

	"github.com/Sirupsen/logrus"
	"github.com/codingconcepts/albert/test"
)

func TestNewOrchestratorConfigPropertiesAssigned(t *testing.T) {
	c := &Config{
		Applications:   applications,
		GatherChanSize: gatherChanSize,
		GatherTimeout:  gatherTimeout,
	}

	p := &mockProcessor{}
	o, err := NewOrchestrator(c, p, logrus.New())
	test.ErrorNil(t, err)

	test.Equals(t, c.Applications, o.applications)
}

func TestNewOrchestratorWithInvalidConfig(t *testing.T) {
	c := &Config{}

	p := &mockProcessor{}
	_, err := NewOrchestrator(c, p, logrus.New())
	test.ErrorNotNil(t, err)
}

func TestProcessHappyPath(t *testing.T) {
	c := &Config{
		Applications:   applications,
		GatherChanSize: gatherChanSize,
		GatherTimeout:  gatherTimeout,
	}

	p := &mockProcessor{}
	o, err := NewOrchestrator(c, p, logger)
	test.ErrorNil(t, err)

	hook.Reset()
	o.Process(testApplication)

	test.AnyLogEntryContainsMessage(t, "scatter gather responses received", hook.Entries)
	test.AnyLogEntryContainsField(t, "totalCount", 2, hook.Entries)
	test.AnyLogEntryContainsField(t, "killCount", 1, hook.Entries)
	test.AnyLogEntryContainsField(t, "name", "notepad", hook.Entries)
	test.AnyLogEntryContainsMessage(t, "published kill", hook.Entries)
	test.AnyLogEntryContainsField(t, "topic", exampleTopic, hook.Entries)
}

func TestProcessFailToGather(t *testing.T) {
	processFailure(t, &mockProcessor{failToGather: true}, errSadGather)

	test.LogEntryContainsField(t, "error", errSadGather.Error(), hook.LastEntry())
}

func TestProcessFailToIssueKill(t *testing.T) {
	processFailure(t, &mockProcessor{failToIssueKill: true}, errSadIssueKill)

	test.LogEntryContainsField(t, "error", errSadIssueKill.Error(), hook.LastEntry())
}

func processFailure(t *testing.T, p Processor, expError error) {
	c := &Config{
		Applications:   applications,
		GatherChanSize: gatherChanSize,
		GatherTimeout:  gatherTimeout,
	}

	o, err := NewOrchestrator(c, p, logger)
	test.ErrorNil(t, err)

	o.Process(testApplication)

	test.LogEntryContainsField(t, "error", expError.Error(), hook.LastEntry())
}


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

class DataSourceLink extends Component {
  render() {
    return (
      {this.props.reference.id}
    );
  }
}

DataSourceLink.propTypes = {
  omitPrefix: React.PropTypes.bool,
  reference: React.PropTypes.shape({
    crossrefCompleteUrl: React.PropTypes.string,
    id: React.PropTypes.string,
  }),
};

export default DataSourceLink;


text:
NSString *const kTwitterKeeperInfoBaseResult = @"result";
NSString *const kTwitterKeeperInfoBaseMsg = @"msg";

@interface TwitterKeeperInfoBase ()

- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;

@end

@implementation TwitterKeeperInfoBase

@synthesize result = _result;
@synthesize msg = _msg;

+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
    return [[self alloc] initWithDictionary:dict];
}

- (instancetype)initWithDictionary:(NSDictionary *)dict
{
    self = [super init];

    // This check serves to make sure that a non-NSDictionary object
    // passed into the model class doesn't break the parsing.
    if(self && [dict isKindOfClass:[NSDictionary class]]) {
            self.result = [[self objectOrNilForKey:kTwitterKeeperInfoBaseResult fromDictionary:dict] boolValue];
            self.msg = [TwitterKeeperInfoMsg modelObjectWithDictionary:[dict objectForKey:kTwitterKeeperInfoBaseMsg]];

    }

    return self;

}

- (NSDictionary *)dictionaryRepresentation
{
    NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
    [mutableDict setValue:[NSNumber numberWithBool:self.result] forKey:kTwitterKeeperInfoBaseResult];
    [mutableDict setValue:[self.msg dictionaryRepresentation] forKey:kTwitterKeeperInfoBaseMsg];

    return [NSDictionary dictionaryWithDictionary:mutableDict];
}

- (NSString *)description
{
    return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}

#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
    id object = [dict objectForKey:aKey];
    return [object isEqual:[NSNull null]] ? nil : object;
}

#pragma mark - NSCoding Methods

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];

    self.result = [aDecoder decodeBoolForKey:kTwitterKeeperInfoBaseResult];
    self.msg = [aDecoder decodeObjectForKey:kTwitterKeeperInfoBaseMsg];
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{

    [aCoder encodeBool:_result forKey:kTwitterKeeperInfoBaseResult];
    [aCoder encodeObject:_msg forKey:kTwitterKeeperInfoBaseMsg];
}

- (id)copyWithZone:(NSZone *)zone
{
    TwitterKeeperInfoBase *copy = [[TwitterKeeperInfoBase alloc] init];

    if (copy) {

        copy.result = self.result;
        copy.msg = [self.msg copyWithZone:zone];
    }

    return copy;
}

@end


text:
        {{vm.ngModel.name}}
        ({{vm.ngModel.size | bytes}})

    <cms-progress-bar load-state="vm.loadState" ng-if="vm.ngModel && !vm.ngModel.isCurrentFile"></cms-progress-bar>

        <button class="btn-icon"
                ngf-select
                title="{{vm.buttonText}}"
                type="button"
                ngf-change="vm.fileChanged($files, $event)"
                ngf-accept="'*.*'"
                ngf-reset-on-click="false"
                ng-disabled="vm.loadState.isLoading">

        </button>
        <button type="button"
                ng-if="vm.isRemovable"
                ng-click="vm.remove()"
                ng-disabled="vm.loadState.isLoading">
            Remove
        </button>

        {{vm.ngModel.name}}
        ({{vm.ngModel.size | bytes}})


text:
/*
offsetWidth: width on page including border+padding but not margin
scrollWidth: total width of element from left to right
clientWidth: visible portion of width due to existance of scrollbar
			 not including borders, margins or scrollbar
*/

// Call whenever the window size changes but the image doesnt
var setCurrentZoom;
// Call whenever the image on a tab becomes visible
var attachZoomToImage;

var setupZoomButton = function()
{
	var myroot        = null;
	var zoom_panel    = null;
	var ul            = null;
	var button        = null;
	var inputZoom     = null;

	var image;
	var div;
	var svgroot;
	var svgcontent;
	var current_zoom;
	var naturalWidth;	// Actual width  in pixels
	var naturalHeight;	// Actual height in pixels

	var disableDefault = function(evt)
	{
		if (evt.stopPropagation) {
			evt.stopPropagation();
		} else {
			evt.cancelBubble = true;
		}
	}

	var showSvgZoom = function()
	{
	 	var rect = svgroot.getBoundingClientRect();
		if (!rect) {
			image.zoom = current_zoom = null;
			inputZoom.value = '';
		} else {
			image.zoom = current_zoom = rect.width / naturalWidth;
			inputZoom.value = Math.round(current_zoom*100);
	}	}

	var zoomToSvgFrame = function()
	{
		svgroot.setAttribute('width', '100%');
		svgroot.removeAttribute('height');
		div.scrollLeft = 0;
		div.scrollTop  = 0;
		showSvgZoom();
	}

	var setHtmlZoom = function(zoom)
	{
		if (zoom <= 0) {
			return;
		}
		var img   = image.img;
		var scale = (zoom != 1 ? 'scale(' + zoom + ')' : null);
		var top   = (scale != null ? '0 0' : null);

/*
		img.style['zoom']                     = zoom;
		img.style['-moz-transform']           = scale;
		img.style['-moz-transform-origin']    = top;
		img.style['-o-transform']             = scale;
		img.style['-o-transform-origin']      = top;
		img.style['-webkit-transform']        = scale;
		img.style['-webkit-transform-origin'] = top;
		img.style['-ms-transform']            = scale;
		img.style['-ms-transform-origin']     = top;
*/

		img.style.MozTransform = scale;
		img.style.MozTransformOrigin = top;
		img.style.WebkitTransform = scale;
		img.style.WebkitTransformOrigin = top;
		if (zoom < 1) {
			img.width = (100/zoom) + '%';
		} else {
			img.width = (zoom * 100) + '%';
		}

		current_zoom    = zoom;
		inputZoom.value = Math.round(current_zoom*100);
	}

    var wasFullFrame;

	var fullScreen = function(img)
	{
		// Stupid behaviour in chrome if try to fullScreen right frame
		wasFullFrame = isFullFrame();
		if (!wasFullFrame) {
			toggle_frames();
		}

        if (img.requestFullScreen) {
            img.requestFullScreen();
		} else if (img.mozRequestFullScreen) {
			img.mozRequestFullScreen();
			// document.mozCancelFullScreen
		} else if (img.webkitRequestFullScreen) {
			img.webkitRequestFullScreen();
			// document.webkitCancelFullScreen
	}	}

	var imageControls;
	var imageTabs;
	var imageDummy;

	var zoomToFullImage = function()
	{
		var img;

		if (image.isImage) {
			imageControls = document.getElementById('imageControls');
			imageTabs     = document.getElementById('tabs');
			imageDummy    = image.dummy;

			svgroot.style.display       = 'none';
			imageDummy.style.display    = '';
			imageControls.style.display = 'none';
			if (imageTabs.style.display == '') {
				imageTabs.style.display = 'none';
			} else {
				imageTabs = null;
			}
			img = image.div;
		} else {
			img = image.img;
		}
		fullScreen(img);
	}

	var zoomToFullMarkup = function()
	{
		var img;

		imageControls = document.getElementById('imageControls');
		imageTabs     = document.getElementById('tabs');

		imageControls.style.display = 'none';
		if (imageTabs.style.display == '') {
			imageTabs.style.display = 'none';
		} else {
			imageTabs = null;
		}
		fullScreen(image.div);
	}

	var fullScreenChange = function()
	{
		if (!document.mozFullScreenElement && !document.webkitIsFullScreen && !document.fullscreen) {
			if (!wasFullFrame) {
				toggle_frames();
			}
			if (imageDummy) {
				imageDummy.style.display = 'none';
				svgroot.style.display    = '';
				imageDummy               = null;
			}
			if (imageControls) {
				imageControls.style.display = '';
				imageControls = null;
			}
			if (imageTabs) {
				imageTabs.style.display = '';
				imageTabs = null;
	}	}	}

	setCurrentZoom = function()
	{
		if (image.isImage) {
	 		var rect = svgroot.getBoundingClientRect();

			if (rect && rect.width < div.clientWidth) {
				zoomToSvgFrame();
			} else {
				showSvgZoom();
			}
		}
	}

	// Setup as if the user had screen grabbed this region
	// Coordinates are in screen pixels, not natural pixels

	var setVisibleRegion = function(x, y, width, height, inverse)
	{
		/* N.B div.clientHeight is not reliable -- goes to end of page */
		var clientWidth  = div.clientWidth;
		var clientHeight = clientWidth * naturalHeight / naturalWidth;
		var increase, zoomlevel;

		increase  = (inverse ? (width/clientWidth) : (clientWidth / width));
		zoomlevel = current_zoom * increase;
		width     = zoomlevel * naturalWidth;

		if (width < clientWidth) {
			zoomToSvgFrame();
			return;
		}

		height    = zoomlevel * naturalHeight;
		x        *= increase;
		y        *= increase;

		if (x + width < clientWidth) {
			// Remove blank space on right
			x = clientWidth - width;
		}
		if (x < 0) {
			x = 0;
		}
		if (y + height < clientHeight) {
			y = clientHeight - height;
		}
		if (y < 0) {
			y = 0;
		}
		svgroot.setAttribute('width',  width);
		svgroot.setAttribute('height', height);
		div.scrollLeft   = x;
		div.scrollTop    = y;

		setCurrentZoom();
	}

	var getStrokedBBox = function()
	{
		var layers = [];
		var child, bb;
		for (child = svgcontent.firstChild; child; child = child.nextSibling) {
			if (child.tagName == 'g') {
				if (child.display != 'none') {
					try {
						bb = child.getBBox();
						layers[layers.length] = bb;
					} catch (e) {
		}	}	}	}

		var lth = layers.length;

		if (lth == 0) {
			return null;
		}
		var full_bb = layers[0];
		if (lth == 1) {
			return full_bb;
		}

		var max_x   = full_bb.x + full_bb.width;
		var max_y   = full_bb.y + full_bb.height;
		var min_x   = full_bb.x;
		var min_y   = full_bb.y;
		var cur_bb, i;

		for (i = 1; i < lth; ++i) {
			cur_bb = layers[i];

			min_x = Math.min(min_x, cur_bb.x);
			min_y = Math.min(min_y, cur_bb.y);
		}

		full_bb.x = min_x;
		full_bb.y = min_y;

		for (i = 1; i < lth; ++i) {
			cur_bb = layers[i];
			max_x  = Math.max(max_x, cur_bb.x + cur_bb.width);
			max_y = Math.max(max_y, cur_bb.y + cur_bb.height);
		}

		full_bb.width  = max_x - min_x;
		full_bb.height = max_y - min_y;
		return full_bb;
	}

	var zoomToMarkup = function(val)
	{
		var bb = getStrokedBBox();
		if (bb) {
			var rect    = svgroot.getBoundingClientRect();
			var scale_x = rect.width  / svgroot.viewBox.baseVal.width;
			var scale_y = rect.height / svgroot.viewBox.baseVal.height;
			setVisibleRegion(bb.x * scale_x, bb.y * scale_y, bb.width * scale_x, bb.height * scale_y, false);
	}	}

	var changeZoomPercent = function(percent)
	{
		if (percent <= 0 || isNaN(percent)) {
			return;
		}

		if (image.isImage) {
			var width  = naturalWidth * percent / 100;

			if (width < div.clientWidth) {
				zoomToSvgFrame();
				return;
			}

			var height = width * naturalHeight / naturalWidth;

			svgroot.setAttribute('width',  width);
			svgroot.setAttribute('height', height);
			setCurrentZoom();
			return;
		}

		setHtmlZoom(percent / 100);
	}

	var mousedownZoomButton = function()
	{
		if (button.className != 'down') {
			button.className = 'down';
			ul.className = 'showZoomList';
		} else {
			button.className = null;
			ul.className = 'hideZoomList';
		}
	};

	var clickZoomLabel = function()
	{
		mousedownZoomButton();
	}

	var zoom_panel = document.getElementById('zoom_panel');
	var node   = document.getElementById('zoom_dropdown');
	var input  = null;
	var child;

	for (child = node.firstChild; child; child = child.nextSibling) {
		switch (child.tagName) {
		case 'BUTTON':
			button = child;
			button.addEventListener(
				'mousedown',
				mousedownZoomButton,
				false
			);
			button.addEventListener(
				'mouseup',
				disableDefault,
				false
			);
			break;
		case 'UL':
			ul = child;
			break;
	}	}

	for (child = ul.firstChild; child; child = child.nextSibling) {
		if (child.tagName == 'LI') {
			var title = child.title;
			if (title) {
				switch (title) {
				case 'frame':
					child.addEventListener(
						'mouseup',
						zoomToSvgFrame,
						false);
					break;
				case 'fullImage':
					child.addEventListener(
						'mouseup',
						zoomToFullImage,
						false);
					break;
				case 'fullMarkup':
					child.addEventListener(
						'mouseup',
						zoomToFullMarkup,
						false);
					break;
				case 'markup':
					child.addEventListener(
						'mouseup',
						zoomToMarkup,
						false);
					break;
				}
			} else {
				child.addEventListener(
					'mouseup',
					function()
					{
						changeZoomPercent(parseInt(this.textContent));
					},
					false);
	}	}	}

	window.addEventListener(
		'mouseup',
		function()
		{
			button.className = '';
			ul.className = 'hideZoomList';
		},
		false
	);

	document.addEventListener(
		'mozfullscreenchange',
		fullScreenChange,
		false);

    document.addEventListener(
		'webkitfullscreenchange',
		fullScreenChange,
        false);

    document.addEventListener(
		'fullscreenchange',
		fullScreenChange,
        false);

	node = document.getElementById('zoomLabel');
	node.addEventListener(
		'click',
		clickZoomLabel,
		false
	);

	inputZoom = document.getElementById('inputZoom');

	inputZoom.addEventListener(
		'keypress',
		function(e)
		{
  			var keyCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
			if (keyCode == 13) {
				changeZoomPercent(e.target.value);
			}
		},
		false
	);

	attachZoomToImage = function()
	{
		if (!selectedImage || (selectedImage.isImage && !selectedImage.svgroot)) {
			return;	// Do later
		}
		var setupRubberBand = function()
		{
			var rubberBandBox = null;
			var	root_sctm;
			var drag, start_x, start_y, shiftKey;
			var scale_x, scale_y;

			var mousedownRubberBand = function(evt)
			{
				// disableDefault(evt);
				if (drag) {
					return;
				}

				var rect = svgroot.getBoundingClientRect();

				scale_x  = svgroot.viewBox.baseVal.width  / rect.width;
				scale_y  = svgroot.viewBox.baseVal.height / rect.height;
				start_x  = evt.layerX;
				start_y  = evt.layerY;
				shiftKey = evt.shiftKey;

				drag    = true;

				rubberBandBox.setAttribute('x', start_x * scale_x);
				rubberBandBox.setAttribute('y', start_y * scale_y);
				rubberBandBox.setAttribute('width', 0);
				rubberBandBox.setAttribute('height', 0);
				rubberBandBox.setAttribute('display', 'inline');
			}

			var mousemoveRubberBand = function(evt)
			{
				if (!drag) {
					return;
				}

				var	x  = evt.layerX,
					y  = evt.layerY;

				// disableDefault(evt);

				rubberBandBox.setAttribute('x',      Math.min(start_x, x) * scale_x);
				rubberBandBox.setAttribute('y',      Math.min(start_y, y) * scale_y);
				rubberBandBox.setAttribute('width',  Math.abs(start_x - x) * scale_x);
				rubberBandBox.setAttribute('height', Math.abs(start_y - y) * scale_y);
			}

			var mouseupRubberBand = function(evt)
			{
				if (!drag) {
					return;
				}

				rubberBandBox.setAttribute('display', 'none');
				drag = false;
				var	x      = evt.layerX,
					y      = evt.layerY,
					width,
					height,
					half;

				if (x == start_x || y == start_y) {
	 				var rect         = svgroot.getBoundingClientRect();
					var clientWidth  = div.clientWidth;
					var clientHeight = clientWidth * naturalHeight / naturalWidth;
					// Assume a pan -- this is to be the centre point
					x      = (start_x + x - clientWidth)  / 2;
					y      = (start_y + y - clientHeight) / 2;
					width  = rect.width;
					height = rect.height;
					if (x + width < clientWidth) {
						// Remove blank space on right
						x = clientWidth - width;
					}
					if (x < 0) {
						x = 0;
					}
					if (y + height < clientHeight) {
						y = clientHeight - height;
					}
					if (y < 0) {
						y = 0;
					}
					div.scrollLeft   = x;
					div.scrollTop    = y;
					return;
				}
				width  = Math.abs(x - start_x);
				height = Math.abs(y - start_y);
				x      = Math.min(start_x, x);
				y      = Math.min(start_y, y);

				setVisibleRegion(x, y, width, height, shiftKey);
			}

			// This is a static variable because it is a member variable
			// Use cascade rather than bubble so nothing can stop
			// propagation to us.
			attachZoomToImage.detachRubberBand = function()
			{
				rubberBandBox.setAttribute('display', 'none');
				svgroot.removeEventListener(
					'mousedown',
					mousedownRubberBand,
					false
				);
				svgroot.removeEventListener(
					'mousemove',
					mousemoveRubberBand,
					false
				);
				svgroot.removeEventListener(
					'mouseup',
					mouseupRubberBand,
					false
				);
				rubberBandBox.parentNode.removeChild(rubberBandBox);
			}

			// This is a static variable because it is a member variable
			attachZoomToImage.attachRubberBand = function()
			{
				if (!rubberBandBox) {
					rubberBandBox = document.createElementNS(
										'http://www.w3.org/2000/svg', 'rect');
					rubberBandBox.setAttribute('fill', '#22C');
					rubberBandBox.setAttribute('fill-opacity', 0.15);
					rubberBandBox.setAttribute('stroke','#22C');
					rubberBandBox.setAttribute('stroke-width', 0.5);
					rubberBandBox.setAttribute('display', 'none');
					rubberBandBox.setAttribute('style', 'pointer-events:none');
				}
				svgroot.appendChild(rubberBandBox);
				svgroot.addEventListener(
					'mouseup',
					mouseupRubberBand,
					false
				);
				svgroot.addEventListener(
					'mousemove',
					mousemoveRubberBand,
					false
				);
				svgroot.addEventListener(
					'mousedown',
					mousedownRubberBand,
					false
				);
			}
		}

		if (svgroot) {
			attachZoomToImage.detachRubberBand();
			svgroot = null;
		}
		image = selectedImage;
		if (image.zoom != 'BAD') {
			var fitToMarkup = document.getElementById('fitToMarkup');
			var fitToFrame  = document.getElementById('fitToFrame');
			var fullMarkup  = document.getElementById('fullMarkup');
			var fullImage   = document.getElementById('fullImage');
			var img;

			fullMarkup.style.display  = 'none';
			fullImage.style.display   = 'none';
			fitToMarkup.style.display = 'none';
			current_zoom  = image.zoom;
			div           = image.div;
			zoom_panel.style   ='pointer-events: auto;cursor: auto';
			inputZoom.readonly = null;
			if (image.isImage) {
				svgroot       = image.svgroot;
				svgcontent    = image.svgcontent;

        		if (div.requestFullScreen || div.mozRequestFullScreen || div.webkitRequestFullScreen) {
					if (svgcontent) {
						fullMarkup.style.display  = '';
						fitToMarkup.style.display = '';
					}
					fullImage.style.display = '';
				}
				fitToFrame.style.display  = '';
				naturalWidth  = image.naturalWidth;
				naturalHeight = image.naturalHeight;
				if (!current_zoom) {
					setCurrentZoom(image);

					if (!myroot) {
						var bodys = document.getElementsByTagName('BODY');
						switch (bodys.length) {
						case 0:
							alert('Can\'t find body');
							break;
						case 1:
							myroot = bodys[0];
							myroot.addEventListener(
								"resize",
								setCurrentZoom,
								false
							);
							break;
						default:
							alert('Saw ' + bodys.length + ' body elements');
					}	}
				}
				setCurrentZoom();

				if (!attachZoomToImage.attachRubberBand) {
					setupRubberBand();
				}
				attachZoomToImage.attachRubberBand();
				return;
			}
			var img = image.img;
        	if (img.requestFullScreen || img.mozRequestFullScreen || img.webkitRequestFullScreen) {
				fullImage.style.display = '';
			}

			// Otherwise this is a web page
			fitToFrame.style.display  = 'none';
			// Can't obtain natural width of an iframe
			// Cross-domain restrictions
			// So don't know how to fit unknown width to iframe
			inputZoom.value = (image.zoom ? image.zoom : '');
			return;
		}
		zoom_panel.style   ='pointer-events: none;cursor: default';
		inputZoom.readonly = 'readonly';
		div             = null;
		svgroot         = null;
		svgcontent      = null;
		current_zoom    = null;
		naturalWidth    = null;
		naturalHeight   = null;
		inputZoom.value = 'N/A';
	}
}


text:
package org.apache.harmony.drlvm.tests.regression.h3505;

import junit.framework.TestCase;

/**
 * Test case for GetFieldModifiers() jvmti function.
 */
public class GetFieldModifiersTest extends TestCase {
    public static void main(String args[]) {
        (new GetFieldModifiersTest()).test();
    }

    public void test() {
        System.out.println("test done");
        assertTrue(Status.status);
    }
}

class Status {
    /** the field should be modified by jvmti agent to determine test result. */
    public static boolean status = false;
}

/** Base class declaring the field */
class Parent {
    int intField;
}

/** Derived class inherits the field */
class Child extends Parent { }


text:
module Bookkeeping
  class IncomeAccount < Account

    def self.balance
      all.select(:id).to_a.sum(&:balance)
    end

    def balance
      credits_balance - debits_balance
    end
  end
end


text:
package net.caoticode.synergy.server

import scala.collection.mutable.{ Set => MutableSet }
import akka.actor.{ Actor, ActorRef, ActorContext }
import net.caoticode.synergy.Channel2ClientProtocol._

trait PullChannel {
  this: Actor =>

  val pullSubscribers = null

  val pullReceive: PartialFunction[Any, Unit] = {

    case SubscribePull(routingTag) =>
      context.watch(sender)
    // TODO: implement

    case UnsubscribePull(routingTag) =>
    // TODO: implement
  }

  def removePull(subscriber: ActorRef): Unit = {
    // TODO: implement
  }
}


text:
/* Licensed 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.
 */
package org.flowable.app.idm.model;

import org.flowable.app.model.common.AbstractRepresentation;

/**
 * @author Joram Barrez
 */
public class AddUserPrivilegeRepresentation extends AbstractRepresentation {

  protected String userId;

  public String getUserId() {
    return userId;
  }

  public void setUserId(String userId) {
    this.userId = userId;
  }

}


text:
YUI.add('htmlPreviewBinderIndex', function(Y, NAME) {
    Y.namespace('mojito.binders')[NAME] = {

        init: function(mojitProxy) {
            // This is awkward, but since the init is the only place where
            // we get the mojitProxy, and the bind is the only place we
            // receive a reference to our mojit container node, we choose
            // to save the mojitProxy here and do the work in our bind
            // method.
            this.mojitProxy = mojitProxy;
        },

        bind: function(node) {
            // Since the bind method is the only spot where we receive our
            // node instance, set up our listener here.
            this.mojitProxy.listen("editor-content-changed", function(payload) {
                // We get the data package and set ourselves.
                // The "payload" is much like an event object in the YUI
                // world. Not sure why mojito tried to be different rather
                // than just use the "on" method....
                node.one(".preview").setHTML(payload.data.content);
            });
        }

    };

}, '0.0.1', {requires: ['event-mouseenter', 'mojito-client']});