text:
<?php

namespace Respect\Data;

use Respect\Data\Collections\Collection;
use SplObjectStorage;

abstract class AbstractMapper
{
    protected $style;
    protected $new;
    protected $tracked;
    protected $changed;
    protected $removed;
    protected $collections = array();

    abstract protected function createStatement(Collection $fromCollection, $withExtra = null);

    protected function parseHydrated(SplObjectStorage $hydrated)
    {
        $this->tracked->addAll($hydrated);
        $hydrated->rewind();

        return $hydrated->current();
    }

    public function getStyle()
    {
        if (null === $this->style) {
            $this->setStyle(new Styles\Standard());
        }

        return $this->style;
    }

    public function setStyle(Styles\Stylable $style)
    {
        $this->style = $style;

        return $this;
    }

    public function __construct()
    {
        $this->tracked  = new SplObjectStorage();
        $this->changed  = new SplObjectStorage();
        $this->removed  = new SplObjectStorage();
        $this->new      = new SplObjectStorage();
    }

    abstract public function flush();

    public function reset()
    {
        $this->changed = new SplObjectStorage();
        $this->removed = new SplObjectStorage();
        $this->new = new SplObjectStorage();
    }

    public function markTracked($entity, Collection $collection)
    {
        $this->tracked[$entity] = $collection;

        return true;
    }

    public function fetch(Collection $fromCollection, $withExtra = null)
    {
        $statement = $this->createStatement($fromCollection, $withExtra);
        $hydrated = $this->fetchHydrated($fromCollection, $statement);
        if (!$hydrated) {
            return false;
        }

        return $this->parseHydrated($hydrated);
    }

    public function fetchAll(Collection $fromCollection, $withExtra = null)
    {
        $statement = $this->createStatement($fromCollection, $withExtra);
        $entities = array();

        while ($hydrated = $this->fetchHydrated($fromCollection, $statement)) {
            $entities[] = $this->parseHydrated($hydrated);
        }

        return $entities;
    }

    public function persist($object, Collection $onCollection)
    {
        $this->changed[$object] = true;

        if ($this->isTracked($object)) {
            return true;
        }

        $this->new[$object] = true;
        $this->markTracked($object, $onCollection);

        return true;
    }

    public function remove($object, Collection $fromCollection)
    {
        $this->changed[$object] = true;
        $this->removed[$object] = true;

        if ($this->isTracked($object)) {
            return true;
        }

        $this->markTracked($object, $fromCollection);

        return true;
    }

    public function isTracked($entity)
    {
        return $this->tracked->contains($entity);
    }

    protected function fetchHydrated(Collection $collection, $statement)
    {
        if (!$collection->hasMore()) {
            return $this->fetchSingle($collection, $statement);
        } else {
            return $this->fetchMulti($collection, $statement);
        }
    }

    public function __get($name)
    {
        if (isset($this->collections[$name])) {
            return $this->collections[$name];
        }

        $coll = new Collection($name);
        $coll->setMapper($this);

        return $coll;
    }

    public function __isset($alias)
    {
        return isset($this->collections[$alias]);
    }

    public function __set($alias, $collection)
    {
        return $this->registerCollection($alias, $collection);
    }

    public function __call($name, $children)
    {
        $collection = Collection::__callstatic($name, $children);
        $collection->setMapper($this);

        return $collection;
    }

    public function registerCollection($alias, Collection $collection)
    {
        $collection->setMapper($this);
        $this->collections[$alias] = $collection;
    }
}


text:
.filtertree {
    font-size: small;
    line-height: 14px;
}

.filtertree ul {
    list-style-type: none;
    margin: 0;
}

.filtertree li {
    padding: 1px;
}

.filtertree li.ft-group, .filtertree li.ft-filter {
    list-style-type: square;
    list-style-position: inside;
}

.filtertree ul.ft-root {
    padding: 0;
}

.filtertree input, .filtertree select {
    margin-right: 2px;
    border: 1px solid #ccc;
}

.filtertree button {
    margin-right: 2px;
}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

/*
 * HTMLPart
 */
module.exports = function(stream, payload) {
   stream.util[payload.mode || 'replace'](payload.id, payload.html);
};


text:
Gérer des périodes
```java
LocalDate manufacturingDate = LocalDate.of(2017, Month.JANUARY, 1);
LocalDate expiryDate = LocalDate.of(2017, Month.JUNE, 20);

Period expiry = Period.between(manufacturingDate, expiryDate);
int numberOfDays = expiry.getDays();
```

Gérer des durées
```java
LocalDateTime startingDate = LocalDateTime.of(2017, Month.JULY, 19, 9, 30);
LocalDateTime endingDate = LocalDateTime.of(2017, Month.JULY, 19, 11, 00);

Duration talkDuration = Duration.between(startingDate, endingDate);
long hours = ChronoUnit.HOURS.between(startingDate, endingDate);
long minutes = ChronoUnit.MINUTES.between(startingDate, endingDate);
```


text:
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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 Microsoft.Azure.Management.BackupServices;

namespace Microsoft.Azure.Commands.AzureBackup.ClientAdapter
{
    public partial class AzureBackupClientAdapter
    {
        public CSMOperationResult GetOperationStatus(string resourceGroupName, string resourceName, string operationId)
        {
            return AzureBackupClient.OperationStatus.CSMGetAsync(resourceGroupName, resourceName, operationId, GetCustomRequestHeaders(), CmdletCancellationToken).Result;
        }
    }
}


text:
package biz.jovido.seed.content;

import org.springframework.util.StringUtils;

import java.text.Normalizer;

/**
 * @author Stephan Grundner
 */
public class Slugifier {

    public String slugify(String text, String separator) {
        if (!StringUtils.hasLength(text)) {
            return text;
        }
        text = text.toLowerCase();
        text = text.replaceAll("ä", "ae");
        text = text.replaceAll("ö", "oe");
        text = text.replaceAll("ü", "ue");
        return Normalizer.normalize(text.toLowerCase(), Normalizer.Form.NFD)
                .replaceAll("\\p{InCombiningDiacriticalMarks}+", "")
                .replaceAll("[^\\p{Alnum}]+", separator);
    }
}


text:
using org.xmlvm;
namespace java.util {
public abstract class TreeMap_2AscendingSubMapIterator: global::java.util.TreeMap_2AbstractSubMapIterator {
new public void @this(global::java.util.TreeMap_2NavigableSubMap n1){
//XMLVM_BEGIN_WRAPPER[java.util.TreeMap$AscendingSubMapIterator: void <init>(java.util.TreeMap$NavigableSubMap)]
    global::System.Object _r0_o = null;
    global::System.Object _r1_o = null;
    _r0_o = this;
    _r1_o = n1;
    ((global::java.util.TreeMap_2AbstractSubMapIterator) _r0_o).@this((global::java.util.TreeMap_2NavigableSubMap) _r1_o);
    return;
//XMLVM_END_WRAPPER[java.util.TreeMap$AscendingSubMapIterator: void <init>(java.util.TreeMap$NavigableSubMap)]
}

public override global::System.Object getBoundaryNode(){
//XMLVM_BEGIN_WRAPPER[java.util.TreeMap$AscendingSubMapIterator: java.util.TreeMap$Entry getBoundaryNode()]
    global::org.xmlvm._nElement _r0;
    global::System.Object _r0_o = null;
    global::System.Object _r1_o = null;
    global::System.Object _r2_o = null;
    _r2_o = this;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r2_o)._fsubMap;
    _r0.i = ((global::java.util.TreeMap_2NavigableSubMap) _r0_o)._ftoEnd ? 1 : 0;
    if (_r0.i == 0) goto label42;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r2_o)._fsubMap;
    _r0.i = ((global::java.util.TreeMap_2NavigableSubMap) _r0_o)._fhiInclusive ? 1 : 0;
    if (_r0.i == 0) goto label31;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r2_o)._fsubMap;
    _r1_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r2_o)._fsubMap;
    _r1_o = ((global::java.util.TreeMap_2NavigableSubMap) _r1_o)._fhi;
    _r0_o = ((global::java.util.TreeMap_2NavigableSubMap) _r0_o).smallerOrEqualEntry((global::java.lang.Object) _r1_o);
    label22:;
    if (_r0_o != null) goto label30;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r2_o)._fsubMap;
    _r0_o = global::java.util.TreeMap_2NavigableSubMap.access_20((global::java.util.TreeMap_2NavigableSubMap) _r0_o);
    label30:;
    return (global::java.util.TreeMap_2Entry) _r0_o;
    label31:;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r2_o)._fsubMap;
    _r1_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r2_o)._fsubMap;
    _r1_o = ((global::java.util.TreeMap_2NavigableSubMap) _r1_o)._fhi;
    _r0_o = ((global::java.util.TreeMap_2NavigableSubMap) _r0_o).smallerEntry((global::java.lang.Object) _r1_o);
    goto label22;
    label42:;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r2_o)._fsubMap;
    _r0_o = ((global::java.util.TreeMap_2NavigableSubMap) _r0_o).theBiggestEntry();
    goto label22;
//XMLVM_END_WRAPPER[java.util.TreeMap$AscendingSubMapIterator: java.util.TreeMap$Entry getBoundaryNode()]
}

public override global::System.Object getStartNode(){
//XMLVM_BEGIN_WRAPPER[java.util.TreeMap$AscendingSubMapIterator: java.util.TreeMap$Entry getStartNode()]
    global::org.xmlvm._nElement _r0;
    global::System.Object _r0_o = null;
    global::System.Object _r1_o = null;
    global::System.Object _r2_o = null;
    _r2_o = this;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r2_o)._fsubMap;
    _r0.i = ((global::java.util.TreeMap_2NavigableSubMap) _r0_o)._ffromStart ? 1 : 0;
    if (_r0.i == 0) goto label34;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r2_o)._fsubMap;
    _r0.i = ((global::java.util.TreeMap_2NavigableSubMap) _r0_o)._floInclusive ? 1 : 0;
    if (_r0.i == 0) goto label23;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r2_o)._fsubMap;
    _r1_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r2_o)._fsubMap;
    _r1_o = ((global::java.util.TreeMap_2NavigableSubMap) _r1_o)._flo;
    _r0_o = ((global::java.util.TreeMap_2NavigableSubMap) _r0_o).biggerOrEqualEntry((global::java.lang.Object) _r1_o);
    label22:;
    return (global::java.util.TreeMap_2Entry) _r0_o;
    label23:;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r2_o)._fsubMap;
    _r1_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r2_o)._fsubMap;
    _r1_o = ((global::java.util.TreeMap_2NavigableSubMap) _r1_o)._flo;
    _r0_o = ((global::java.util.TreeMap_2NavigableSubMap) _r0_o).biggerEntry((global::java.lang.Object) _r1_o);
    goto label22;
    label34:;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r2_o)._fsubMap;
    _r0_o = ((global::java.util.TreeMap_2NavigableSubMap) _r0_o).theSmallestEntry();
    goto label22;
//XMLVM_END_WRAPPER[java.util.TreeMap$AscendingSubMapIterator: java.util.TreeMap$Entry getStartNode()]
}

public virtual global::System.Object getNext(){
//XMLVM_BEGIN_WRAPPER[java.util.TreeMap$AscendingSubMapIterator: java.util.TreeMap$Entry getNext()]
    global::org.xmlvm._nElement _r0;
    global::System.Object _r0_o = null;
    global::org.xmlvm._nElement _r1;
    global::System.Object _r1_o = null;
    global::System.Object _r2_o = null;
    global::System.Object _r3_o = null;
    _r3_o = this;
    _r2_o = null;
    _r0.i = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._fexpectedModCount;
    _r1_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._fsubMap;
    _r1_o = ((global::java.util.TreeMap_2NavigableSubMap) _r1_o)._fm;
    _r1.i = ((global::java.util.TreeMap) _r1_o)._fmodCount;
    if (_r0.i == _r1.i) goto label17;
    _r0_o = new global::java.util.ConcurrentModificationException();
    ((global::java.util.ConcurrentModificationException) _r0_o).@this();
    throw new global::org.xmlvm._nExceptionAdapter((global::java.util.ConcurrentModificationException) _r0_o);
    label17:;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._fnode;
    if (_r0_o != null) goto label27;
    _r0_o = new global::java.util.NoSuchElementException();
    ((global::java.util.NoSuchElementException) _r0_o).@this();
    throw new global::org.xmlvm._nExceptionAdapter((global::java.util.NoSuchElementException) _r0_o);
    label27:;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._fnode;
    ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._flastNode = (global::java.util.TreeMap_2Node) _r0_o;
    _r0.i = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._foffset;
    ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._flastOffset = _r0.i;
    _r0.i = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._foffset;
    _r1_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._fnode;
    _r1.i = ((global::java.util.TreeMap_2Node) _r1_o)._fright_1idx;
    if (_r0.i == _r1.i) goto label90;
    _r0.i = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._foffset;
    _r0.i = _r0.i + 1;
    ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._foffset = _r0.i;
    label49:;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._flastNode;
    if (_r0_o == null) goto label107;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o).getBoundaryNode();
    ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._fboundaryPair = (global::java.util.TreeMap_2Entry) _r0_o;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._fboundaryPair;
    if (_r0_o == null) goto label81;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._fboundaryPair;
    _r0_o = ((global::java.util.TreeMap_2Entry) _r0_o)._fnode;
    _r1_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._flastNode;
    if (_r0_o != _r1_o) goto label81;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._fboundaryPair;
    _r0.i = ((global::java.util.TreeMap_2Entry) _r0_o)._findex;
    _r1.i = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._flastOffset;
    if (_r0.i != _r1.i) goto label81;
    ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._fnode = (global::java.util.TreeMap_2Node) _r2_o;
    label81:;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._flastNode;
    _r1.i = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._flastOffset;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o).createEntry((global::java.util.TreeMap_2Node) _r0_o, (int) _r1.i);
    label89:;
    return (global::java.util.TreeMap_2Entry) _r0_o;
    label90:;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._fnode;
    _r0_o = ((global::java.util.TreeMap_2Node) _r0_o)._fnext;
    ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._fnode = (global::java.util.TreeMap_2Node) _r0_o;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._fnode;
    if (_r0_o == null) goto label49;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._fnode;
    _r0.i = ((global::java.util.TreeMap_2Node) _r0_o)._fleft_1idx;
    ((global::java.util.TreeMap_2AscendingSubMapIterator) _r3_o)._foffset = _r0.i;
    goto label49;
    label107:;
    _r0_o = _r2_o;
    goto label89;
//XMLVM_END_WRAPPER[java.util.TreeMap$AscendingSubMapIterator: java.util.TreeMap$Entry getNext()]
}

public override bool hasNext(){
//XMLVM_BEGIN_WRAPPER[java.util.TreeMap$AscendingSubMapIterator: boolean hasNext()]
    global::org.xmlvm._nElement _r0;
    global::System.Object _r0_o = null;
    global::System.Object _r1_o = null;
    _r1_o = this;
    _r0_o = ((global::java.util.TreeMap_2AscendingSubMapIterator) _r1_o)._fnode;
    if (_r0_o == null) goto label6;
    _r0.i = 1;
    label5:;
    return _r0.i!=0;
    label6:;
    _r0.i = 0;
    goto label5;
//XMLVM_END_WRAPPER[java.util.TreeMap$AscendingSubMapIterator: boolean hasNext()]
}

//XMLVM_BEGIN_WRAPPER[java.util.TreeMap$AscendingSubMapIterator]
//XMLVM_END_WRAPPER[java.util.TreeMap$AscendingSubMapIterator]

} // end of class: TreeMap_2AscendingSubMapIterator

} // end of namespace: java.util


text:
import subprocess

from flask import current_app, render_template

def current_revision():
    return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'])

def landingpage():
    links = []
    for rule in current_app.url_map.iter_rules():
        links.append((rule.endpoint, str(rule), list(rule.methods)))

    return render_template('index.html', links=sorted(links), revision=current_revision())


text:
var gulp = require('gulp');

gulp.task('deploy', ['sass', 'images', 'sprites', 'minifyCss', 'uglifyJs', 'minifyHtml']);


text:
require 'pry'
require 'stylesheets'

style = StyleSheets::Style.new("article header h1")
style.properties.text.color "red"
puts style


text:
<?php

/**
 * Related products block
 *
 * @category    Mage
 * @package     Mage_XmlConnect
 * @author      Magento Core Team <core@magentocommerce.com>
 */
class Mage_XmlConnect_Block_Catalog_Product_Related extends Mage_XmlConnect_Block_Catalog_Product_List
{
    /**
     * Retrieve related products xml object based on current product
     *
     * @return Mage_XmlConnect_Model_Simplexml_Element
     * @see $this->getProduct()
     */
    public function getRelatedProductsXmlObj()
    {
        /** @var $relatedXmlObj Mage_XmlConnect_Model_Simplexml_Element */
        $relatedXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<related_products></related_products>');

        $productObj = $this->getParentBlock()->getProduct();

        if (is_object(Mage::getConfig()->getNode('modules/Enterprise_TargetRule'))) {
            Mage::register('product', $productObj, true);

            $productBlock = $this->getLayout()->addBlock(
                'enterprise_targetrule/catalog_product_list_related', 'relatedProducts'
            );

            $collection = $productBlock->getItemCollection();
        } else {
            if ($productObj->getId() > 0) {
                $collection = $this->_getProductCollection();
                if (!$collection) {
                    return $relatedXmlObj;
                }
                $collection = $collection->getItems();
            }
        }

        $this->_addProductXmlObj($relatedXmlObj, $collection);

        return $relatedXmlObj;
    }

    /**
     * Add related products info to xml object
     *
     * @param Mage_XmlConnect_Model_Simplexml_Element $relatedXmlObj
     * @param array $collection
     * @return Mage_XmlConnect_Model_Simplexml_Element
     */
    protected function _addProductXmlObj(Mage_XmlConnect_Model_Simplexml_Element $relatedXmlObj, $collection)
    {
        foreach ($collection as $product) {
            $productXmlObj = $this->productToXmlObject($product);

            if (!$productXmlObj) {
                continue;
            }

            if ($this->getParentBlock()->getChild('product_price')) {
                $this->getParentBlock()->getChild('product_price')->setProduct($product)
                    ->setProductXmlObj($productXmlObj)->collectProductPrices();
            }
            $relatedXmlObj->appendChild($productXmlObj);
        }
        return $relatedXmlObj;
    }

    /**
     * Generate related products xml
     *
     * @return string
     */
    protected function _toHtml()
    {
        return $this->getRelatedProductsXmlObj()->asNiceXml();
    }

    /**
     * Retrieve product collection with all prepared data
     *
     * @return Mage_Eav_Model_Entity_Collection_Abstract
     */
    protected function _getProductCollection()
    {
        if ($this->_productCollection === null) {
            $collection = $this->getParentBlock()->getProduct()->getRelatedProductCollection();
            Mage::getSingleton('catalog/layer')->prepareProductCollection($collection);
            /**
             * Add rating and review summary, image attribute, apply sort params
             */
            $this->_prepareCollection($collection);
            $this->_productCollection = $collection;
        }
        return $this->_productCollection;
    }
}


text:
package com.logginghub.utils;

public class VLPorts {

    public static final String socketHubProperty = "vl_socketHubDefaultPort";
    public static final String socketHubUPDProperty = "vl_socketHubUDPPort";
    public static final String restfulListenerProperty = "vl_restfulListenerPort";
    public static final String containerProperty = "vl_containerPort";
    public static final String webFrontendPort = "vl_webFrontEndPort";
    public static final String telemetryProperty = "vl_telemetryHubDefaultPort";
    public static final String zeroCopyHubListenerPort = "vl_zeroCopyHubListenerPort";
    public final static String telemetryMessaging3Property = "vl_telemetryMessaging3HubDefaultPort";
    public final static String socketTextReader1Property = "vl_socketTextReader1DefaultPort";
    public static final String repositoryDefaultPort = "vl_vlptRepositoryDefaultPort";
    public static final String repositoryWebDefaultPort = "vl_vlptRepositoryDefaultWebPort";

    public static final String vlptAgent1Port = "vl_vlptAgent1Port";
    public static final String vlptAgent2Port = "vl_vlptAgent2Port";
    public static final String vlptAgent3Port = "vl_vlptAgent3Port";
    public static final String vlptAgent4Port = "vl_vlptAgent4Port";
    public static final String vlptAgent5Port = "vl_vlptAgent5Port";

    public static int getVLPTAgent1Port() {
        return EnvironmentProperties.getInteger(vlptAgent1Port, 20001);
    }

    public static int getVLPTAgent2Port() {
        return EnvironmentProperties.getInteger(vlptAgent2Port, 20002);
    }

    public static int getVLPTAgent3Port() {
        return EnvironmentProperties.getInteger(vlptAgent3Port, 20003);
    }

    public static int getVLPTAgent4Port() {
        return EnvironmentProperties.getInteger(vlptAgent4Port, 20004);
    }

    public static int getVLPTAgent5Port() {
        return EnvironmentProperties.getInteger(vlptAgent5Port, 20005);
    }

    public static int getRepositoryDefaultPort() {
        return EnvironmentProperties.getInteger(repositoryDefaultPort, 15005);
    }

    public static int getRepositoryWebDefaultPort() {
        return EnvironmentProperties.getInteger(repositoryWebDefaultPort, 8082);
    }

    public static int getSocketHubDefaultPort() {
        return EnvironmentProperties.getInteger(socketHubProperty, 15000);
    }

    public static int getSocketHubUDPPort() {
        return EnvironmentProperties.getInteger(socketHubUPDProperty, 15000);
    }

    public static int getTelemetryHubDefaultPort() {
        return EnvironmentProperties.getInteger(telemetryProperty, 15001);
    }

    public static int getTelemetryMessaging3HubDefaultPort() {
        return EnvironmentProperties.getInteger(telemetryMessaging3Property, 15003);
    }

    public static int getSocketTextReader1DefaultPort() {
        return EnvironmentProperties.getInteger(socketTextReader1Property, 15002);
    }

    public static int getRestfulListenerPort() {
        return EnvironmentProperties.getInteger(restfulListenerProperty, 15009);
    }

    public static int getZeroCopyHubListenerPort() {
        return EnvironmentProperties.getInteger(zeroCopyHubListenerPort, 15010);
    }

    public static int getContainerDefaultPort() {
        return EnvironmentProperties.getInteger(containerProperty, 15011);
    }

    public static int getWebFrontendPort() {
        return EnvironmentProperties.getInteger(webFrontendPort, 80);
    }
}


text:
'use strict'

const Sequelize = require('sequelize')
const db = require('APP/db')

const Breed = db.define('breeds', {
  name: {
    type: Sequelize.STRING,
    allowNull: false
  }

})

module.exports = Breed


text:
package com.netflix.spinnaker.clouddriver.titus.deploy.events;

import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import com.netflix.spinnaker.clouddriver.event.EventMetadata;
import com.netflix.spinnaker.clouddriver.saga.SagaEvent;
import javax.annotation.Nonnull;
import lombok.Builder;
import lombok.Value;
import lombok.experimental.NonFinal;

@Builder(builderClassName = "TitusScalingPolicyCopiedBuilder", toBuilder = true)
@JsonDeserialize(builder = TitusScalingPolicyCopied.TitusScalingPolicyCopiedBuilder.class)
@JsonTypeName("titusScalingPolicyCopied")
@Value
public class TitusScalingPolicyCopied implements SagaEvent {

  @Nonnull private final String serverGroupName;
  @Nonnull private final String region;
  @Nonnull private final String sourcePolicyId;
  @NonFinal private EventMetadata metadata;

  @Override
  public void setMetadata(EventMetadata metadata) {
    this.metadata = metadata;
  }

  @JsonPOJOBuilder(withPrefix = "")
  public static class TitusScalingPolicyCopiedBuilder {}
}


text:
/*
 * @(#)BackupFacade.java
 *
 * @project    : org.fugerit.java.core.db
 * @package    : org.fugerit.java.core.db.backup
 * @creation   : 05/set/06
 * @license	   : META-INF/LICENSE.TXT
 */
package org.fugerit.java.core.db.backup;

import java.io.File;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Iterator;
import java.util.List;

import org.fugerit.java.core.db.backup.seq.GenericSequenceReset;
import org.fugerit.java.core.db.connect.CfConfig;
import org.fugerit.java.core.db.sql.ExecFacade;
import org.fugerit.java.core.log.LogFacade;
import org.fugerit.java.core.xml.dom.DOMIO;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

/**
 *

 *
 * @author mfranci
 *
 */
public class BackupFacade {

	public static final String VERSION = "BackupFacade 1.1.0 - 2016-06-17";

	public static int backup( Element config ) throws Exception {
		return backup( config, CfConfig.EMPTY_CONFIG );
	}

	public static int backup( Element config, CfConfig cfConfig ) throws Exception {
		BackupConfig backupConfig = new BackupConfig();
		backupConfig.setCfConfig( cfConfig );
		backupConfig.configure( config );
		return backup( backupConfig, cfConfig );
	}

	private static int runSqlList( Connection c, List<String> list ) throws SQLException {
		int res = 0;
		if ( !list.isEmpty() ) {
			c.setAutoCommit( false );
			Statement stm = c.createStatement();
			Iterator<String> it = list.iterator();
			while ( it.hasNext() ) {
				String sql = (String) it.next();
				boolean result = stm.execute( sql );
				LogFacade.getLog().info( "BackupConfig.backup() query result : "+result+" - "+sql );
			}
			c.commit();
			c.setAutoCommit( true );
		}
		return res;
	}

	public static int backup( BackupConfig backupConfig ) throws Exception {
		return backup( backupConfig, CfConfig.EMPTY_CONFIG );
	}

	public static int backup( BackupConfig backupConfig, CfConfig cfConfig ) throws Exception {
		int result = 0;
		LogFacade.getLog().info( "Using version : "+VERSION );
		if ( backupConfig.deleteFirst() ) {
			int delete = 0;
			for ( int k=backupConfig.getTableList().size()-1; k>=0; k-- ) {
				TableConfig tableConfig = (TableConfig)backupConfig.getTableList().get( k );
				String tableName = tableConfig.getTable();
				String sql = " DELETE FROM "+tableName+" ";
				int currentDelete = ExecFacade.executeUpdate( backupConfig.getFactoryTo() , sql );
				LogFacade.getLog().info( "BackupConfig.backup() Executed delete command : "+sql+" result : "+currentDelete );
				delete+= currentDelete;
			}
			LogFacade.getLog().info( "BackupConfig.backup() Total delete result : "+delete );
		}

		Connection from = backupConfig.getFactoryFrom().getConnection();
		Connection to = backupConfig.getFactoryTo().getConnection();

		// pre script
		runSqlList( from, backupConfig.getPreSqlFromList() );
		runSqlList( to, backupConfig.getPreSqlToList() );

		GenericSequenceReset sequenceReset = new GenericSequenceReset();

		Iterator<SequenceConfig> itSequenceList = backupConfig.getSequenceList().iterator();
		while ( itSequenceList.hasNext() ) {
			SequenceConfig sequenceConfig = itSequenceList.next();
			String sequenceName = sequenceConfig.getSequenceName();
			long value = sequenceReset.loadNextValue( from , sequenceName );
			sequenceReset.saveNextValue( to, sequenceName, value );
		}

		Iterator<TableConfig> itTableList = backupConfig.getTableList().iterator();
		while ( itTableList.hasNext() ) {
			TableConfig tableConfig = itTableList.next();
			String tableName = tableConfig.getTable();
			String sql = tableConfig.getSelect();
			if ( sql == null ) {
				result+= backupConfig.getTableBackup().backupTable( tableName, from, to, tableConfig );
			} else {
				result+= backupConfig.getTableBackup().backupTable( tableName, from, to, sql, tableConfig);
			}
		}

		if ( result == 0 ) {
			runSqlList( to, backupConfig.getPostSqlToList() );
			runSqlList( from, backupConfig.getPostSqlFromList() );
		} else {
			LogFacade.getLog().info( "Result errors : "+result+", skip post queries" );
		}

		from.close();
		to.close();
		LogFacade.getLog().info( "Backup return code : "+result );
		return result;
	}

	public static void main( String[] args ) {
		try {
			String file = args[0];

			Document config = DOMIO.loadDOMDoc( new File( file ) );

			int result = BackupFacade.backup( config.getDocumentElement() );

			System.out.println( "Backup result : "+result );

			System.exit( result );

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}


text:
gemfile
configuration: controller, model, initializer
registration needed?
confirmable?

# Omniauth::Backme

TODO: Write a gem description

## Installation

Add this line to your application's Gemfile:

```ruby
gem "omniauth-backme", git: "git@github.com:BackerFounder/omniauth-backme.git"
```

And then execute:

    $ bundle

## Configuration

```
# config/initializers/devise.rb
Devise.setup do |config|
  config.omniauth :backme, Rails.application.secrets.backme_key, Rails.application.secrets.backme_secret
end
```
or

```
# config/initializers/devise.rb
Devise.setup do |config|
  config.omniauth :backme, ENV["BACKME_KEY"], ENV["BACKME_SECRET"]
end
```

```
# app/models/user.rb
omniauth_providers: [:facebook, :google_oauth2, :weibo, :backme]
```

## Usage

TODO: Write usage instructions here

## Contributing

1. Fork it ( https://github.com/[my-github-username]/omniauth-backme/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request


text:
public class Main {
    private static final int TEST_TIME = 5;

    public static void main(String[] args) {
        System.out.println("Running (" + TEST_TIME + " seconds) ...");
        InfiniteForLoop forLoop = new InfiniteForLoop();
        InfiniteWhileLoop whileLoop = new InfiniteWhileLoop();
        InfiniteDoWhileLoop doWhileLoop = new InfiniteDoWhileLoop();
        MakeGarbage garbage = new MakeGarbage();
        forLoop.start();
        whileLoop.start();
        doWhileLoop.start();
        garbage.start();
        for (int i = 0; i < TEST_TIME; i++) {
          Runtime.getRuntime().gc();
          System.out.println(".");
          sleep(1000);
        }
        forLoop.stopNow();
        whileLoop.stopNow();
        doWhileLoop.stopNow();
        garbage.stopNow();
        System.out.println("Done.");
    }

    public static void sleep(int ms) {
        try {
            Thread.sleep(ms);
        } catch (InterruptedException ie) {
            System.err.println("sleep was interrupted");
        }
    }
}

class InfiniteWhileLoop extends Thread {
  volatile private boolean keepGoing = true;
  public void run() {
    int i = 0;
    while (keepGoing) {
      i++;
    }
  }
  public void stopNow() {
    keepGoing = false;
  }
}

class InfiniteDoWhileLoop extends Thread {
  volatile private boolean keepGoing = true;
  public void run() {
    int i = 0;
    do {
      i++;
    } while (keepGoing);
  }
  public void stopNow() {
    keepGoing = false;
  }
}

class InfiniteForLoop extends Thread {
  int count = 100000;
  volatile private boolean keepGoing = true;
  public void run() {
    int i = 0;
    for (int j = 0; keepGoing; j++) {
      i += j;
    }
  }
  public void stopNow() {
    keepGoing = false;
  }
}

class MakeGarbage extends Thread {
  volatile private boolean keepGoing = true;
  public void run() {
    while (keepGoing) {
      byte[] garbage = new byte[100000];
    }
  }
  public void stopNow() {
    keepGoing = false;
  }
}


text:
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */

import keyMirror from 'react/lib/keyMirror';

export default keyMirror({
  GET_PAGE: null,
  RECEIVE_PAGE: null,
  CHANGE_LOCATION: null,
  ON_LOGIN: null,
  TOGGLE_MENU: null
});


text:
#include "Mesh.h"

Mesh::Mesh(ID3D11Buffer* vb)
	: m_VertexBuffer(vb)
	, m_TrianglesCount(0)
{}

Mesh::~Mesh()
{
	SafeRelease(m_VertexBuffer);
}

ID3D11Buffer* Mesh::GetVertexBuffer() const
{
	return m_VertexBuffer;
}

void Mesh::AddSubset(SubsetPtr subset)
{
	m_Subsets.push_back(subset);
	m_TrianglesCount += subset->GetIndicesCount() / 3;
}

SubsetPtr Mesh::GetSubset(size_t id) const
{
	assert(id < m_Subsets.size());
	return m_Subsets[id];
}


text:
<?php

class Campaigner_trigger_field_option {

	/* --------------------------------------------------------------
	 * PRIVATE PROPERTIES.
	 * ------------------------------------------------------------ */

	private $_id;
	private $_label;

	/* --------------------------------------------------------------
	 * PUBLIC METHODS
	 * ------------------------------------------------------------ */

	/**
	 * Constructor.
	 *
	 * @access	public
	 * @param 	array 		$properties		Initial settings.
	 * @return	void
	 */
	public function __construct(Array $properties = array())
	{
		$this->reset();

		foreach ($properties AS $property => $value)
		{
			$method_name = 'set_' .$property;

			if (method_exists($this, $method_name))
			{
				$this->$method_name($value);
			}
		}
	}

	/**
	 * Returns the option ID.
	 *
	 * @access	public
	 * @return	string
	 */
	public function get_id()
	{
		return $this->_id;
	}

	/**
	 * Returns the option label.
	 *
	 * @access	public
	 * @return	string
	 */
	public function get_label()
	{
		return $this->_label;
	}

	/**
	 * Resets all the properties to their default values.
	 *
	 * @access	public
	 * @return	EI_member_field
	 */
	public function reset()
	{
		$this->_id 		= '';
		$this->_label	= '';
	}

	/**
	 * Sets the option ID.
	 *
	 * @access	public
	 * @param 	string	    $id			The string ID.
	 * @return	string
	 */
	public function set_id($id)
	{
		if (is_string($id) OR is_numeric($id))
		{
			$this->_id = (string) $id;
		}

		return $this->get_id();
	}

	/**
	 * Sets the option label.
	 *
	 * @access	public
	 * @param 	string		$label		The option label.
	 * @return	string
	 */
	public function set_label($label)
	{
		if (is_string($label))
		{
			$this->_label = $label;
		}

		return $this->get_label();
	}

	/**
	 * Returns the instance as an array.
	 *
	 * @access	public
	 * @return	array
	 */
	public function to_array()
	{
		return array(
			'id'		=> $this->get_id(),
			'label'		=> $this->get_label()
		);
	}

}

/* End of file		: campaigner_trigger_field_option.php */
/* File location	: third_party/campaigner/classes/campaigner_trigger_field_option.php */


text:
package publisher

import (
	"expvar"
	"sync"

	"github.com/elastic/beats/libbeat/common"
	"github.com/elastic/beats/libbeat/outputs"
)

// Metrics that can retrieved through the expvar web interface.
var (
	messagesInWorkerQueues = expvar.NewInt("libbeatMessagesInWorkerQueues")
)

type worker interface {
	send(m message)
}

type messageWorker struct {
	queue     chan message
	bulkQueue chan message
	ws        *workerSignal
	handler   messageHandler
}

type message struct {
	context context
	event   common.MapStr
	events  []common.MapStr
}

type workerSignal struct {
	done chan struct{}
	wg   sync.WaitGroup
}

type messageHandler interface {
	onMessage(m message)
	onStop()
}

func newMessageWorker(ws *workerSignal, hwm, bulkHWM int, h messageHandler) *messageWorker {
	p := &messageWorker{}
	p.init(ws, hwm, bulkHWM, h)
	return p
}

func (p *messageWorker) init(ws *workerSignal, hwm, bulkHWM int, h messageHandler) {
	p.queue = make(chan message, hwm)
	p.bulkQueue = make(chan message, bulkHWM)
	p.ws = ws
	p.handler = h
	ws.wg.Add(1)
	go p.run()
}

func (p *messageWorker) run() {
	defer p.shutdown()
	for {
		select {
		case <-p.ws.done:
			return
		case m := <-p.queue:
			messagesInWorkerQueues.Add(-1)
			p.handler.onMessage(m)
		case m := <-p.bulkQueue:
			messagesInWorkerQueues.Add(-1)
			p.handler.onMessage(m)
		}
	}
}

func (p *messageWorker) shutdown() {
	p.handler.onStop()
	stopQueue(p.queue)
	stopQueue(p.bulkQueue)
	p.ws.wg.Done()
}

func (p *messageWorker) send(m message) {
	if m.event != nil {
		p.queue <- m
	} else {
		p.bulkQueue <- m
	}
	messagesInWorkerQueues.Add(1)
}

func (ws *workerSignal) stop() {
	close(ws.done)
	ws.wg.Wait()
}

func newWorkerSignal() *workerSignal {
	w := &workerSignal{}
	w.Init()
	return w
}

func (ws *workerSignal) Init() {
	ws.done = make(chan struct{})
}

func stopQueue(qu chan message) {
	close(qu)
	for msg := range qu { // clear queue and send fail signal
		outputs.SignalFailed(msg.context.signal, nil)
	}
}


text:
using MYOB.AccountRight.SDK.Services.Sale;
using NUnit.Framework;

namespace SDK.Test.Services
{
    [TestFixture]
    public class QuoteServiceTests
    {
        [Test]
        public void ServiceHasTheExpectedRoute()
        {
            Assert.AreEqual("Sale/Quote", new QuoteService(null, null).Route);
        }
    }
}


text:
/// <reference path="../_references.ts"/>

module powerbitests {
    import lineStyle = powerbi.visuals.lineStyle;
    import ColorHelper = powerbi.visuals.ColorHelper;
    import DataColorPalette = powerbi.visuals.DataColorPalette;
    import ObjectEnumerationBuilder = powerbi.visuals.ObjectEnumerationBuilder;
    import TrendLineHelper = powerbi.visuals.TrendLineHelper;
    import TrendLine = powerbi.visuals.TrendLine;
    import DataViewTransform = powerbi.data.DataViewTransform;

    describe('TrendLineHelper', () => {
        let samplePoints: powerbi.visuals.IPoint[] = [{ x: 0, y: 0 }, { x: 100, y: 100 }];

        let defaultColors: DataColorPalette;

        beforeEach(() => {
            defaultColors = new DataColorPalette();
        });

        describe('enumerateObjectInstances', () => {
            it('with no trend lines generates a trend line object', () => {
                let enumerationBuilder = new ObjectEnumerationBuilder();
                TrendLineHelper.enumerateObjectInstances(enumerationBuilder, undefined);
                let instances = enumerationBuilder.complete().instances;

                expect(instances.length).toBe(1);
                expect(instances[0]).toEqual({
                    selector: null,
                    properties: {
                        show: false,
                        lineColor: TrendLineHelper.defaults.lineColor,
                        transparency: TrendLineHelper.defaults.transparency,
                        style: TrendLineHelper.defaults.lineStyle,
                        combineSeries: TrendLineHelper.defaults.combineSeries,
                    },
                    objectName: 'trend',
                });
            });

            it('with trend line object', () => {
                let enumerationBuilder = new ObjectEnumerationBuilder();

                let trendLine: TrendLine = {
                    points: samplePoints,
                    show: true,
                    lineColor: { solid: { color: 'red' } },
                    style: lineStyle.dotted,
                    transparency: 20,
                    combineSeries: true,
                    y2Axis: false,
                    useHighlightValues: TrendLineHelper.defaults.useHighlightValues,
                };

                TrendLineHelper.enumerateObjectInstances(enumerationBuilder, [trendLine]);
                let instances = enumerationBuilder.complete().instances;

                expect(instances[0]).toEqual({
                    selector: null,
                    properties: {
                        show: true,
                        lineColor: { solid: { color: 'red' } },
                        style: lineStyle.dotted,
                        transparency: 20,
                        combineSeries: true,
                        useHighlightValues: TrendLineHelper.defaults.useHighlightValues,
                    },
                    objectName: 'trend',
                });
            });
        });

        describe('readDataView', () => {
            it('invalid data view', () => {
                expect(TrendLineHelper.readDataView(null, null, false, defaultColors)).toBeUndefined();

                expect(TrendLineHelper.readDataView(
                    { single: { value: 10 }, metadata: { columns: [] } },
                    { single: { value: 10 }, metadata: { columns: [] } },
                    false,
                    defaultColors)).toBeUndefined();

                expect(TrendLineHelper.readDataView(
                    {
                        categorical: {
                            categories: [],
                            values: DataViewTransform.createValueColumns(),
                        },
                        metadata: {
                            columns: []
                        },
                    },
                    {
                        categorical: {
                            categories: [],
                            values: DataViewTransform.createValueColumns(),
                        },
                        metadata: {
                            columns: []
                        },
                    },
                    false,
                    defaultColors)).toBeUndefined();

                // Only category column
                let categoryField = powerbi.data.SQExprBuilder.entity('schema', 'table', 'category_column');
                let categoryValues = ['a', 'b'];
                let dataViewWithOnlyCategories = powerbi.data.createCategoricalDataViewBuilder().withCategory({
                    identityFrom: {
                        fields: [categoryField],
                        identities: _.map(categoryValues, v => mocks.dataViewScopeIdentity(v))
                    },
                    source: {
                        displayName: 'category column',
                        isMeasure: false,
                        index: 0,
                        queryName: 'select1',
                        roles: { 'Category': true },
                        type: powerbi.ValueType.fromDescriptor({ text: true }),
                    },
                    values: categoryValues
                }).build();
                expect(TrendLineHelper.readDataView(dataViewWithOnlyCategories, dataViewWithOnlyCategories, false, defaultColors)).toBeUndefined();

                // Only value column
                let dataViewWithOnlyValues = powerbi.data.createCategoricalDataViewBuilder().withValues({
                    columns: [
                        {
                            source: {
                                displayName: 'value column',
                                isMeasure: false,
                                index: 0,
                                queryName: 'select1',
                                roles: { 'Y': true },
                                type: powerbi.ValueType.fromDescriptor({ numeric: true }),
                            },
                            values: [1],
                        }
                    ]
                }).build();
                expect(TrendLineHelper.readDataView(dataViewWithOnlyValues, dataViewWithOnlyValues, false, defaultColors)).toBeUndefined();
            });

            it('combined series', () => {
                let dataViews = new helpers.TrendLineBuilder({
                    combineSeries: true,
                    multipleSeries: true,
                }).buildDataViews();

                expect(TrendLineHelper.readDataView(dataViews[1], dataViews[0], false, defaultColors)).toEqual([{
                    points: [{ x: 1, y: 10 }, { x: 6, y: 60 }],
                    show: true,
                    lineColor: { solid: { color: '#000' } },
                    transparency: TrendLineHelper.defaults.transparency,
                    style: TrendLineHelper.defaults.lineStyle,
                    combineSeries: true,
                    y2Axis: false,
                    useHighlightValues: TrendLineHelper.defaults.useHighlightValues,
                }]);
            });

            it('grouped data view for multiple series', () => {
                let dataViews = new helpers.TrendLineBuilder({
                    combineSeries: false,
                    dynamicSeries: true,
                    multipleSeries: true,
                }).buildDataViews();

                let sourceDataView = dataViews[0];
                let groups = sourceDataView.categorical.values.grouped();
                let colorHelper = new ColorHelper(defaultColors);

                expect(TrendLineHelper.readDataView(dataViews[1], dataViews[0], false, defaultColors)).toEqual([
                    {
                        points: [{ x: 1, y: 10 }, { x: 6, y: 60 }],
                        show: true,
                        lineColor: { solid: { color: TrendLineHelper.darkenTrendLineColor(colorHelper.getColorForSeriesValue(null, sourceDataView.categorical.values.identityFields, groups[0].name)) } },
                        transparency: TrendLineHelper.defaults.transparency,
                        style: TrendLineHelper.defaults.lineStyle,
                        combineSeries: false,
                        y2Axis: false,
                        useHighlightValues: TrendLineHelper.defaults.useHighlightValues,
                    }, {
                        points: [{ x: 1, y: 15 }, { x: 6, y: 65 }],
                        show: true,
                        lineColor: { solid: { color: TrendLineHelper.darkenTrendLineColor(colorHelper.getColorForSeriesValue(null, sourceDataView.categorical.values.identityFields, groups[1].name)) } },
                        transparency: TrendLineHelper.defaults.transparency,
                        style: TrendLineHelper.defaults.lineStyle,
                        combineSeries: false,
                        y2Axis: false,
                        useHighlightValues: TrendLineHelper.defaults.useHighlightValues,
                    }]);
            });

            describe('explicit colors in source data view are matched', () => {
                it('dynamic series color', () => {
                    let dataViews = new helpers.TrendLineBuilder({
                        combineSeries: false,
                        dynamicSeries: true,
                        multipleSeries: true,
                    }).buildDataViews();

                    let sourceDataView = dataViews[0];
                    let groups = sourceDataView.categorical.values.grouped();
                    groups[1].objects = {
                        dataPoint: {
                            fill: { solid: { color: '#123' } }
                        }
                    };
                    sourceDataView.categorical.values.grouped = () => groups;
                    let colorHelper = new ColorHelper(defaultColors, { objectName: 'dataPoint', propertyName: 'fill' });

                    expect(TrendLineHelper.readDataView(dataViews[1], dataViews[0], false, defaultColors)).toEqual([
                        {
                            points: [{ x: 1, y: 10 }, { x: 6, y: 60 }],
                            show: true,
                            lineColor: { solid: { color: TrendLineHelper.darkenTrendLineColor(colorHelper.getColorForSeriesValue(groups[0].objects, sourceDataView.categorical.values.identityFields, groups[0].name)) } },
                            transparency: TrendLineHelper.defaults.transparency,
                            style: TrendLineHelper.defaults.lineStyle,
                            combineSeries: false,
                            y2Axis: false,
                            useHighlightValues: TrendLineHelper.defaults.useHighlightValues,
                        }, {
                            points: [{ x: 1, y: 15 }, { x: 6, y: 65 }],
                            show: true,
                            lineColor: { solid: { color: TrendLineHelper.darkenTrendLineColor('#123') } },
                            transparency: TrendLineHelper.defaults.transparency,
                            style: TrendLineHelper.defaults.lineStyle,
                            combineSeries: false,
                            y2Axis: false,
                            useHighlightValues: TrendLineHelper.defaults.useHighlightValues,
                        }]);
                });

                it('static series color', () => {
                    let dataViews = new helpers.TrendLineBuilder({
                        combineSeries: false,
                        dynamicSeries: false,
                        multipleSeries: true,
                    }).buildDataViews();

                    let sourceDataView = dataViews[0];
                    sourceDataView.categorical.values[1].source.objects = {
                        dataPoint: {
                            fill: { solid: { color: '#123' } }
                        }
                    };
                    let colorHelper = new ColorHelper(defaultColors, { objectName: 'dataPoint', propertyName: 'fill' });

                    expect(TrendLineHelper.readDataView(dataViews[1], dataViews[0], false, defaultColors)).toEqual([
                        {
                            points: [{ x: 1, y: 10 }, { x: 6, y: 60 }],
                            show: true,
                            lineColor: { solid: { color: TrendLineHelper.darkenTrendLineColor(colorHelper.getColorForMeasure(sourceDataView.categorical.values[0].source.objects, sourceDataView.categorical.values[0].source.queryName)) } },
                            transparency: TrendLineHelper.defaults.transparency,
                            style: TrendLineHelper.defaults.lineStyle,
                            combineSeries: false,
                            y2Axis: false,
                            useHighlightValues: TrendLineHelper.defaults.useHighlightValues,
                        }, {
                            points: [{ x: 1, y: 15 }, { x: 6, y: 65 }],
                            show: true,
                            lineColor: { solid: { color: TrendLineHelper.darkenTrendLineColor('#123') } },
                            transparency: TrendLineHelper.defaults.transparency,
                            style: TrendLineHelper.defaults.lineStyle,
                            combineSeries: false,
                            y2Axis: false,
                            useHighlightValues: TrendLineHelper.defaults.useHighlightValues,
                        }]);
                });
            });

            it('legacy color', () => {
                let dataViews = new helpers.TrendLineBuilder({
                    combineSeries: true,
                }).buildDataViews();

                dataViews[1].categorical.values[0].source.objects = {
                    dataPoint: {
                        fill: { solid: { color: '#123' } },
                    }
                };

                expect(TrendLineHelper.readDataView(dataViews[1], dataViews[0], false, defaultColors)).toEqual([{
                    points: [{ x: 1, y: 10 }, { x: 6, y: 60 }],
                    show: true,
                    lineColor: { solid: { color: '#123' } },
                    transparency: TrendLineHelper.defaults.transparency,
                    style: TrendLineHelper.defaults.lineStyle,
                    combineSeries: true,
                    y2Axis: false,
                    useHighlightValues: TrendLineHelper.defaults.useHighlightValues,
                }]);

                // --- Legacy color overrides line color
                dataViews[1].metadata.objects = {
                    trend: {
                        show: true,
                        lineColor: { solid: { color: '#456' } }
                    },
                    dataPoint: {
                        fill: { solid: { color: '#123' } },
                    }
                };

                expect(TrendLineHelper.readDataView(dataViews[1], dataViews[0], false, defaultColors)).toEqual([{
                    points: [{ x: 1, y: 10 }, { x: 6, y: 60 }],
                    show: true,
                    lineColor: { solid: { color: '#123' } },
                    transparency: TrendLineHelper.defaults.transparency,
                    style: TrendLineHelper.defaults.lineStyle,
                    combineSeries: true,
                    y2Axis: false,
                    useHighlightValues: TrendLineHelper.defaults.useHighlightValues,
                }]);
            });

            it('invalid numbers', () => {
                let dataViews = new helpers.TrendLineBuilder({}).buildDataViews();

                let regressionDataView = dataViews[1];
                regressionDataView.categorical.categories[0].values = [20, null];
                regressionDataView.categorical.values[0].values = [NaN, 100];
                regressionDataView.categorical.values.grouped()[0].values[0].values = [NaN, 100];

                expect(TrendLineHelper.readDataView(dataViews[1], dataViews[0], false, defaultColors)).toEqual([{
                    points: [],
                    show: true,
                    lineColor: TrendLineHelper.defaults.lineColor,
                    transparency: TrendLineHelper.defaults.transparency,
                    style: TrendLineHelper.defaults.lineStyle,
                    combineSeries: true,
                    y2Axis: false,
                    useHighlightValues: TrendLineHelper.defaults.useHighlightValues,
                }]);
            });

            it('use y2 axis', () => {
                let dataViews = new helpers.TrendLineBuilder({}).buildDataViews();

                expect(TrendLineHelper.readDataView(dataViews[1], dataViews[0], true, defaultColors)).toEqual([{
                    points: [{ x: 1, y: 10 }, { x: 6, y: 60 }],
                    show: true,
                    lineColor: { solid: { color: '#000' } },
                    transparency: TrendLineHelper.defaults.transparency,
                    style: TrendLineHelper.defaults.lineStyle,
                    combineSeries: true,
                    y2Axis: true,
                    useHighlightValues: TrendLineHelper.defaults.useHighlightValues,
                }]);
            });

            it('useHighlightValues', () => {
                let dataViews = new helpers.TrendLineBuilder({
                    highlights: true,
                }).buildDataViews();

                expect(TrendLineHelper.readDataView(dataViews[1], dataViews[0], false, defaultColors)).toEqual([{
                    points: [{ x: 1, y: 3 }, { x: 6, y: 6 }],
                    show: true,
                    lineColor: { solid: { color: '#000' } },
                    transparency: TrendLineHelper.defaults.transparency,
                    style: TrendLineHelper.defaults.lineStyle,
                    combineSeries: true,
                    y2Axis: false,
                    useHighlightValues: TrendLineHelper.defaults.useHighlightValues,
                }]);
            });
        });

        it('isDataViewForRegression', () => {
            let dataView: powerbi.DataView = {
                single: {
                    value: 10
                },
                metadata: {
                    columns: [
                        {
                            displayName: 'column1',
                            index: 0,
                            isMeasure: true,
                            queryName: 'select1',
                            roles: {
                                'Category': true,
                            },
                            type: powerbi.ValueType.fromDescriptor({ numeric: true }),
                        }
                    ]
                }
            };

            expect(TrendLineHelper.isDataViewForRegression(dataView)).toBe(false);

            dataView.metadata.columns[0].roles['regression.X'] = true;

            expect(TrendLineHelper.isDataViewForRegression(dataView)).toBe(true);
        });
    });
}


text:
BasicTests
==========

Learning how to use CTest


text:
require 'test_helper'

module ActiveModel
  class Serializer
    class SerializerForWithNamespaceTest < ActiveSupport::TestCase
      class Book < ::Model
        attributes :title, :author_name
        associations :publisher, :pages
      end
      class Page < ::Model; attributes :number, :text end
      class Publisher < ::Model; attributes :name end

      module Api
        module V3
          class BookSerializer < ActiveModel::Serializer
            attributes :title, :author_name

            has_many :pages
            belongs_to :publisher
          end

          class PageSerializer < ActiveModel::Serializer
            attributes :number, :text
          end

          class PublisherSerializer < ActiveModel::Serializer
            attributes :name
          end
        end
      end

      class BookSerializer < ActiveModel::Serializer
        attributes :title, :author_name
      end
      test 'resource without a namespace' do
        book = Book.new(title: 'A Post', author_name: 'hello')

        # TODO: this should be able to pull up this serializer without explicitly specifying the serializer
        #       currently, with no options, it still uses the Api::V3 serializer
        result = ActiveModelSerializers::SerializableResource.new(book, serializer: BookSerializer).serializable_hash

        expected = { title: 'A Post', author_name: 'hello' }
        assert_equal expected, result
      end

      test 'resource with namespace' do
        book = Book.new(title: 'A Post', author_name: 'hi')

        result = ActiveModelSerializers::SerializableResource.new(book, namespace: Api::V3).serializable_hash

        expected = { title: 'A Post', author_name: 'hi', pages: nil, publisher: nil }
        assert_equal expected, result
      end

      test 'has_many with nested serializer under the namespace' do
        page = Page.new(number: 1, text: 'hello')
        book = Book.new(title: 'A Post', author_name: 'hi', pages: [page])

        result = ActiveModelSerializers::SerializableResource.new(book, namespace: Api::V3).serializable_hash

        expected = {
          title: 'A Post', author_name: 'hi',
          publisher: nil,
          pages: [{
            number: 1, text: 'hello'
          }]
        }
        assert_equal expected, result
      end

      test 'belongs_to with nested serializer under the namespace' do
        publisher = Publisher.new(name: 'Disney')
        book = Book.new(title: 'A Post', author_name: 'hi', publisher: publisher)

        result = ActiveModelSerializers::SerializableResource.new(book, namespace: Api::V3).serializable_hash

        expected = {
          title: 'A Post', author_name: 'hi',
          pages: nil,
          publisher: {
            name: 'Disney'
          }
        }
        assert_equal expected, result
      end
    end
  end
end


text:
from django.core.management.base import NoArgsCommand
from django.core.management.commands.test import Command as TestCommand
from django.core.management import call_command

class Command(NoArgsCommand):
    option_list = TestCommand.option_list
    help = 'Runs the test suite for all applications in settings.MY_INSTALLED_APPS.'

    requires_model_validation = False

    def handle_noargs(self, **options):
        from django.conf import settings

        print "Running tests for the following apps:\n{0}\n".format(
            ', '.join(settings.MY_INSTALLED_APPS))

        call_command('test', *settings.MY_INSTALLED_APPS, **options)


text:
#include "textsearchtoolbar.h"
#include "lineedit.h"
#include "highlighter.h"

TextSearchToolbar::TextSearchToolbar(QTextEdit * textEdit, QWidget *parent) :
       QToolBar(parent), textEdit_(textEdit){

     setWindowTitle(tr("Search bar"));
     setObjectName(tr("Searchtoolbar"));

     closeSearch = new QToolButton(this);
     closeSearch->setText("X");
     closeSearch->setShortcut(Qt::Key_Escape);
     addWidget(closeSearch);

     searchLine_ = new LineEdit(this);
     searchLine_->setPlaceholderText(tr("Enter search argument"));
     addWidget(searchLine_);

     findPrevious = new QToolButton(this);
     findPrevious->setText(tr("Find &previous"));
     addWidget(findPrevious);

     findNext = new QToolButton(this);
     findNext->setText(tr("Find &next"));
     addWidget(findNext);

     caseSensitiveBox = new QCheckBox(this);
     caseSensitiveBox->setText(tr("&Case sensitive"));
     addWidget(caseSensitiveBox);

     connect(closeSearch, SIGNAL(clicked(bool)), this, SLOT(hide()));

     connect(searchLine_, SIGNAL(textChanged(QString)), this, SLOT(selectNextExpression()));
     connect(findNext, SIGNAL(clicked(bool)), SLOT(selectNextExpression()));
     connect(findPrevious, SIGNAL(clicked(bool)), SLOT(selectPreviousExpression()));
     connect(searchLine_, SIGNAL(returnPressed()), SLOT(selectNextExpression()));
}

void TextSearchToolbar::selectNextExpression(){
     if(this->caseSensitiveBox->isChecked()){
       if(!textEdit_->find(this->searchLine_->text(), QTextDocument::FindCaseSensitively)){
         textEdit_->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
         textEdit_->find(this->searchLine_->text(), QTextDocument::FindCaseSensitively);
       }
     }
     else{
       if(!textEdit_->find(this->searchLine_->text())){
         textEdit_->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
         textEdit_->find(this->searchLine_->text());
       }
     }
     highlightText(this->searchLine_->text());
}

void TextSearchToolbar::setText(const QString &text)
{
    searchLine_->setText(text);
    highlightText(textEdit_->textCursor().selectedText());
}

void TextSearchToolbar::selectPreviousExpression(){
     if(this->caseSensitiveBox->isChecked()){
       if(!textEdit_->find(this->searchLine_->text(), QTextDocument::FindCaseSensitively |
           QTextDocument::FindBackward)){
         textEdit_->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
         textEdit_->find(this->searchLine_->text(), QTextDocument::FindCaseSensitively |
           QTextDocument::FindBackward);
       }
     }
     else{
       if(!textEdit_->find(this->searchLine_->text(), QTextDocument::FindBackward)){
         textEdit_->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
         textEdit_->find(this->searchLine_->text(), QTextDocument::FindBackward);
       }
     }
     highlightText(this->searchLine_->text());
}

void TextSearchToolbar::highlightText(QString str){
     highlighter = new Highlighter(textEdit_->document());
     highlighter->expression = str;
     if(this->caseSensitiveBox->isChecked())
       highlighter->caseSensitive = true;
     else
       highlighter->caseSensitive = false;
     connect(closeSearch, SIGNAL(clicked(bool)), highlighter, SLOT(deleteLater()));
     connect(closeSearch, SIGNAL(clicked(bool)), textEdit_, SLOT(setFocus()));
     connect(closeSearch, SIGNAL(clicked(bool)), this->searchLine_, SLOT(clear()));

     textEdit_->ensureCursorVisible();
}


text:
{{ site.locales[site.default_locale].Copyright_Notice }}

  {% if site.default_locale == "cn" %}

  {% else %}

  {% endif %}


text:
using Xunit;
using Piranha.Models;

namespace Piranha.Tests.Hooks;

[Collection("Integration tests")]
public class AliasHookTests : BaseTestsAsync
{
    private const string ALIAS = "/alias-url";
    private readonly Guid SITE_ID = Guid.NewGuid();
    private readonly Guid ID = Guid.NewGuid();

    public class AliasOnLoadException : Exception {}
    public class AliasOnBeforeSaveException : Exception {}
    public class AliasOnAfterSaveException : Exception {}
    public class AliasOnBeforeDeleteException : Exception {}
    public class AliasOnAfterDeleteException : Exception {}

    public override async Task InitializeAsync()
    {
        using (var api = CreateApi())
        {
            // Initialize
            Piranha.App.Init(api);

            // Create site
            await api.Sites.SaveAsync(new Site
            {
                Id = SITE_ID,
                Title = "Alias Hook Site"
            });

            // Create test alias
            await api.Aliases.SaveAsync(new Alias
            {
                Id = ID,
                SiteId = SITE_ID,
                AliasUrl = ALIAS,
                RedirectUrl = "/redirect"
            });
        }
    }

    public override async Task DisposeAsync()
    {
        using (var api = CreateApi())
        {
            // Remove test data
            var aliases = await api.Aliases.GetAllAsync();

            foreach (var a in aliases)
            {
                await api.Aliases.DeleteAsync(a);
            }
            await api.Sites.DeleteAsync(SITE_ID);
        }
    }

    [Fact]
    public async Task OnLoad()
    {
        Piranha.App.Hooks.Alias.RegisterOnLoad(m => throw new AliasOnLoadException());
        using (var api = CreateApi())
        {
            await Assert.ThrowsAsync<AliasOnLoadException>(async () =>
            {
                await api.Aliases.GetByIdAsync(ID);
            });
        }
        Piranha.App.Hooks.Alias.Clear();
    }

    [Fact]
    public async Task OnBeforeSave()
    {
        Piranha.App.Hooks.Alias.RegisterOnBeforeSave(m => throw new AliasOnBeforeSaveException());
        using (var api = CreateApi())
        {
            await Assert.ThrowsAsync<AliasOnBeforeSaveException>(async () =>
            {
                await api.Aliases.SaveAsync(new Alias
                {
                    SiteId = SITE_ID,
                    AliasUrl = "/my-first-alias",
                    RedirectUrl = "/my-first-redirect"
                });
            });
        }
        Piranha.App.Hooks.Alias.Clear();
    }

    [Fact]
    public async Task OnAfterSave()
    {
        Piranha.App.Hooks.Alias.RegisterOnAfterSave(m => throw new AliasOnAfterSaveException());
        using (var api = CreateApi())
        {
            await Assert.ThrowsAsync<AliasOnAfterSaveException>(async () =>
            {
                await api.Aliases.SaveAsync(new Alias
                {
                    SiteId = SITE_ID,
                    AliasUrl = "/my-second-alias",
                    RedirectUrl = "/my-seconf-redirect"
                });
            });
        }
        Piranha.App.Hooks.Alias.Clear();
    }

    [Fact]
    public async Task OnBeforeDelete()
    {
        Piranha.App.Hooks.Alias.RegisterOnBeforeDelete(m => throw new AliasOnBeforeDeleteException());
        using (var api = CreateApi())
        {
            await Assert.ThrowsAsync<AliasOnBeforeDeleteException>(async () =>
            {
                await api.Aliases.DeleteAsync(ID);
            });
        }
        Piranha.App.Hooks.Alias.Clear();
    }

    [Fact]
    public async Task OnAfterDelete()
    {
        Piranha.App.Hooks.Alias.RegisterOnAfterDelete(m => throw new AliasOnAfterDeleteException());
        using (var api = CreateApi())
        {
            await Assert.ThrowsAsync<AliasOnAfterDeleteException>(async () =>
            {
                await api.Aliases.DeleteAsync(ID);
            });
        }
        Piranha.App.Hooks.Alias.Clear();
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.apache.camel</groupId>
    <artifactId>maven-plugins</artifactId>
    <version>2.16.1-SNAPSHOT</version>
  </parent>

  <artifactId>camel-eip-documentation-enricher-maven-plugin</artifactId>
  <packaging>maven-plugin</packaging>
  <name>Camel :: Maven Plugins :: Camel EIP Documentation Enricher Plugin</name>
  <description>Adds documentation to camel xsd schema</description>
  <dependencies>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.maven.reporting</groupId>
      <artifactId>maven-reporting-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.reporting</groupId>
      <artifactId>maven-reporting-impl</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-utils</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <version>3.3</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-descriptor</artifactId>
      <version>2.2.1</version>
      <exclusions>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-artifact</artifactId>
      <version>2.2.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>${commons-lang3-version}</version>
    </dependency>

    <!-- add some logging to the classpath -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>log4j-over-slf4j</artifactId>
      <version>${slf4j-version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
      <version>${hamcrest-version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
    <!-- Camel annotations in provided scope to avoid compile errors in IDEs -->
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>spi-annotations</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-plugin-plugin</artifactId>
          <version>3.3</version>
          <configuration>
            <!-- see http://jira.codehaus.org/browse/MNG-5346 -->
            <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
          </configuration>
          <executions>
            <execution>
              <id>mojo-descriptor</id>
              <goals>
                  <goal>descriptor</goal>
              </goals>
            </execution>
            <execution>
              <id>help-goal</id>
              <goals>
                  <goal>helpmojo</goal>
              </goals>
            </execution>
          </executions>
          </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
    </plugins>
  </build>

</project>