text:
package jdk.internal.platform;

import java.lang.reflect.Method;

/**
 * Operating System Metrics class
 *
 * @implNote Some of the APIs within this class return metrics for an
 * "Isolation Group" or "Container".  When the term "Isolation Group"
 * is used in the API description, this refers to either:
 *
 *

 *
 All processes, including the current process within a container.
 *
 *
 All processes, including the current process running together
 *    isolated from other non-isolated processes.
 *
 *
 All processes running on a host when that there is no isolation
 *     in effect.
 *

 *
 * @author bobv
 * @since 11
 */

public interface Metrics {

    /**
     * Returns an instance of the Metrics class.
     *
     * @return Metrics object or null if not supported on this platform.
     */
    public static Metrics systemMetrics() {
        return SystemMetrics.instance();
    }

    /**
     * Returns the interface responsible for providing the
     * platform metrics.
     *
     * @implNote
     * Metrics are currently only supported Linux.
     * The provider for Linux is cgroups (version 1 or 2).
     *
     * @return The name of the provider.
     *
     */
    public String getProvider();

    /*****************************************************************
     * CPU Accounting Subsystem
     ****************************************************************/

    /**
     * Returns the aggregate time, in nanoseconds, consumed by all
     * tasks in the Isolation Group.
     *
     * @return Time in nanoseconds, -1 if unknown or
     *         -2 if the metric is not supported.
     *
     */
    public long getCpuUsage();

    /**
     * Returns the aggregate time, in nanoseconds, consumed by all tasks in
     * the Isolation Group, separated by CPU. If the current process
     * is running within a container, the reported time will only be
     * valid for processes running within the same container.  The values
     * are returned in an array, one entry for each physical processor
     * on the system.  Time values for processors unavailable to this
     * Group are undefined.
     *
     * @return long array of time values.  The size of the array is equal
     *         to the total number of physical processors in the system. If
     *         this metric is not supported or not available, null will be
     *         returned.
     *
     */
    public long[] getPerCpuUsage();

    /**
     * Returns the aggregate user time, in nanoseconds, consumed by all
     * tasks in the Isolation Group.
     *
     * @return User time in nanoseconds, -1 if the metric is not available or
     *         -2 if the metric is not supported.
     *
     */
    public long getCpuUserUsage();

    /**
     * Returns the aggregate system time, in nanoseconds, consumed by
     * all tasks in the Isolation Group.
     *
     * @return System time in nanoseconds, -1 if the metric is not available or
     *         -2 if the metric is not supported.
     *
     */
    public long getCpuSystemUsage();

    /*****************************************************************
     * CPU Scheduling Metrics
     ****************************************************************/

    /**
     * Returns the length of the scheduling period, in
     * microseconds, for processes within the Isolation Group.
     *
     * @return time in microseconds, -1 if the metric is not available or
     *         -2 if the metric is not supported.
     *
     */
    public long getCpuPeriod();

    /**
     * Returns the total available run-time allowed, in microseconds,
     * during each scheduling period for all tasks in the Isolation
     * Group.
     *
     * @return time in microseconds, -1 if the quota is unlimited or
     *         -2 if not supported.
     *
     */
    public long getCpuQuota();

    /**
     * Returns the relative weighting of processes with the Isolation
     * Group used for prioritizing the scheduling of processes across
     * all Isolation Groups running on a host.
     *
     * @implNote
     * Popular container orchestration systems have standardized shares
     * to be multiples of 1024, where 1024 is interpreted as 1 CPU share
     * of execution.  Users can distribute CPU resources to multiple
     * Isolation Groups by specifying the CPU share weighting needed by
     * each process.  To request 2 CPUS worth of execution time, CPU shares
     * would be set to 2048.
     *
     * @return shares value, -1 if the metric is not available or
     *         -2 if cpu shares are not supported.
     *
     */
    public long getCpuShares();

    /**
     * Returns the number of time-slice periods that have elapsed if
     * a CPU quota has been setup for the Isolation Group
     *
     * @return count of elapsed periods, -1 if the metric is not available
     *         or -2 if the metric is not supported.
     *
     */
    public long getCpuNumPeriods();

    /**
     * Returns the number of time-slice periods that the group has
     * been throttled or limited due to the group exceeding its quota
     * if a CPU quota has been setup for the Isolation Group.
     *
     * @return count of throttled periods, -1 if the metric is not available or
     *         -2 if it is not supported.
     *
     */
    public long getCpuNumThrottled();

    /**
     * Returns the total time duration, in nanoseconds, that the
     * group has been throttled or limited due to the group exceeding
     * its quota if a CPU quota has been setup for the Isolation Group.
     *
     * @return Throttled time in nanoseconds, -1 if the metric is not available
     *         or -2 if it is not supported.
     *
     */
    public long getCpuThrottledTime();

    /**
     * Returns the number of effective processors that this Isolation
     * group has available to it.  This effective processor count is
     * computed based on the number of dedicated CPUs, CPU shares and
     * CPU quotas in effect for this isolation group.
     *
     * This method returns the same value as
     * {@link java.lang.Runtime#availableProcessors()}.
     *
     * @return The number of effective CPUs.
     *
     */
    public long getEffectiveCpuCount();

    /*****************************************************************
     * CPU Sets
     ****************************************************************/

    /**
     * Returns the CPUS that are available for execution of processes
     * in the current Isolation Group. The size of the array is equal
     * to the total number of CPUs and the elements in the array are the
     * physical CPU numbers that are available.  Some of the CPUs returned
     * may be offline.  To get the current online CPUs, use
     * {@link getEffectiveCpuSetCpus()}.
     *
     * @return An array of available CPUs. Returns null if the metric is not
     *         available or the metric is not supported.
     *
     */
    public int[] getCpuSetCpus();

    /**
     * Returns the CPUS that are available and online for execution of
     * processes within the current Isolation Group. The size of the
     * array is equal to the total number of CPUs and the elements in
     * the array are the physical CPU numbers.
     *
     * @return An array of available and online CPUs. Returns null
     *         if the metric is not available or the metric is not supported.
     *
     */
    public int[] getEffectiveCpuSetCpus();

    /**
     * Returns the memory nodes that are available for use by processes
     * in the current Isolation Group. The size of the array is equal
     * to the total number of nodes and the elements in the array are the
     * physical node numbers that are available.  Some of the nodes returned
     * may be offline.  To get the current online memory nodes, use
     * {@link getEffectiveCpuSetMems()}.
     *
     * @return An array of available memory nodes or null
     *         if the metric is not available or is not supported.
     *
     */
    public int[] getCpuSetMems();

    /**
     * Returns the memory nodes that are available and online for use by
     * processes within the current Isolation Group. The size of the
     * array is equal to the total number of nodes and the elements in
     * the array are the physical node numbers.
     *
     * @return An array of available and online nodes or null
     *         if the metric is not available or is not supported.
     *
     */
    public int[] getEffectiveCpuSetMems();

    /*****************************************************************
     * Memory Subsystem
     ****************************************************************/

    /**
     * Returns the number of times that user memory requests in the
     * Isolation Group have exceeded the memory limit.
     *
     * @return The number of exceeded requests or -1 if the metric
     *         is not available. Returns -2 if the metric is not
     *         supported.
     *
     */
    public long getMemoryFailCount();

    /**
     * Returns the maximum amount of physical memory, in bytes, that
     * can be allocated in the Isolation Group.
     *
     * @return The maximum amount of memory in bytes or -1 if
     *         there is no limit or -2 if this metric is not supported.
     *
     */
    public long getMemoryLimit();

    /**
     * Returns the amount of physical memory, in bytes, that is currently
     * allocated in the current Isolation Group.
     *
     * @return The amount of memory in bytes allocated or -1 if
     *         the metric is not available or -2 if the metric is not
     *         supported.
     *
     */
    public long getMemoryUsage();

    /**
     * Returns the amount of networking physical memory, in bytes, that
     * is currently allocated in the current Isolation Group.
     *
     * @return The amount of memory in bytes allocated or -1 if the metric
     *         is not available. Returns -2 if this metric is not supported.
     *
     */
    public long getTcpMemoryUsage();

    /**
     * Returns the maximum amount of physical memory and swap space,
     * in bytes, that can be allocated in the Isolation Group.
     *
     * @return The maximum amount of memory in bytes or -1 if
     *         there is no limit set or -2 if this metric is not supported.
     *
     */
    public long getMemoryAndSwapLimit();

    /**
     * Returns the amount of physical memory and swap space, in bytes,
     * that is currently allocated in the current Isolation Group.
     *
     * @return The amount of memory in bytes allocated or -1 if
     *         the metric is not available. Returns -2 if this metric is not
     *         supported.
     *
     */
    public long getMemoryAndSwapUsage();

    /**
     * Returns the hint to the operating system that allows groups
     * to specify the minimum amount of physical memory that they need to
     * achieve reasonable performance in low memory systems.  This allows
     * host systems to provide greater sharing of memory.
     *
     * @return The minimum amount of physical memory, in bytes, that the
     *         operating system will try to maintain under low memory
     *         conditions.  If this metric is not available, -1 will be
     *         returned. Returns -2 if the metric is not supported.
     *
     */
    public long getMemorySoftLimit();

    /*****************************************************************
     * BlKIO Subsystem
     ****************************************************************/

    /**
     * Returns the number of block I/O requests to the disk that have been
     * issued by the Isolation Group.
     *
     * @return The count of requests or -1 if the metric is not available.
     *         Returns -2 if this metric is not supported.
     *
     */
    public long getBlkIOServiceCount();

    /**
     * Returns the number of block I/O bytes that have been transferred
     * to/from the disk by the Isolation Group.
     *
     * @return The number of bytes transferred or -1 if the metric is not
     *         available. Returns -2 if this metric is not supported.
     *
     */
    public long getBlkIOServiced();
}


text:
@interface PSNetworkQueue (Private)

- (void)queueDidFinish:(ASINetworkQueue *)queue;

@end

@implementation PSNetworkQueue

- (id)init {
  self = [super init];
  if (self) {
    [self setDelegate:self];
    [self setQueueDidFinishSelector:@selector(queueDidFinish:)];
    [self setSuspended:NO]; // Always enable queue
  }
	return self;
}

- (void)dealloc {
  [super dealloc];
}

+ (id)sharedQueue {
  static id sharedQueue = nil;
  @synchronized(self) {
    if (sharedQueue == nil) {
      sharedQueue = [[self alloc] init];
    }
    return sharedQueue;
  }
}

#pragma mark - Request Preparation
//- (void)addOperation:(NSOperation *)op {
//  // Override this to check for duplicate requests
//  if (![op isKindOfClass:[ASIHTTPRequest class]]) {
//		[NSException raise:@"AttemptToAddInvalidRequest" format:@"Attempted to add an object that was not an ASIHTTPRequest to an ASINetworkQueue"];
//  }
//
//  ASIHTTPRequest *newOp = (ASIHTTPRequest *)op;
//
//  NSString *newUrlPath = [[newOp originalURL] absoluteString];
//  if ([_pendingRequests objectForKey:newUrlPath]) {
//    // request already pending, don't add another one
//  } else {
//    // Pass to ASINetworkQueue
//    [super addOperation:op];
//  }
//}

#pragma mark - Delegate
- (void)queueDidFinish:(ASINetworkQueue *)queue {
  VLog(@"queueDidFinish: %@", queue);
}

@end

redpajama_set_name: RedPajamaGithub


text:
package com.esri.simulator;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.http.entity.StringEntity;

/**
 *
 * @author david
 */
public class TcpSenderThread extends Thread {

    LinkedBlockingQueue<String> lbq;
    private volatile boolean running = true;

    private final String ip;
    private final int port;

    private OutputStream os;

    private long cntErr;
    private long cnt;

    public long getCntErr() {
        return cntErr;
    }

    public long getCnt() {
        return cnt;
    }

    public TcpSenderThread(LinkedBlockingQueue<String> lbq, String ip, int port) {
        this.lbq = lbq;
        this.ip = ip;
        this.port = port;
        try {
            Socket skt = new Socket(this.ip, this.port);
            this.os = skt.getOutputStream();
        } catch (IOException e) {
            System.out.println("Failed to created socket to: " +  this.ip + ":" + this.port);
        }

    }

    public void terminate() {
        running = false;
        try {
            os.close();
        } catch (IOException ex) {
            Logger.getLogger(TcpSenderThread.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Override
    public void run() {
        try {
            while (running) {
                String line = lbq.take();
                if (line == null) {
                    break;
                }
                // Send the String

                os.write(line.getBytes());
                os.flush();

                cnt += 1;

            }

        } catch (InterruptedException ex) {
            Logger.getLogger(HttpPosterThread.class.getName()).log(Level.SEVERE, null, ex);
            cntErr += 1;
        } catch (IOException ex) {
            Logger.getLogger(HttpPosterThread.class.getName()).log(Level.SEVERE, null, ex);
            cntErr += 1;
        }
    }

}


text:
![imagekit logo](https://imagekit.io/static/img/logo-dark.png)

* [Overview / Requirement](#overview-and-resources)
* [Installation](#installation)
* [Usage](#usage)
  * [`$(elm).imagekit()`](#using-jquery)
  * [`imagekit.url(options)`](#using-url)
* [Options](#options)

## Overview / Requirement

ImageKit provides ready-to-use image delivery servers along with dedicated image storage, on-the-fly image transformation like resize, crop, rotate directly from the URL and image uploads.

By using ImageKit, you can experience about 30% improvement in page load time thanks to the tons of image optimizations that work out of the box without you putting in any effort. Migrating to ImageKit is super simple and takes just a few minutes with our Plug-and-Play technology. Images are delivered across the globe using a CDN ensuring lightning fast experience for your users.

If you haven't already registered then first [create an account](https://imagekit.io/registration) on ImageKit before using this library.

## Installation

There are two ways to install imagekit.js depending on your project.

1. **Bower**: `bower install --save imagekit`
2. **Manual**: [Download imagekit.js](https://github.com/imagekit-developer/imagekit.js), and use `dist/imagekit.min.js`.

imagekit.js has a following global options:

* `imagekitid`: ImageKit ID for your account.
* `url-pattern`: Your [ImageKit URL pattern](https://docs.imagekit.io/#url-patterns) you want to use to access imags. It (defaults to `img`).
* `useHttps`: A boolean (defaults to `true`), specifying whether to generate `http` or `https` URLs.
* `usesubdomain`: A boolean (defaults to `false`).
  1. If true then image URL will become like `https://<imagekitid>.imagekit.io/<url-pattern>/...`
  2. If false then image URL will become like `https://.ik.imagekit.io/<imagekit-id>/<url-pattern>/...`
* `srcattribute`: Attribute which will be set with image url. Defaults to `src`

You can set these options manually on the global `imagekit.config` object:

``` html
<script src="imagekit.min.js"></script>
<script>
  // Sepecify imagekitid
  imagekit.config.imagekitid = 'demo';
  // Optionally disable HTTPS image URL generation (defaults to `true`).
  imagekit.config.usesecure = false;
</script>
```

## Usage

Now that everything's installed and set up, you can start using ImageKit on your page. There are a few ways to do this.

### `$(elm).imagekit()`

The simplest way to use imagekit.js is to create an `img` tag with the `data-path` attribute:

``` html
<img data-path="static/img/landingpage-icons/outofbox.png" data-width="500">
<script src="imagekit.min.js"></script>
<script>
  // Sepecify imagekitid
  imagekit.config.imagekitid = 'demo';
  $("img").imagekit();
</script>
```

This will generate HTML something like the following:

``` html
<img src="https://ik.imagekit.io/demo/img/tr:w-500/static/img/landingpage-icons/outofbox.png">
```

You can override `imagekitid` by specifying in the attribute itself like

``` html
<img data-imagekitid="override-demo" src="https://ik.imagekit.io/override-demo/img/tr:w-500/static/img/landingpage-icons/outofbox.png">
```

### `imagekit.url(options)`

Here's how we can use `imagekit.url()` function and pass it [options](#options) to get URL:

``` html
<script>
    imagekit.config.imagekitid = "demo";
    var options = {
      width: 100,
      heigh: 200,
      path : "static/img/landingpage-icons/outofbox.png"
    };
    var url = imagekit.url(options);
    console.log(url); // https://ik.imagekit.io/demo/img/tr:w-100,h-200/static/img/landingpage-icons/outofbox.png
</script>
```

## Options

You can pass options object while using `imagekit.url(options)`. The same options can be set as attributes in an image element prefixed with `data-` and `$(elm).imagekit()` will automatically pick/override values.

You can refer [documentation](https://docs.imagekit.io/#transformations) to learn more about a particular transformations.

Valid options:

* `width`
* `height`
* `quality`
* `crop`
* `crop-mode`
* `focus`
* `format`
* `rounded-corner`
* `border`
* `rotation`
* `blur`
* `named`
* `overlay-image`
* `overlay-x`
* `overlay-y`
* `overlay-focus`
* `transformation` : Array of transformation to apply [chained transformation](https://docs.imagekit.io/#chained-transformations)
``` html
<script>
    window.imagekit.config.imagekitid = "demo";
    var url = window.imagekit.url({
        path : "static/img/landingpage-icons/outofbox.png",
        transformation : [{width: 100, height: 300}, {blur:100}]
    });
    console.log(url); // https://ik.imagekit.io/demo/img/tr:w-100,h-300:bl-100/static/img/landingpage-icons/outofbox.png
</script>
```


text:
var root = ui("$");

var procon = ui("do_ImageView_1");
var protxt = ui("do_Label_1");
root.on("probarsimg",function(data){
	var getwidth = data*7;

	var animpbari= mm("do_Animator");
	var proppbari = {width:getwidth};
	animpbari.append(300, proppbari, "EaseOut");
	procon.animate(animpbari);

	protxt.text = data+"%";
	root.fire("probarsfimg",getwidth);
});


text:
package org.opensmartgridplatform.adapter.protocol.oslp.elster.application.mapping;

import org.opensmartgridplatform.dto.valueobjects.LightTypeDto;
import org.opensmartgridplatform.oslp.Oslp;

import ma.glasnost.orika.MappingContext;
import ma.glasnost.orika.converter.BidirectionalConverter;
import ma.glasnost.orika.metadata.Type;

public class LightTypeConverter extends BidirectionalConverter<LightTypeDto, Oslp.LightType> {

    @Override
    public org.opensmartgridplatform.oslp.Oslp.LightType convertTo(final LightTypeDto source,
            final Type<org.opensmartgridplatform.oslp.Oslp.LightType> destinationType, final MappingContext context) {
        if (source == null) {
            return null;
        }

        return Oslp.LightType.valueOf(source.toString());
    }

    @Override
    public LightTypeDto convertFrom(final org.opensmartgridplatform.oslp.Oslp.LightType source,
            final Type<LightTypeDto> destinationType, final MappingContext context) {
        if (source == null || source == Oslp.LightType.LT_NOT_SET) {
            return null;
        }

        return LightTypeDto.valueOf(source.toString());
    }

}


text:
<?php

class Google_Service_PolyService_FormatComplexity extends Google_Model
{
  public $lodHint;
  public $triangleCount;

  public function setLodHint($lodHint)
  {
    $this->lodHint = $lodHint;
  }
  public function getLodHint()
  {
    return $this->lodHint;
  }
  public function setTriangleCount($triangleCount)
  {
    $this->triangleCount = $triangleCount;
  }
  public function getTriangleCount()
  {
    return $this->triangleCount;
  }
}


text:
using pst.core;
using pst.encodables.ndb;
using pst.interfaces.messaging.changetracking.model;
using System;

namespace pst.interfaces.messaging.changetracking
{
    interface IRecipientTracker
    {
        void TrackRecipientTable(
            ObjectPath messageObjectPath,
            NID recipientTableNodeId,
            ObjectStates tableState);

        void TrackRecipient(
            ObjectPath messageObjectPath,
            NID recipientTableNodeId,
            int recipientRowId,
            ObjectStates recipientState);

        NID GetTrackedRecipientTable(
            ObjectPath messageObjectPath);

        int[] GetTrackedRecipients(
            ObjectPath messageObjectPath,
            NID recipientTableNodeId,
            Func<ObjectStates, bool> recipientStatePredicate);

        void SetProperty(
            ObjectPath messageObjectPath,
            NID recipientTableNodeId,
            int recipientRowId,
            PropertyTag propertyTag,
            PropertyValue propertyValue);

        void DeleteProperty(
            ObjectPath messageObjectPath,
            NID recipientTableNodeId,
            int recipientRowId,
            PropertyTag propertyTag);

        Maybe<PropertyValue> GetProperty(
            ObjectPath messageObjectPath,
            NID recipientTableNodeId,
            int recipientRowId,
            PropertyTag propertyTag,
            Func<Maybe<PropertyValue>> untrackedPropertyValueReader);
    }
}


text:
import sys
from controlboard import *
from time import sleep
import serial

def handleCommand(command):
	words = command.split()
	if len(words) == 0:
		return True
	words[0] = words[0].lower()
	try:
		if words[0] == 'help':
			print
			print 'Commands:'
			print
			print 'close                - close the connection to the control board'
			print 'exit|quit            - leave this program forever'
			print 'help                 - obvious'
			print 'open (port) (baud)   - opens a connection to the control board'
			print 'poll                 - loop and grab lots of samples'
			print 'program (filename)   - write a HEX file to the sensor board'
			print 'reset control|sensor - reset the control or sensor board'
			print 'start                - start sampling the sensor'
			print 'state                - report the control board state'
			print 'stop                 - stop sampling the sensor'
			print
			print 'poll and program commands can be cancelled with Ctrl-C without'
			print 'also exiting the interactive command line'
			print
		elif words[0] == 'exit' or words[0] == 'quit':
			print 'Goodbye forever.'
			print
			return False
		elif words[0] == 'open':
			if len(words) != 3:
				print 'usage:'
				print 'open (port) (baud)'
				return True
			port = words[1]
			baud = int(words[2])
			print 'Openning "' + port + '" with baud rate', baud
			controlBoard.open(port, baud)
			print 'Ready.'
		elif words[0] == 'close':
			controlBoard.close()
			print 'Connection closed.'
		elif words[0] == 'reset':
			if len(words) == 2:
				words[1] = words[1].lower()
				if words[1] == 'control':
					print 'Resetting control board...'
					controlBoard.reset()
					print 'Ready.'
					return True
				elif words[1] == 'sensor':
					print 'Resetting sensor board...'
					controlBoard.resetSlave()
					print 'Ready.'
					return True
			print 'usage:'
			print 'reset control|sensor'
		elif words[0] == 'program':
			try:
				print 'Programming sensor board with "' + words[1] + '"...'
				controlBoard.pmodeStart()
				controlBoard.erase()
				controlBoard.writeHexFile(words[1])
				controlBoard.pmodeEnd()
				print 'Ready.'
			except KeyboardInterrupt:
				print
				print 'Cancelled.'
		elif words[0] == 'start':
			print 'Starting control board sampling.'
			controlBoard.sampleStart()
		elif words[0] == 'stop':
			print 'Stopping control board sampling.'
			controlBoard.sampleEnd()
		elif words[0] == 'state':
			print 'Current control board state: ' + controlBoard.getState()
		elif words[0] == 'poll':
			try:
				while True:
					data = controlBoard.readMotion()
					words = list();
					for i in range(3):
						low = ord(data[i * 2])
						high = ord(data[i * 2 + 1])
						d = high * 256 + low
						if d >= 32768:
							d = d - 65536
						words.append(d)
					print 'X accel:', words[0], 'Y accel:', words[1], 'Z accel:', words[2]
					sleep(.05)
			except KeyboardInterrupt:
				print
				print 'Cancelled.'
		else:
			print 'Unknown command: "' + command + '"'
		return True
	except serial.serialutil.SerialException:
		print 'Serial port error.'
		return True

printUsage = False
portGiven = False
baudGiven = False
commandGiven = False
baud = 19200

i = 1
while i < len(sys.argv):
	param = sys.argv[i]
	if param == '-p':
		i = i + 1
		if i >= len(sys.argv):
			printUsage = True
			break;
		port = sys.argv[i]
		portGiven = True
	elif param == '-b':
		i = i + 1
		if i >= len(sys.argv):
			printUsage = True
			break;
		baud = sys.argv[i]
		baudGiven = True
	elif param == '-c':
		i = i + 1
		if i >= len(sys.argv):
			printUsage = True
			break;
		command = sys.argv[i]
		commandGiven = True
	else:
		printUsage = True
	i = i + 1

if printUsage:
	print
	print 'usage:'
	print sys.argv[0], '-p (port) [-b (baud)] [-c "command"]'
	print
	print '-p (port)    - specifies the system name of the RS232 port to use'
	print '-b (baud)    - specifies the baud rate of the serial connection'
	print '               default is 19200'
	print '-c "command" - executes "command" and quits, rather than entering'
	print '               the interactive terminal - useful for programming'
	print '               the sensor board'
	print
	sys.exit(1)

print
print 'AzInc Control Board Host Interface'
print
print '(C) 2013 Andy McCormick, Ryan Schuster'
print 'MIT license, no warranty'
print 'See LICENSE.txt for details.'
print

controlBoard = ControlBoard()
if portGiven:
	print 'Openning channel to control board...'
	controlBoard.open(port, baud)
	print 'Ready.'

if commandGiven:
	handleCommand(command)
else:
	while True:
		command = raw_input('>')
		if not handleCommand(command):
			break;

controlBoard.close()


text:
class PezDispenser
  attr_accessor :flavors

  def initialize(flavors)
    @flavors = flavors
  end

end
# DRIVER TESTS GO BELOW THIS LINE___________________________
flavors = %w(cherry chocolate cola grape lemon orange peppermint raspberry strawberry).shuffle

super_mario = PezDispenser.new(flavors)
puts "A new pez dispenser has been created. You have #{super_mario.flavors.length} pez!"
puts "Here's a look inside the dispenser:"
puts super_mario.flavors
puts "Adding a banana pez."
super_mario.flavors.push("banana")
puts "Now you have #{super_mario.flavors.length} pez!"
puts "Oh, you want one do you?"
puts "The pez flavor you got is: #{super_mario.flavors.shift}"
puts "Now you have #{super_mario.flavors.length} pez!"

# Reflection
# I reviewed classes and got a better understanding. I did try to make this harder than what it should be. I see now more than ever that I am not reading the directions correctly and trying to do much more  than what is asked for.


text:
{# Twitter #}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="{{ COPY.share.twitter_handle }}">
<meta name="twitter:title" content="{{ COPY.share.twitter_title }}">
<meta name="twitter:description" content="{{ COPY.share.twitter_text }}">
<meta name="twitter:image" content="{{ COPY.share.twitter_image_url }}" />

{# Facebook #}
<meta property="og:title" content="{{ COPY.share.facebook_title }}" />
<meta property="og:url" content="{{ COPY.share.share_url }}" />
<meta property="og:type" content="article" />
<meta property="og:description" content="{{ COPY.meta.facebook_text }}" />
<meta property="og:image" content="{{ COPY.meta.facebook_image_url }}" />
<meta property="og:site_name" content="stlpublicradio.org" />
<meta property="fb:app_id" content="{{ COPY.meta.facebook_app_id }}" />
{# Google News #}
<meta name="thumbnail" content="{{ COPY.share.google_news_image_url }}" />


text:
<?php

/**
 * Abstract API2 class for sales order comments
 *
 * @category   Mage
 * @package    Mage_Sales
 * @author     Magento Core Team <core@magentocommerce.com>
 */
abstract class Mage_Sales_Model_Api2_Order_Comment_Rest extends Mage_Sales_Model_Api2_Order_Comment
{
    /**#@+
     * Parameters in request used in model (usually specified in route mask)
     */
    const PARAM_ORDER_ID = 'id';
    /**#@-*/

    /**
     * Get sales order comments
     *
     * @return array
     */
    protected function _retrieveCollection()
    {
        $collection = $this->_getCollectionForRetrieve();
        $collection->addFieldToSelect($this->getForcedAttributes());

        $this->_applyCollectionModifiers($collection);

        $data = $collection->load()->toArray();
        return isset($data['items']) ? $data['items'] : $data;
    }

    /**
     * Retrieve collection instances
     *
     * @return Mage_Sales_Model_Resource_Order_Status_History_Collection
     */
    protected function _getCollectionForRetrieve()
    {
        /* @var $collection Mage_Sales_Model_Resource_Order_Status_History_Collection */
        $collection = Mage::getResourceModel('sales/order_status_history_collection');
        $collection->setOrderFilter($this->_loadOrderById($this->getRequest()->getParam(self::PARAM_ORDER_ID)));

        return $collection;
    }

    /**
     * Load order by id
     *
     * @param int $id
     * @throws Mage_Api2_Exception
     * @return Mage_Sales_Model_Order
     */
    protected function _loadOrderById($id)
    {
        /* @var $order Mage_Sales_Model_Order */
        $order = Mage::getModel('sales/order')->load($id);
        if (!$order->getId()) {
            $this->_critical(self::RESOURCE_NOT_FOUND);
        }

        return $order;
    }
}


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.activiti.engine.impl;

import java.util.List;

import org.activiti.engine.ActivitiIllegalArgumentException;
import org.activiti.engine.history.HistoricVariableInstance;
import org.activiti.engine.history.HistoricVariableInstanceQuery;
import org.activiti.engine.impl.context.Context;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.interceptor.CommandExecutor;
import org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity;
import org.activiti.engine.impl.variable.CacheableVariable;
import org.activiti.engine.impl.variable.JPAEntityListVariableType;
import org.activiti.engine.impl.variable.JPAEntityVariableType;
import org.activiti.engine.impl.variable.VariableTypes;

/**
 * @author Christian Lipphardt (camunda)
 */
public class HistoricVariableInstanceQueryImpl extends AbstractQuery<HistoricVariableInstanceQuery, HistoricVariableInstance> implements
        HistoricVariableInstanceQuery {

  private static final long serialVersionUID = 1L;
  protected String id;
  protected String taskId;
  protected String processInstanceId;
  protected String activityInstanceId;
  protected String variableName;
  protected String variableNameLike;
  protected boolean excludeTaskRelated = false;
  protected boolean excludeVariableInitialization = false;
  protected QueryVariableValue queryVariableValue;

  public HistoricVariableInstanceQueryImpl() {
  }

  public HistoricVariableInstanceQueryImpl(CommandContext commandContext) {
    super(commandContext);
  }

  public HistoricVariableInstanceQueryImpl(CommandExecutor commandExecutor) {
    super(commandExecutor);
  }

  public HistoricVariableInstanceQuery id(String id) {
    this.id = id;
    return this;
  }

  public HistoricVariableInstanceQueryImpl processInstanceId(String processInstanceId) {
    if (processInstanceId == null) {
      throw new ActivitiIllegalArgumentException("processInstanceId is null");
    }
    this.processInstanceId = processInstanceId;
    return this;
  }

  public HistoricVariableInstanceQuery activityInstanceId(String activityInstanceId) {
    this.activityInstanceId = activityInstanceId;
    return this;
  }

  public HistoricVariableInstanceQuery taskId(String taskId) {
    if (taskId == null) {
      throw new ActivitiIllegalArgumentException("taskId is null");
    }
    if(excludeTaskRelated) {
      throw new ActivitiIllegalArgumentException("Cannot use taskId together with excludeTaskVariables");
    }
    this.taskId = taskId;
    return this;
  }

  @Override
  public HistoricVariableInstanceQuery excludeTaskVariables() {
    if(taskId != null) {
      throw new ActivitiIllegalArgumentException("Cannot use taskId together with excludeTaskVariables");
    }
    excludeTaskRelated = true;
    return this;
  }

  public HistoricVariableInstanceQuery excludeVariableInitialization() {
    excludeVariableInitialization = true;
    return this;
  }

  public HistoricVariableInstanceQuery variableName(String variableName) {
    if (variableName == null) {
      throw new ActivitiIllegalArgumentException("variableName is null");
    }
    this.variableName = variableName;
    return this;
  }

  public HistoricVariableInstanceQuery variableValueEquals(String variableName, Object variableValue) {
    if (variableName == null) {
      throw new ActivitiIllegalArgumentException("variableName is null");
    }
    if (variableValue == null) {
      throw new ActivitiIllegalArgumentException("variableValue is null");
    }
    this.variableName = variableName;
    queryVariableValue = new QueryVariableValue(variableName, variableValue, QueryOperator.EQUALS, true);
    return this;
  }

  public HistoricVariableInstanceQuery variableNameLike(String variableNameLike) {
    if (variableNameLike == null) {
      throw new ActivitiIllegalArgumentException("variableNameLike is null");
    }
    this.variableNameLike = variableNameLike;
    return this;
  }

  protected void ensureVariablesInitialized() {
    if (this.queryVariableValue != null) {
      VariableTypes variableTypes = Context.getProcessEngineConfiguration().getVariableTypes();
      queryVariableValue.initialize(variableTypes);
    }
  }

  public long executeCount(CommandContext commandContext) {
    checkQueryOk();
    ensureVariablesInitialized();
    return commandContext
        .getHistoricVariableInstanceEntityManager()
        .findHistoricVariableInstanceCountByQueryCriteria(this);
  }

  public List<HistoricVariableInstance> executeList(CommandContext commandContext, Page page) {
    checkQueryOk();
    ensureVariablesInitialized();

    List<HistoricVariableInstance> historicVariableInstances = commandContext
            .getHistoricVariableInstanceEntityManager()
            .findHistoricVariableInstancesByQueryCriteria(this, page);

    if (excludeVariableInitialization == false) {
      for (HistoricVariableInstance historicVariableInstance: historicVariableInstances) {
        if (historicVariableInstance instanceof HistoricVariableInstanceEntity) {
          HistoricVariableInstanceEntity variableEntity = (HistoricVariableInstanceEntity) historicVariableInstance;
          if(variableEntity != null && variableEntity.getVariableType() != null) {
            variableEntity.getValue();

            // make sure JPA entities are cached for later retrieval
            if (JPAEntityVariableType.TYPE_NAME.equals(variableEntity.getVariableType().getTypeName()) || JPAEntityListVariableType.TYPE_NAME.equals(variableEntity.getVariableType().getTypeName())) {
              ((CacheableVariable) variableEntity.getVariableType()).setForceCacheable(true);
            }
          }
        }
      }
    }
    return historicVariableInstances;
  }

  // order by /////////////////////////////////////////////////////////////////

  public HistoricVariableInstanceQuery orderByProcessInstanceId() {
    orderBy(HistoricVariableInstanceQueryProperty.PROCESS_INSTANCE_ID);
    return this;
  }

  public HistoricVariableInstanceQuery orderByVariableName() {
    orderBy(HistoricVariableInstanceQueryProperty.VARIABLE_NAME);
    return this;
  }

  // getters and setters //////////////////////////////////////////////////////

  public String getProcessInstanceId() {
    return processInstanceId;
  }

  public String getTaskId() {
    return taskId;
  }

  public String getActivityInstanceId() {
    return activityInstanceId;
  }

  public boolean getExcludeTaskRelated() {
    return excludeTaskRelated;
  }

  public String getVariableName() {
    return variableName;
  }

  public String getVariableNameLike() {
    return variableNameLike;
  }

  public QueryVariableValue getQueryVariableValue() {
    return queryVariableValue;
  }

}


text:
; vim:filetype=nasm:

bits 64

; callee-save: rbp, rbx, r12-r15
; caller-save: rax, rcx, rdx, rsi, rdi, r8-r11
%macro clear_clobbered_syscall 0
	; rax, rcx, r11 are also in this list, but are used for return, rip and rflags respectively.
%endmacro
%macro clear_clobbered 0
	clear_clobbered_syscall
	zero	ecx
	zero	r11
%endmacro

%macro zero 1
	xor	%1, %1
%endmacro

%macro restruc 1-2 1
	resb (%1 %+ _size) * %2
%endmacro

%assign i 0

%macro	reglabels 1-*
%rep	%0
	.r %+ %1 equ .regs+(i * 8)
	%assign i i+1
	%rotate 1
%endrep
%endmacro

struc iframe
	.rip	resq 1
	.cs	resq 1
	.rflags	resq 1
	.rsp	resq 1
	.ss	resq 1
endstruc

struc gseg
	.self	resq 1
	.rsp	resq 1
	.proc	resq 1
	; Pointer to register save area. Most likely inside of gseg, but
	; referenced by pointer to avoid depending on its location from the
	; assembly stubs.
	.kernel_reg_save resq 1
endstruc

struc	proc, -0x80
	.regs	resq 16 ; a,c,d,b,sp,bp,si,di,r8-15

	; Aliases for offsets into regs
	reglabels ax,cx,dx,bx,sp,bp,si,di
%rep 8
	reglabels i
%endrep

	.rip	resq 1
	.rflags	resq 1

	.cr3	resq 1

endstruc

%macro load_regs 1-*
%define %%reg %1
%rotate 1
%rep (%0 - 1)
%ifidni %1,%%reg
	%error %%reg is in use by this macro
%else
	mov	%1,[%%reg+proc. %+ %1]
%endif
	%rotate 1
%endrep
%endmacro

%macro save_regs 1-*
%define %%reg %1
%rotate 1
%rep (%0 - 1)
%ifidni %1,%%reg
	%error %%reg is in use by this macro
%else
	mov	[%%reg+proc. %+ %1], %1
%endif
	%rotate 1
%endrep
%endmacro

%macro gfunc 1
%%end: global %1:function (%%end - %1)
%endmacro

%macro proc 1-2 1
%ifnidn %2,NOSECTION
section .text.%1, exec
%endif
%push proc
%1:
%define %$LAST_PROC %1
%endmacro

%macro endproc 0
%ifnctx proc
	%error unmatched endproc
%endif
gfunc %$LAST_PROC
; %%end:
; global %$LAST_PROC:function (%%end - %$LAST_PROC)
%pop
%endmacro

proc fastret
	zero	edx
	zero	r8
	zero	r9
	zero	r10
.no_clear:
	sub	rdi, proc
	mov	rbx, cr3
	cmp	rbx, [rdi + proc.cr3]
	jne	.wrong_cr3
	load_regs rdi,  rbp,rbx,r12,r13,r14,r15
.fast_fastret:
	mov	rsp, [rdi + proc.rsp]
	mov	rcx, [rdi + proc.rip]
	mov	r11, [rdi + proc.rflags]
	mov	rax, rsi
	swapgs
	o64 sysret
.wrong_cr3:
	ud2
endproc

; section .text.syscall_entry_stub, exec
; syscall_entry_stub:
proc syscall_entry_stub
	swapgs
	xchg	[gs:8], rsp
	push	rax
	zero	eax
	mov	rax, [gs:rax + gseg.proc]
	sub	rax, proc
	; * Save registers that aren't caller-save
	;   if we have syscall *return* instead, we could get rid of these, but
	;   that would require that it return *here* and not try to switch
	;   tasks by itself. It wouldn't be all wrong to do that though.
	save_regs rax,  rbp,rbx,r12,r13,r14,r15
	; * Save rip and rflags
	mov	[rax + proc.rflags], r11
	mov	[rax + proc.rip], rcx
	zero	rcx
	mov	rbp, [gs:rcx + gseg.self]
	mov	rcx, [rbp + gseg.rsp]
	mov	[rax + proc.rsp], rcx
	lea	rcx, [rsp + 8]
	mov	[rbp + gseg.rsp], rcx
	; * Fix up for syscall vs normal calling convention.
	;   r10 (caller-save) is used instead of rcx for argument 4
	mov	rcx, r10

	; The syscall function's prototype is:
	; fn(rdi,rsi,rdx,r10,r8,r9,  rax)

	; Need to use call since we have one stack-allocated register (rax)
	; But note that we do *not* expect syscall to return here - in that
	; case fall through to the ud2 below.
	extern syscall
	call syscall

proc syscall_entry_compat, NOSECTION
	; Fail
	ud2
endproc

; .end
; global	syscall_entry_compat:function (syscall_entry_compat.end - syscall_entry_compat)
;global	syscall_entry_stub:function (syscall_entry_compat.end - syscall_entry_stub)
endproc

%macro stub 1
%if %1 >= 128
	push	byte %1 - 256
%else
	push	byte %1
%endif
	jmp	asm_int_entry
%endmacro

%macro cond 2
	j%-1	%%skip
	%2
%%skip:
%endmacro

; Stack when we get here (from low to high address)
; vector
; (error)
; rip
; cs
; rflags
; rsp
; ss
; some tasks:
; get gseg
; save rip, rflags, rsp to process
; save all caller-save regs to process
proc asm_int_entry
	push	rsi
	lea	rsi, [rsp + 8]
	push	rdi
	push	rax

	; Set flags to a known state. Must be done before lodsq in case someone
	; set the direction flag.
	push	byte 0
	popfq

	; rsp is always 16-byte aligned before pushing the stack frame, the
	; basic interrupt stack frame is 5 qwords (making it misaligned), we
	; always add a vector (aligning it again), and sometimes add another
	; error making it misaligned.
	; rsi is the original stack pointer on entry.
	; I.e. test esi,8 => nz if we have an error.
	lodsq
	mov	edi, eax
	; We removed the vector above, so the parity we're checking is flipped.
	test	esi, 8
	cond	z, lodsq

	; edi = vector
	; rax = error (if applicable, otherwise garbage)
	; rsi = frame

	; If we came from privilege level 0, this is some sort of kernel
	; fault.
	test	byte [rsi + iframe.cs], 3
	jz	.kernel_fault

	swapgs
	zero	eax
	mov	rax, [gs:rax + gseg.proc]

	test	rax, rax
	jz	.idle

.save_regs:
	; stack:
	; saved_rax, saved_rdi, saved_rsi, vector, [error], rip, cs, rflags, rsp, ss

	; rax points to the actual start of proc (C++ pointer), not at the 0x80
	; struct offset. Special case for proc.rax here, since it's at offset
	; 0, this is shorter than the corresponding offseted [rax-0x80]. It
	; matters more for regs 8 and up.
	pop	qword [rax - proc + proc.rax] ; The rax saved on entry
	sub	rax, proc
	pop	qword [rax + proc.rdi]
	pop	qword [rax + proc.rsi]
	pop	rdi ; vector
	; rsp now points to error or frame, rsi should be error or zero
	zero	esi
	; size of stack frame is misaligned, meaning if it's aligned we have
	; an error code.
	test	esp, 8
	jnz	.no_err
	pop	rsi
.no_err:

	pop	qword [rax + proc.rip]
	add	rsp, 8 ; cs
	pop	qword [rax + proc.rflags]
	pop	qword [rax + proc.rsp]
	add	rsp, 8 ; ss

	; already saved: ax, di, si
	; caller-save: rax, rcx, rdx, rsi, rdi, r8-r11
	save_regs rax,  rdx,rcx,r8,r9,r10,r11
	; callee-saved regs (the rest):
	; if we had int_entry *return* instead of tail-calling it, we could
	; perhaps avoid saving callee-save registers to the process and doing
	; an iretq from here.
	save_regs rax,  rbp,rbx,r12,r13,r14,r15

.int_entry:
	zero    edx
	mov     rdx, [gs:rdx + gseg.self]
	; Now rdi = vector, rsi = error (or 0), rdx = gseg
	extern	int_entry
	jmp	int_entry

.idle:
	; Ignore saved_{rax,rdi,rsi}, just get the vector
	add	rsp, 24
	pop	rdi
	zero	esi
	; See above for details on the stack misalignment check to detect the
	; error code
	test	esp, 8
	jz	.int_entry
	pop	rsi
	jmp	.int_entry

.kernel_fault:
	; Since this was a kernel fault of some kind, tnstead of saving regs in
	; proc we should save it in a temporary register storage area for
	; faults (somewhere in gseg). Our stack layout is compatible with the
	; state at .save_regs, so we just need to load rax and adjust it for
	; the proc struct offset.
	zero	eax
	mov	rax, [gs:rax + gseg.kernel_reg_save]
	test	rax, rax
	; If we have a kernel-reg-save-area, store everything there
	jnz .save_regs

	; Otherwise just "panic" (should try to print something first though)
.panic:
	extern	abort
	jmp	abort

; slowret: all registers are currently unknown, load *everything* from process
; (in rdi), then iretq
proc slowret, NOSECTION
	sub	rdi, proc ; offset because it comes from C++ code
	; All the callee-saves
	load_regs rdi,  rbp,rbx,r12,r13,r14,r15
.from_int:
	; all caller-saves except rdi
	load_regs rdi,  rax,rcx,rsi,rdx,r8,r9,r10,r11
	; Push stuff for iretq
user_code_seg	equ	56
user_cs		equ	user_code_seg+16 | 11b
user_ds		equ	user_cs+8
	push	user_ds
	push	qword [rdi + proc.rsp]
	push	qword [rdi + proc.rflags]
	push	user_cs
	push	qword [rdi + proc.rip]
	mov	rdi, [rdi + proc.rdi]
	swapgs
	iretq
endproc

endproc

handler_NM_stub stub 7
gfunc handler_NM_stub
handler_PF_stub stub 14
gfunc handler_PF_stub
handler_DF_stub stub 8
gfunc handler_DF_stub


text:
/**
 * FigShare main classes.
 *
 * @since 0.1
 */
package org.biouno.figshare;


text:
// Generated by CoffeeScript 1.6.3
(function() {
  var htmlDecode, htmlEncode, socket, wrapMessage;

  socket = io.connect('http://localhost:3000');

  window.socket = socket;

  window.trace = function(obj) {
    return socket.emit('debug', obj);
  };

  wrapMessage = function(str) {
    return {
      message: str
    };
  };

  htmlEncode = function(value) {
    return $('
').text(value).html();
  };

  htmlDecode = function(value) {
    return $('
').html(value).text();
  };

  socket.on('onConnect', function(data) {
    console.log(data);
    $("#chat-history").append("
 " + (htmlEncode(data.message)) + ": " + data.date + "
");
    return socket.emit('onConnect', wrapMessage('client connected:'));
  });

  socket.on('updateChat', function(data) {
    var $chatHistory, self, _ref;
    self = (_ref = data.username === socket.username) != null ? _ref : {
      'self': ''
    };
    $chatHistory = $("#chat-history");
    $chatHistory.append("
" + (htmlEncode(data.username)) + ": " + (htmlEncode(data.message)) + "
");
    return $chatHistory.scrollTop($chatHistory[0].scrollHeight);
  });

  socket.on('newUser', function(data) {
    var $chatHistory;
    $chatHistory = $("#chat-history");
    $chatHistory.append("
" + (htmlEncode(data.message)) + " has joined the conversation.
");
    $chatHistory.scrollTop($chatHistory[0].scrollHeight);
    if (socket.username === data.message) {
      $("#authenticate").hide('slow');
      $("#chat").show('slow');
      return $("#chat-input").focus();
    }
  });

  socket.on('debug', function(data) {
    return console.log(data);
  });

  $(function() {
    $("#login-form input[name='username']").focus();
    $("#login-form").submit(function(e) {
      var name;
      e.preventDefault();
      name = $("#login-form input[name='username']").val();
      if (name) {
        socket.username = name;
        return socket.emit('setName', wrapMessage(name));
      }
    });
    return $("#chat-input-form").submit(function(e) {
      var $chatInput, message;
      e.preventDefault();
      $chatInput = $("#chat-input");
      message = $chatInput.val();
      $chatInput.val('');
      return socket.emit('onChat', wrapMessage(message));
    });
  });

}).call(this);

/*
//@ sourceMappingURL=app-client.map
*/


text:
[![Build Status](https://travis-ci.org/JoshuaKGoldberg/intern-assassins.svg?branch=master)](https://travis-ci.org/JoshuaKGoldberg/intern-assassins)

Microsoft 2016 ISC Intern Assassins. Go wild or go home.

## Project Structure

### Front-end

Under `src/site` is a React-based TypeScript application.
It's served by an `expressjs` server.

### Back-end

Under `src/server` is an `expressjs` server.

## Building

Required software:
* [Node.js](http://node.js.org) >= 6.X
* [MongoDB](https://www.mongodb.com/)
    * *[Windows installation guide](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/)*

To build from scratch, run the following commands:

```
npm install -g gulp
npm install
gulp
```

## Running

In one shell, start MongoDB locally:
```shell
mongod
```

In another shell, start the server:
```shell
node src\main
```

The command `mongod` is required in that format for tests.
* On Windows, add the path to `mongod.exe` to your PATH. For example, `C:\Program Files\MongoDB\Server\3.2\bin`.

Settings for the server are read from `assassins.json` at startup.
This file contains the server `port`.

Before running the app, copy `assassins.default.json` to `assassins.json`.
You'll also need to build first.

### Individual Gulp tasks

* `gulp browserify` - Compresses and converts compiled .js files under `src/site` from the `tsc` task into a browser-compatible bundle.
* `gulp less` - Runes the [Less](http://lesscss.org/) compiler.
* `gulp test` - Runs tests in `tests/`.
* `gulp tsc` - Runs the [TypeScript](https://typescriptlang.org/) compiler.
* `gulp tslint` - Runs [TSLint](https://github.com/palantir/tslint).
* `gulp watch` - Runs the appropriate `less` or `tsc`+`tslint` tasks when a source file changes.

#### Integration tests

Integration tests are done with cucumber-js, but seem to be hanging weirdly.
Run one at a time:

```shell
cls && gulp && gulp test:integration:{test}
```

Tests:
* `leaders`
* `login`
* `users`


text:
package com.cloud.legacymodel.communication.answer;

import com.cloud.legacymodel.communication.command.Command;

public class AgentControlAnswer extends Answer {
    public AgentControlAnswer() {
    }

    public AgentControlAnswer(final Command command) {
        super(command);
    }

    public AgentControlAnswer(final Command command, final boolean success, final String details) {
        super(command, success, details);
    }
}


text:
class Serializer::SerializerPrivate {
};

Serializer::Serializer() : d( new SerializerPrivate ) {
}

Serializer::~Serializer() {
  delete d;
}

void Serializer::serialize( const QVariant& v, QIODevice* io, bool* ok )
{
  Q_ASSERT( io );
  if (!io->isOpen()) {
    if (!io->open(QIODevice::WriteOnly)) {
      if ( ok != 0 )
        *ok = false;
      qCritical ("Error opening device");
      return;
    }
  }

  if (!io->isWritable()) {
    if (ok != 0)
      *ok = false;
    qCritical ("Device is not readable");
    io->close();
    return;
  }

  const QByteArray str = serialize( v );
  if ( !str.isNull() ) {
    QDataStream stream( io );
    stream << str;
  } else {
    if ( ok )
      *ok = false;
  }
}

static QString sanitizeString( QString str )
{
  str.replace( QLatin1String( "\\" ), QLatin1String( "\\\\" ) );
  str.replace( QLatin1String( "\"" ), QLatin1String( "\\\"" ) );
  str.replace( QLatin1String( "\b" ), QLatin1String( "\\b" ) );
  str.replace( QLatin1String( "\f" ), QLatin1String( "\\f" ) );
  str.replace( QLatin1String( "\n" ), QLatin1String( "\\n" ) );
  str.replace( QLatin1String( "\r" ), QLatin1String( "\\r" ) );
  str.replace( QLatin1String( "\t" ), QLatin1String( "\\t" ) );
  return QString( QLatin1String( "\"%1\"" ) ).arg( str );
}

static QByteArray join( const QList<QByteArray>& list, const QByteArray& sep ) {
  QByteArray res;
  Q_FOREACH( const QByteArray& i, list ) {
    if ( !res.isEmpty() )
      res += sep;
    res += i;
  }
  return res;
}

QByteArray Serializer::serialize( const QVariant &v )
{
  QByteArray str;
  bool error = false;

  if ( ! v.isValid() ) { // invalid or null?
    str = "null";
  } else if ( v.type() == QVariant::List ) { // variant is a list?
    const QVariantList list = v.toList();
    QList<QByteArray> values;
    Q_FOREACH( const QVariant& v, list )
    {
      QByteArray serializedValue = serialize( v );
      if ( serializedValue.isNull() ) {
        error = true;
        break;
      }
      values << serializedValue;
    }
    str = "[ " + join( values, ", " ) + " ]";
  } else if ( v.type() == QVariant::Map ) { // variant is a map?
    const QVariantMap vmap = v.toMap();
    QMapIterator<QString, QVariant> it( vmap );
    str = "{ ";
    QList<QByteArray> pairs;
    while ( it.hasNext() ) {
      it.next();
      QByteArray serializedValue = serialize( it.value() );
      if ( serializedValue.isNull() ) {
        error = true;
        break;
      }
      pairs << sanitizeString( it.key() ).toUtf8() + " : " + serializedValue;
    }
    str += join( pairs, ", " );
    str += " }";
  } else if (( v.type() == QVariant::String ) ||  ( v.type() == QVariant::ByteArray )) { // a string or a byte array?
    str = sanitizeString( v.toString() ).toUtf8();
  } else if ( v.type() == QVariant::Double ) { // a double?
    str = QByteArray::number( v.toDouble() );
    if( ! str.contains( "." ) && ! str.contains( "e" ) ) {
      str += ".0";
    }
  } else if ( v.type() == QVariant::Bool ) { // boolean value?
    str = ( v.toBool() ? "true" : "false" );
  } else if ( v.type() == QVariant::ULongLong ) { // large unsigned number?
    str = QByteArray::number( v.value<qulonglong>() );
  } else if ( v.canConvert<qlonglong>() ) { // any signed number?
    str = QByteArray::number( v.value<qlonglong>() );
  } else if ( v.canConvert<QString>() ){ // can value be converted to string?
    // this will catch QDate, QDateTime, QUrl, ...
    str = sanitizeString( v.toString() ).toUtf8();
    //TODO: catch other values like QImage, QRect, ...
  } else {
    error = true;
  }
  if ( !error )
    return str;
  else
    return QByteArray();
}


text:
<?php

namespace ViewOne\WPCLIEnvironment;

class Generator
{
    /**
     * Get wp-cli global path
     *
     * Method is using code from wp-cli
     *
     * @return string $dir
     */

    public static function getCachePath()
    {
        $home = getenv('HOME');

        if ( !$home ) {
            $home = getenv('HOMEDRIVE') . '/' . getenv('HOMEPATH');
        }

        $dir = getenv('WP_CLI_CACHE_DIR') ? : "$home/.wp-cli/cache";

        return $dir;
    }

    /**
     * Generate command class based on $args, $assocParams and $params
     * and put content in Command.php file in global cache wp-cli path.
     *
     * @return void
     */

    public static function generateCommandClass()
    {
        $args  = \ViewOne\WPCLIEnvironment\Command::getArguments();
        $assocParams = \ViewOne\WPCLIEnvironment\Command::getAssocParameters();
        $params = \ViewOne\WPCLIEnvironment\Command::getParameters();

        $moutstache = new \Mustache_Engine;

        $dir = self::getCachePath();

        if (!file_exists($dir . '/wp-cli-environment')) {
            mkdir($dir . '/wp-cli-environment', 0777, true);
        }

        $template = file_get_contents(__DIR__ . '/../../../template/command.mustache');
        $variables = array('args' => $args, 'assoc_params' => $assocParams, 'params' => $params);

        $class = $moutstache->render($template, $variables);

        file_put_contents($dir . '/wp-cli-environment/Command.php', $class);
    }
}


text:
EXT = \
	ext/bashplus/lib \
	ext/test-more-bash/lib \

.PHONY: test
test: $(EXT)
	prove $(PROVEOPT:%=% )test/

$(EXT):
	git submodule update --init --recursive


text:
package com.github.mjreid.flinkwrapper

import play.api.libs.json.{JsPath, Reads}
import play.api.libs.functional.syntax._

case class JobPlanNode(
  id: String,
  parallelism: Int,
  operator: String,
  operatorStrategy: String,
  description: String,
  inputs: Option[Seq[NodeInput]],
  optimizerProperties: OptimizerProperties
)

object JobPlanNode {
  implicit val reads: Reads[JobPlanNode] = (
    (JsPath \ "id").read[String] and
      (JsPath \ "parallelism").read[Int] and
      (JsPath \ "operator").read[String] and
      (JsPath \ "operator_strategy").read[String] and
      (JsPath \ "description").read[String] and
      (JsPath \ "inputs").readNullable[Seq[NodeInput]] and
      (JsPath \ "optimizer_properties").read[OptimizerProperties]
    )(JobPlanNode.apply _)
}


text:
/**
 * bluebird build version 0.11.5-1
 * Features enabled: core, timers, race, any, call_get, filter, generators, map, nodeify, promisify, props, reduce, settle, some, progress, cancel, synchronous_inspection
*/
/**
 * @preserve Copyright (c) 2013 Petka Antonov
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:

 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
;(function (f) {
  // CommonJS
  if (typeof exports === "object" && typeof module === "object" && module.exports) {
    module.exports = f();

  // RequireJS
  } else if (typeof define === "function" && define.amd) {
    define(f);

  //


text:
set -e
set -o xtrace

MINGWPREFIX=$1
JAVA_COMPARISON_TOOL=$2
RUN_EXPENSIVE_TESTS=$3
JOBS=${4-1}
OUT_DIR=${5-}

if [ $# -lt 2 ]; then
  echo "Usage: $0 [mingw-prefix] [java-comparison-tool] <make jobs> <save output dir>"
  exit 1
fi

DISTDIR=bitcoin-3.0.1

# Cross-compile for windows first (breaking the mingw/windows build is most common)
cd /home/ahmed/digitalcoin
make distdir
mkdir -p win32-build
rsync -av $DISTDIR/ win32-build/
rm -r $DISTDIR
cd win32-build

if [ $RUN_EXPENSIVE_TESTS = 1 ]; then
  ./configure --disable-silent-rules --disable-ccache --prefix=$MINGWPREFIX --host=i586-mingw32msvc --with-qt-bindir=$MINGWPREFIX/host/bin --with-qt-plugindir=$MINGWPREFIX/plugins --with-qt-incdir=$MINGWPREFIX/include --with-boost=$MINGWPREFIX --with-protoc-bindir=$MINGWPREFIX/host/bin CPPFLAGS=-I$MINGWPREFIX/include LDFLAGS=-L$MINGWPREFIX/lib --with-comparison-tool="$JAVA_COMPARISON_TOOL"
else
  ./configure --disable-silent-rules --disable-ccache --prefix=$MINGWPREFIX --host=i586-mingw32msvc --with-qt-bindir=$MINGWPREFIX/host/bin --with-qt-plugindir=$MINGWPREFIX/plugins --with-qt-incdir=$MINGWPREFIX/include --with-boost=$MINGWPREFIX --with-protoc-bindir=$MINGWPREFIX/host/bin CPPFLAGS=-I$MINGWPREFIX/include LDFLAGS=-L$MINGWPREFIX/lib
fi
make -j$JOBS

# And compile for Linux:
cd /home/ahmed/digitalcoin
make distdir
mkdir -p linux-build
rsync -av $DISTDIR/ linux-build/
rm -r $DISTDIR
cd linux-build
if [ $RUN_EXPENSIVE_TESTS = 1 ]; then
  ./configure --disable-silent-rules --disable-ccache --with-comparison-tool="$JAVA_COMPARISON_TOOL" --enable-comparison-tool-reorg-tests
else
  ./configure --disable-silent-rules --disable-ccache --with-comparison-tool="$JAVA_COMPARISON_TOOL"
fi
make -j$JOBS

# link interesting binaries to parent out/ directory, if it exists. Do this before
# running unit tests (we want bad binaries to be easy to find)
if [ -d "$OUT_DIR" -a -w "$OUT_DIR" ]; then
  set +e
  # Windows:
  cp /home/ahmed/digitalcoin/win32-build/src/bitcoind.exe $OUT_DIR/bitcoind.exe
  cp /home/ahmed/digitalcoin/win32-build/src/test/test_bitcoin.exe $OUT_DIR/test_bitcoin.exe
  cp /home/ahmed/digitalcoin/win32-build/src/qt/bitcoind-qt.exe $OUT_DIR/bitcoin-qt.exe
  # Linux:
  cp /home/ahmed/digitalcoin/linux-build/src/bitcoind $OUT_DIR/bitcoind
  cp /home/ahmed/digitalcoin/linux-build/src/test/test_bitcoin $OUT_DIR/test_bitcoin
  cp /home/ahmed/digitalcoin/linux-build/src/qt/bitcoind-qt $OUT_DIR/bitcoin-qt
  set -e
fi

# Run unit tests and blockchain-tester on Linux:
cd /home/ahmed/digitalcoin/linux-build
make check

# Run RPC integration test on Linux:
/home/ahmed/digitalcoin/qa/rpc-tests/wallet.sh /home/ahmed/digitalcoin/linux-build/src
/home/ahmed/digitalcoin/qa/rpc-tests/listtransactions.py --srcdir /home/ahmed/digitalcoin/linux-build/src
# Clean up cache/ directory that the python regression tests create
rm -rf cache

if [ $RUN_EXPENSIVE_TESTS = 1 ]; then
  # Run unit tests and blockchain-tester on Windows:
  cd /home/ahmed/digitalcoin/win32-build
  make check
fi

# Clean up builds (pull-tester machine doesn't have infinite disk space)
cd /home/ahmed/digitalcoin/linux-build
make clean
cd /home/ahmed/digitalcoin/win32-build
make clean

# TODO: Fix code coverage builds on pull-tester machine
# # Test code coverage
# cd /home/ahmed/digitalcoin
# make distdir
# mv $DISTDIR linux-coverage-build
# cd linux-coverage-build
# ./configure --enable-lcov --disable-silent-rules --disable-ccache --with-comparison-tool="$JAVA_COMPARISON_TOOL"
# make -j$JOBS
# make cov


text:
#ifndef UBIDITRANSFORM_H
#define UBIDITRANSFORM_H

#include "unicode/utypes.h"
#include "unicode/ubidi.h"
#include "unicode/uchar.h"
#include "unicode/localpointer.h"

/**
 * \file
 * \brief Bidi Transformations
 *
 * UBiDiOrder indicates the order of text.

 * This bidi transformation engine supports all possible combinations (4 in
 * total) of input and output text order:
 *

 *
<logical input, visual output>: unless the output direction is RTL, this
 * corresponds to a normal operation of the Bidi algorithm as described in the
 * Unicode Technical Report and implemented by UBiDi when the
 * reordering mode is set to UBIDI_REORDER_DEFAULT. Visual RTL
 * mode is not supported by UBiDi and is accomplished through
 * reversing a visual LTR string,

 *
<visual input, logical output>: unless the input direction is RTL, this
 * corresponds to an "inverse bidi algorithm" in UBiDi with the
 * reordering mode set to UBIDI_REORDER_INVERSE_LIKE_DIRECT.
 * Visual RTL mode is not not supported by UBiDi and is
 * accomplished through reversing a visual LTR string,

 *
<logical input, logical output>: if the input and output base directions
 * mismatch, this corresponds to the UBiDi implementation with the
 * reordering mode set to UBIDI_REORDER_RUNS_ONLY; and if the
 * input and output base directions are identical, the transformation engine
 * will only handle character mirroring and Arabic shaping operations without
 * reordering,

 *
<visual input, visual output>: this reordering mode is not supported by
 * the UBiDi engine; it implies character mirroring, Arabic
 * shaping, and - if the input/output base directions mismatch -  string
 * reverse operations.

 *

 * @see ubidi_setInverse
 * @see ubidi_setReorderingMode
 * @see UBIDI_REORDER_DEFAULT
 * @see UBIDI_REORDER_INVERSE_LIKE_DIRECT
 * @see UBIDI_REORDER_RUNS_ONLY
 * @stable ICU 58
 */
typedef enum {
    /** 0: Constant indicating a logical order.
      * This is the default for input text.
      * @stable ICU 58
      */
    UBIDI_LOGICAL = 0,
    /** 1: Constant indicating a visual order.
      * This is a default for output text.
      * @stable ICU 58
      */
    UBIDI_VISUAL
} UBiDiOrder;

/**
 * UBiDiMirroring indicates whether or not characters with the
 * "mirrored" property in RTL runs should be replaced with their mirror-image
 * counterparts.
 * @see UBIDI_DO_MIRRORING
 * @see ubidi_setReorderingOptions
 * @see ubidi_writeReordered
 * @see ubidi_writeReverse
 * @stable ICU 58
 */
typedef enum {
    /** 0: Constant indicating that character mirroring should not be
      * performed.
      * This is the default.
      * @stable ICU 58
      */
    UBIDI_MIRRORING_OFF = 0,
    /** 1: Constant indicating that character mirroring should be performed.
      * This corresponds to calling ubidi_writeReordered or
      * ubidi_writeReverse with the
      * UBIDI_DO_MIRRORING option bit set.
      * @stable ICU 58
      */
    UBIDI_MIRRORING_ON
} UBiDiMirroring;

/**
 * Forward declaration of the UBiDiTransform structure that stores
 * information used by the layout transformation engine.
 * @stable ICU 58
 */
typedef struct UBiDiTransform UBiDiTransform;

/**
 * Performs transformation of text from the bidi layout defined by the input
 * ordering scheme to the bidi layout defined by the output ordering scheme,
 * and applies character mirroring and Arabic shaping operations.

 * In terms of UBiDi, such a transformation implies:
 *

 *
calling ubidi_setReorderingMode as needed (when the
 * reordering mode is other than normal),

 *
calling ubidi_setInverse as needed (when text should be
 * transformed from a visual to a logical form),

 *
resolving embedding levels of each character in the input text by
 * calling ubidi_setPara,

 *
reordering the characters based on the computed embedding levels, also
 * performing character mirroring as needed, and streaming the result to the
 * output, by calling ubidi_writeReordered,

 *
performing Arabic digit and letter shaping on the output text by calling
 * u_shapeArabic.

 *

 * An "ordering scheme" encompasses the base direction and the order of text,
 * and these characteristics must be defined by the caller for both input and
 * output explicitly .

 * There are 36 possible combinations of <input, output> ordering schemes,
 * which are partially supported by UBiDi already. Examples of the
 * currently supported combinations:
 *

 *
<Logical LTR, Visual LTR>: this is equivalent to calling
 * ubidi_setPara with paraLevel == UBIDI_LTR,

 *
<Logical RTL, Visual LTR>: this is equivalent to calling
 * ubidi_setPara with paraLevel == UBIDI_RTL,

 *
<Logical Default ("Auto") LTR, Visual LTR>: this is equivalent to
 * calling ubidi_setPara with
 * paraLevel == UBIDI_DEFAULT_LTR,

 *
<Logical Default ("Auto") RTL, Visual LTR>: this is equivalent to
 * calling ubidi_setPara with
 * paraLevel == UBIDI_DEFAULT_RTL,

 *
<Visual LTR, Logical LTR>: this is equivalent to
 * calling ubidi_setInverse(UBiDi*, TRUE) and then
 * ubidi_setPara with paraLevel == UBIDI_LTR,

 *
<Visual LTR, Logical RTL>: this is equivalent to
 * calling ubidi_setInverse(UBiDi*, TRUE) and then
 * ubidi_setPara with paraLevel == UBIDI_RTL.

 *

 * All combinations that involve the Visual RTL scheme are unsupported by
 * UBiDi, for instance:
 *

 *
<Logical LTR, Visual RTL>,

 *
<Visual RTL, Logical RTL>.

 *

 *
Example of usage of the transformation engine:

 *

 * \code
 * UChar text1[] = {'a', 'b', 'c', 0x0625, '1', 0};
 * UChar text2[] = {'a', 'b', 'c', 0x0625, '1', 0};
 * UErrorCode errorCode = U_ZERO_ERROR;
 * // Run a transformation.
 * ubiditransform_transform(pBidiTransform,
 *          text1, -1, text2, -1,
 *          UBIDI_LTR, UBIDI_VISUAL,
 *          UBIDI_RTL, UBIDI_LOGICAL,
 *          UBIDI_MIRRORING_OFF,
 *          U_SHAPE_DIGITS_AN2EN | U_SHAPE_DIGIT_TYPE_AN_EXTENDED,
 *          &errorCode);
 * // Do something with text2.
 *  text2[4] = '2';
 * // Run a reverse transformation.
 * ubiditransform_transform(pBidiTransform,
 *          text2, -1, text1, -1,
 *          UBIDI_RTL, UBIDI_LOGICAL,
 *          UBIDI_LTR, UBIDI_VISUAL,
 *          UBIDI_MIRRORING_OFF,
 *          U_SHAPE_DIGITS_EN2AN | U_SHAPE_DIGIT_TYPE_AN_EXTENDED,
 *          &errorCode);
 *\endcode
 *

 *

 *
 * @param pBiDiTransform A pointer to a UBiDiTransform object
 *        allocated with ubiditransform_open() or
 *        NULL.

 *        This object serves for one-time setup to amortize initialization
 *        overheads. Use of this object is not thread-safe. All other threads
 *        should allocate a new UBiDiTransform object by calling
 *        ubiditransform_open() before using it. Alternatively,
 *        a caller can set this parameter to NULL, in which case
 *        the object will be allocated by the engine on the fly.

 * @param src A pointer to the text that the Bidi layout transformations will
 *        be performed on.
 *
Note: the text must be (at least)
 *        srcLength long.

 * @param srcLength The length of the text, in number of UChars. If
 *        length == -1 then the text must be zero-terminated.
 * @param dest A pointer to where the processed text is to be copied.
 * @param destSize The size of the dest buffer, in number of
 *        UChars. If the U_SHAPE_LETTERS_UNSHAPE option is set,
 *        then the destination length could be as large as
 *        srcLength * 2. Otherwise, the destination length will
 *        not exceed srcLength. If the caller reserves the last
 *        position for zero-termination, it should be excluded from
 *        destSize.
 *
destSize == -1 is allowed and makes sense when
 *        dest was holds some meaningful value, e.g. that of
 *        src. In this case dest must be
 *        zero-terminated.

 * @param inParaLevel A base embedding level of the input as defined in
 *        ubidi_setPara documentation for the
 *        paraLevel parameter.
 * @param inOrder An order of the input, which can be one of the
 *        UBiDiOrder values.
 * @param outParaLevel A base embedding level of the output as defined in
 *        ubidi_setPara documentation for the
 *        paraLevel parameter.
 * @param outOrder An order of the output, which can be one of the
 *        UBiDiOrder values.
 * @param doMirroring Indicates whether or not to perform character mirroring,
 *        and can accept one of the UBiDiMirroring values.
 * @param shapingOptions Arabic digit and letter shaping options defined in the
 *        ushape.h documentation.
 *
Note: Direction indicator options are computed by
 *        the transformation engine based on the effective ordering schemes, so
 *        user-defined direction indicators will be ignored.

 * @param pErrorCode A pointer to an error code value.
 *
 * @return The destination length, i.e. the number of UChars written to
 *         dest. If the transformation fails, the return value
 *         will be 0 (and the error code will be written to
 *         pErrorCode).
 *
 * @see UBiDiLevel
 * @see UBiDiOrder
 * @see UBiDiMirroring
 * @see ubidi_setPara
 * @see u_shapeArabic
 * @stable ICU 58
 */
U_STABLE uint32_t U_EXPORT2
ubiditransform_transform(UBiDiTransform *pBiDiTransform,
            const UChar *src, int32_t srcLength,
            UChar *dest, int32_t destSize,
            UBiDiLevel inParaLevel, UBiDiOrder inOrder,
            UBiDiLevel outParaLevel, UBiDiOrder outOrder,
            UBiDiMirroring doMirroring, uint32_t shapingOptions,
            UErrorCode *pErrorCode);

/**
 * Allocates a UBiDiTransform object. This object can be reused,
 * e.g. with different ordering schemes, mirroring or shaping options.

 * Note:The object can only be reused in the same thread.
 * All other threads should allocate a new UBiDiTransform object
 * before using it.

 * Example of usage:

 *

 * \code
 * UErrorCode errorCode = U_ZERO_ERROR;
 * // Open a new UBiDiTransform.
 * UBiDiTransform* transform = ubiditransform_open(&errorCode);
 * // Run a transformation.
 * ubiditransform_transform(transform,
 *          text1, -1, text2, -1,
 *          UBIDI_RTL, UBIDI_LOGICAL,
 *          UBIDI_LTR, UBIDI_VISUAL,
 *          UBIDI_MIRRORING_ON,
 *          U_SHAPE_DIGITS_EN2AN,
 *          &errorCode);
 * // Do something with the output text and invoke another transformation using
 * //   that text as input.
 * ubiditransform_transform(transform,
 *          text2, -1, text3, -1,
 *          UBIDI_LTR, UBIDI_VISUAL,
 *          UBIDI_RTL, UBIDI_VISUAL,
 *          UBIDI_MIRRORING_ON,
 *          0, &errorCode);
 *\endcode
 *

 *

 * The UBiDiTransform object must be deallocated by calling
 * ubiditransform_close().
 *
 * @return An empty UBiDiTransform object.
 * @stable ICU 58
 */
U_STABLE UBiDiTransform* U_EXPORT2
ubiditransform_open(UErrorCode *pErrorCode);

/**
 * Deallocates the given UBiDiTransform object.
 * @stable ICU 58
 */
U_STABLE void U_EXPORT2
ubiditransform_close(UBiDiTransform *pBidiTransform);

#if U_SHOW_CPLUSPLUS_API

U_NAMESPACE_BEGIN

/**
 * \class LocalUBiDiTransformPointer
 * "Smart pointer" class, closes a UBiDiTransform via ubiditransform_close().
 * For most methods see the LocalPointerBase base class.
 *
 * @see LocalPointerBase
 * @see LocalPointer
 * @stable ICU 58
 */
U_DEFINE_LOCAL_OPEN_POINTER(LocalUBiDiTransformPointer, UBiDiTransform, ubiditransform_close);

U_NAMESPACE_END

#endif

#endif


text:
package com.dli.repositories;

import com.dli.entities.Demo;
import com.dli.entities.Message;
import com.dli.entities.User;
import com.dli.entities.adminMonthCountStatistics;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface UserRepo {

    User getUserByUserID( int userid);

    void  updatePasswordByUserid(@Param("password") String password,  @Param("userid")int userid  );

    void backAddUser(  User u  );

    void   backAddUserRoleMapping( @Param("userid") int userid  ,@Param("roleid") int roleid );

    void   backUpdateUser( User u);

    //List<User>  backGetUserList(User u  );

    List<User>  backGetUserList(@Param("company_id") int company_id, @Param("full_name")String full_name,@Param("cell_phone")String  cell_phone,
                                @Param("department")String department,@Param("area") String area,  @Param("skip")int skip,@Param("take") int take );

    int   backGetUserListCount(@Param("company_id") int company_id, @Param("full_name")String full_name,@Param("cell_phone")String  cell_phone,
                               @Param("department")String department,@Param("area") String area );

    void  backDisableUserByID( int userid );

    List<User>  backGetCompanyAdminList( @Param("companyid") int companyid  ,@Param("skip") int skip ,@Param("take") int take);

    int  backGetCompanyAdminListCount( int companyid);

    void   backUpdateUserRole(@Param("roleid")int roleid, @Param("userid") int userid);

    List<User>   backGetCompanyEmployeeList ( @Param("fullname") String fullname,  @Param("companyid") int companyid  ,@Param("skip") int skip ,@Param("take") int take);

   int   backGetCompanyEmployeeListCount (  @Param("fullname") String fullname,  @Param("companyid") int companyid);

      void     UpdateUserPic(  @Param("avatar")  String  avatar,   @Param("userid") int userid );

      void   adminAddPlatformUser(User  u);

      void  adminUpdatePlatformUser( User u);

      List<User>  adminGetPlatformUserList( @Param("skip") int skip ,  @Param("take") int take);

    int   adminGetPlatformUserListCount( @Param("skip") int skip ,  @Param("take") int take);

    List<adminMonthCountStatistics>    adminGetEmployeeStatistics();

    int backGetUserCountByCompanyID(  int companyid  );

     void  addMessage(  @Param("cellphone") String  cellphone,  @Param("messageparam") String messageparam   , @Param("templatecode")  String templatecode  ,  @Param("msgtype") String msgtype);

     List<Message>  jobGetMessageList();

     void   jobUpdateMessage( Message   msg  );

     int   getUserByCellphone  (String  cellphone);

}


text:
.PHONY: clean-pyc clean-build docs test-release

help:
	@echo "clean-build - remove build artifacts"
	@echo "clean-pyc - remove Python file artifacts"
	@echo "clean - remove all artifacts"
	@echo "lint - check style with flake8"
	@echo "test - run tests quickly with the default Python"
	@echo "testall - run tests on every Python version with tox"
	@echo "coverage - check code coverage quickly with the default Python"
	@echo "qa - run quick quality assurance (pre-checkin)"
	@echo "qa-all - run full quality assurance (pre-release)"
	@echo "docs - generate Sphinx HTML documentation"
	@echo "docs-recreate-automodules - Create reST files with automodule directives"
	@echo "release - package and upload a release"
	@echo "sdist - package"

clean: clean-build clean-pyc

qa: lint coverage

qa-all: qa docs sdist test-all

clean-build:
	rm -fr build/
	rm -fr dist/
	rm -fr *.egg-info

clean-pyc:
	find . -name '*.pyc' -exec rm -f {} +
	find . -name '*.pyo' -exec rm -f {} +
	find . -name '*~' -exec rm -f {} +

lint:
	flake8 --exclude='.tox,build,dist' .

test:
	python run_tests.py

test-all:
	tox

coverage:
	coverage erase
	./run_tests.py --with-coverage --cover-tests
	coverage html
	open htmlcov/index.html

docs-recreate-automodules:
	rm -f docs/multigtfs*
	rm -f docs/modules.rst
	sphinx-apidoc -e -H "Source documentation" -o docs/ multigtfs multigtfs/admin.py multigtfs/management multigtfs/migrations multigtfs/tests

docs:
	$(MAKE) -C docs clean
	$(MAKE) -C docs html
	open docs/_build/html/index.html

release: clean
	python setup.py sdist upload
	python setup.py bdist_wheel upload

test-release:
	python setup.py register -r https://testpypi.python.org/pypi
	python setup.py sdist bdist_wheel upload -r https://testpypi.python.org/pypi
	python -m webbrowser -n https://testpypi.python.org/pypi/multigtfs

sdist: clean
	python setup.py sdist
	ls -l dist
	check-manifest
	pyroma dist/`ls -t dist | head -n1`


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright 2021 The Android Open Source Project
  ~
  ~ 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
  ~
  ~     https://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.
  -->

<resources>
    <color name="primary_green">#00cc66</color>

    <style name="AppTheme" parent="Theme.MaterialComponents.NoActionBar">
        <item name="colorPrimary">@color/primary_green</item>
        <item name="colorControlActivated">?colorPrimary</item>
    </style>
</resources>


text:
Throttle
========

A throttle is the mechanism by which the flow of a fluid is managed by constriction or obstruction.

`cycle` is the minimum time in seconds that will occur between emitting data.

Throttle is a pipe generator.

    module.exports = (cycle) ->
      lastFired = -Infinity
      lastValue = undefined
      timeout = null
      t = cycle * 1000 # ms

      (output) ->
        (input) ->
          lastValue = input

          unless timeout
            currentTime = +new Date
            delta = currentTime - lastFired
            target = t - delta

            timeout = setTimeout ->
              lastFired = +new Date
              output(lastValue)
              timeout = null
            , target


text:
/*
 * File:         directory.h
 * Created:      2013-05-02
 * Authors:      Dennis Vesterlund
 * License:      Apache License, see LICENSE
 * Description:  Class for handling directories
 * Platforms:    Linux
 */

#ifndef DIRECTORY_H
#define DIRECTORY_H

#include <dirent.h>
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
#include <sys/stat.h>
#include <sys/types.h>

class dirHandler {
private:
    std::string directory;
    //DIR* d;
    std::vector<std::string> dirs;
    std::vector<std::string> files;
    long nrOfFolders;
    long nrOfFiles;
public:
    dirHandler();
    int changeDir(const char * newDir);
    int updateDirlist();
    std::vector<std::string> getDirList();
    std::vector<std::string> getFileList();
    long getNrOfDirs();
    ~dirHandler();
};

#endif // DIRECTORY_H


text:
package adminapi

import (
	"github.com/ant0ine/go-json-rest/rest"
	"github.com/crunchydata/crunchy-postgresql-manager/admindb"
	"github.com/crunchydata/crunchy-postgresql-manager/logit"
	"github.com/crunchydata/crunchy-postgresql-manager/types"
	"github.com/crunchydata/crunchy-postgresql-manager/util"
	"net/http"
)

// GetHealthCheck returns the latest health check metrics that have been collected
func GetHealthCheck(w rest.ResponseWriter, r *rest.Request) {

	dbConn, err := util.GetConnection("clusteradmin")
	if err != nil {
		logit.Error.Println(err.Error())
		rest.Error(w, err.Error(), http.StatusBadRequest)
		return
	}
	defer dbConn.Close()

	err = secimpl.Authorize(dbConn, r.PathParam("Token"), "perm-read")
	if err != nil {
		logit.Error.Println(err.Error())
		rest.Error(w, err.Error(), http.StatusUnauthorized)
		return
	}

	var results []types.HealthCheck

	results, err = admindb.GetHealthCheck(dbConn)
	if err != nil {
		logit.Error.Println(err.Error())
		w.WriteJson(&results)
		return
	}

	w.WriteJson(&results)

}


text:
#ifndef ECCLESIA_LIB_REDFISH_TRANSPORT_X509_CERTIFICATE_H_
#define ECCLESIA_LIB_REDFISH_TRANSPORT_X509_CERTIFICATE_H_

#include <string>

#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "openssl/base.h"
#include "openssl/x509.h"

namespace ecclesia {

// Subject Alternative Names (SANs). SAN is an extension to X.509 that allows
// various values to be associated with a security certificate: Email addresses,
// IP addresses, URIs, DNS names, etc.
struct SubjectAltName {
  // |spiffe_id| is a URI SAN, used in Google internal services.
  absl::optional<std::string> spiffe_id = absl::nullopt;
  // |fqdn| is a DNS SAN.
  absl::optional<std::string> fqdn = absl::nullopt;
  // |critical| represents whether these SANs are critical. See
  // https://www.openssl.org/docs/manmaster/man5/x509v3_config.html
  bool critical = false;

  std::string DebugInfo() const {
    return absl::StrCat("spiffe_id=", spiffe_id.value_or("empty"),
                        "; fqdn=", fqdn.value_or("empty"),
                        "; critical=", critical ? "true" : "false");
  }
};

// Parses the Subject Altenative Name (SAN) from the given PEM certificate
// block. If there are multiple certificates in the block, it only parses the
// first one.
absl::StatusOr<SubjectAltName> GetSubjectAltName(absl::string_view pem);

}  // namespace ecclesia

#endif  // ECCLESIA_LIB_REDFISH_TRANSPORT_X509_CERTIFICATE_H_


text:
package org.apache.asterix.app.function;

import org.apache.asterix.external.api.IRecordReader;
import org.apache.asterix.metadata.declared.AbstractDatasourceFunction;
import org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
import org.apache.hyracks.api.application.INCServiceContext;
import org.apache.hyracks.api.context.IHyracksTaskContext;
import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.storage.am.common.api.IIndexDataflowHelper;
import org.apache.hyracks.storage.am.common.dataflow.IndexDataflowHelperFactory;

public class DumpIndexFunction extends AbstractDatasourceFunction {

    private static final long serialVersionUID = 1L;
    private final IndexDataflowHelperFactory indexDataflowHelperFactory;
    private final RecordDescriptor recDesc;
    private final IBinaryComparatorFactory[] comparatorFactories;

    public DumpIndexFunction(AlgebricksAbsolutePartitionConstraint locations,
            IndexDataflowHelperFactory indexDataflowHelperFactory, RecordDescriptor recDesc,
            IBinaryComparatorFactory[] comparatorFactories) {
        super(locations);
        this.indexDataflowHelperFactory = indexDataflowHelperFactory;
        this.recDesc = recDesc;
        this.comparatorFactories = comparatorFactories;
    }

    @Override
    public IRecordReader<char[]> createRecordReader(IHyracksTaskContext ctx, int partition)
            throws HyracksDataException {
        INCServiceContext serviceCtx = ctx.getJobletContext().getServiceContext();
        final IIndexDataflowHelper indexDataflowHelper = indexDataflowHelperFactory.create(serviceCtx, partition);
        return new DumpIndexReader(indexDataflowHelper, recDesc, comparatorFactories);
    }
}


text:
import sys
import datetime
import re
from base64 import b64encode, b64decode
from collections import OrderedDict
from Crypto.Hash import SHA
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5

from . import conf

from urllib.parse import urljoin, quote_plus

class CsobVerifyError(Exception):
    pass

def sign(payload, keyfile):
    msg = mk_msg_for_sign(payload)
    key = RSA.importKey(open(keyfile).read())
    h = SHA.new(msg)
    signer = PKCS1_v1_5.new(key)
    return b64encode(signer.sign(h)).decode()

def verify(payload, signature, pubkeyfile):
    msg = mk_msg_for_sign(payload)
    key = RSA.importKey(open(pubkeyfile).read())
    h = SHA.new(msg)
    verifier = PKCS1_v1_5.new(key)
    return verifier.verify(h, b64decode(signature))

def mk_msg_for_sign(payload):
    payload = payload.copy()
    if 'cart' in payload and payload['cart'] not in conf.EMPTY_VALUES:
        cart_msg = []
        for one in payload['cart']:
            cart_msg.extend(one.values())
        payload['cart'] = '|'.join(map(str_or_jsbool, cart_msg))
    msg = '|'.join(map(str_or_jsbool, payload.values()))
    return msg.encode('utf-8')

def mk_payload(keyfile, pairs):
    payload = OrderedDict([(k, v) for k, v in pairs if v not in conf.EMPTY_VALUES])
    payload['signature'] = sign(payload, keyfile)
    return payload

def mk_url(base_url, endpoint_url, payload=None):
    url = urljoin(base_url, endpoint_url)
    if payload is None:
        return url
    return urljoin(url, '/'.join(map(quote_plus, payload.values())))

def str_or_jsbool(v):
    if type(v) == bool:
        return str(v).lower()
    return str(v)

def dttm(format_='%Y%m%d%H%M%S'):
    return datetime.datetime.now().strftime(format_)

def dttm_decode(value):
    """Decode dttm value '20190404091926' to the datetime object."""
    return datetime.datetime.strptime(value, "%Y%m%d%H%M%S")

def validate_response(response, key):
    response.raise_for_status()

    data = response.json()
    signature = data.pop('signature')
    payload = OrderedDict()

    for k in conf.RESPONSE_KEYS:
        if k in data:
            payload[k] = data[k]

    if not verify(payload, signature, key):
        raise CsobVerifyError('Cannot verify response')

    if "dttm" in payload:
        payload["dttime"] = dttm_decode(payload["dttm"])

    response.extensions = []
    response.payload = payload

    # extensions
    if 'extensions' in data:
        maskclnrp_keys = 'extension', 'dttm', 'maskedCln', 'expiration', 'longMaskedCln'
        for one in data['extensions']:
            if one['extension'] == 'maskClnRP':
                o = OrderedDict()
                for k in maskclnrp_keys:
                    if k in one:
                        o[k] = one[k]
                if verify(o, one['signature'], key):
                    response.extensions.append(o)
                else:
                    raise CsobVerifyError('Cannot verify masked card extension response')

    return response

PROVIDERS = (
    (conf.CARD_PROVIDER_VISA, re.compile(r'^4\d{5}$')),
    (conf.CARD_PROVIDER_AMEX, re.compile(r'^3[47]\d{4}$')),
    (conf.CARD_PROVIDER_DINERS, re.compile(r'^3(?:0[0-5]|[68][0-9])[0-9]{4}$')),
    (conf.CARD_PROVIDER_JCB, re.compile(r'^(?:2131|1800|35[0-9]{2})[0-9]{2}$')),
    (conf.CARD_PROVIDER_MC, re.compile(r'^5[1-5][0-9]{4}|222[1-9][0-9]{2}|22[3-9][0-9]{4}|2[3-6][0-9]{5}|27[01][0-9]{4}|2720[0-9]{2}$')),
)

def get_card_provider(long_masked_number):
    for provider_id, rx in PROVIDERS:
        if rx.match(long_masked_number[:6]):
            return provider_id, conf.CARD_PROVIDERS[provider_id]
    return None, None


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Tinderbox</title>

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  <link rel="stylesheet" href="<?php echo base_url(); ?>public/css/mystyle.css">

    <img src="<?php echo base_url(); ?>public/img/bg-sign-in.png" alt="background-sign-in">

            <img class="img-responsive pull-right" src="<?php echo base_url(); ?>public/img/e-flag.png" alt="english-flag">

            <img class="img-responsive pull-left" src="<?php echo base_url(); ?>public/img/d-flag.png" alt="danish-flag">

                <img class="img-responsive center-block" src="<?php echo base_url(); ?>public/img/Logo.png" alt="logo">

            <form action="" method="POST" role="form">
              <?php if (isset($error)) : ?>

<?php echo $error; ?>

              <?php endif; ?>

                  <input type="text" name="username" class="form-control InputEmail" placeholder="USERNAME">

                <?php echo form_error('username'); ?>

                  <input type="password" name="password" class="form-control InputPassword" placeholder="PASSWORD">

                <?php echo form_error('password'); ?>
                <button type="submit" value="Login" class="btn btn-primary btn-block button-submit">Login</button>

                    <button type="button" class="btn btn-signed" data-color="primary">Keep me Signed In</button>
                    <input type="checkbox" class="hidden" />

                 Forgot your password?
            </form>

Sign Up with

            <img src="<?php echo base_url(); ?>public/img/fbk.png" alt="" class="img-responsive">

            <img src="<?php echo base_url(); ?>public/img/twitter.png" alt="" class="img-responsive">

            <img src="<?php echo base_url(); ?>public/img/google.png" alt="" class="img-responsive">

Don't have an account?

          <a href="<?php echo base_url();?>index.php/register"><button type="submit"  class="btn btn-primary btn-block button-submit button-register">Normal Registration</button>


text:
"use strict";

window.onload = function(){
    initMenu();
};

function getRandomInt(min, max){
    return Math.floor(Math.random() * (max - min + 1)) + min;
}

var startButton;
var gui, ship1GUI, ship2GUI;
var guiContainer;
var randomButton;
var huemin = 0, huemax = 360, satmin = 0, satmax = 100, litmin = 25, litmax = 100;
var opts = function(){ this.name = "Player";
    this.hue1 = getRandomInt(huemin, huemax); this.sat1 = getRandomInt(satmin, satmax); this.lit1 = getRandomInt(litmin, litmax);
    this.hue2 = getRandomInt(huemin, huemax); this.sat2 = getRandomInt(satmin, satmax); this.lit2 = getRandomInt(litmin, litmax);};
var ship1Opts, ship2Opts;

var genOpts = {winScore: 3};

var ship1Name, ship2Name;

var player1keys = "WASD";
var player2keys = "↑ ← ↓ →";
var player1GamepadActive = false;
var player2GamepadActive = false;

function initMenu(){
    if (localStorage.getItem("ship1opts")){
    ship1Opts = JSON.parse(localStorage.getItem("ship1opts"));
    } else {
        ship1Opts = new opts();
        ship1Opts.name = "Player 1";
    }

    if (localStorage.getItem("ship2opts")){
        ship2Opts = JSON.parse(localStorage.getItem("ship2opts"));
    } else {
        ship2Opts = new opts()
        ship2Opts.name = "Player 2";
    }

    initGamepads();
    createLogoText();
    createColPreviews();
    createStartButton();
    createRandomButton();
    createInfoImage();
    createShipGUIs();

}

function HSL2CSS(h,s,l){
    return "hsl(" + h + ", " + s + "%, " + l + "%)";
}
var infoImage;
function createInfoImage(){
    infoImage = document.createElement("img");
    infoImage.style.position = "fixed";
    infoImage.style.right = "0%";
    infoImage.style.top = "0%";
    infoImage.style.zIndex = "-1";
    infoImage.style.height = "100%";
    infoImage.onload = function(e){
        document.body.appendChild(infoImage);
    };
    infoImage.setAttribute("src", "images/buttons.png");
}

var logotext;
function createLogoText(){
    logotext = document.createElement("h2");
    logotext.textContent = "CosmoWar!";

    logotext.style.fontFamily = "press_start_2pregular";
    logotext.style.color = "white";

    document.body.appendChild(logotext);
}

function createColPreviews(){
    ship1Name = document.createElement("p");
    ship1Name.textContent = ship1Opts.name;
    ship1Name.style.fontFamily = "press_start_2pregular";
    ship1Name.style.width = "400px";
    ship1Name.style.borderStyle = "solid";
    ship1Name.style.borderWidth = "4px";

    document.body.appendChild(ship1Name);

    ship2Name = document.createElement("p");
    ship2Name.textContent = ship2Opts.name;
    ship2Name.style.fontFamily = "press_start_2pregular";
    ship2Name.style.width = "400px";
    ship2Name.style.borderStyle = "solid";
    ship2Name.style.borderWidth = "4px";

    document.body.appendChild(ship2Name);

    onGUIChange();
}

function onGUIChange(){
    ship1Name.textContent = ship1Opts.name + " ( " + player1keys + " )";
    ship2Name.textContent = ship2Opts.name + " ( " + player2keys + " )";

    var col = HSL2CSS(ship1Opts.hue2, ship1Opts.sat2, ship1Opts.lit2);
    ship1Name.style.color = col;
    col = HSL2CSS(ship2Opts.hue2, ship2Opts.sat2, ship2Opts.lit2);
    ship2Name.style.color = col;

    col = HSL2CSS(ship1Opts.hue1, ship1Opts.sat1, ship1Opts.lit1);
    ship1Name.style.backgroundColor = col;
    ship1Name.style.borderColor = col;
    col = HSL2CSS(ship2Opts.hue1, ship2Opts.sat1, ship2Opts.lit1);
    ship2Name.style.backgroundColor = col;
    ship2Name.style.borderColor = col;

}

function createStartButton(){
    startButton = document.createElement("button");
    startButton.setAttribute("type", "button");
    startButton.setAttribute("name", "startGame");
    startButton.setAttribute("onclick", "startGame()");
    startButton.textContent = "Start Game";
    startButton.style.position = "relative";
    document.body.appendChild(startButton);
}

function createRandomButton(){
    randomButton = document.createElement("button");
    randomButton.setAttribute("type", "button");
    randomButton.setAttribute("name", "randomCol");
    randomButton.setAttribute("onclick", "randomizeColors()");
    randomButton.textContent = "Randomize Colors";
    randomButton.style.position = "relative";
    document.body.appendChild(randomButton);
}

function randomizeColors(){
    var name1 = ship1Opts.name, name2 = ship2Opts.name;

    ship1Opts = new opts();
    ship2Opts = new opts();

    ship1Opts.name = name1;
    ship2Opts.name = name2;

    onGUIChange();
}

function createShipGUIs(){
    gui = new dat.GUI({ autoPlace: false });
    gui.add(genOpts, "winScore", 1, 10).step(1);

    gui.domElement.style.position = "relative";
    gui.domElement.style.top = "200px";

    guiContainer = document.getElementById("GUIContainer");
    guiContainer.appendChild(gui.domElement);

    guiContainer.style.position = "fixed";

    ship1GUI = gui.addFolder("Player 1");
    var c = ship1GUI.add(ship1Opts, "name");
    c.onChange(onGUIChange);
    c = ship1GUI.add(ship1Opts, "hue1", huemin, huemax);
    c.onChange(onGUIChange);
    c = ship1GUI.add(ship1Opts, "sat1", satmin, satmax);
    c.onChange(onGUIChange);
    c = ship1GUI.add(ship1Opts, "lit1", litmin, litmax);
    c.onChange(onGUIChange);
    c = ship1GUI.add(ship1Opts, "hue2", huemin, huemax);
    c.onChange(onGUIChange);
    c = ship1GUI.add(ship1Opts, "sat2", satmin, satmax);
    c.onChange(onGUIChange);
    c = ship1GUI.add(ship1Opts, "lit2", litmin, litmax);
    c.onChange(onGUIChange);

    ship2GUI = gui.addFolder("Player 2");
    c = ship2GUI.add(ship2Opts, "name");
    c.onChange(onGUIChange);
    c = ship2GUI.add(ship2Opts, "hue1", huemin, huemax);
    c.onChange(onGUIChange);
    c = ship2GUI.add(ship2Opts, "sat1", satmin, satmax);
    c.onChange(onGUIChange);
    c = ship2GUI.add(ship2Opts, "lit1", litmin, litmax);
    c.onChange(onGUIChange);
    c = ship2GUI.add(ship2Opts, "hue2", huemin, huemax);
    c.onChange(onGUIChange);
    c = ship2GUI.add(ship2Opts, "sat2", satmin, satmax);
    c.onChange(onGUIChange);
    c = ship2GUI.add(ship2Opts, "lit2", litmin, litmax);
    c.onChange(onGUIChange);

}

// delete all menu dom elements
function exitMenu(){
    document.body.removeChild(startButton);
    document.body.removeChild(guiContainer);
    document.body.removeChild(ship1Name);
    document.body.removeChild(ship2Name);
    document.body.removeChild(logotext);
    document.body.removeChild(infoImage);
    document.body.removeChild(randomButton);

    localStorage.setItem("ship1opts", JSON.stringify(ship1Opts));
    localStorage.setItem("ship2opts", JSON.stringify(ship2Opts));
}

function startGame(){
    exitMenu();
    init();
    animate();
}

var gamepad1, gamepad2;
function initGamepads(){
    // TODO: once API stabilizes, add code for firefox. Once both chrome and firefox agree, scrap everything and rewrite this section.
    // NOTE: Need to build custom wrapper for gamepad functions once firefox support arrives.
    var webkitGamepadSupportAvailable = !!navigator.webkitGetGamepads;

    if (!!webkitGamepadSupportAvailable){
        var gamepads = navigator.webkitGetGamepads();

        gamepad1 = gamepads[0];
        gamepad2 = gamepads[1];

        if (gamepad1){
            console.log("Controller detected! Player 1 controller active!");

            player1keys = "CONTROLLER";
            player1GamepadActive = true;
        }

        if (gamepad2){
            console.log("Controller detected! Player 2 controller active!");

            player2keys = "CONTROLLER";
            player2GamepadActive = true;
        }
    }

}