text:
/*package com.googlecode.rockit.app.solver.aggregate.frequentItemset;

import java.util.HashMap;

import com.googlecode.rockit.app.solver.aggregate.*;
import com.googlecode.rockit.app.solver.aggregate.simple.AggragationManagerSimpleImpl;
import com.googlecode.rockit.app.solver.pojo.Clause;
import com.googlecode.rockit.conn.ilpSolver.GurobiConnector;
import com.googlecode.rockit.exception.ILPException;
import com.googlecode.rockit.exception.SolveException;
import com.googlecode.rockit.javaAPI.formulas.FormulaSoft;

public class AggregationManagerFrequentItemsetImpl implements AggregationManager{

	private HashMap<Integer, AggregationManager> aggregationForLength = new HashMap<Integer, AggregationManager>();

	public AggregationManagerFrequentItemsetImpl(FormulaSoft formula){
		aggregationForLength.put(1, new AggragationManagerSimpleImpl());
		if(formula.getRestrictions().size()>1){
			for(int i=2;i<=formula.getRestrictions().size();i++){
				aggregationForLength.put(i, new AggregationFrequentItemsetForSpecificSize(i, formula));
			}
		}
	}

	@Override
	public void resetAggregatedSoftFormulas() {
		aggregationForLength = new HashMap<Integer, AggregationManager>();
	}

	@Override
	public void addClauseForAggregation(Clause clause, FormulaSoft formula) {
		int size = clause.getRestriction().size();
		if(size>0) aggregationForLength.get(size).addClauseForAggregation(clause, formula);
	}

	@Override
	public void addConstraintsToILP(GurobiConnector connector)
			throws ILPException, SolveException {
		for(AggregationManager m : this.aggregationForLength.values()){
			m.addConstraintsToILP(connector);
		}

	}

	@Override
	public void addOrUpdateGurobiVariables(GurobiConnector con)
			throws ILPException {
		for(AggregationManager m : this.aggregationForLength.values()){
			m.addOrUpdateGurobiVariables(con);
		}

	}

	@Override
	public int getNumberOfAggregatedClauses() {
		int number = 0;

		for(AggregationManager m : this.aggregationForLength.values()){
			number = number + m.getNumberOfAggregatedClauses();
		}
		return number;
	}

	@Override
	public void calculateAggregation() {
		for(AggregationManager m : this.aggregationForLength.values()){
			m.calculateAggregation();
		}
	}

}*/

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace XM\SecurityBundle\Controller;

use FOS\UserBundle\Controller\SecurityController as BaseSecurityController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Http\Util\TargetPathTrait;

class SecurityController extends BaseSecurityController
{
    use TargetPathTrait;

    /**
     * The target path, used during the login and passed to the login view.
     * @var string
     */
    protected $targetPath;

    /**
     * {@inheritdoc}
     */
    public function loginAction(Request $request)
    {
        if ($this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) {
            $token = $this->get('security.token_storage')->getToken();
            $handler = $this->get('xm_security.auth.authentication_success_handler');
            // so they aren't just taken back to the page they were just on
            // most important when coming from the password reset
            $handler->setOptions(['use_referer' => false]);
            $response = $handler->onAuthenticationSuccess($request, $token);

            return $response;
        }

        $this->pullUsernameFromQuery($request);
        $this->pullTargetPathFromQuery($request);

        if ($this->targetPath) {
            $this->saveTargetPath(
                $request->getSession(),
                'main',
                $this->targetPath
            );
        }

        return parent::loginAction($request);
    }

    /**
     * {@inheritdoc}
     */
    protected function renderLogin(array $data)
    {
        if ($this->targetPath) {
            $data['target_path'] = $this->targetPath;
        }

        $data['registration_is_enabled'] = $this->isRegistrationEnabled();

        return parent::renderLogin($data);
    }

    /**
     * Populates the last username in the session based on
     * the query param "username".
     *
     * @param Request $request
     */
    protected function pullUsernameFromQuery(Request $request)
    {
        $queryUsername = $request->query->get('username');

        if ($queryUsername) {
            if (strlen($queryUsername) <= Security::MAX_USERNAME_LENGTH) {
                $request->getSession()
                    ->set(Security::LAST_USERNAME, $queryUsername);
            }
        }
    }

    /**
     * Populates the target path/URL property based on the request query param.
     *
     * @param Request $request
     */
    protected function pullTargetPathFromQuery(Request $request)
    {
        $targetPath = $request->query->get('target_path');
        if (!$targetPath) {
            $targetPath = $request->query->get('_target_path');
        }

        if ($targetPath) {
            $this->targetPath = $targetPath;
        }
    }

    /**
     * Returns true when registration is enabled.
     *
     * @return bool
     */
    protected function isRegistrationEnabled()
    {
        $router = $this->container->get('router');

        if (get_class($router) == 'JMS\I18nRoutingBundle\Router\I18nRouter') {
            $routes = $router->getOriginalRouteCollection();
        } else {
            $routes = $router->getRouteCollection();
        }

        return (null !== $routes->get('fos_user_registration_register'));
    }
}


text:
var chalk = require("chalk");
var _ = require("lodash");

_.templateSettings.interpolate = /{:([\s\S]+?):}/g

var compile = function (template, params, prefix) {

    /**
     * @param string
     * @returns {String}
     */
    var modifier = function (string) {

        var split = /{(.+?[^:]):(.+?)(?:})/.exec(string);

        var color = split[1];
        var content = split[2];

        return chalk[color](content);
    };

    /**
     * @param string
     * @returns {String}
     */
    var replacer = function (string) {
        return modifier(string);
    };

    if (params) {
        template = _.template(template)(params);
    }

    if (prefix) {
        template = [prefix, template].join(" ");
    }

    return template.replace(/({.+?[^:]:)(.+?)(?:})/g, replacer);
};

module.exports.compile = compile;

/**
 * Alternative way to retrieve the compiler, this time with a prefix
 * @param {String} prefix
 * @returns {Function}
 */
module.exports.getCompiler = function (prefix) {
    return function (template, params) {

        var output = [];

        if (Array.isArray(template)) {

            template.forEach(function (item) {
                output.push(compile(item, params, prefix));
            });

            return output.join("\n");
        }

        return compile(template, params, prefix);
    };
};

module.exports.clc = chalk;
module.exports.chalk = chalk;


text:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.samples" xmlns:xsd="http://services.samples/xsd">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:getQuote>
         <!--Optional:-->
         <ser:request>
            <!--Optional:-->
            <xsd:symbol>WSO2</xsd:symbol>
         </ser:request>
      </ser:getQuote>
   </soapenv:Body>
</soapenv:Envelope>


text:
import datafile

class Directory(object):
    def __init__(self, os, path, filetypes):
        self.os = os
        self.path = path
        self.filetypes = filetypes

    def get_oldest_file(self):
        files = self.os.listdir(self.path)
        dataFiles = []
        for file in files:
            for filetype in self.filetypes:
                if file.lower().endswith(filetype.lower()):
                    imageFile = datafile.Datafile(self.path + file, self.os.path.getctime(self.path + file))
                    dataFiles.append(imageFile)

        dataFiles = sorted(dataFiles, key=lambda datafile: datafile.ctime)

        if len(dataFiles) == 0:
            raise IOError('Klopfer says: no new file to import')

        return dataFiles[0]


text:
angular.module('platen.services').factory('logger', function() {

  var MAX_QUEUE_SIZE = 100;
  var offset = 0;
  var log = [];

  return {
    log: function(message, location) {
      var entry = {
        message: message,
        location: location,
        date: new Date()
      };

      if (log.length > MAX_QUEUE_SIZE) {
        console.log("removing log item");
        var item = log[offset];
        if (++offset * 2 >= log.length) {
          log = log.slice(offset);
          offset = 0;
        }
      }

      log.push(entry);

      console.log(message + ', from ' + location + ' at ' + entry.date);
    },

    getLogs: function() {
      return log.reverse();
    }
  };
});


text:
package foo.bar;

import com.github.rocksteady.builder2.Buildable;

public class SomeInner {

    @Buildable
    public class Inner {

    }
}


text:
<?xml version="1.0"?>
<adios-config>

    <io name="PluginTest">
        <engine type="plugin">
            <!-- general plugin engine parameters -->
            <parameter key="PluginName" value="fides"/>
            <parameter key="PluginLibrary" value="ParaViewADIOSInSituEngine"/>
            <!-- ParaViewFides engine parameters -->
            <parameter key="DataModel" value="cartesian.json"/>
            <parameter key="Script" value="pipeline.py"/>
        </engine>
    </io>

</adios-config>


text:
namespace factor
{

#define BIGNUM_OUT_OF_BAND ((bignum *) 0)

enum bignum_comparison
{
  bignum_comparison_equal = 0,
  bignum_comparison_less = -1,
  bignum_comparison_greater = 1
};

}


text:
exports.notFound = function(req, res) {
  var viewFilePath = '404',
    statusCode = 404,
    result = {
      status: statusCode
    };

  res.status(result.status);
  res.render(viewFilePath, function(err) {
    if (err) {
      return res.json(result, result.status);
    }
    res.render(viewFilePath);
  });
};


text:
using System;
using System.Collections.Generic;
using System.Text;
using Core.Basic;
using Core.CodeGeneration.Code;
using Core.CodeGeneration;
using Core.Main;

namespace Core.Blocks.Math.Operators
{
    [Block(Name = "Mul", Path = "Math/Operators")]
    public class Mul : BaseBlock
    {
        public Mul(BlockManager owner)
            : base(owner, null)
        {
            AddInput(new BlockInput(this, "Input0"));
            AddInput(new BlockInput(this, "Input1"));
            AddOutput(new BlockOutput(this, Format.FLOAT4, "Output"));
            RaiseDataChanged();
        }
        protected override void DataChanged()
        {
            if (Inputs.Count == 2 && Outputs.Count == 1)
            {
                Expression e0, e1;
                Outputs[0].Format = InstructionHelper.BinaryOperatorVectorSecondFloatExpressions(Inputs[0], Inputs[1], out e0, out e1);
            }
            base.DataChanged();
        }

        protected internal override void GenerateCode(ShaderCodeGenerator sc)
        {
            sc.AddInstruction(InstructionHelper.BinaryOperatorVectorSecondFloat(BinaryExpression.Operators.Mul, Outputs[0].Variable, Inputs[0], Inputs[1]));
        }
    }
}


text:
import re
import calendar
import xml

from datetime import datetime
from suds.sax.text import Text as sudTypeText # for the 'parse_soap()' string type

from paython.exceptions import GatewayError

CARD_TYPES = {
    'visa': r'4\d{12}(\d{3})?$',
    'amex': r'37\d{13}$',
    'mc': r'5[1-5]\d{14}$',
    'discover': r'6011\d{12}',
    'diners': r'(30[0-5]\d{11}|(36|38)\d{12})$'
}

def parse_xml(element):
    """
    Parse an XML API Response xml.dom.minidom.Document. Returns the result as dict or string
    depending on amount of child elements. Returns None in case of empty elements
    """
    if not isinstance(element, xml.dom.minidom.Node):
        try:
            element = xml.dom.minidom.parseString(element)
        except xml.parsers.expat.ExpatError as e:
            raise GatewayError("Error parsing XML: {0}".format(e))

    # return DOM element with single text element as string
    if len(element.childNodes) == 1:
        child = element.childNodes[0]
        if child.nodeName == '#text':
            return child.nodeValue.strip()

    # parse the child elements and return as dict
    root = {}

    for e in element.childNodes:
        t = {}

        if e.nodeName == '#text':
            if not e.nodeValue.strip(): continue

        if e.attributes:
            t['attribute'] = {}
            for attribute in e.attributes.values():
                t['attribute'][attribute.nodeName] = attribute.childNodes[0].nodeValue

        if e.childNodes:
            if t.has_key('attribute'):
                t['meta'] = parse_xml(e)
            else:
                if len(e.childNodes) == 1:
                    if e.firstChild.nodeType == xml.dom.Node.CDATA_SECTION_NODE:
                        t = e.firstChild.wholeText
                    else:
                        t = parse_xml(e)
                else:
                    t = parse_xml(e)

        if not t:
            t = e.nodeValue

        if root.has_key(e.nodeName):
            if not isinstance(root[e.nodeName], list):
                tmp = []
                tmp.append(root[e.nodeName])
            tmp.append(t)
            t = tmp

        root[e.nodeName] = t

    return root

def is_valid_cc(cc):
    """
    Uses Luhn Algorithm for credit card number validation. http://en.wikipedia.org/wiki/Luhn_algorithm
    """
    try:
        num = map(int, cc)
    except ValueError:
        return False
    else:
        return not sum(num[::-2] + map(lambda d: sum(divmod(d * 2, 10)), num[-2::-2])) % 10

def is_valid_exp(month, year):
    """
    Uses datetime to compare string of card expiration to the time right now
    """
    month = int(month)
    year = int(year)

    exp_date_obj = datetime(year, month, calendar.monthrange(year, month)[1], 23, 59, 59, 59)
    return datetime.now() < exp_date_obj

def is_valid_cvv(cc_cvv):
    """
    Simple regex for card validator length & type.
    """
    return re.match(r'^[\d+]{3,4}$', cc_cvv)

def get_card_type(cc):
    """
    Gets card type by using card number
    """
    for k, v in CARD_TYPES.items():
        if re.match(v, cc):
            return k

def get_card_exp(month, year):
    """
    Gets the expiration date by concatenating strings
    """
    return "{0}/{1}".format(month, year)

def is_valid_email(email):
    """
    Based on "The Perfect E-Mail Regex" : http://fightingforalostcause.net/misc/2006/compare-email-regex.php
    """
    pat = '^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$'
    return re.search(pat, email, re.IGNORECASE)

def transform_keys():
    raise NotImplemented


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>

<body bgcolor="white">

This package contains codecs for application layer encoding/escaping schemes that can be used for
both canonicalization and output encoding. By using the codecs to decode (canonicalize) input
before validation, many attacks can be detected and handled.  By using the codecs to encode
untrusted data before sending it to an interpreter, a wide variety of 'injection' attacks can
be stopped. However,
this package does not currently address issues related to converting between byte-streams and
internal character representations, such as overlong UTF-8 issues. Those are left to the platform.
The codecs cover protocol encodings such as HTML entity encoding and percent encoding, but also
common product escaping schemes, such as Unix, Windows, MySQL, and Oracle.

</body>
</html>


text:
class Fluentd::Settings::InMonitorAgentController < ApplicationController
  include SettingConcern
  before_action :set_agents_tab

  private

  def target_class
    Fluentd::Setting::InMonitorAgent
  end
end


text:
/* eslint-disable no-console */
const Sentry = require('@sentry/gatsby');

exports.onClientEntry = function (_, pluginParams) {
  const isIntialized = isSentryInitialized();
  const areOptionsDefined = areSentryOptionsDefined(pluginParams);

  if (isIntialized) {
    window.Sentry = Sentry; // For backwards compatibility
    if (areOptionsDefined) {
      console.warn(
        'Sentry Logger [Warn]: The SDK was initialized in the Sentry config file, but options were found in the Gatsby config. ' +
          'These have been ignored, merge them to the Sentry config if you want to use them.\n' +
          'Learn more about the Gatsby SDK on https://docs.sentry.io/platforms/javascript/guides/gatsby/',
      );
    }
    return;
  }

  if (!areOptionsDefined) {
    console.error(
      'Sentry Logger [Error]: No config for the Gatsby SDK was found.\n' +
        'Learn how to configure it on https://docs.sentry.io/platforms/javascript/guides/gatsby/',
    );
    return;
  }

  Sentry.init({
    // eslint-disable-next-line no-undef
    release: __SENTRY_RELEASE__,
    // eslint-disable-next-line no-undef
    dsn: __SENTRY_DSN__,
    ...pluginParams,
  });
  window.Sentry = Sentry; // For backwards compatibility
};

function isSentryInitialized() {
  // Although `window` should exist because we're in the browser (where this script
  // is run), and `__SENTRY__.hub` is created when importing the Gatsby SDK, double
  // check that in case something weird happens.
  return !!(window && window.__SENTRY__ && window.__SENTRY__.hub && window.__SENTRY__.hub.getClient());
}

function areSentryOptionsDefined(params) {
  if (params == undefined) return false;
  // Even if there aren't any options, there's a `plugins` property defined as an empty array
  if (Object.keys(params).length == 1 && Array.isArray(params.plugins) && params.plugins.length == 0) {
    return false;
  }
  return true;
}


text:
using System;
using Basics.Algorithms.Sorts;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Basics.Algorithms.Tests
{
    [TestClass]
    public class SortExtensionsTests
    {
        [TestMethod]
        public void Int_TestIsSorted()
        {
            var array = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            Assert.IsTrue(array.IsSorted());
        }

        [TestMethod]
        public void Int_TestIsNotSorted()
        {
            var array = new int[] { 0, 3, 9, 1, 4, 5, 2, 7, 8, 6 };
            Assert.IsFalse(array.IsSorted());
        }

        [TestMethod]
        public void Int_TestRangeIsSorted()
        {
            var array = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            Assert.IsTrue(array.IsSorted(5, 9));
        }

        [TestMethod]
        public void Int_TestRangeIsNotSorted()
        {
            var array = new int[] { 0, 3, 9, 1, 4, 5, 2, 7, 8, 6 };
            Assert.IsFalse(array.IsSorted(5, 9));
        }

        [TestMethod]
        public void Double_TestIsSorted()
        {
            var array = new double[] { 0, 1.0, 2.1, 3.3, 4, 5, 6, 7, 8, 9 };
            Assert.IsTrue(array.IsSorted());
        }

        [TestMethod]
        public void Double_TestIsNotSorted()
        {
            var array = new double[] { 0, 3, 9.1, 1, 4.5, 5, 2.8, 7, 8, 6 };
            Assert.IsFalse(array.IsSorted());
        }

        [TestMethod]
        public void String_TestIsSorted()
        {
            var array = new string[] { "a", "b", "c", "d", "e", "f", "g" };
            Assert.IsTrue(array.IsSorted());
        }

        [TestMethod]
        public void String_TestIsNotSorted()
        {
            var array = new string[] { "f", "b", "g", "d", "e", "a", "c" };
            Assert.IsFalse(array.IsSorted());
        }

        private class GenericComparableData : IComparable<GenericComparableData>
        {
            private int _value;

            public GenericComparableData(int value)
            {
                _value = value;
            }

            public int CompareTo(GenericComparableData other)
            {
                return _value.CompareTo(other._value);
            }
        }

        [TestMethod]
        public void GenericComparable_TestIsSorted()
        {
            var array = new GenericComparableData[]
            {
                new GenericComparableData(0),
                new GenericComparableData(1),
                new GenericComparableData(2),
                new GenericComparableData(3)
            };
            Assert.IsTrue(array.IsSorted());
        }

        [TestMethod]
        public void GenericComparable_TestIsNotSorted()
        {
            var array = new GenericComparableData[]
            {
                new GenericComparableData(0),
                new GenericComparableData(3),
                new GenericComparableData(2),
                new GenericComparableData(1)
            };
            Assert.IsFalse(array.IsSorted());
        }
    }
}


text:
<?php

use LaravelEnso\StructureManager\app\Classes\StructureMigration;

class CreateStructureForSystem extends StructureMigration
{
    protected $menu = [
        'name' => 'System', 'icon' => 'sliders-h', 'route' => null, 'order_index' => 600, 'has_children' => true,
    ];
}


text:
<?xml version="1.0" encoding="utf-16"?>

<RevertDialogText xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <CannotRevertTitle>Kan ikke vende tilbage</CannotRevertTitle>
  <CannotRevertText>På grund af LMP -begrænsninger kan du ikke vende tilbage efter at have skiftet til et andet fartøj eller mens du ser på. Se wikien for flere detaljer</CannotRevertText>
  <CloseBtn>Luk</CloseBtn>
</RevertDialogText>


text: {{text}}


text:
(function(angular){

  window.ngLoupeApp = angular.module('ngLoupeApp', ["ngLoupeField"]);

}(angular));


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 io.trino.server.security.oauth2;

import static java.util.Objects.requireNonNull;

public enum TokenEndpointAuthMethod
{
    CLIENT_SECRET_POST("client_secret_post"),
    CLIENT_SECRET_BASIC("client_secret_basic"),
    PRIVATE_KEY_JWT("private_key_jwt"),
    NONE("none");

    private final String value;

    TokenEndpointAuthMethod(String value)
    {
        this.value = requireNonNull(value, "value is null");
    }

    public String getValue()
    {
        return value;
    }
}


text:
// Copyright (c) 2008-2022, Hazelcast, Inc. All Rights Reserved.
//
// 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.

using System;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;

namespace Hazelcast.Benchmarks
{
    // the purpose of this benchmark is to determine whether it is cheaper to async/await
    // and then dispose a disposable, or elide the async/await (and avoid the cost of the
    // associated state machine) and dispose in a continuation.
    //
    // results:
    //
    //  |             Method |     Mean |     Error |    StdDev |  Gen 0 | Gen 1 | Gen 2 | Allocated |
    //  |------------------- |---------:|----------:|----------:|-------:|------:|------:|----------:|
    //  |       WithAwaiting | 1.884 us | 0.0148 us | 0.0138 us | 0.0896 |     - |     - |     383 B |
    //  |   WithContinuation | 2.105 us | 0.0386 us | 0.0361 us | 0.1259 |     - |     - |     530 B |
    //
    // conclusion:
    //
    // is is cheaper to pay for the async/await state machine that to use a continuation.

    public class DisposeWithAsyncAwaitOrContinuation
    {
        [Benchmark]
        public async Task WithAwaiting()
        {
            await RunAwaiting();
        }

        [Benchmark]
        public async Task WithContinuation()
        {
            await RunContinuation();
        }

        public async Task RunAwaiting()
        {
            // await the Whatever method, and *then* dispose the disposable
            // so we pay for the async/await state machine, but not for the continuation
            using var disposable = new SomeDisposable();
            await Whatever();
        }

        public Task RunContinuation()
        {
            // return the Whatever() task without awaiting, with a continuation
            // which will dispose the disposable once the task has completed,
            // so we pay for the continuation, but not for the async/await state machine
            var disposable = new SomeDisposable();
            return ThenDispose(Whatever(), disposable);

            // could be this with an extension method
            //return Whatever().ThenDispose(disposable);
        }

        public async Task Whatever()
        {
            await Task.Yield();
        }

        /// <summary>
        /// Configures a task to dispose a resource after it completes.
        /// </summary>
        /// <param name="task">The task.</param>
        /// <param name="disposable">The disposable resource.</param>
        /// <returns>A task.</returns>
        public static Task ThenDispose(Task task, IDisposable disposable)
        {
            if (task == null) throw new ArgumentNullException(nameof(task));
            return task.ContinueWith(x =>
            {
                disposable.Dispose();
                return x;
            }, default, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Current).Unwrap();
        }

        public class SomeDisposable : IDisposable
        {
            public void Dispose()
            { }
        }
    }
}


text:
@interface ListViewController ()
    <UITableViewDelegate, UITableViewDataSource, MJRefreshBaseViewDelegate, HttpManagerDelegate>

@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *dataArray;

@property (nonatomic, strong) MJRefreshHeaderView *headerView;
@property (nonatomic, assign) BOOL isLoading;

@end

@implementation ListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];

    if(_type == CategoryList){
        [self addNav:_navTitle bgImage:nil type:LongLength rightBtn:nil withLength:0];
    }else if(_type == SearchList){
        [self addNav:[NSString stringWithFormat:@"\"%@\"搜索结果", _navTitle] bgImage:nil type:LongLength rightBtn:nil withLength:0];
    }

    _dataArray = [NSMutableArray array];
    _isLoading = NO;

    [self createTableView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)createTableView{
    self.automaticallyAdjustsScrollViewInsets = NO;

    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 64, ScreenWidth, ScreenHeight-64) style:UITableViewStylePlain];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.backgroundColor = [UIColor clearColor];
    [_tableView registerClass:[CategoryDetailCell class] forCellReuseIdentifier:@"CategoryDetailCellId"];
    [self.view addSubview:_tableView];

    _headerView = [MJRefreshHeaderView header];
    _headerView.delegate = self;
    _headerView.scrollView = _tableView;

    [_headerView beginRefreshing];
}

- (void)downloadData{
    _isLoading = YES;

    HttpManager *manager = [[HttpManager alloc] init];
    manager.delegate = self;
    if(_type == CategoryList){
        [manager requestGet:[NSString stringWithFormat:lListByCategoryUrl, _catId]];
    }else if(_type == SearchList){
        NSString *urlString = [NSString stringWithFormat:lSearchUrl, _navTitle];
        [manager requestGet:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
    }
}

#pragma mark - HttpManagerDelegate
- (void)failure:(AFHTTPRequestOperation *)operation response:(NSError *)error{
    NSLog(@"CategoryDetail:%@", error);
    _isLoading = NO;
    [_headerView endRefreshing];
}

- (void)success:(AFHTTPRequestOperation *)operation response:(id)responseObject{
    [_dataArray removeAllObjects];
    NSDictionary *rootDic = [NSJSONSerialization JSONObjectWithData:responseObject
                                                            options:NSJSONReadingMutableContainers
                                                              error:nil];
    if(![rootDic[@"posts"] isEqual:@""]){
        for(NSDictionary *dic in rootDic[@"posts"]){
            ExpressModel *model = [[ExpressModel alloc] init];
            [model setValuesForKeysWithDictionary:dic];
            [_dataArray addObject:model];
        }
    }

    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 40)];
    label.text = @"没有更多啦。";
    label.font = [UIFont systemFontOfSize:14];
    label.textAlignment = 1;
    _tableView.tableFooterView = label;

    [_tableView reloadData];

    _isLoading = NO;
    [_headerView endRefreshing];
}

#pragma mark - UITableViewDelegate, UITableViewDataSource
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 80;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _dataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    CategoryDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CategoryDetailCellId"];
    cell.selectionStyle = UITableViewCellSelectionStyleGray;
    cell.model = _dataArray[indexPath.row];
    return cell;
}

#pragma mark - MJRefreshBaseViewDelegate
- (void)refreshViewBeginRefreshing:(MJRefreshBaseView *)refreshView{
    if(_isLoading){
        return ;
    }

    if(refreshView == _headerView){
        [self downloadData];
    }
}

- (void)dealloc{
    [_headerView free];
}

@end


text:
'use strict';

interface IProvideRoutes {
	getRoutes(): RouteSettings.IAcklenAvenueRoute[];
}

class UserRoutes implements IProvideRoutes {
	getRoutes(): RouteSettings.IAcklenAvenueRoute[] {
		var userRoutes: RouteSettings.IAcklenAvenueRoute [] = [
			{
				state: 'users',
				config: {
					url: '/users',
					templateUrl: 'app/users/activateDeactivateUsers/users.activate-deactivate.html',
					controller: 'users.activate-deactivate.controller',
					controllerAs: 'vm',
					title: 'Users Managment',
					settings: {
						nav: 2,
						content: ' Users',
						claim: 'ActivateDeactivateUsers'
					}
				}
			},
			{
				state: 'googleLogin',
				config: {
					url: '/login',
					templateUrl: 'app/users/login/google/users.login.google.html',
					controller: 'users.login.google.controller',
					controllerAs: 'vm',
					title: 'Login',
					settings: {
						nav: 0,
						content: ' Login',
						notShowInMenu: true,
						notShowSideBar: true,
						isPublic: true
					}
				}
			},

		];

		return userRoutes;
	}
}
var appUsers: IAppUsers = angular.module('app.users');
appUsers.constant('userRoutes', new UserRoutes());
appUsers.run(['userRoutes', 'routeHelper', (userRoutes: UserRoutes, routeHelper: any) => {
	routeHelper.configureStates(userRoutes.getRoutes(), '/');
}]);


text:
technogi-angular-directives
===========================

Useful directive for Angular.js


text:
namespace content {
class ColorChooser;
class WebContents;
}  // namespace content

namespace chrome {
// Shows a color chooser that reports to the given WebContents.
content::ColorChooser* ShowColorChooser(content::WebContents* web_contents,
                                        SkColor initial_color);
}  // namespace chrome

#endif  // CHROME_BROWSER_UI_COLOR_CHOOSER_H_


text:
using System;
using System.Collections.Generic;

using Mono.Unix;

using Banshee.SmartPlaylist;
using Banshee.Collection;
using Banshee.Configuration;

namespace Banshee.Library
{
    public class VideoLibrarySource : LibrarySource
    {
        // Catalog.GetString ("Video Library")
        public VideoLibrarySource () : base (Catalog.GetString ("Videos"), "VideoLibrary", 50)
        {
            MediaTypes = TrackMediaAttributes.VideoStream;
            NotMediaTypes = TrackMediaAttributes.Podcast;
            Properties.SetStringList ("Icon.Name", "video-x-generic", "video", "source-library");
            Properties.Set<string> ("SearchEntryDescription", Catalog.GetString ("Search your videos"));
            Properties.SetString ("TrackView.ColumnControllerXml", String.Format (@"
                <column-controller>
                  <add-all-defaults />
                  <remove-default column=""DiscColumn"" />
                  <remove-default column=""AlbumColumn"" />
                  <remove-default column=""ComposerColumn"" />
                  <remove-default column=""AlbumArtistColumn"" />
                  <remove-default column=""ConductorColumn"" />
                  <remove-default column=""ComposerColumn"" />
                  <remove-default column=""BpmColumn"" />
                  <sort-column direction=""asc"">track_title</sort-column>
                  <column modify-default=""ArtistColumn"">
                    <title>{0}</title>
                    <long-title>{0}</long-title>
                  </column>
                </column-controller>
            ", Catalog.GetString ("Produced By")));

            // Migrate the old import settings, if necessary
            if (DatabaseConfigurationClient.Client.Get<int> ("VideoImportSettingsMigrated", 0) != 1) {
                bool oldImportSettings = OldImportSetting.Get ();
                CopyOnImport = oldImportSettings;
                DatabaseConfigurationClient.Client.Set<int> ("VideoImportSettingsMigrated", 1);
            }
        }

        public override string GetPluralItemCountString (int count)
        {
            return Catalog.GetPluralString ("{0} video", "{0} videos", count);
        }

        public override bool ShowBrowser {
            get { return false; }
        }

        protected override bool HasArtistAlbum {
            get { return false; }
        }

        public override string DefaultBaseDirectory {
            get { return Hyena.XdgBaseDirectorySpec.GetXdgDirectoryUnderHome ("XDG_VIDEOS_DIR", "Videos"); }
        }

        public override IEnumerable<SmartPlaylistDefinition> DefaultSmartPlaylists {
            get { return default_smart_playlists; }
        }

        public override bool HasCopyOnImport {
            get { return true; }
        }

        protected override string SectionName {
            get { return Catalog.GetString ("Videos Folder"); }
        }

        private static SmartPlaylistDefinition [] default_smart_playlists = new SmartPlaylistDefinition [] {
            new SmartPlaylistDefinition (
                Catalog.GetString ("Favorites"),
                Catalog.GetString ("Videos rated four and five stars"),
                "rating>=4"),

            new SmartPlaylistDefinition (
                Catalog.GetString ("Unwatched"),
                Catalog.GetString ("Videos that haven't been played yet"),
                "plays=0"),
        };
    }
}


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Ink.Runtime;

public class InLineScript : MonoBehaviour {
	// SerializeField: use private variable in the inspector
	[SerializeField]
	private TextAsset inkStory; // asset for ink file
	private Story story; // variable to import ink file

	[SerializeField]
	private Canvas canvas; // canvas for text/images
	private GameObject buttonPlace; // placement for button
	private GameObject dialogePlace;

	// UI Prefabs
	[SerializeField]
	private Text textPrefab;
	[SerializeField]
	private Button buttonPrefab;

	void Awake(){
		buttonPlace = GameObject.Find("Buttons");
		dialogePlace = GameObject.Find("Dialogue");
		StartCoroutine(ChangeLevel());
	}

	// Use this for initialization
	void StartStory () {
		story = new Story(inkStory.text);

		RefreshView();
	}

	void RefreshView(){
		RemoveChildren();

		while(story.canContinue){
			string text = story.Continue().Trim();
			CreateContentView(text);
		}

		if(story.currentChoices.Count>0){
			for(int i =0;i<story.currentChoices.Count;i++){
				Choice choice = story.currentChoices [i];
				Button button = CreateChoiceView (choice.text.Trim ());
				button.onClick.AddListener (delegate {
					OnClickChoiceButton (choice);
				});
			}
		}
		else {
			Button choice = CreateChoiceView("End of story.");
			choice.onClick.AddListener(delegate{
				canvas.GetComponent<Fading>().BeginFade(1);
				//canvas.GetComponent<Fading>().StartCoroutine(ChangeLevel());
				//Debug.Log("clicked");
			});
		}
	}
	void OnClickChoiceButton (Choice choice) {
		story.ChooseChoiceIndex (choice.index);
		RefreshView();
	}

	void CreateContentView (string text) {
		Text storyText = Instantiate (textPrefab) as Text;
		storyText.text = text;
		storyText.transform.SetParent (dialogePlace.transform, false);

	}

	Button CreateChoiceView (string text) {
		Button choice = Instantiate (buttonPrefab) as Button;

		choice.transform.SetParent (buttonPlace.transform, false);

		Text choiceText = choice.GetComponentInChildren<Text> ();
		choiceText.text = text;

		return choice;
	}

	void RemoveChildren () {
		// remove children of dialogePlace
		int canvasChild = dialogePlace.transform.childCount;
		for (int i = canvasChild - 1; i >= 0; --i) {
			GameObject.Destroy (dialogePlace.transform.GetChild (i).gameObject);
		}

		// remove children of buttonPlace
		int buttonChild = buttonPlace.transform.childCount;
		for (int i = buttonChild - 1; i >= 0; --i) {
			GameObject.Destroy (buttonPlace.transform.GetChild (i).gameObject);
		}
	}

	IEnumerator ChangeLevel(){
	 	yield return new WaitForSeconds(10);
		StartStory();
 	}
}


text:
module Sfx4
  module Abstract
    module AzExtraInfo

      def self.included(klass)
        klass.class_eval do
          require 'nokogiri'
          self.table_name = 'AZ_EXTRA_INFO'
          self.primary_key = 'AZ_EXTRA_INFO_ID'

          belongs_to :az_title,
                     :foreign_key => 'OBJECT_ID',
                     :class_name => "#{klass.to_s.deconstantize}::AzTitle"

          include MetadataHelper # for normalize_lccn
        end
      end

      def issn
        @issn ||= extra_info_xml.search("item[key=issn]").text
      end

      def isbn
        @isbn ||= extra_info_xml.search("item[key=isbn]").text
      end

      def lccn
        @lccn ||= normalize_lccn(extra_info_xml.search("item[key=lccn]").text)
      end

      def extra_info_xml
        @extra_info_xml ||= Nokogiri::XML(self.EXTRA_INFO_XML)
      end
    end
  end
end


text:
import type { DataStatusActions } from '../actions/dataStatus';
import {
  HAS_FETCH_FAILED_SET,
  IS_FETCHING_SET,
  IS_STALE_SET,
} from '../actions/ActionTypes';

type State = {
  +isFetching: boolean,
  +isStale: boolean,
  +hasFetchFailed: boolean,
};

const initialState = {
  isFetching: false,
  isStale: false,
  hasFetchFailed: false,
};

export default function reducer(
  state: State = initialState,
  action: DataStatusActions
): State {
  switch (action.type) {
    case HAS_FETCH_FAILED_SET:
      return {
        ...state,
        hasFetchFailed: action.payload,
      };
    case IS_FETCHING_SET:
      return {
        ...state,
        isFetching: action.payload,
      };
    case IS_STALE_SET:
      return {
        ...state,
        isStale: action.payload,
      };
    default:
      return state;
  }
}


text:
<title>Results for apim-server-startup</title>
Select a result on the left-hand pane.


text:
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Testing.Common.IAEntities;

namespace Nrepo.DataAccess.EntityFramework.Testing.IATesting
{
	public partial class EFRepositoryTesting
	{
		private void Add10Managers()
		{
			var repository = new EFRepositoryTester();
			repository.Initialize();

			var addingDate = DateTime.UtcNow;

			for (int i = 0; i < 10; i++)
			{
				var manager = new Manager()
				{
					Director = director,
					ManagerTrackers = new List<ManagerTracker>()
					{
						new ManagerTracker()
					},
					Office = office1,
					Computer = new Computer() { Data = "data", Admin = admin },
					Things = new List<Thing>()
					{
						new Thing()
						{
							Id = 1,
							Admin = admin,
							Data = "data"
						},
						new Thing()
						{
							Id = 2,
							Admin = admin,
							Data = "data"
						}
					},
					Description = new Description()
					{
						Data = "data"
					},
					Data = "data",
					Car = car1,
					//Projects = new List<Project>()
					//{
					//	project1,
					//	project2
					//}
				};

				manager.Data = "data" + i;

				repository.Add(new AddOperationParameters<Manager>()
				{
					Entity = manager,
					OperationDateTime = addingDate
				});
			}
		}

		[TestMethod]
		[ExpectedException(typeof(ArgumentNullException))]
		public void GetTotalCount_ParametersIsNull_ThrowsArgumentNullException()
		{
			//Arrange
			var repository = new EFRepositoryTester();
			repository.Initialize();

			//Act
			//Assert
			repository.GetTotalCount(null);
		}

		[TestMethod]
		public void GetTotalCount_NoEntities_ReturnsZero()
		{
			//Arrange
			var repository = new EFRepositoryTester();
			repository.Initialize();

			//Act
			var result = repository.GetTotalCount(new OperationParameters());

			//Assert
			Assert.AreEqual(0, result);
		}

		[TestMethod]
		public void GetTotalCount_EntitiesExist_ReturnsEntitiesCount()
		{
			//Arrange
			var repository = new EFRepositoryTester();
			repository.Initialize();

			var addingDate = DateTime.UtcNow;

			var manager1 = new Manager()
			{
				Director = director,
				ManagerTrackers = new List<ManagerTracker>()
				{
					new ManagerTracker()
				},
				Office = office1,
				Computer = new Computer() { Data = "data", Admin = admin },
				Things = new List<Thing>()
				{
					new Thing()
					{
						Id = 1,
						Admin = admin,
						Data = "data"
					},
					new Thing()
					{
						Id = 2,
						Admin = admin,
						Data = "data"
					}
				},
				Description = new Description()
				{
					Data = "data"
				},
				Data = "data",
				Car = car1,
				Projects = new List<Project>()
				{
					project1
				}
			};

			var manager2 = new Manager()
			{
				Director = director,
				ManagerTrackers = new List<ManagerTracker>()
				{
					new ManagerTracker()
				},
				Office = office2,
				Computer = new Computer() { Data = "data", Admin = admin },
				Things = new List<Thing>()
				{
					new Thing()
					{
						Id = 1,
						Admin = admin,
						Data = "data"
					},
					new Thing()
					{
						Id = 2,
						Admin = admin,
						Data = "data"
					}
				},
				Description = new Description()
				{
					Data = "data"
				},
				Data = "data",
				Car = car2,
				Projects = new List<Project>()
				{
					project2
				}
			};

			repository.Add(new AddOperationParameters<Manager>()
			{
				Entity = manager1,
				OperationDateTime = addingDate
			});

			repository.Add(new AddOperationParameters<Manager>()
			{
				Entity = manager2,
				OperationDateTime = addingDate
			});

			repository.Delete(new DeleteOperationParameters()
			{
				OperationDateTime = DateTime.UtcNow,
				PrimaryKeys = new object[] { manager2.Id }
			});

			//Act
			var result = repository.GetTotalCount(new OperationParameters());

			//Assert
			Assert.AreEqual(1, result);
		}

		[TestMethod]
		public void Get_ByPrimaryKeysAndNoEntities_ReturnsEmptyArray()
		{
			//Arrange
			var repository = new EFRepositoryTester();
			repository.Initialize();

			//Act
			var entities = repository.Get(new GetOperationParameters()
			{
				QueryParameters = new QueryParameters()
				{
					Filter = new EqualsCondition()
					{
						Property = ReflectionHelper.GetPropertyName<Manager, long>(e => e.Id),
						Value = 123L
					}
				}
			});

			//Assert
			Assert.IsNotNull(entities);
			Assert.AreEqual(0, entities.Length);
		}

		[TestMethod]
		public void Get_ByFilter_ReturnsEntities()
		{
			//Arrange
			var repository = new EFRepositoryTester();
			repository.Initialize();

			Add10Managers();

			//Act
			var entities = repository.Get(new GetOperationParameters()
			{
				QueryParameters = new QueryParameters()
				{
					Filter = new OrOperator()
					{
						LeftOperand = new ContainsCondition()
						{
							Property = ReflectionHelper.GetPropertyName<Manager, string>(e => e.Data),
							Value = "9"
						},
						RightOperand = new OrOperator()
						{
							LeftOperand = new EqualsCondition()
							{
								Property = ReflectionHelper.GetPropertyName<Manager, string>(e => e.Data),
								Value = "data1"
							},
							RightOperand = new EqualsCondition()
							{
								Property = ReflectionHelper.GetPropertyName<Manager, string>(e => e.Data),
								Value = "data2"
							}
						}
					}
				}
			});

			//Assert
			Assert.AreEqual(3, entities.Length);
			foreach (var entity in entities)
			{
				Assert.IsTrue(entity.Data == "data1"
					|| entity.Data == "data2"
					|| entity.Data == "data9");
			}
		}

		[TestMethod]
		public void Get_ByFilterWhenDeletedEntitiesExist_ReturnsNotDeletedEntities()
		{
			//Arrange
			var repository = new EFRepositoryTester();
			repository.Initialize();

			Add10Managers();

			var entitiesToDelete = repository.Get(new GetOperationParameters());

			repository.Delete(new DeleteOperationParameters()
			{
				PrimaryKeys = new object[] { entitiesToDelete[0].Id }
			});

			repository.Delete(new DeleteOperationParameters()
			{
				PrimaryKeys = new object[] { entitiesToDelete[1].Id }
			});

			repository.Delete(new DeleteOperationParameters()
			{
				PrimaryKeys = new object[] { entitiesToDelete[2].Id }
			});

			//Act
			var entities = repository.Get(new GetOperationParameters()
			{
				QueryParameters = new QueryParameters()
				{
					Filter = new OrOperator()
					{
						LeftOperand = new ContainsCondition()
						{
							Property = ReflectionHelper.GetPropertyName<Manager, string>(e => e.Data),
							Value = "data9"
						},
						RightOperand = new OrOperator()
						{
							LeftOperand = new EqualsCondition()
							{
								Property = ReflectionHelper.GetPropertyName<Manager, string>(e => e.Data),
								Value = "data1"
							},
							RightOperand = new EqualsCondition()
							{
								Property = ReflectionHelper.GetPropertyName<Manager, string>(e => e.Data),
								Value = "data2"
							}
						}
					}
				}
			});

			//Assert
			Assert.AreEqual(1, entities.Length);
			foreach (var entity in entities)
			{
				Assert.AreEqual("data9", entity.Data);
			}
		}

		[TestMethod]
		public void Get_ByFilterForUsedEntity_ReturnsEntities()
		{
			//Arrange
			var repository = new EFRepositoryTester();
			repository.Initialize();

			Add10Managers();

			//Act
			var entities = repository.Get(new GetOperationParameters()
			{
				QueryParameters = new QueryParameters()
				{
					Filter = new EqualsCondition()
					{
						Property = ReflectionHelper.GetPropertyName<Manager, string>(e => e.Car.Data),
						Value = "data"
					}
				}
			});

			//Assert
			Assert.AreEqual(10, entities.Length);
			for (int i = 1; i < 10; i++)
			{
				Assert.IsTrue(entities[i].Id - entities[i - 1].Id == 1);
			}
		}

		[TestMethod]
		public void Get_WithSorting_ReturnsSortedEntities()
		{
			//Arrange
			var repository = new EFRepositoryTester();
			repository.Initialize();

			Add10Managers();

			//Act
			var entities = repository.Get(new GetOperationParameters()
			{
				QueryParameters = new QueryParameters()
				{
					Filter = new OrOperator()
					{
						LeftOperand = new ContainsCondition()
						{
							Property = ReflectionHelper.GetPropertyName<Manager, string>(e => e.Data),
							Value = "9"
						},
						RightOperand = new OrOperator()
						{
							LeftOperand = new EqualsCondition()
							{
								Property = ReflectionHelper.GetPropertyName<Manager, string>(e => e.Data),
								Value = "data1"
							},
							RightOperand = new EqualsCondition()
							{
								Property = ReflectionHelper.GetPropertyName<Manager, string>(e => e.Data),
								Value = "data2"
							}
						}
					},
					SortingParameters = new QuerySortingParameters()
					{
						SortBy = ReflectionHelper.GetPropertyName<Manager, string>(e => e.Data),
						SortingType = SortingType.Descending
					}
				}
			});

			//Assert
			Assert.AreEqual(3, entities.Length);
			foreach (var entity in entities)
			{
				Assert.IsTrue(entity.Data == "data1"
					|| entity.Data == "data2"
					|| entity.Data == "data9");
			}
		}

		[TestMethod]
		public void Get_WhenPageNumberIs0AndPageSizeIs3_ReturnsFirstThreeEntities()
		{
			//Arrange
			var repository = new EFRepositoryTester();
			repository.Initialize();

			Add10Managers();

			//Act
			var getParameters = new GetOperationParameters()
			{
				QueryParameters = new QueryParameters()
				{
					PagingParameters = new QueryPagingParameters()
					{
						PageNumber = 0,
						PageSize = 3,
					}
				}
			};

			var entities = repository.Get(getParameters);

			//Assert
			Assert.AreEqual(3, entities.Length);
			Assert.AreEqual(10, getParameters.QueryParameters.PagingParameters.TotalCount);

			for (int i = 0; i < 3; i++)
			{
				Assert.IsTrue(entities[i].Data == "data0"
					|| entities[i].Data == "data1"
					|| entities[i].Data == "data2");
			}
		}

		[TestMethod]
		public void Get_WhenPageNumberIs4AndPageSizeIs3_ReturnsLastEntity()
		{
			//Arrange
			var repository = new EFRepositoryTester();
			repository.Initialize();

			Add10Managers();

			//Act
			var getParameters = new GetOperationParameters()
			{
				QueryParameters = new QueryParameters()
				{
					PagingParameters = new QueryPagingParameters()
					{
						PageNumber = 3,
						PageSize = 3,
					}
				}
			};

			var entities = repository.Get(getParameters);

			//Assert
			Assert.AreEqual(1, entities.Length);
			Assert.AreEqual(10, getParameters.QueryParameters.PagingParameters.TotalCount);
			Assert.AreEqual("data9", entities[0].Data);
		}

		[TestMethod]
		public void Get_WhenFilteredAndSortedAndPaged_ReturnsEntities()
		{
			//Arrange
			var repository = new EFRepositoryTester();
			repository.Initialize();

			Add10Managers();

			//Act
			var getParameters = new GetOperationParameters()
			{
				QueryParameters = new QueryParameters()
				{
					Filter = new OrOperator()
					{
						LeftOperand = new OrOperator()
						{
							LeftOperand = new EqualsCondition()
							{
								Property = ReflectionHelper.GetPropertyName<Manager, string>(e => e.Data),
								Value = "data1"
							},
							RightOperand = new EqualsCondition()
							{
								Property = ReflectionHelper.GetPropertyName<Manager, string>(e => e.Data),
								Value = "data2"
							}
						},
						RightOperand = new OrOperator()
						{
							LeftOperand = new EqualsCondition()
							{
								Property = ReflectionHelper.GetPropertyName<Manager, string>(e => e.Data),
								Value = "data3"
							},
							RightOperand = new EqualsCondition()
							{
								Property = ReflectionHelper.GetPropertyName<Manager, string>(e => e.Data),
								Value = "data4"
							}
						},
					},
					SortingParameters = new QuerySortingParameters()
					{
						SortBy = ReflectionHelper.GetPropertyName<Manager, string>(e => e.Data),
						SortingType = SortingType.Descending
					},
					PagingParameters = new QueryPagingParameters()
					{
						PageNumber = 0,
						PageSize = 3,
					}
				}
			};

			var entities = repository.Get(getParameters);

			//Assert
			Assert.AreEqual(3, entities.Length);
			Assert.AreEqual(4, getParameters.QueryParameters.PagingParameters.TotalCount);
			Assert.AreEqual("data4", entities[0].Data);
			Assert.AreEqual("data3", entities[1].Data);
			Assert.AreEqual("data2", entities[2].Data);
		}

		[TestMethod]
		public void Get_WithoutUsingEntities_IsUsedIsFalse()
		{
			//Arrange
			var repository = new EFRepositoryTester();
			repository.Initialize();

			var manager = new Manager()
			{
				Director = director,
				ManagerTrackers = new List<ManagerTracker>()
				{
					new ManagerTracker()
				},
				Office = office1,
				Computer = new Computer() { Data = "data", Admin = admin },
				Things = new List<Thing>()
				{
					new Thing()
					{
						Id = 1,
						Admin = admin,
						Data = "data"
					},
					new Thing()
					{
						Id = 2,
						Admin = admin,
						Data = "data"
					}
				},
				Description = new Description()
				{
					Data = "data"
				},
				Data = "data",
				Car = car1,
				Projects = new List<Project>()
				{
					project1,
					//project2
				}
			};

			repository.Add(new AddOperationParameters<Manager>()
			{
				Entity = manager,
				OperationDateTime = initializingDate
			});

			//Attach using entities
			var context = new EFContext();

			context.Directors.Attach(director);
			context.Managers.Attach(manager);
			director.Managers = new List<Manager>();
			director.Managers.Add(manager);

			context.ManagerTrackers.Add(new ManagerTracker()
			{
				Manager = manager,
				Data = "data"
			});

			context.SaveChanges();

			//Act
			var entities = repository.Get(new GetOperationParameters()
			{
				LoadSubEntities = true,
				LoadUsedEntities = true,
				LoadUsingEntities = false,
			});

			//Assert
			Assert.AreEqual(false, entities[0].IsUsed);
		}

		[TestMethod]
		public void Get_WithUsingEntities_IsUsedIsTrue()
		{
			//Arrange
			var repository = new EFRepositoryTester();
			repository.Initialize();

			var manager = new Manager()
			{
				Director = director,
				ManagerTrackers = new List<ManagerTracker>()
				{
					new ManagerTracker()
				},
				Office = office1,
				Computer = new Computer() { Data = "data", Admin = admin },
				Things = new List<Thing>()
				{
					new Thing()
					{
						Id = 1,
						Admin = admin,
						Data = "data"
					},
					new Thing()
					{
						Id = 2,
						Admin = admin,
						Data = "data"
					}
				},
				Description = new Description()
				{
					Data = "data"
				},
				Data = "data",
				Car = car1,
				Projects = new List<Project>()
				{
					project1,
					//project2
				}
			};

			repository.Add(new AddOperationParameters<Manager>()
			{
				Entity = manager,
				OperationDateTime = initializingDate
			});

			//Attach using entities
			var context = new EFContext();

			context.Directors.Attach(director);
			context.Managers.Attach(manager);
			director.Managers = new List<Manager>();
			director.Managers.Add(manager);

			context.ManagerTrackers.Add(new ManagerTracker()
			{
				Manager = manager,
				Data = "data"
			});

			context.SaveChanges();

			//Act
			var entities = repository.Get(new GetOperationParameters()
			{
				LoadSubEntities = true,
				LoadUsedEntities = true,
				LoadUsingEntities = true,
			});

			//Assert
			Assert.AreEqual(true, entities[0].IsUsed);
		}

		[TestMethod]
		public void Get_WhenNoUsingEntities_IsUsedIsFalse()
		{
			//Arrange
			var repository = new EFRepositoryTester();
			repository.Initialize();

			var manager = new Manager()
			{
				Director = director,
				ManagerTrackers = new List<ManagerTracker>()
				{
					new ManagerTracker()
				},
				Office = office1,
				Computer = new Computer() { Data = "data", Admin = admin },
				Things = new List<Thing>()
				{
					new Thing()
					{
						Id = 1,
						Admin = admin,
						Data = "data"
					},
					new Thing()
					{
						Id = 2,
						Admin = admin,
						Data = "data"
					}
				},
				Description = new Description()
				{
					Data = "data"
				},
				Data = "data",
				Car = car1,
				Projects = new List<Project>()
				{
					project1,
					//project2
				}
			};

			repository.Add(new AddOperationParameters<Manager>()
			{
				Entity = manager,
				OperationDateTime = initializingDate
			});

			//Act
			var entities = repository.Get(new GetOperationParameters()
			{
				LoadSubEntities = true,
				LoadUsedEntities = true,
				LoadUsingEntities = true,
			});

			//Assert
			Assert.AreEqual(false, entities[0].IsUsed);
		}

		[TestMethod]
		public void Get_WithAllRelatedEntities_ReturnsEntities()
		{
			//Arrange
			var repository = new EFRepositoryTester();
			repository.Initialize();

			var manager = new Manager()
			{
				Director = director,
				ManagerTrackers = new List<ManagerTracker>()
				{
					new ManagerTracker()
				},
				Office = office1,
				Computer = new Computer() { Data = "data", Admin = admin },
				Things = new List<Thing>()
				{
					new Thing()
					{
						Id = 1,
						Admin = admin,
						Data = "data"
					},
					new Thing()
					{
						Id = 2,
						Admin = admin,
						Data = "data"
					}
				},
				Description = new Description()
				{
					Data = "data"
				},
				Data = "data",
				Car = car1,
				Projects = new List<Project>()
				{
					project1,
					//project2
				}
			};

			repository.Add(new AddOperationParameters<Manager>()
			{
				Entity = manager,
				OperationDateTime = initializingDate
			});

			//Attach using entities
			var context = new EFContext();

			context.Directors.Attach(director);
			context.Managers.Attach(manager);
			director.Managers = new List<Manager>();
			director.Managers.Add(manager);

			context.ManagerTrackers.Add(new ManagerTracker()
			{
				Manager = manager,
				Data = "data"
			});

			context.SaveChanges();

			//Act
			var entities = repository.Get(new GetOperationParameters()
			{
				LoadSubEntities = true,
				LoadUsedEntities = true,
				LoadUsingEntities = true,
			});

			//Assert
			Assert.AreEqual(true, entities[0].IsUsed);

			AssertUsingEntities();

			AssertSecondLevelUsedEntities();

			//Sub entities
			Assert.AreEqual(1, entities.Length);
			Assert.AreEqual("data", entities[0].Computer.Data);
			Assert.AreEqual(admin.Id, entities[0].Computer.Admin.Id);

			Assert.AreEqual("data", entities[0].Description.Data);

			Assert.AreEqual("data", entities[0].Things[0].Data);
			Assert.AreEqual(admin.Id, entities[0].Things[0].Admin.Id);
			Assert.AreEqual(entities[0].Id, entities[0].Things[0].Manager.Id);

			Assert.AreEqual("data", entities[0].Things[1].Data);
			Assert.AreEqual(admin.Id, entities[0].Things[1].Admin.Id);
			Assert.AreEqual(entities[0].Id, entities[0].Things[1].Manager.Id);

			//Main entity
			Assert.AreEqual("data", entities[0].Data);
			Assert.AreEqual(car1.Id, entities[0].Car.Id);
			Assert.AreEqual(director.Id, entities[0].Director.Id);
			Assert.AreEqual(office1.Id, entities[0].Office.Id);

			//First level used entities
			Assert.AreEqual(office1.Id, entities[0].Office.Id);
			Assert.AreEqual("data", entities[0].Office.Data);

			Assert.AreEqual(admin.Id, entities[0].Car.Admin.Id);
			Assert.AreEqual(car1.Id, entities[0].Car.Id);
			Assert.AreEqual("data", entities[0].Car.Data);

			Assert.AreEqual(admin.Id, entities[0].Projects[0].Admin.Id);
			Assert.AreEqual(project1.Id, entities[0].Projects[0].Id);
			Assert.AreEqual("data", entities[0].Projects[0].Data);
			Assert.AreEqual(manager.Id, entities[0].Projects[0].Manager.Id);

			//Assert.AreEqual(admin.Id, entities[0].Projects[1].AdminId);
			//Assert.AreEqual(project2.Id, entities[0].Projects[1].Id);
			//Assert.AreEqual(initializingDate, entities[0].Projects[1].CreatedOn);
			//Assert.AreEqual(initializingDate, entities[0].Projects[1].LastUpdateOn);
			//Assert.AreEqual("data", entities[0].Projects[1].Data);
			//Assert.AreEqual(false, entities[0].Projects[1].IsDeleted);
			//Assert.AreEqual(manager.Id, entities[0].Projects[1].ManagerId);

			//Using entities
			Assert.AreEqual("data", entities[0].ManagerTrackers[0].Data);
			Assert.AreEqual(manager.Id, entities[0].ManagerTrackers[0].Manager.Id);

			//Get result
		}
	}
}


text:
This is a fork of Richard Berry's freeRTOS, optimised for the Arduino AVR devices.

It has been created to provide access to FreeRTOS capabilities, with full compatibility to the Arduino environment.
It does this by keeping hands off almost everything, and only touching the minimum of hardware to be successful.

## Further Reading

The canonical source for information is the [FreeRTOS Web Site](http://www.freertos.org/ "FreeRTOS").
Within this site, the [Getting Started](http://www.freertos.org/FreeRTOS-quick-start-guide.html "Quick Start Guide") page is very useful.
It is worth having a view from a user, and [manicbug](https://maniacbug.wordpress.com/2012/01/31/freertos/) has some interesting examples.
My other [AVRfreeRTOS Repository](https://sourceforge.net/projects/avrfreertos/) has plenty of examples,
ranging from [blink](https://sourceforge.net/projects/avrfreertos/files/MegaBlink/) through to a [synthesiser](https://sourceforge.net/projects/avrfreertos/files/GA_Synth/).

## General

FreeRTOS has a multitude of configuration options, which can be specified from within the FreeRTOSConfig.h file.
To keep commonality with all of the Arduino hardware options, some sensible defaults have been selected.

The AVR Watchdog Timer is used to generate 15ms time slices, but Tasks that finish before their allocated time will hand execution back to the Scheduler.
This does not affect the use of any of the normal Timer functions in Arduino.

Time slices can be selected from 15ms up to 500ms. Slower time slicing can allow the Arduino MCU to sleep for longer, without the complexity of a Tickless idle.

Watchdog period options:
* WDTO_15MS
* WDTO_30MS
* WDTO_60MS
* WDTO_120MS
* WDTO_250MS
* WDTO_500MS

Note that Timer resolution is affected by integer math division and the time slice selected. Trying to measure 100ms, using a 60ms time slice for example, won't work.

Stack for the loop() function has been set at 128 bytes. This can be configured by adjusting the configIDLE_STACK_SIZE parameter.
It should not be less than the configMINIMAL_STACK_SIZE. If you have stack overflow issues, just increase it.
Users should prefer to allocate larger structures, arrays, or buffers using pvPortMalloc(), rather than defining them locally on the stack.

Memory for the heap is allocated by the normal malloc() function, wrapped by pvPortMalloc().
This option has been selected because it is automatically adjusted to use the capabilities of each device.
Other heap allocation schemes are supported by FreeRTOS, and they can used with additional configuration.

## Errors

* Stack Overflow: If any stack (for the loop() or) for any Task overflows, there will be a slow LED blink, with 4 second cycle.
* Heap Overflow: If any Task tries to allocate memory and that allocation fails, there will be a fast LED blink, with 100 millisecond cycle.

## Errata

Testing with the Software Serial library shows some incompatibilities at low baud rates (9600), due to the extended time this library disables the global interrupt. Working on characterising and resolving the problem currently.

## Compatibility

  * ATmega328 @ 16MHz : Arduino UNO, Arduino Duemilanove, Arduino Diecimila, etc.
  * ATmega328 @ 16MHz : Adafruit Pro Trinket 5V, Adafruit Metro 328, Adafruit Metro Mini
  * ATmega328 @ 16MHz : Seeed Studio Stalker
  * ATmega328 @ 16MHz : Freetronics Eleven
  * ATmega328 @ 12MHz : Adafruit Pro Trinket 3V
  * ATmega32u4 @ 16MHz : Arduino Leonardo, Arduino Micro, Arduino Yun, Teensy 2.0
  * ATmega32u4 @ 8MHz : Adafruit Flora, Bluefruit Micro
  * ATmega1284p @ 24.576MHz : Seeed Studio Goldilocks, Seeed Studio Goldilocks Analogue
  * ATmega2560 @ 16MHz : Arduino Mega, Arduino ADK
  * ATmega2560 @ 16MHz : Seeed Studio ADK
  * ATmegaXXXX @ XXMHz : Anything with an ATmega MCU, really.

## Files & Configuration

* Arduino_FreeRTOS.h : Must always be #include first. It references other configuration files, and sets defaults where necessary.
* FreeRTOSConfig.h : Contains a multitude of API and environment configurations.
* FreeRTOSVariant.h : Contains the AVR specific configurations for this port of freeRTOS.
* heap_3.c : Contains the heap allocation scheme based on malloc(). Other schemes are available, but depend on user configuration for specific MCU choice.


text:
<?php
return array(
	'phrase' => 'Please contact me at',
	'home' => 'Home',
	'about' => 'About Franco',
	'benefits' => 'Your Benefits',
	'buyers' => 'Buyers',
	'sellers' => 'Sellers',
	'resource_center' => 'Resource Center',
	'relocating' => 'Relocating Houston',
	'support' => 'Support',
	'advantages' => 'Advantages',
	'contact' => 'Contact',
	'view_more' => 'View More',
	'sold' => 'SOLD',
	'info' => 'Information',
	'description' => 'Description',
	'price' => 'Price',
	'dimension' => 'Building SquareFeet',
	'year' => 'Year Built',
	'bed' => 'Bedrooms',
	'bath' => 'Baths',
	'garage' => 'Garage',
	'pool' => 'Swimming Pool',
	'district' => 'School District',
	'elementary' => 'Elementary School',
	'middle' => 'Middle School',
	'high' => 'High School',
	'harLink' => 'HAR (Houston Association of Realtors) link',
	'notFound' => 'Sorry, no results found',
	'emailFail' => 'You must complete all fields and place a valid email address.',
	'emailSuccess' => 'Your request were sent, you will hear shortly from Franco.'
);


text:
	Configuration

		Environment: {{$environment, default: 'Default'}}

Loaded configuration:

			File
			Configuration

		{% foreach($config as $file => $configuration) %}

				{{$file}}
				{{$dump($configuration)}}

		{% endforeach %}


text:
class MotorLaunch
  include DataMapper::Resource
  property :id, Integer, :serial => true
  property :name, String, :auto_validation => false
end

class BoatDock
  include DataMapper::Resource
  property :id, Integer, :serial => true
  property :name, String, :auto_validation => false, :default => "I'm a long string"
  validates_length :name, :min => 3
end


text:
package net.cyanwool.platform.world;

public enum LightType {

	SKY, BLOCK;

}


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

namespace LivingRoom
{
    public static class EnumerableExtensions
    {

        public static IEnumerable<TResult> Each<T, TResult>(
            this IEnumerable<T> enumerable, Func<T, TResult> action)
        {
            return enumerable.Select(action);
        }

        public static void Each<T>(this IEnumerable<T> enumerable, Action<T> action)
        {
            foreach (var item in enumerable)
                action(item);
        }

    }
}