text:
"use strict";

//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------

module.exports = function(context) {
    var config = context.options[0] || {};
    var checkGetWithoutSet = config.getWithoutSet === true;
    var checkSetWithoutGet = config.setWithoutGet !== false;

    /**
     * Checks a object expression to see if it has setter and getter both present or none.
     * @param {ASTNode} node The node to check.
     * @returns {void}
     * @private
     */
    function checkLonelySetGet(node) {
        var isSetPresent = false;
        var isGetPresent = false;
        var propLength = node.properties.length;

        for (var i = 0; i < propLength; i++) {
            var propToCheck = node.properties[i].kind === "init" ? node.properties[i].key.name : node.properties[i].kind;

            switch (propToCheck) {
                case "set":
                    isSetPresent = true;
                    break;

                case "get":
                    isGetPresent = true;
                    break;

                default:
                    // Do nothing
            }

            if (isSetPresent && isGetPresent) {
                break;
            }
        }

        if (checkSetWithoutGet && isSetPresent && !isGetPresent) {
            context.report(node, "Getter is not present");
        } else if (checkGetWithoutSet && isGetPresent && !isSetPresent) {
            context.report(node, "Setter is not present");
        }
    }

    return {
        "ObjectExpression": function (node) {
            if (checkSetWithoutGet || checkGetWithoutSet) {
                checkLonelySetGet(node);
            }
        }
    };

};

module.exports.schema = [
    {
        "type": "object",
        "properties": {
            "getWithoutSet": {
                "type": "boolean"
            },
            "setWithoutGet": {
                "type": "boolean"
            }
        },
        "additionalProperties": false
    }
];


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

namespace Tests;

use PHPUnit\Framework\TestCase;

class ProtocolTest extends TestCase
{

    public function testEmpty()
    {
        $protocol = new Nirvarnia\Http\Protocol();
        $test = $protocol->get();
        $this->assertEquals('1.1', $test);
    }

    public function testInvalidProtocol_One()
    {
        $this->expectException(Nirvarnia\Http\Exception\BadArgument::class);
        $protocol = new Nirvarnia\Http\Protocol();
        $protocol->set('0.1');
    }

    public function testInvalidProtocol_Two()
    {
        $this->expectException(Nirvarnia\Http\Exception\BadArgument::class);
        $protocol = new Nirvarnia\Http\Protocol();
        $protocol->set('1');
    }

    public function testInvalidProtocol_Three()
    {
        $this->expectException(Nirvarnia\Http\Exception\BadArgument::class);
        $protocol = new Nirvarnia\Http\Protocol();
        $protocol->set(2);
    }

    public function testToString()
    {
        $protocol = new Nirvarnia\Http\Protocol('1.0');
        $test = '' . $protocol;
        $this->assertEquals('HTTP/1.0', $test);
    }

    public function testExceptionBadArgumentOnConstruction_Boolean()
    {
        $this->expectException(Nirvarnia\Http\Exception\BadArgument::class);
        $protocol = new Nirvarnia\Http\Protocol(true);
    }

    public function testExceptionBadArgumentOnConstruction_Integer()
    {
        $this->expectException(Nirvarnia\Http\Exception\BadArgument::class);
        $protocol = new Nirvarnia\Http\Protocol(123);
    }

    public function testExceptionBadArgumentOnConstruction_Array()
    {
        $this->expectException(Nirvarnia\Http\Exception\BadArgument::class);
        $protocol = new Nirvarnia\Http\Protocol([]);
    }

}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Reflection;
using System.Xml.Xsl.Qil;

namespace System.Xml.Xsl.Xslt
{
    /// <summary>
    /// Several annotations are created and attached to Qil nodes during Xslt compilation.
    /// </summary>
    internal class XsltAnnotation : ListBase<object>
    {
        private object _arg0, _arg1, _arg2;

        //-----------------------------------------------
        // Constructor
        //-----------------------------------------------

        /// <summary>
        /// Create and initialize XsltAnnotation for the specified node.
        /// Allow properties to be read and written.
        /// </summary>
        public static XsltAnnotation Write(QilNode nd)
        {
            XsltAnnotation ann = nd.Annotation as XsltAnnotation;

            if (ann == null)
            {
                ann = new XsltAnnotation();
                nd.Annotation = ann;
            }

            return ann;
        }

        private XsltAnnotation()
        {
        }

        //-----------------------------------------------
        // ListBase implementation
        //-----------------------------------------------

        /// <summary>
        /// List of annotations can be updated.
        /// </summary>
        public override bool IsReadOnly
        {
            get { return false; }
        }

        /// <summary>
        /// Return the count of sub-annotations maintained by this annotation.
        /// </summary>
        public override int Count
        {
            get { return 3; }
        }

        /// <summary>
        /// Return the annotation at the specified index.
        /// </summary>
        public override object this[int index]
        {
            get
            {
                switch (index)
                {
                    case 0: return _arg0;
                    case 1: return _arg1;
                    case 2: return _arg2;
                }

                throw new IndexOutOfRangeException();
            }
            set
            {
                switch (index)
                {
                    case 0: _arg0 = value; return;
                    case 1: _arg1 = value; return;
                    case 2: _arg2 = value; return;
                }
                throw new IndexOutOfRangeException();
            }
        }
    }
}


text:
function  [SINR_ETs] = SINR_ETs(posSU, posET, B, n, m, nET, TVpower, delta, SUcellRadius, coverage, pathlossfactor, s)

posETs = [];    % the location of endusers of one WBS
posETsSUs = [];
SINR_ETs_oneWBS = [];
SINR_ETs = [];

posETcell = mat2cell(posET, [2], nET*ones(1, n));

for i = 1: n

    % generate pathlos matrix
    posETsSUs = [posETcell{i}, posSU];
    d = dist(posETsSUs);    % get distance matrix for SUs
    G = ones(n+nET, n+nET)./ (d  + diag(ones(n+nET, 1))).^pathlossfactor;
    shadow = normrnd (0, s, n+nET, n+nET);
    G = G.*10.^(shadow/10);
    Gtilde = G - diag(diag(G));     % path loss between any ET of one WBS and any other WBS

    g_signal = Gtilde(1: nET, nET+i); % pathloss between all ETs and mother WBS, nET x 1

    currentChannel = find(B(i, :)); % which channel is being used:
%     listCochannelWBS = find(:, currentChannel); % list of co-channel WBSs
%     g_interference = Gtilde(1: nET, listCochannelWBS); % pathloss between all ETs and interfering WBS, nTE x m

    g_interference = Gtilde(1: nET, nET+1: nET+n); % nET  x n

    WBScochannel = B(:, currentChannel); % the power of WBS which interfers ETs, o means there is no interference caused.
    MumWBPower = WBScochannel(i); % power of mother WBS
    WBScochannel(i) = 0; % set the power of ith WB to 0

    SINR_ETs_oneWBS = 10*log10((g_signal*MumWBPower)./(g_interference* WBScochannel + delta)); % calculate SINR on all of them
    SINR_ETs = [SINR_ETs, SINR_ETs_oneWBS']; % store

end % every WBS


text:
<?php

/**
 * ##MODULE_NAME## actions.
 *
 * @package    ##PROJECT_NAME##
 * @subpackage ##MODULE_NAME##
 * @author     ##AUTHOR_NAME##
 * @version    SVN: $Id: actions.class.php 604 2009-06-15 07:40:56Z tumf $
 */
class ##MODULE_NAME##Actions extends auto##MODULE_NAME##Actions
{
}


text:
<?php
require_once "../vendor/autoload.php";

use Hprose\Swoole\Client;
use Hprose\Future;

Future\co(function() {
    $client = new Client("tcp://127.0.0.1:1980");
    $id = (yield $client->getId());
    $client->subscribe('news', $id, function($news) {
        var_dump($news);
    });
    var_dump((yield $client->hello('hprose')));
});


text:
<!DOCTYPE html>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <title>Options for your land</title>

    <link href="/assets/govuk/stylesheets/govuk-template.css" media="screen" rel="stylesheet">

    <link href="/assets/govuk/stylesheets/govuk-template-print.css" media="print" rel="stylesheet">

    <link href="/assets/govuk/stylesheets/fonts.css" media="all" rel="stylesheet">

    <link rel="shortcut icon" href="/assets/govuk/images/favicon.ico" type="image/x-icon">

    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/assets/govuk/images/apple-touch-icon-144x144.png">

    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/assets/govuk/images/apple-touch-icon-114x114.png">

    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/assets/govuk/images/apple-touch-icon-72x72.png">

    <link rel="apple-touch-icon-precomposed" href="/assets/govuk/images/apple-touch-icon-57x57.png">

    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta property="og:image" content="/assets/govuk/images/opengraph-image.png">

    <link href="/assets/stylesheets/main.css" media="all" rel="stylesheet">

      Skip to main content

GOV.UK uses cookies to make the site simpler. Find out more about cookies

             GOV.UK

      Menu

        Rural payments

        Beta
        This is a new service – your feedback will help us to improve it.

    Back to Land you want included in your application

Parcels eligible for options

The options below may be suitable for your application

Values shown are indicative and are subject to adjustment

                £

                potential value per year

                0 ha

                total holding area

          <form class="form-table" method="post" action="/" id="options">

Land parcels

                  Code
                  Option
                  Type
                  Quantity
                  Value
                  Criteria

          </form>

Review my application

          Save and finish application later

Help

Cookies

Contact

Cymraeg

Built by Defra

Open Government Licence

All content is available under the Open Government Licence v3.0, except where otherwise stated

          © Crown copyright


text:
package org.apache.hbase.collections;

import java.io.IOException;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;

import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HTableInterface;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.filter.Filter;
import org.apache.hadoop.hbase.filter.PrefixFilter;
import org.apache.hadoop.hbase.util.Bytes;

public class HBaseMap<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> {

  private static final byte[] DEFAULT_FAMILY = Bytes.toBytes("map");
  private static final byte[] DEFAULT_SIZE = HConstants.EMPTY_BYTE_ARRAY;
  private static final byte[] DEFAULT_QUAL = HConstants.EMPTY_BYTE_ARRAY;

  private final HTableFactory _tableFactory;
  private SerializerFactory<K, V> _serializerFactory = new SerializerFactory<K, V>();
  private byte[] _table;
  private byte[] _family;
  private byte[] _defaultQualifier;
  private byte[] _mapName;
  private byte[] _sizeQualifier;

  static abstract class Command<T> {
    abstract T execute(HTableInterface table) throws IOException;
  }

  public HBaseMap(String table, String mapName) {
    this(Bytes.toBytes(table), Bytes.toBytes(mapName));
  }

  public HBaseMap(Configuration configuration, String table, String mapName) {
    this(configuration, Bytes.toBytes(table), Bytes.toBytes(mapName));
  }

  public HBaseMap(byte[] table, byte[] mapName) {
    this(table, DEFAULT_FAMILY, mapName, DEFAULT_QUAL, DEFAULT_SIZE);
  }

  public HBaseMap(Configuration configuration, byte[] table, byte[] mapName) {
    this(configuration, table, DEFAULT_FAMILY, mapName, DEFAULT_QUAL, DEFAULT_SIZE);
  }

  public HBaseMap(byte[] table, byte[] family, byte[] mapName, byte[] defaultQualifier, byte[] sizeQualifier) {
    this(HBaseConfiguration.create(), table, family, mapName, defaultQualifier, sizeQualifier);
  }

  public HBaseMap(Configuration configuration, byte[] table, byte[] family, byte[] mapName, byte[] defaultQualifier,
      byte[] sizeQualifier) {
    _table = table;
    _family = family;
    _mapName = mapName;
    _defaultQualifier = defaultQualifier;
    _sizeQualifier = sizeQualifier;
    _tableFactory = HTableFactory.instance(configuration);
  }

  @Override
  public Set<java.util.Map.Entry<K, V>> entrySet() {
    return new AbstractSet<Map.Entry<K, V>>() {

      @Override
      public Iterator<java.util.Map.Entry<K, V>> iterator() {
        final HTableInterface htable = _tableFactory.getInstance(_table);
        final ResultScanner scanner;
        try {
          Scan scan = new Scan();
          scan.addFamily(_family);
          byte[] rowPrefix = _serializerFactory.getRowPrefix(_mapName);
          scan.setStartRow(rowPrefix);
          Filter filter = new PrefixFilter(rowPrefix);
          scan.setFilter(filter);
          scanner = htable.getScanner(scan);
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
        final Iterator<Result> iterator = scanner.iterator();
        return new Iterator<Map.Entry<K, V>>() {

          private K _key;
          private V _value;

          @Override
          public boolean hasNext() {
            return iterator.hasNext();
          }

          @Override
          public java.util.Map.Entry<K, V> next() {
            Result result = iterator.next();
            _key = getKey(result);
            _value = getValue(result);
            return new Entry<K, V>() {

              @Override
              public K getKey() {
                return _key;
              }

              @Override
              public V getValue() {
                return _value;
              }

              @Override
              public V setValue(V value) {
                return HBaseMap.this.put(_key, value);
              }

              @Override
              public String toString() {
                return "[\"" + _key + "\",\"" + _value + "\"]";
              }

            };
          }

          @Override
          public void remove() {
            HBaseMap.this.remove(_key);
          }

          @Override
          protected void finalize() throws Throwable {
            scanner.close();
            htable.close();
          }

        };
      }

      @Override
      public int size() {
        return HBaseMap.this.size();
      }
    };
  }

  @Override
  public int size() {
    long sizeActual = sizeActual();
    if (sizeActual > Integer.MAX_VALUE) {
      return Integer.MAX_VALUE;
    }
    return (int) sizeActual;
  }

  public long sizeActual() {
    return execute(new Command<Long>() {
      @Override
      Long execute(HTableInterface table) throws IOException {
        Get get = new Get(_mapName).addColumn(_family, _sizeQualifier);
        Result result = table.get(get);
        if (result.getRow() == null) {
          return 0L;
        }
        byte[] value = result.getValue(_family, _sizeQualifier);
        return Bytes.toLong(value);
      }
    });
  }

  @Override
  public boolean containsKey(Object key) {
    V v = get(key);
    if (v == null) {
      return false;
    } else {
      return true;
    }
  }

  @SuppressWarnings("unchecked")
  @Override
  public V remove(Object k) {
    final K key = (K) k;
    return execute(new Command<V>() {
      @Override
      V execute(HTableInterface table) throws IOException {
        Get get = getGet(key);
        Delete delete = getDelete(key);
        while (true) {
          Result result = table.get(get);
          byte[] val;
          long sizeChange;
          if (result.getRow() == null) {
            return null;
          } else {
            val = result.getValue(_family, _defaultQualifier);
            sizeChange = -1;
          }
          boolean checkAndDelete = table.checkAndDelete(get.getRow(), _family, _defaultQualifier, val, delete);
          if (checkAndDelete) {
            updateSize(sizeChange);
            return getValue(result);
          }
        }
      }
    });
  }

  @SuppressWarnings("unchecked")
  @Override
  public V get(final Object k) {
    final K key = (K) k;
    return execute(new Command<V>() {
      @Override
      V execute(HTableInterface table) throws IOException {
        Get get = getGet(key);
        Result result = table.get(get);
        return getValue(result);
      }
    });
  }

  @Override
  public V put(final K key, final V value) {
    return execute(new Command<V>() {
      @Override
      V execute(HTableInterface table) throws IOException {
        Get get = getGet(key);
        Put put = getPut(key, value);
        while (true) {
          Result result = table.get(get);
          byte[] val;
          long sizeChange;
          if (result.getRow() == null) {
            val = null;
            sizeChange = 1;
          } else {
            val = result.getValue(_family, _defaultQualifier);
            sizeChange = 0;
          }
          boolean checkAndPut = table.checkAndPut(get.getRow(), _family, _defaultQualifier, val, put);
          if (checkAndPut) {
            updateSize(sizeChange);
            return getValue(result);
          }
        }
      }
    });
  }

  @Override
  public V putIfAbsent(final K key, final V value) {
    return execute(new Command<V>() {
      @Override
      V execute(HTableInterface table) throws IOException {
        Get get = getGet(key);
        Put put = getPut(key, value);
        byte[] val = null;
        boolean checkAndPut = table.checkAndPut(get.getRow(), _family, _defaultQualifier, val, put);
        if (checkAndPut) {
          updateSize(1l);
          return null;
        } else {
          return getValue(table.get(get));
        }
      }
    });
  }

  @Override
  public boolean remove(final Object key, final Object value) {
    return execute(new Command<Boolean>() {
      @SuppressWarnings("unchecked")
      @Override
      Boolean execute(HTableInterface table) throws IOException {
        byte[] val = _serializerFactory.toBytes(value);
        Delete delete = getDelete((K) key);
        boolean checkAndDelete = table.checkAndDelete(delete.getRow(), _family, _defaultQualifier, val, delete);
        if (checkAndDelete) {
          updateSize(-1l);
        }
        return checkAndDelete;
      }
    });
  }

  @Override
  public boolean replace(final K key, final V oldValue, final V newValue) {
    return execute(new Command<Boolean>() {
      @Override
      Boolean execute(HTableInterface table) throws IOException {
        Put put = getPut(key, newValue);
        byte[] val = _serializerFactory.toBytes(oldValue);
        return table.checkAndPut(put.getRow(), _family, _defaultQualifier, val, put);
      }
    });
  }

  @Override
  public V replace(final K key, final V value) {
    return execute(new Command<V>() {
      @Override
      V execute(HTableInterface table) throws IOException {
        Get get = getGet(key);
        Put put = getPut(key, value);
        while (true) {
          Result result = table.get(get);
          byte[] val;
          if (result.getRow() == null) {
            return null;
          } else {
            val = result.getValue(_family, _defaultQualifier);
          }
          boolean checkAndPut = table.checkAndPut(get.getRow(), _family, _defaultQualifier, val, put);
          if (checkAndPut) {
            return getValue(result);
          }
        }
      }
    });
  }

  protected void updateSize(final long sizeChange) {
    execute(new Command<Void>() {
      @Override
      Void execute(HTableInterface table) throws IOException {
        table.incrementColumnValue(_mapName, _family, _sizeQualifier, sizeChange);
        return null;
      }
    });
  }

  protected K getKey(Result result) {
    return _serializerFactory.getKey(result, _mapName, _family, _defaultQualifier);
  }

  protected V getValue(Result result) {
    return _serializerFactory.getValue(result, _mapName, _family, _defaultQualifier);
  }

  protected Get getGet(K key) {
    return _serializerFactory.getGet(key, _mapName, _family, _defaultQualifier);
  }

  protected Put getPut(K key, V value) {
    return _serializerFactory.getPut(key, value, _mapName, _family, _defaultQualifier);
  }

  protected Delete getDelete(K key) {
    return _serializerFactory.getDelete(key, _mapName, _family, _defaultQualifier);
  }

  private <T> T execute(Command<T> command) {
    HTableInterface table = null;
    try {
      table = _tableFactory.getInstance(_table);
      return command.execute(table);
    } catch (IOException e) {
      throw new RuntimeException(e);
    } finally {
      IOUtils.closeQuietly(table);
    }
  }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project name="build.android.lib" >

    <fail unless="builder.imported"
                  message="Import build.xml in order to use ${ant.file.build.android.lib} build file." />

    <import file="common.xml" />
	<import file="android.quality.xml" />
    <import file="android.sdk.xml" />

    <target name="-pre-build-debug" >
        <property name="build.mode" value="debug" />
    </target>

    <target name="-pre-build-instrument" >
        <property name="build.mode" value="instrument" />
    </target>

    <target name="-pre-build-release" >
        <property name="build.mode" value="release" />
    </target>

    <target name="-pre-build">
        <property name="bin.dir" location="${project.dir}/bin" />
        <property name="libs.dir" location="${project.dir}/libs" />
        <property name="bin.dir" location="${project.dir}/bin/${build.mode}" />
        <property name="jar.file" location="${bin.dir}/classes.jar" />
        <property name="jar.dir"  location="${bin.dir}/jar" />

        <echo>bin.dir  = ${bin.dir}</echo>
        <echo>jar.file = ${jar.file}</echo>
        <echo>jar.dir  = ${jar.dir}</echo>
        <mkdir dir="${bin.dir}" />
    </target>

    <target name="drop-jar">
        <copy file="${jar.file}" tofile="${drop.dir}/${build.mode}/${project.name}.jar" />
    </target>

    <target name="make-libs-dir">
        <mkdir dir="${libs.dir}" />
    </target>

    <target name="build" depends="-pre-build, drop-jar, make-libs-dir" />

    <target name="debug" depends="-pre-build-debug, prepare-project, android.debug, build" />
    <target name="instrument" depends="-pre-build-instrument, prepare-project, android.instrument, build" />
    <target name="release" depends="-pre-build-release, prepare-project, android.release, build" />
    <target name="clean" depends="-pre-build, android.clean" >
        <delete dir="${bin.dir}" />
        <delete dir="${libs.dir}" />
        <mkdir dir="${libs.dir}" />
    </target>

	<target name="pmd" depends="-pre-build-debug, android.quality.pmd" />
	<target name="cpd" depends="-pre-build-debug, android.quality.cpd" />
	<target name="findbugs" depends="debug, android.quality.findbugs" />

</project>


text:
namespace NETXUSASharp.Models
{
    public class inventory
    {
        public int? quantity { get; set; }
        public System.DateTime? stockETA { get; set; }
    }
}


text:
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.9.1">
  <compounddef id="namespace_symfony_1_1_component_1_1_config_1_1_definition_1_1_builder_1_1_tree_builder" kind="namespace" language="PHP">
    <compoundname>Symfony::Component::Config::Definition::Builder::TreeBuilder</compoundname>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <location file="/Applications/XAMPP/xamppfiles/htdocs/CR/src/CR/GSBRBundle/DependencyInjection/Configuration.php" line="1" column="1"/>
  </compounddef>
</doxygen>


text:
Management

Application

User

Project

Users

Apply

List *

Manage *

Projects

Apply

List *

Manage *

Results

Members


text:
package com.github.st1hy.countthemcalories.activities.overview.graph.inject;

import com.github.st1hy.countthemcalories.activities.overview.graph.GraphFragment;
import com.github.st1hy.countthemcalories.activities.overview.graph.inject.column.GraphColumnComponentFactory;
import com.github.st1hy.countthemcalories.inject.PerFragment;
import com.github.st1hy.countthemcalories.inject.common.FragmentModule;

import dagger.Subcomponent;

@PerFragment
@Subcomponent(modules = {
        FragmentModule.class,
        GraphModule.class
})
public interface GraphComponent extends GraphColumnComponentFactory {

    void inject(GraphFragment graphFragment);

}


text:
namespace Points
{
    public struct Point3D
    {
        private static readonly Point3D origin = new Point3D(0,0,0);

        public decimal X { get; set; }
        public decimal Y { get; set; }
        public decimal Z { get; set; }
        public static Point3D Origin
        {
            get
            {
                return origin;
            }
        }

        public Point3D(decimal inputX, decimal inputY, decimal inputZ)
            : this()    // Structure has to have a parameterless constructor.
        {
            this.X = inputX;
            this.Y = inputY;
            this.Z = inputZ;
        }

        public override string ToString()
        {
            return string.Format("{{{0}; {1}; {2}}}", this.X, this.Y, this.Z);
        }

    }
}


text:
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;

namespace Tyrrrz.Extensions
{
    /// <summary>
    /// Extensions for <see cref="ISet{T}" />.
    /// </summary>
    public static class SetExtensions
    {
        /// <summary>
        /// Creates a hashset from given sequence.
        /// </summary>
        [return: NotNull]
        public static HashSet<T> ToHashSet<T>([NotNull] this IEnumerable<T> source, [NotNull] IEqualityComparer<T> comparer)
        {
            return new HashSet<T>(source, comparer);
        }

        /// <summary>
        /// Creates a hashset from given sequence.
        /// </summary>
        [return: NotNull]
        public static HashSet<T> ToHashSet<T>([NotNull] this IEnumerable<T> source) => source.ToHashSet(EqualityComparer<T>.Default);

        /// <summary>
        /// Adds items to the set and returns the number of items that were successfully added.
        /// </summary>
        public static int AddRange<T>([NotNull] this ISet<T> source, [NotNull] IEnumerable<T> items)
        {
            return items.Count(source.Add);
        }
    }
}


text:
package org.apache.rya.api.client.accumulo;

import static java.util.Objects.requireNonNull;

import edu.umd.cs.findbugs.annotations.DefaultAnnotation;
import edu.umd.cs.findbugs.annotations.NonNull;

import org.apache.accumulo.core.client.Connector;

import com.google.common.base.Optional;

import org.apache.rya.accumulo.instance.AccumuloRyaInstanceDetailsRepository;
import org.apache.rya.api.client.GetInstanceDetails;
import org.apache.rya.api.client.InstanceDoesNotExistException;
import org.apache.rya.api.client.InstanceExists;
import org.apache.rya.api.client.RyaClientException;
import org.apache.rya.api.instance.RyaDetails;
import org.apache.rya.api.instance.RyaDetailsRepository;
import org.apache.rya.api.instance.RyaDetailsRepository.NotInitializedException;
import org.apache.rya.api.instance.RyaDetailsRepository.RyaDetailsRepositoryException;

/**
 * An Accumulo implementation of the {@link GetInstanceDetails} command.
 */
@DefaultAnnotation(NonNull.class)
public class AccumuloGetInstanceDetails extends AccumuloCommand implements GetInstanceDetails {

    private final InstanceExists instanceExists;

    /**
     * Constructs an instance of {@link AccumuloGetInstanceDetails}.
     *
     * @param connectionDetails - Details about the values that were used to create the connector to the cluster. (not null)
     * @param connector - Provides programatic access to the instance of Accumulo that hosts Rya instance. (not null)
     */
    public AccumuloGetInstanceDetails(final AccumuloConnectionDetails connectionDetails, final Connector connector) {
        super(connectionDetails, connector);
        instanceExists = new AccumuloInstanceExists(connectionDetails, connector);
    }

    @Override
    public Optional<RyaDetails> getDetails(final String instanceName) throws InstanceDoesNotExistException, RyaClientException {
        requireNonNull(instanceName);

        // Ensure the Rya instance exists.
        if(!instanceExists.exists(instanceName)) {
            throw new InstanceDoesNotExistException(String.format("There is no Rya instance named '%s'.", instanceName));
        }

        // If the instance has details, then return them.
        final RyaDetailsRepository detailsRepo = new AccumuloRyaInstanceDetailsRepository(getConnector(), instanceName);
        try {
            return Optional.of( detailsRepo.getRyaInstanceDetails() );
        } catch (final NotInitializedException e) {
            return Optional.absent();
        } catch (final RyaDetailsRepositoryException e) {
            throw new RyaClientException("Could not fetch the Rya instance's details.", e);
        }
    }
}


text:
<?php

namespace Oro\Component\ConfigExpression\Condition;

/**
 * Implements '>' operator.
 */
class GreaterThan extends AbstractComparison
{
    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'gt';
    }

    /**
     * {@inheritdoc}
     */
    protected function doCompare($left, $right)
    {
        return $left > $right;
    }
}


text:
package by.bsuir.verkpavel.adb.shared;

import java.rmi.Remote;
import java.rmi.RemoteException;

public interface IRemoteBank extends Remote{

    boolean isAuthenticate(OperationList operationList) throws RemoteException;

    boolean executePayments(OperationList operationList) throws RemoteException;

    boolean executeWithdrawal(OperationList operationList) throws RemoteException;

    double getBalance(OperationList operationList) throws RemoteException;

}


text:
package geco.vo.filter;

import geco.vo.Customer;
import geco.vo.Destination;
import geco.vo.Document;
import geco.vo.Supplier;
import geco.vo.Transporter;

public class GenerateDocsFilter {
	private Document sourcedoc;
	private Supplier supplier;
	private Customer customer;
	private Destination destination;
	private Transporter transporter;
	private String fromDate;
	private String toDate;
	public Document getSourcedoc() {
		return sourcedoc;
	}
	public void setSourcedoc(Document sourcedoc) {
		this.sourcedoc = sourcedoc;
	}
	public Supplier getSupplier() {
		return supplier;
	}
	public void setSupplier(Supplier supplier) {
		this.supplier = supplier;
	}
	public Customer getCustomer() {
		return customer;
	}
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
	public Destination getDestination() {
		return destination;
	}
	public void setDestination(Destination destination) {
		this.destination = destination;
	}
	public Transporter getTransporter() {
		return transporter;
	}
	public void setTransporter(Transporter transporter) {
		this.transporter = transporter;
	}
	public String getFromDate() {
		return fromDate;
	}
	public void setFromDate(String fromDate) {
		this.fromDate = fromDate;
	}
	public String getToDate() {
		return toDate;
	}
	public void setToDate(String toDate) {
		this.toDate = toDate;
	}

}


text:
/*jshint worker: true*/

// WorkerBroker routes messages between web workers and the main thread, allowing for simpler
// async code via promises. Example usage:
//
// In web worker, register self as a callable "target", and define a method:
//
//     WorkerBroker.addTarget('self', self);
//
//     self.square = function (x) {
//         return x * x;
//     };
//
// In main thread, invoke that method and receive the result (if any) as a promise.
//
//     worker = new Worker(...);
//     WorkerBroker.addWorker(worker);
//
//     WorkerBroker.postMessage(worker, 'self.square', 5).then(function(y) {
//         console.log(y);
//     });
//
//     -> prints 25
//
// Async code:
//
// For synchronous code that must pass a return value to the main thread, the function can simply
// return an immediate value (see example above). For cases where the worker method needs to run
// asynchronous code, the function can return a promise, and the resolved or rejected value will
// be sent back to the main thread when the promise is fulfilled.
//
// Error handling:
//
// If the worker method either throws an error, or returns a promise that is rejected, it will be
// sent back to the main thread as a promise rejection. These two examples are equivalent:
//
//     In worker, throwing an error:
//
//         self.broken = function () {
//             throw new Error('error in worker!');
//         };
//
//     In worker, returning a rejected promise:
//
//         self.broken = function () {
//             return Promise.reject(new Error('error in worker!'));
//         };
//
//     In main thread, both errors are received as a promise rejection:
//
//         WorkerBroker.postMessage(worker, 'self.broken').then(
//             // Promise resolved
//             function() {
//                 console.log('success!');
//             },
//             // Promise rejected
//             function(error) {
//                 console.log('error!', error);
//             });
//
//         -> prints 'error! error in worker'
//
// Calling from worker to main thread:
//
// The same style of calls can be made *from* a web worker, to the main thread. The API is the same
// with the exception that the first argument, 'worker', is not needed for WorkerBroker.postMessage(),
// since the main thread is the implicit target.
//
// In main thread, define a method and register it:
//
//     var geometry = {
//         length: function(x, y) {
//             return Math.sqrt(x * x + y * y);
//         }
//     };
//
//     WorkerBroker.addTarget('geometry', geometry);
//
// In worker thread):
//
//     WorkerBroker.postMessage('geometry.length', 3, 4).then(function(d) {
//         console.log(d);
//     });
//
//     -> prints 5
//

import Thread from './thread';
import log from './log';

var WorkerBroker;
export default WorkerBroker = {};

// Global list of all worker messages
// Uniquely tracks every call made between main thread and a worker
var message_id = 0;
var messages = {};

// Register an object to receive calls from other thread
WorkerBroker.targets = {};
WorkerBroker.addTarget = function (name, target) {
    WorkerBroker.targets[name] = target;
};

WorkerBroker.removeTarget = function (name) {
    if (name) {
        delete WorkerBroker.targets[name];
    }
};

// Given a dot-notation-style method name, e.g. 'Object.object.method',
// find the object to call the method on from the list of registered targets
function findTarget (method) {
    var chain = [];
    if (typeof method === 'string') {
        chain = method.split('.');
        method = chain.pop();
    }

    var target = WorkerBroker.targets;

    for (let m=0; m < chain.length; m++) {
        if (target[chain[m]]) {
            target = target[chain[m]];
        }
        else {
            return [];
        }
    }

    return [method, target];
}

// Main thread:
// - Send messages to workers, and optionally receive an async response as a promise
// - Receive messages from workers, and optionally send an async response back as a promise
function setupMainThread () {

    // Send a message to a worker, and optionally get an async response
    // Arguments:
    //   - worker: one or more web worker instances to send the message to (single value or array)
    //   - method: the method with this name, specified with dot-notation, will be invoked in the worker
    //   - message: spread of arguments to call the method with
    // Returns:
    //   - a promise that will be fulfilled if the worker method returns a value (could be immediately, or async)
    //
    WorkerBroker.postMessage = function (worker, method, ...message) {
        // If more than one worker specified, post to multiple
        if (Array.isArray(worker)) {
            return Promise.all(
                worker.map(w => WorkerBroker.postMessage(w, method, ...message))
            );
        }

        // Parse options
        let options = {};
        if (typeof method === 'object') {
            options = method;
            method = method.method;
        }

        // Track state of this message
        var promise = new Promise((resolve, reject) => {
            messages[message_id] = { method, message, resolve, reject };
        });

        let payload, transferables = [];

        if (message && message.length === 1 && message[0] instanceof WorkerBroker.withTransferables) {
            transferables = message[0].transferables;
            message = message[0].value;
        }

        payload = {
            type: 'main_send',      // mark message as method invocation from main thread
            message_id,             // unique id for this message, for life of program
            method,                 // will dispatch to a function of this name within the worker
            message                 // message payload
        };

        if (options.stringify) {
            payload = JSON.stringify(payload);
        }

        worker.postMessage(payload, transferables.map(t => t.object));
        freeTransferables(transferables);
        if (transferables.length > 0) {
            log('trace', `'${method}' transferred ${transferables.length} objects to worker thread`);
        }

        message_id++;
        return promise;
    };

    // Add a worker to communicate with - each worker must be registered from the main thread
    WorkerBroker.addWorker = function (worker) {
        if (!(worker instanceof Worker)) {
            throw Error('Worker broker could not add non-Worker object', worker);
        }

        worker.addEventListener('message', function WorkerBrokerMainThreadHandler(event) {
            let data = ((typeof event.data === 'string') ? JSON.parse(event.data) : event.data);
            let id = data.message_id;

            // Listen for messages coming back from the worker, and fulfill that message's promise
            if (data.type === 'worker_reply') {
                // Pass the result to the promise
                if (messages[id]) {
                    if (data.error) {
                        messages[id].reject(data.error);
                    }
                    else {
                        messages[id].resolve(data.message);
                    }
                    delete messages[id];
                }
            }
            // Listen for messages initiating a call from the worker, dispatch them,
            // and send any return value back to the worker
            // Unique id for this message & return call to main thread
            else if (data.type === 'worker_send' && id != null) {
                // Call the requested method and save the return value
                let result, error, target, method_name, method;
                try {
                    [method_name, target] = findTarget(data.method);
                    if (!target) {
                        throw Error(`Worker broker could not dispatch message type ${data.method} on target ${data.target} because no object with that name is registered on main thread`);
                    }

                    method = (typeof target[method_name] === 'function') && target[method_name];
                    if (!method) {
                        throw Error(`Worker broker could not dispatch message type ${data.method} on target ${data.target} because object has no method with that name`);
                    }

                    result = method.apply(target, data.message);
                }
                catch(e) {
                    // Thrown errors will be passed back (in string form) to worker
                    error = e;

                }
                // Send return value to worker
                let payload, transferables = [];

                // Async result
                if (result instanceof Promise) {
                    result.then((value) => {
                        if (value instanceof WorkerBroker.withTransferables) {
                            transferables = value.transferables;
                            value = value.value[0];
                        }

                        payload = {
                            type: 'main_reply',
                            message_id: id,
                            message: value
                        };
                        worker.postMessage(payload, transferables.map(t => t.object));
                        freeTransferables(transferables);
                        if (transferables.length > 0) {
                            log('trace', `'${method_name}' transferred ${transferables.length} objects to worker thread`);
                        }

                    }, (error) => {
                        worker.postMessage({
                            type: 'main_reply',
                            message_id: id,
                            error: (error instanceof Error ? `${error.message}: ${error.stack}` : error)
                        });
                    });
                }
                // Immediate result
                else {
                    if (result instanceof WorkerBroker.withTransferables) {
                        transferables = result.transferables;
                        result = result.value[0];
                    }

                    payload = {
                        type: 'main_reply',
                        message_id: id,
                        message: result,
                        error: (error instanceof Error ? `${error.message}: ${error.stack}` : error)
                    };
                    worker.postMessage(payload, transferables.map(t => t.object));
                    freeTransferables(transferables);
                    if (transferables.length > 0) {
                        log('trace', `'${method_name}' transferred ${transferables.length} objects to worker thread`);
                    }
                }
            }
        });

    };

    // Expose for debugging
    WorkerBroker.getMessages = function () {
        return messages;
    };

    WorkerBroker.getMessageId = function () {
        return message_id;
    };

}

// Worker threads:
// - Receive messages from main thread, and optionally send an async response back as a promise
// - Send messages to main thread, and optionally receive an async response as a promise
function setupWorkerThread () {

    // Send a message to the main thread, and optionally get an async response as a promise
    // Arguments:
    //   - method: the method with this name, specified with dot-notation, will be invoked on the main thread
    //   - message: array of arguments to call the method with
    // Returns:
    //   - a promise that will be fulfilled if the main thread method returns a value (could be immediately, or async)
    //
    WorkerBroker.postMessage = function (method, ...message) {
        // Parse options
        let options = {};
        if (typeof method === 'object') {
            options = method;
            method = method.method;
        }

        // Track state of this message
        var promise = new Promise((resolve, reject) => {
            messages[message_id] = { method, message, resolve, reject };
        });

        let payload, transferables = [];

        if (message && message.length === 1 && message[0] instanceof WorkerBroker.withTransferables) {
            transferables = message[0].transferables;
            message = message[0].value;
        }

        payload = {
            type: 'worker_send',    // mark message as method invocation from worker
            message_id,             // unique id for this message, for life of program
            method,                 // will dispatch to a method of this name on the main thread
            message                 // message payload
        };

        if (options.stringify) {
            payload = JSON.stringify(payload);
        }

        self.postMessage(payload, transferables.map(t => t.object));
        freeTransferables(transferables);
        if (transferables.length > 0) {
            log('trace', `'${method}' transferred ${transferables.length} objects to main thread`);
        }

        message_id++;
        return promise;
    };

    self.addEventListener('message', function WorkerBrokerWorkerThreadHandler(event) {
        let data = ((typeof event.data === 'string') ? JSON.parse(event.data) : event.data);
        let id = data.message_id;

        // Listen for messages coming back from the main thread, and fulfill that message's promise
        if (data.type === 'main_reply') {
            // Pass the result to the promise
            if (messages[id]) {
                if (data.error) {
                    messages[id].reject(data.error);
                }
                else {
                    messages[id].resolve(data.message);
                }
                delete messages[id];
            }
        }
        // Receive messages from main thread, dispatch them, and send back a reply
        // Unique id for this message & return call to main thread
        else if (data.type === 'main_send' && id != null) {
            // Call the requested worker method and save the return value
            let result, error, target, method_name, method;
            try {
                [method_name, target] = findTarget(data.method);
                if (!target) {
                    throw Error(`Worker broker could not dispatch message type ${data.method} on target ${data.target} because no object with that name is registered on main thread`);
                }

                method = (typeof target[method_name] === 'function') && target[method_name];

                if (!method) {
                    throw Error(`Worker broker could not dispatch message type ${data.method} because worker has no method with that name`);
                }

                result = method.apply(target, data.message);
            }
            catch(e) {
                // Thrown errors will be passed back (in string form) to main thread
                error = e;
            }

            // Send return value to main thread
            let payload, transferables = [];

            // Async result
            if (result instanceof Promise) {
                result.then((value) => {
                    if (value instanceof WorkerBroker.withTransferables) {
                        transferables = value.transferables;
                        value = value.value[0];
                    }

                    payload = {
                        type: 'worker_reply',
                        message_id: id,
                        message: value
                    };
                    self.postMessage(payload, transferables.map(t => t.object));
                    freeTransferables(transferables);
                    if (transferables.length > 0) {
                        log('trace', `'${method_name}' transferred ${transferables.length} objects to main thread`);
                    }
                }, (error) => {
                    self.postMessage({
                        type: 'worker_reply',
                        message_id: id,
                        error: (error instanceof Error ? `${error.message}: ${error.stack}` : error)
                    });
                });
            }
            // Immediate result
            else {
                if (result instanceof WorkerBroker.withTransferables) {
                    transferables = result.transferables;
                    result = result.value[0];
                }

                payload = {
                    type: 'worker_reply',
                    message_id: id,
                    message: result,
                    error: (error instanceof Error ? `${error.message}: ${error.stack}` : error)
                };
                self.postMessage(payload, transferables.map(t => t.object));
                freeTransferables(transferables);
                if (transferables.length > 0) {
                    log('trace', `'${method_name}' transferred ${transferables.length} objects to main thread`);
                }
            }
        }
    });

}

// Special value wrapper, to indicate that we want to find and include transferable objects in the message
WorkerBroker.withTransferables = function (...value) {
    if (!(this instanceof WorkerBroker.withTransferables)) {
        return new WorkerBroker.withTransferables(...value);
    }

    this.value = value;
    this.transferables = findTransferables(this.value);
};

// Build a list of transferable objects from a source object
// Returns a list of info about each transferable:
//   - object: the actual transferable object
//   - parent: the parent object that the transferable is a property of (if any)
//   - property: the property name of the transferable on the parent object (if any)
// TODO: add option in case you DON'T want to transfer objects
function findTransferables(source, parent = null, property = null, list = []) {
    if (!source) {
        return list;
    }

    if (Array.isArray(source)) {
        // Check each array element
        source.forEach((x, i) => findTransferables(x, source, i, list));
    }
    else if (typeof source === 'object') {
        // Is the object a transferable array buffer?
        if (source instanceof ArrayBuffer) {
            list.push({ object: source, parent, property });
        }
        // Or looks like a typed array (has an array buffer property)?
        else if (source.buffer instanceof ArrayBuffer) {
            list.push({ object: source.buffer, parent, property });
        }
        // Otherwise check each property
        else {
            for (let prop in source) {
                findTransferables(source[prop], source, prop, list);
            }
        }
    }
    return list;
}

// Remove neutered transferables from parent objects, as they should no longer be accessed after transfer
function freeTransferables(transferables) {
    if (!Array.isArray(transferables)) {
        return;
    }
    transferables.filter(t => t.parent && t.property).forEach(t => delete t.parent[t.property]);
}

// Setup this thread as appropriate
if (Thread.is_main) {
    setupMainThread();
}

if (Thread.is_worker) {
    setupWorkerThread();
}


text:
package com.linxcool.wechoice.contract;

import com.linxcool.andbase.mvp.BaseContract;
import com.linxcool.andbase.mvp.BaseModel;
import com.linxcool.andbase.mvp.BasePresenter;
import com.linxcool.andbase.mvp.BaseView;
import com.linxcool.wechoice.data.entity.VideoItem;

import java.util.List;

import io.reactivex.Observable;

/**
 * Created by linxcool on 17/3/16.
 */

public interface VideoListContract extends BaseContract {

    interface View extends BaseView<BaseView> {

        String getCategoryId();

        void showVideos(List<VideoItem> list);

        void showLoadVideosFailure(String msg);

    }

    interface Presenter extends BasePresenter {

        void loadVideos(boolean fromNetwork, int page);

    }

    interface Model extends BaseModel {

        Observable<List<VideoItem>> loadNetworkVideos(String cid, int startPage);

        Observable<List<VideoItem>> loadPreviousVideos(String cid, int startPage);

    }

}


text:
include(RunCMake)

run_cmake(NotAFeature)
run_cmake(NotAFeatureGenex)
run_cmake(NotAFeatureTransitive)
run_cmake(NotAFeature_OriginDebug)
run_cmake(NotAFeature_OriginDebugGenex)
run_cmake(NotAFeature_OriginDebugTransitive)
run_cmake(NotAFeature_OriginDebugCommand)

run_cmake(generate_feature_list)
file(READ
  "${RunCMake_BINARY_DIR}/generate_feature_list-build/c_features.txt"
  C_FEATURES
)
file(READ
  "${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx_features.txt"
  CXX_FEATURES
)
include("${RunCMake_BINARY_DIR}/generate_feature_list-build/c_standard_default.cmake")
include("${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx_standard_default.cmake")

if (NOT C_FEATURES)
  run_cmake(NoSupportedCFeatures)
  run_cmake(NoSupportedCFeaturesGenex)
endif()

if (NOT CXX_FEATURES)
  run_cmake(NoSupportedCxxFeatures)
  run_cmake(NoSupportedCxxFeaturesGenex)
else()
  if(CXX_STANDARD_DEFAULT EQUAL 98)
    run_cmake(LinkImplementationFeatureCycle)
  endif()
  run_cmake(LinkImplementationFeatureCycleSolved)

  if (";${CXX_FEATURES};" MATCHES ";cxx_final;")
    set(RunCMake_TEST_OPTIONS "-DHAVE_FINAL=1")
  endif()
  run_cmake(NonValidTarget1)
  run_cmake(NonValidTarget2)
  unset(RunCMake_TEST_OPTIONS)
endif()

if(CXX_STANDARD_DEFAULT)
  run_cmake(NotAStandard)

  foreach(standard 98 11)
    file(READ
      "${RunCMake_BINARY_DIR}/generate_feature_list-build/cxx${standard}_flag.txt"
      CXX${standard}_FLAG
    )
    if (CXX${standard}_FLAG STREQUAL NOTFOUND)
      run_cmake(RequireCXX${standard})
      run_cmake(RequireCXX${standard}Variable)
    endif()
    if (CXX${standard}EXT_FLAG STREQUAL NOTFOUND)
      run_cmake(RequireCXX${standard}Ext)
      run_cmake(RequireCXX${standard}ExtVariable)
    endif()
  endforeach()
endif()


text:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("GitExecutorTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GitExecutorTest")]
[assembly: AssemblyCopyright("Copyright ©  2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]

// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です
[assembly: Guid("ca41b8da-bf0f-4975-9857-474574bd453f")]

// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]


text:
'use strict';

var express = require('express');
var app = express();

app.get('/', function(req,res) {
	res.redirect(`/${new Date()}`)
})

app.get('/:date', function(req, res) {
	var timestamp = {
		"unix": '',
		"utc": ''
	}

	var inputDate = req.params.date
	var d = Date.parse(inputDate)

	if ( isNaN(d) ) {
		// date is not valid as a natural date - check to see if it was a unix date..
		if ( isNaN(inputDate) ) {
			// date is invalid
			timestamp.unix = ''
			timestamp.utc= ''
			console.log('Invalid Date by time...')
			res.send({"error": "Invalid Date"})
		}
		else {
			// date is valid...
			timestamp.unix = inputDate
			timestamp.utc = new Date(inputDate * 1).toUTCString()
			res.send(timestamp)
		}
	}
	else {
		// date is valid
		timestamp.unix = d
		timestamp.utc = new Date(d).toUTCString()
		res.send(timestamp)
	}

	console.log('Input:', inputDate)
	console.log('Unix:', timestamp.unix)
	console.log('UTC:', timestamp.utc)
	res.end()
})

var port = process.env.PORT || 8080;
app.listen(port,  function () {
	console.log('Node.js listening on port ' + port + '...');
});


text:
"""
HTMLMinifier
------------

A simple HTML5 minifier written in Python.

:copyright: (c) 2014-2015, Chi-En Wu.
:license: BSD 3-Clause License.
"""

from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand

import HTMLMinifier

class Tox(TestCommand):

    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = ['-v', '-epy']
        self.test_suite = True

    def run_tests(self):
        import tox
        tox.cmdline(self.test_args)

setup(
    name='HTMLMinifier',
    version=HTMLMinifier.__version__,
    author=HTMLMinifier.__author__,
    author_email='',
    description='A simple HTML5 minifier written in Python.',
    long_description=__doc__,
    url='https://github.com/jason2506/HTMLMinifier',
    license=HTMLMinifier.__license__,
    packages=find_packages(),
    zip_safe=False,
    platforms='any',
    install_requires=[],
    tests_require=['tox'],
    cmdclass={'test': Tox},
    classifiers=[
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: Implementation :: PyPy',
        "Topic :: Text Processing :: Markup :: HTML",
        'Topic :: Software Development :: Libraries :: Python Modules'
    ]
)


text:
/**
 * A very simplistic view of DNA. Ignore chromosomes and strands for now. After all
 * it took billions of years for Nature to figure that out!
 *
 * There are two ways in which DNA can change:
 * - through a Mutator when two instances of the creature mate.
 * - randomly through the lifetime of a creature.
 *
 * Each time DNA changes it may result in a creature dying, or having a more
 * limited lifespan. Alternatively it may result in the creature having a better
 * chance of surviving.
 */

/**
 * Each element of DNA has a range of values. And a chance of mutation.
 * Does the chance change as the value changes?
 *
 * Think of it as a spectrum.
 * - minor range at far left which is bad.
 * - major range at far right which is bad.
 * - average values/range.
 * - range between minor and average which is positive somehow?
 * - range between average and major which is positive somehow?
 *
 * Examples:
 *
 * Heads:
 * - 0 is dead!
 * - 1 is the optimum value.
 * - multiple is chaos and dead.
 *
 * Legs:
 * - 0 is dead (easy for predators).
 * - 1 is dead (easy for predators).
 * - 2 is ok.
 * - 3 is chaos (dead).
 * - 4 is good for speed.
 * - 5 and above chaos (dead). Though maybe 6 and 8 are ok?
 */

public class DNA
{
    /**
     * Normally specified per species but every now and then a randome
     * element will creap in to change some of these values.
     */

    public enum Behaviours {
	NUMBER_OF_LEGS,  // can be useful in combat or as predator/prey
	NUMBER_OF_ARMS,  // can be useful in combat or as predator/prey
	NUMBER_OF_EYES,  // can be useful in combat or as predator/prey
	NUMBER_OF_HEADS, // should normally be 1!
	NUMBER_OF_HEARTS, // should normally be 1!
	OVERALL_SIZE,  // size between 1 and 100
	BASE_TEMPERATURE,  // base needed to live
	TEMPERATURE_THRESHOLD,  // how much less than base it can survive
	TERRESTRIAL, // does the creature live on the land?
	AQUATIC, // does the creature live in water/ocean?
	AVIAN, // does the creature live in the air?
	BASE_OXYGEN,  // base needed to live
	OXYGEN_THRESHOLD,  // how much less than base it can survive
	DISEASE,  // non-zero means has a disease and aggressiveness
	LIFESPAN,  // in units of the world
	MALE,  // non-zero means yes
	FEMALE,  // non-zero means yes
	TOUGHNESS,  // general toughness
	TEETH,  // combat and ability to feed
	CLAWS,  // combat and ability to feed
	HORNS,  // combat
	ARMOUR,  // gives protection against cold and combat
	HAIR,  // gives some protection against cold
	WINGS,  // assume even number needed to fly
	CAN_REPRODUCE, // should usually be non-zero
	FLYING_SPEED // if 0 then can't fly even if have wings
    }

    @Override
    public boolean equals (Object dna)
    {
	if (this == dna)
	    return true;

	if (dna == null || dna.getClass() != this.getClass())
            return false;

	for (int i = 0; i < SIZE_OF_DNA; i++)
	{
	    if (_theMagic[i] != dna.get(i))
		return false;
	}

	return true;
    }

    public int getValue (int v)
    {
	return _theMagic[v];
    }

    public void setValue (int v, int n)
    {
	_theMagic[v] = n;
    }

    private static final int SIZE_OF_DNA = 100;

    private int[] _theMagic = new int[SIZE_OF_MAGIC];
}


text:
param($installPath, $toolsPath, $package, $project)

$projectFullName = $project.FullName
$projectFileInfo = new-object -typename System.IO.FileInfo -ArgumentList $projectFullName

# Get the source paths
$sourcePath = join-path $installPath 'Content'              # E.g. "C:\Users\Mattias\.nuget\packages\Emmellsoft.IoT.RPi.SenseHat\0.1.0.7\Content"
$sourceDemosPath = join-path $installPath 'Content\Demos'   # E.g. "C:\Users\Mattias\.nuget\packages\Emmellsoft.IoT.RPi.SenseHat\0.1.0.7\Content\Demos"

# Get the dest paths
$projectPath = $projectFileInfo.DirectoryName               # E.g. "C:\Users\Mattias\Projects\Test\2015\MyNugetTest\MyNugetTest"
$projectDemosPath = join-path $projectPath 'Demos'          # E.g. "C:\Users\Mattias\Projects\Test\2015\MyNugetTest\MyNugetTest\Demos"

# Ensure the dest "Demos" path exists
if (!(test-path $projectDemosPath))
{
	md $projectDemosPath | out-null
}

Copy-Item -Path "$sourcePath\DemoRunner.cs" -Destination "$projectPath\DemoRunner.cs" -Force
Copy-Item -Path "$sourcePath\SenseHatDemo.cs" -Destination "$projectPath\SenseHatDemo.cs" -Force
Copy-Item -Path "$sourcePath\Demos\*.cs" -Destination "$projectPath\Demos\" -Force

Write-Host ""
Write-Host "Note:"
Write-Host "   ""DemoRunner.cs"" and ""SenseHatDemo.cs"" has been copied to your project folder, along with a folder called ""Demos""!"
Write-Host "    However, you will need to include them manually, since NuGet 3.1 doesn't support content source files anymore... :'("
Write-Host ""
Write-Host "    Newly copied files:"
Write-Host "    *) $projectPath\DemoRunner.cs"
Write-Host "    *) $projectPath\SenseHatDemo.cs"
Write-Host "    *) $projectPath\Demos\*.cs"
Write-Host ""
Write-Host "  Usage:"
Write-Host "  For example, simply call the DemoRunner.Run method from the constructor of the MainPage:"
Write-Host ""
Write-Host "  public MainPage()"
Write-Host "  {"
Write-Host "      this.InitializeComponent();"
Write-Host ""
Write-Host "      // Replace the ""DiscoLights"" class below with the demo you want to run! :-)"
Write-Host "      RPi.SenseHat.Demo.DemoRunner.Run(senseHat => new RPi.SenseHat.Demo.Demos.DiscoLights(senseHat));"
Write-Host "  }"


text:
An accompanying JavaScript library for the [NHS Common User Interface](http://systems.hscic.gov.uk/data/cui/uig) guidance documents, by James Donnelly.

This is a work in-progress.


text:
================================
Building the user and admin docs
================================

This documentation should eventually end up in the OpenStack documentation
repositories `api-site` and `openstack-manuals`.

Dependencies
============

on Ubuntu:

  sudo apt-get install maven

on Fedora Core:

  sudo yum install maven

Use `mvn`
=========

Build the REST API reference manual:

  cd api-ref
  mvn clean generate-sources

Build the Heat admin guide:

  cd senlin-admin
  mvn clean generate-sources


text:
@protocol TTSSpeechConnectionDelegate
- (void)connection:(id)arg1 speechRequest:(id)arg2 willSpeakMark:(long long)arg3 inRange:(struct _NSRange)arg4;
- (void)connection:(id)arg1 speechRequest:(id)arg2 didStopAtEnd:(_Bool)arg3 phonemesSpoken:(id)arg4 error:(id)arg5;
- (void)connection:(id)arg1 speechRequestDidContinue:(id)arg2;
- (void)connection:(id)arg1 speechRequestDidPause:(id)arg2;
- (void)connection:(id)arg1 speechRequestDidStart:(id)arg2;
@end


text:
'use strict';
var mBuffer = require('../misc/buffer.js');

var EchonetLitePropertyParser = function() {
	this.lang = 'en';
	this.descs = {
		'en': {
			'ENG': {
				'field': 'Energy',
				'values': {}
			}
		},
		'ja': {
			'ENG': {
				'field': '電力量',
				'values': {}
			}
		}
	}
	this.desc = this.descs[this.lang];
};

EchonetLitePropertyParser.prototype.setLang = function(lang) {
	if(this.descs[lang]) {
		this.desc = this.descs[lang];
		this.lang = lang;
	}
	return this.lang;
};

EchonetLitePropertyParser.prototype.parse = function(buf) {
	var structure = [];
	// Check the length of the buffer
	if(buf.length !== 4) {
		return null;
	}
	// Energy
	var eng_buf = buf.slice(0, 4);
	var eng_key = 'ENG';
	var eng_value = eng_buf.readUInt32BE(0);
	var eng = {
		'key'   : eng_key,
		'field' : this.desc[eng_key]['field'],
		'value' : eng_value,
		'buffer': eng_buf,
		'hex'   : mBuffer.convBufferToHexString(eng_buf),
		'desc'  : eng_value.toString()
	};
	structure.push(eng);

	var parsed = {
		'message': {
			'energy': eng_value
		},
		'structure': structure
	}
	return parsed;
};

EchonetLitePropertyParser.prototype.create = function(data) {
	if(typeof(data) !== 'object') {
		throw new Error('The 1st argument "data" must be an object.');
	}
	var energy = data['energy'];
	if(typeof(energy) !== 'number' || energy < 0 || energy > 99999999 || energy % 1 > 0) {
		throw new Error('The "energy" property in the 1st argument "data" is invalid.');
	}
	var buf = Buffer.alloc(4);
	buf.writeUInt32BE(energy);
	return buf;
};

module.exports = new EchonetLitePropertyParser();


text:
package com.google.cloud.talent.v4.samples;

// [START jobs_v4_generated_CompanyService_ListCompanies_String_sync]
import com.google.cloud.talent.v4.Company;
import com.google.cloud.talent.v4.CompanyServiceClient;
import com.google.cloud.talent.v4.TenantName;

public class SyncListCompaniesString {

  public static void main(String[] args) throws Exception {
    syncListCompaniesString();
  }

  public static void syncListCompaniesString() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
      String parent = TenantName.of("[PROJECT]", "[TENANT]").toString();
      for (Company element : companyServiceClient.listCompanies(parent).iterateAll()) {
        // doThingsWith(element);
      }
    }
  }
}
// [END jobs_v4_generated_CompanyService_ListCompanies_String_sync]


text:
package com.ss.editor.ui.control.property.impl;

import static com.ss.rlib.common.util.ObjectUtils.notNull;
import com.jme3.math.ColorRGBA;
import com.ss.editor.annotation.FromAnyThread;
import com.ss.editor.annotation.FxThread;
import com.ss.editor.model.undo.editor.ChangeConsumer;
import com.ss.editor.ui.control.property.PropertyControl;
import com.ss.editor.ui.css.CssClasses;
import com.ss.editor.ui.util.UiUtils;
import com.ss.rlib.fx.util.FxControlUtils;
import com.ss.rlib.fx.util.FxUtils;
import javafx.scene.control.ColorPicker;
import javafx.scene.layout.HBox;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * The implementation of the {@link PropertyControl} to edit a color values.
 *
 * @param <C> the change
 * @param <T> the type parameter
 * @author JavaSaBr
 */
public class ColorPropertyControl<C extends ChangeConsumer, T> extends PropertyControl<C, T, ColorRGBA> {

    /**
     * The color picker.
     */
    @Nullable
    private ColorPicker colorPicker;

    public ColorPropertyControl(
            @Nullable ColorRGBA propertyValue,
            @NotNull String propertyName,
            @NotNull C changeConsumer
    ) {
        super(propertyValue, propertyName, changeConsumer);
    }

    @Override
    @FxThread
    protected void createComponents(@NotNull HBox container) {
        super.createComponents(container);

        colorPicker = new ColorPicker();
        colorPicker.prefWidthProperty()
                .bind(widthProperty().multiply(CONTROL_WIDTH_PERCENT));

        FxControlUtils.onColorChange(colorPicker, this::updateValue);

        FxUtils.addClass(colorPicker,
                CssClasses.PROPERTY_CONTROL_COLOR_PICKER);

        FxUtils.addChild(container, colorPicker);
    }

    @Override
    @FxThread
    public void changeControlWidthPercent(double controlWidthPercent) {
        super.changeControlWidthPercent(controlWidthPercent);

        FxUtils.rebindPrefWidth(getColorPicker(),
                widthProperty().multiply(controlWidthPercent));
    }

    @Override
    @FxThread
    protected void setPropertyValue(@Nullable ColorRGBA color) {
        super.setPropertyValue(color == null ? null : color.clone());
    }

    @Override
    @FromAnyThread
    protected boolean isSingleRow() {
        return true;
    }

    /**
     * Get the color picker.
     *
     * @return the color picker.
     */
    @FxThread
    private @NotNull ColorPicker getColorPicker() {
        return notNull(colorPicker);
    }

    @Override
    @FxThread
    protected void reload() {
        getColorPicker().setValue(UiUtils.from(getPropertyValue()));
    }

    /**
     * Updating value.
     */
    @FxThread
    private void updateValue() {

        if (isIgnoreListener()) {
            return;
        }

        var colorPicker = getColorPicker();
        var newColor = UiUtils.from(colorPicker.getValue());
        var oldValue = getPropertyValue();

        changed(newColor, oldValue == null ? null : oldValue.clone());
    }
}


text:
'use strict';

describe('ExpectedConditions', function() {
  var path = require('path');
  var driver = require(path.resolve(__dirname, '..', 'lib', 'driver')).driver;
  var wd = require('../../src/webdriver-sync');
  var ExpectedCondition = require('../../src/interfaces/ExpectedCondition');
  var ExpectedConditions = wd.ExpectedConditions;
  var By = wd.By;

  beforeEach(function() {
    driver.get('http://google.com');
  });

  after(function(){
    driver.quit();
  });

  it('should be able to work with expected conditions', function(){
    var by=By.cssSelector('body');
    var element = driver.findElement(by);
    validate(ExpectedConditions.alertIsPresent());
    validate(ExpectedConditions.elementSelectionStateToBe(by, false));
    validate(ExpectedConditions.elementSelectionStateToBe(element, false));
    validate(ExpectedConditions.elementToBeClickable(by));
    validate(ExpectedConditions.elementToBeClickable(element));
    validate(ExpectedConditions.elementToBeSelected(by));
    validate(ExpectedConditions.elementToBeSelected(element));
    validate(ExpectedConditions.frameToBeAvailableAndSwitchToIt('asdf'));
    validate(ExpectedConditions.invisibilityOfElementLocated(by));
    validate(ExpectedConditions.invisibilityOfElementWithText(by, 'adsf'));
    validate(ExpectedConditions.not(ExpectedConditions.alertIsPresent()));
    validate(ExpectedConditions.presenceOfAllElementsLocatedBy(by));
    validate(ExpectedConditions.presenceOfElementLocated(by));
    validate(ExpectedConditions.refreshed(ExpectedConditions.alertIsPresent()));
    validate(ExpectedConditions.stalenessOf(element));
    validate(ExpectedConditions.textToBePresentInElement(by, 'ads'));
    validate(ExpectedConditions.textToBePresentInElement(element, 'ads'));
    validate(ExpectedConditions.textToBePresentInElementValue(by, 'adsf'));
    validate(ExpectedConditions.textToBePresentInElementValue(element, 'adsf'));
    validate(ExpectedConditions.titleContains('asdf'));
    validate(ExpectedConditions.titleIs('sdf'));
    validate(ExpectedConditions.visibilityOf(element));
    validate(ExpectedConditions.visibilityOfElementLocated(by));
  });

  it('should accept an element from driver#findElements', function() {
    var by = By.cssSelector('div');
    var element = driver.findElements(by)[0];
    ExpectedConditions.visibilityOf(element);
  });

  function validate(val){
    val.should.be.an.instanceOf(ExpectedCondition);
  }
});


text:
<?php
/**
* Archives
*
* @package custom
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
$this->need('header.php');
?>

	<?php
    $stat = Typecho_Widget::widget('Widget_Stat');
    $this->widget('Widget_Contents_Post_Recent', 'pageSize='.$stat->publishedPostsNum)->to($archives);
    $year=0; $mon=0; $i=0; $j=0;
    $output = '
';
    while($archives->next()){
        $year_tmp = date('Y',$archives->created);
        $mon_tmp = date('m',$archives->created);
        $y=$year; $m=$mon;
        if ($year > $year_tmp || $mon > $mon_tmp) {
            $output .= '

';
        }
        if ($year != $year_tmp || $mon != $mon_tmp) {
			 $year = $year_tmp;
			 $mon = $mon_tmp;
			 $output .= '
'.date('M Y',$archives->created).'

';
        }
        $output .= '

permalink .'">'. $archives->title .'

 '.date('M j, Y',$archives->created).'

';
    }
    $output .= '

';
    echo $output;
    ?>

<?php $this->need('footer.php'); ?>


text:
#include <iostream>
#include <fstream>
#include <simple-base/base.h>
#include "compression/CompressionFactory.h"
#include "encryption/EncryptionFactory.h"
#include "utility/ChecksumUtility.h"
#include "utility/MeteredFilestream.h"
#include "utility/ApplicationConfig.h"
#include "efc/EFCHeaderFactory.h"

using namespace std;

int main (int argc, char* argv[])
{
	//Output the program's header and copyright information
	clog << "EFC Encryption Utility" << endl << "Copyright (c) 2011, Adam Rehn" << endl << endl;

	//Keep track of whether or not we encounter any errors so we can generate the right exit code
	bool errorOcurred = false;

	//Check if any arguments were supplied
	if (argc > 1)
	{
		//Parse the command line arguments
		ApplicationConfig config(argc, argv, EncryptionMode::Encrypt);

		//Output any errors generated during argument parsing
		clog << config.error;

		//Abort immediately if requested
		if (config.abort == true) {
			exit(1);
		}

		//Attempt to open the input file
		MeteredIfstream infile(config.infilePath);
		if (infile.is_open())
		{
			//Create a new EFC header
			EFCHeader* header = EFCHeaderFactory::createHeader(EFCHeaderVersion::Default);
			if (header != NULL)
			{
				//Set the header field values
				header->filename    = config.infilePath;
				header->compression = config.compression;
				header->cipher      = config.cipher;

				//Create the compression instance
				CompressionStrategy* compression = CompressionFactory::CreateCompression(header->compression, CompressionMode::Compress);
				if (compression != NULL)
				{
					//Create the encryption instance
					EncryptionStrategy* encryption = EncryptionFactory::CreateEncryption(header->cipher, EncryptionMode::Encrypt);
					if (encryption != NULL)
					{
						//Attempt to open the output file
						MeteredOfstream outfile(config.outfilePath);
						if (outfile.is_open())
						{
							//Generate the checksum of the input file
							string checksum = ChecksumUtility::GenerateFileChecksum(infile);
							clog << "Input file checksum: " << hex(checksum.data(), checksum.length()) << endl;

							//Write the incomplete header as a placeholder
							header->WriteHeader(outfile);

							//Reset the output file's write count
							outfile.ResetWriteCount();

							//Encrypt the file
							encryption->TransformFile(compression, infile, outfile, config.key, checksum);

							//Fill in the payload size in the header
							header->payloadSize = outfile.WriteCount();

							//Seek back to the beginning and write the completed header
							outfile.seekp(0);
							header->WriteHeader(outfile);

							clog << "Done!" << endl;

							//Close the output file
							outfile.close();
						}
						else {
							clog << "Error: could not open output file!" << endl;
							errorOcurred = true;
						}

						//Free the encryption instance
						delete encryption;
					}
					else {
						clog << "Error: unsupported encryption algorithm (" << header->cipher << ")!" << endl;
						errorOcurred = true;
					}

					//Free the compression instance
					delete compression;
				}
				else {
					clog << "Error: unsupported compression mode (" << header->compression << ")!" << endl;
					errorOcurred = true;
				}
			}
			else {
				clog << "Error: invalid EFC header!" << endl;
				errorOcurred = true;
			}

			//Close the input file
			infile.close();
		}
		else {
			clog << "Error: could not open input file (" << config.infilePath << ")!" << endl;
			errorOcurred = true;
		}
	}
	else
	{
		//No arguments were supplied
		clog << "No arguments supplied." << endl << "Use \"efcencode --help\" for usage syntax." << endl;
	}

	//All done!
	return (errorOcurred == true);
}


text:
package com.android.util.protocol.TUDP;
public class UIObserver implements IPacketObserver
{
    @Override
    public void onReceived(InPacket packet)
    {
    }
    @Override
    public void onTimeout(OutPacket packet)
    {

    }
}


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

namespace DrdPlus\Tests\Codes\Theurgist;

class DemonBodyCodeTest extends AbstractTheurgistCodeTest
{
    protected function getValuesSameInCzechAndEnglish(): array
    {
        return ['amulet'];
    }

}


text:
@interface TechnologyTableViewCell ()

@property (strong, nonatomic) IBOutlet UIImageView *imgView;
@property (strong, nonatomic) IBOutlet UILabel *titleLabel;
@property (strong, nonatomic) IBOutlet UILabel *timeLabel;
@property (strong, nonatomic) IBOutlet UILabel *replyLabel;

@end

@implementation TechnologyTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setTechnology:(Technology *)technology{
    _technology = technology;
    _titleLabel.text = technology.title;
    _timeLabel.text = technology.time;
    _replyLabel.text = [NSString stringWithFormat:@"%ld评论", technology.replycount];
    [_imgView sd_setImageWithURL:[NSURL URLWithString:technology.smallpic] placeholderImage:[UIImage imageNamed:@"3"]];
}

@end


text:
package be.objectify.deadbolt.scala.test.controllers

import play.api.test.WithServer

abstract class AbstractRestrictSpec extends AbstractControllerSpec {

  "The application" should {
    "when the foo AND bar roles are required" >> {
      "deny access if no subject is present" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooAndBar").get()).status must equalTo(UNAUTHORIZED)
      }

      "allow access if the subject has the foo and bar roles" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooAndBar").addHttpHeaders(("x-deadbolt-test-user", "greet")).get()).status must equalTo(OK)
      }

      "deny access if the subject has the foo but not the bar roles" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooAndBar").addHttpHeaders(("x-deadbolt-test-user", "trippel")).get()).status must equalTo(UNAUTHORIZED)
      }

      "deny access if the subject has the bar but not the foo roles" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooAndBar").addHttpHeaders(("x-deadbolt-test-user", "steve")).get()).status must equalTo(UNAUTHORIZED)
      }
    }

    "when the foo OR bar roles are required" >> {
      "deny access if no subject is present" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooOrBar").get()).status must equalTo(UNAUTHORIZED)
      }

      "allow access if the subject has the foo and bar roles" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooOrBar").addHttpHeaders(("x-deadbolt-test-user", "greet")).get()).status must equalTo(OK)
      }

      "allow access if the subject has the foo but not the bar roles" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooOrBar").addHttpHeaders(("x-deadbolt-test-user", "trippel")).get()).status must equalTo(OK)
      }

      "allow access if the subject has the bar but not the foo roles" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooOrBar").addHttpHeaders(("x-deadbolt-test-user", "steve")).get()).status must equalTo(OK)
      }

      "deny access if the subject has neither the bar or foo roles" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooOrBar").addHttpHeaders(("x-deadbolt-test-user", "lotte")).get()).status must equalTo(UNAUTHORIZED)
      }
    }

    "when the foo AND NOT the bar roles are required" >> {
      "deny access if no subject is present" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooAndNotBar").get()).status must equalTo(UNAUTHORIZED)
      }

      "deny access if the subject has the foo and bar roles" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooAndNotBar").addHttpHeaders(("x-deadbolt-test-user", "greet")).get()).status must equalTo(UNAUTHORIZED)
      }

      "allow access if the subject has the foo but not the bar roles" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooAndNotBar").addHttpHeaders(("x-deadbolt-test-user", "trippel")).get()).status must equalTo(OK)
      }

      "deny access if the subject has the bar but not the foo roles" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooAndNotBar").addHttpHeaders(("x-deadbolt-test-user", "steve")).get()).status must equalTo(UNAUTHORIZED)
      }

      "deny access if the subject has neither the bar or foo roles" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooAndNotBar").addHttpHeaders(("x-deadbolt-test-user", "lotte")).get()).status must equalTo(UNAUTHORIZED)
      }
    }

    "when the foo OR NOT the bar roles are required" >> {
      "deny access if no subject is present" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooOrNotBar").get()).status must equalTo(UNAUTHORIZED)
      }

      "allow access if the subject has the foo and bar roles" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooOrNotBar").addHttpHeaders(("x-deadbolt-test-user", "greet")).get()).status must equalTo(OK)
      }

      "allow access if the subject has the foo but not the bar roles" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooOrNotBar").addHttpHeaders(("x-deadbolt-test-user", "trippel")).get()).status must equalTo(OK)
      }

      "deny access if the subject only has the bar role" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooOrNotBar").addHttpHeaders(("x-deadbolt-test-user", "steve")).get()).status must equalTo(UNAUTHORIZED)
      }

      "allow access if the subject has neither the bar or foo roles" in new WithServer(app = testApp, port = 3333) {
        await(ws(implicitApp).url(s"http://localhost:3333/$pathSegment/restrict/fooOrNotBar").addHttpHeaders(("x-deadbolt-test-user", "lotte")).get()).status must equalTo(OK)
      }
    }
  }
}


text:
<!DOCTYPE html>

        <link rel="stylesheet" href="css/reveal.css">
        <link rel="stylesheet" href="css/theme/simple.css">
        <link rel="stylesheet" href="css/TimeCircles.css">

Instructions

Make a Google Sheet with Column Names of "Duration", "Title","Notes", "Owner".

Click File, then Publish to Web (sample)

Click Publish, and paste the URL in the Box Below

Have a Well Run Meeting

        <input type="text" placeholder="Google Sheets URL" id="spreadsheet_url" name="url"><button onClick="init()">Start Presentation</button>

Welcome


text:
{{extend 'plugin_wiki/layout.html'}}

{{=form}}

  Cancel


text:
package gh2011b.events

import gh2011.events.GH2011EventBody
import gh2011b.models._
import net.liftweb.json.JsonAST.JValue

abstract class EventParser[E, P](val name: String)
{
   def parsePayload(json: JValue): Option[P]
   def make(event: GH2011EventBody, payload: P): GH2011bEvent
}

object PushEventParser extends EventParser[PushEvent, PushEventPayload]("PushEvent")
{
   override def parsePayload(json: JValue): Option[PushEventPayload] = PushEventPayload(json)

   override def make(event: GH2011EventBody, payload: PushEventPayload): PushEvent = PushEvent(event, payload)
}

object WatchEventParser extends EventParser[WatchEvent, WatchEventPayload]("WatchEvent")
{
   override def parsePayload(json: JValue): Option[WatchEventPayload] = WatchEventPayload(json)

   override def make(event: GH2011EventBody, payload: WatchEventPayload): GH2011bEvent = WatchEvent(event, payload)
}

object CreateEventParser extends EventParser[CreateEvent, CreateEventPayload]("CreateEvent")
{
   override def parsePayload(json: JValue): Option[CreateEventPayload] = CreateEventPayload(json)

   override def make(event: GH2011EventBody, payload: CreateEventPayload): GH2011bEvent = CreateEvent(event, payload)
}

object IssuesEventParser extends EventParser[IssueEvent, IssuesEventPayload]("IssuesEvent")
{
   override def parsePayload(json: JValue): Option[IssuesEventPayload] = IssuesEventPayload(json)

   override def make(event: GH2011EventBody, payload: IssuesEventPayload): GH2011bEvent = IssueEvent(event, payload)
}

object ForkEventParser extends EventParser[ForkEvent, ForkEventPayload]("ForkEvent")
{
   override def parsePayload(json: JValue): Option[ForkEventPayload] = ForkEventPayload(json)

   override def make(event: GH2011EventBody, payload: ForkEventPayload): GH2011bEvent = ForkEvent(event, payload)
}

object PublicEventParser extends EventParser[PublicEvent, PublicEventPayload]("PublicEvent")
{
   override def parsePayload(json: JValue): Option[PublicEventPayload] = PublicEventPayload(json)

   override def make(event: GH2011EventBody, payload: PublicEventPayload): GH2011bEvent = PublicEvent(event, payload)
}

object PullRequestEventParser extends EventParser[PullRequestEvent, PullRequestEventPayload]("PullRequestEvent")
{
   override def parsePayload(json: JValue): Option[PullRequestEventPayload] = PullRequestEventPayload(json)

   override def make(event: GH2011EventBody, payload: PullRequestEventPayload): GH2011bEvent = PullRequestEvent(event, payload)
}

object DeleteEventParser extends EventParser[DeleteEvent, DeleteEventPayload]("DeleteEvent")
{
   override def parsePayload(json: JValue): Option[DeleteEventPayload] = DeleteEventPayload(json)

   override def make(event: GH2011EventBody, payload: DeleteEventPayload): GH2011bEvent = DeleteEvent(event, payload)
}

object GistEventParser extends EventParser[GistEvent, GistEventPayload]("GistEvent")
{
   override def parsePayload(json: JValue): Option[GistEventPayload] = GistEventPayload(json)

   override def make(event: GH2011EventBody, payload: GistEventPayload): GH2011bEvent = GistEvent(event, payload)
}

object FollowEventParser extends EventParser[FollowEvent, FollowEventPayload]("FollowEvent")
{
   override def parsePayload(json: JValue): Option[FollowEventPayload] = FollowEventPayload(json)

   override def make(event: GH2011EventBody, payload: FollowEventPayload): GH2011bEvent = FollowEvent(event, payload)
}

object GollumEventParser extends EventParser[GollumEvent, GollumEventPayload]("GollumEvent")
{
   override def parsePayload(json: JValue): Option[GollumEventPayload] = GollumEventPayload(json)

   override def make(event: GH2011EventBody, payload: GollumEventPayload): GH2011bEvent = GollumEvent(event, payload)
}

object MultiGollumEventParser extends EventParser[MultiGollumEvent, MultiGollumEventPayload]("GollumEvent")
{
   override def parsePayload(json: JValue): Option[MultiGollumEventPayload] = MultiGollumEventPayload(json)

   override def make(event: GH2011EventBody, payload: MultiGollumEventPayload): GH2011bEvent = MultiGollumEvent(event, payload)
}

object CommitCommentEventParser extends EventParser[CommitCommentEvent, CommitCommentEventPayload]("CommitCommentEvent")
{
   override def parsePayload(json: JValue): Option[CommitCommentEventPayload] = CommitCommentEventPayload(json)

   override def make(event: GH2011EventBody, payload: CommitCommentEventPayload): GH2011bEvent = CommitCommentEvent(event, payload)
}

object MemberEventParser extends EventParser[MemberEvent, MemberEventPayload]("MemberEvent")
{
   override def parsePayload(json: JValue): Option[MemberEventPayload] = MemberEventPayload(json)

   override def make(event: GH2011EventBody, payload: MemberEventPayload): GH2011bEvent = MemberEvent(event, payload)
}

object DownloadEventParser extends EventParser[DownloadEvent, DownloadEventPayload]("DownloadEvent")
{
   override def parsePayload(json: JValue): Option[DownloadEventPayload] = DownloadEventPayload(json)

   override def make(event: GH2011EventBody, payload: DownloadEventPayload): GH2011bEvent = DownloadEvent(event, payload)
}

object ForkApplyEventParser extends EventParser[ForkApplyEvent, ForkApplyEventPayload]("ForkApplyEvent")
{
   override def parsePayload(json: JValue): Option[ForkApplyEventPayload] = ForkApplyEventPayload(json)

   override def make(event: GH2011EventBody, payload: ForkApplyEventPayload): GH2011bEvent = ForkApplyEvent(event, payload)
}

object IssueCommentEventParser extends EventParser[IssueCommentEvent, IssueCommentEventPayload]("IssueCommentEvent")
{
   override def parsePayload(json: JValue): Option[IssueCommentEventPayload] = IssueCommentEventPayload(json)

   override def make(event: GH2011EventBody, payload: IssueCommentEventPayload): GH2011bEvent = IssueCommentEvent(event, payload)
}


text:
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

exports.main = 42;
require("./subdir/subfile");
require("sdk/self"); // trigger inclusion of our data/ directory