text:
package mixcoin

import (
	"log"
)

type ReceivingPool struct {
	putc    chan PoolItem
	recvc   chan []string
	scanc   chan []PoolItem
	keysc   chan chan []string
	filterc chan func(PoolItem) bool
}

func NewReceivingPool() *ReceivingPool {
	p := &ReceivingPool{
		putc:    make(chan PoolItem),
		recvc:   make(chan []string),
		scanc:   make(chan []PoolItem),
		keysc:   make(chan chan []string),
		filterc: make(chan func(PoolItem) bool),
	}
	go p.run()
	return p
}

func (p *ReceivingPool) Put(item PoolItem) {
	p.putc <- item
}

func (p *ReceivingPool) Scan(keys []string) []PoolItem {
	p.recvc <- keys
	return <-p.scanc
}

func (p *ReceivingPool) Keys() []string {
	ch := make(chan []string)
	p.keysc <- ch
	return <-ch
}

func (p *ReceivingPool) Filter(f func(PoolItem) bool) {
	p.filterc <- f
}

func (p *ReceivingPool) run() {
	table := make(map[string]PoolItem)

	for {
		select {
		case item := <-p.putc:
			table[item.Key()] = item

		case ch := <-p.keysc:
			var keys []string
			for key, _ := range table {
				keys = append(keys, key)
			}
			ch <- keys

		case keys := <-p.recvc:
			var items []PoolItem
			for _, key := range keys {
				item, ok := table[key]
				if ok {
					items = append(items, item)
					delete(table, key)
				}
			}
			p.scanc <- items

		case f := <-p.filterc:
			var remove []string
			for key, item := range table {
				if f(item) {
					log.Printf("pruning key %s", key)
					remove = append(remove, key)
				}
			}
			for _, key := range remove {
				delete(table, key)
				db.Delete(key)
			}
		}
	}
}


text:
using namespace blink;

namespace {

class NotReached : public ScriptFunction {
public:
    static v8::Local<v8::Function> createFunction(ScriptState* scriptState)
    {
        NotReached* self = new NotReached(scriptState);
        return self->bindToV8Function();
    }

private:
    explicit NotReached(ScriptState* scriptState)
        : ScriptFunction(scriptState)
    {
    }

    ScriptValue call(ScriptValue) override;
};

ScriptValue NotReached::call(ScriptValue)
{
    EXPECT_TRUE(false) << "'Unreachable' code was reached";
    return ScriptValue();
}

class StubFunction : public ScriptFunction {
public:
    static v8::Local<v8::Function> createFunction(ScriptState* scriptState, ScriptValue& value, size_t& callCount)
    {
        StubFunction* self = new StubFunction(scriptState, value, callCount);
        return self->bindToV8Function();
    }

private:
    StubFunction(ScriptState* scriptState, ScriptValue& value, size_t& callCount)
        : ScriptFunction(scriptState)
        , m_value(value)
        , m_callCount(callCount)
    {
    }

    ScriptValue call(ScriptValue arg) override
    {
        m_value = arg;
        m_callCount++;
        return ScriptValue();
    }

    ScriptValue& m_value;
    size_t& m_callCount;
};

class GarbageCollectedHolder : public GarbageCollectedScriptWrappable {
public:
    typedef ScriptPromiseProperty<Member<GarbageCollectedScriptWrappable>, Member<GarbageCollectedScriptWrappable>, Member<GarbageCollectedScriptWrappable>> Property;
    GarbageCollectedHolder(ExecutionContext* executionContext)
        : GarbageCollectedScriptWrappable("holder")
        , m_property(new Property(executionContext, toGarbageCollectedScriptWrappable(), Property::Ready)) { }

    Property* property() { return m_property; }
    GarbageCollectedScriptWrappable* toGarbageCollectedScriptWrappable() { return this; }

    DEFINE_INLINE_VIRTUAL_TRACE()
    {
        GarbageCollectedScriptWrappable::trace(visitor);
        visitor->trace(m_property);
    }

private:
    Member<Property> m_property;
};

class RefCountedHolder : public RefCountedScriptWrappable {
public:
    // Do not resolve or reject the property with the holder itself. It leads
    // to a leak.
    typedef ScriptPromiseProperty<RefCountedScriptWrappable*, RefPtr<RefCountedScriptWrappable>, RefPtr<RefCountedScriptWrappable>> Property;
    static PassRefPtr<RefCountedHolder> create(ExecutionContext* executionContext)
    {
        return adoptRef(new RefCountedHolder(executionContext));
    }
    Property* property() { return m_property; }
    RefCountedScriptWrappable* toRefCountedScriptWrappable() { return this; }

private:
    RefCountedHolder(ExecutionContext* executionContext)
        : RefCountedScriptWrappable("holder")
        , m_property(new Property(executionContext, toRefCountedScriptWrappable(), Property::Ready)) { }

    Persistent<Property> m_property;
};

class ScriptPromisePropertyTestBase {
public:
    ScriptPromisePropertyTestBase()
        : m_page(DummyPageHolder::create(IntSize(1, 1)))
    {
        v8::HandleScope handleScope(isolate());
        m_otherScriptState = ScriptStateForTesting::create(v8::Context::New(isolate()), DOMWrapperWorld::create(isolate(), 1));
    }

    virtual ~ScriptPromisePropertyTestBase()
    {
        m_page.clear();
        gc();
        Heap::collectAllGarbage();
    }

    Document& document() { return m_page->document(); }
    v8::Isolate* isolate() { return toIsolate(&document()); }
    ScriptState* mainScriptState() { return ScriptState::forMainWorld(document().frame()); }
    DOMWrapperWorld& mainWorld() { return mainScriptState()->world(); }
    ScriptState* otherScriptState() { return m_otherScriptState.get(); }
    DOMWrapperWorld& otherWorld() { return m_otherScriptState->world(); }
    ScriptState* currentScriptState() { return ScriptState::current(isolate()); }

    virtual void destroyContext()
    {
        m_page.clear();
        m_otherScriptState.clear();
        gc();
        Heap::collectGarbage(ThreadState::HeapPointersOnStack, ThreadState::GCWithSweep, Heap::ForcedGC);
    }

    void gc() { V8GCController::collectGarbage(v8::Isolate::GetCurrent()); }

    v8::Local<v8::Function> notReached(ScriptState* scriptState) { return NotReached::createFunction(scriptState); }
    v8::Local<v8::Function> stub(ScriptState* scriptState, ScriptValue& value, size_t& callCount) { return StubFunction::createFunction(scriptState, value, callCount); }

    template <typename T>
    ScriptValue wrap(DOMWrapperWorld& world, const T& value)
    {
        v8::HandleScope handleScope(isolate());
        ScriptState* scriptState = ScriptState::from(toV8Context(&document(), world));
        ScriptState::Scope scope(scriptState);
        return ScriptValue(scriptState, toV8(value, scriptState->context()->Global(), isolate()));
    }

private:
    OwnPtr<DummyPageHolder> m_page;
    RefPtr<ScriptState> m_otherScriptState;
};

// This is the main test class.
// If you want to examine a testcase independent of holder types, place the
// test on this class.
class ScriptPromisePropertyGarbageCollectedTest : public ScriptPromisePropertyTestBase, public ::testing::Test {
public:
    typedef GarbageCollectedHolder::Property Property;

    ScriptPromisePropertyGarbageCollectedTest()
        : m_holder(new GarbageCollectedHolder(&document()))
    {
    }

    GarbageCollectedHolder* holder() { return m_holder; }
    Property* property() { return m_holder->property(); }
    ScriptPromise promise(DOMWrapperWorld& world) { return property()->promise(world); }

    void destroyContext() override
    {
        m_holder = nullptr;
        ScriptPromisePropertyTestBase::destroyContext();
    }

private:
    Persistent<GarbageCollectedHolder> m_holder;
};

TEST_F(ScriptPromisePropertyGarbageCollectedTest, Promise_IsStableObjectInMainWorld)
{
    ScriptPromise v = property()->promise(DOMWrapperWorld::mainWorld());
    ScriptPromise w = property()->promise(DOMWrapperWorld::mainWorld());
    EXPECT_EQ(v, w);
    ASSERT_FALSE(v.isEmpty());
    {
        ScriptState::Scope scope(mainScriptState());
        EXPECT_EQ(v.v8Value().As<v8::Object>()->CreationContext(), toV8Context(&document(), mainWorld()));
    }
    EXPECT_EQ(Property::Pending, property()->state());
}

TEST_F(ScriptPromisePropertyGarbageCollectedTest, Promise_IsStableObjectInVariousWorlds)
{
    ScriptPromise u = property()->promise(otherWorld());
    ScriptPromise v = property()->promise(DOMWrapperWorld::mainWorld());
    ScriptPromise w = property()->promise(DOMWrapperWorld::mainWorld());
    EXPECT_NE(mainScriptState(), otherScriptState());
    EXPECT_NE(&mainWorld(), &otherWorld());
    EXPECT_NE(u, v);
    EXPECT_EQ(v, w);
    ASSERT_FALSE(u.isEmpty());
    ASSERT_FALSE(v.isEmpty());
    {
        ScriptState::Scope scope(otherScriptState());
        EXPECT_EQ(u.v8Value().As<v8::Object>()->CreationContext(), toV8Context(&document(), otherWorld()));
    }
    {
        ScriptState::Scope scope(mainScriptState());
        EXPECT_EQ(v.v8Value().As<v8::Object>()->CreationContext(), toV8Context(&document(), mainWorld()));
    }
    EXPECT_EQ(Property::Pending, property()->state());
}

TEST_F(ScriptPromisePropertyGarbageCollectedTest, Promise_IsStableObjectAfterSettling)
{
    ScriptPromise v = promise(DOMWrapperWorld::mainWorld());
    GarbageCollectedScriptWrappable* value = new GarbageCollectedScriptWrappable("value");

    property()->resolve(value);
    EXPECT_EQ(Property::Resolved, property()->state());

    ScriptPromise w = promise(DOMWrapperWorld::mainWorld());
    EXPECT_EQ(v, w);
    EXPECT_FALSE(v.isEmpty());
}

TEST_F(ScriptPromisePropertyGarbageCollectedTest, Promise_DoesNotImpedeGarbageCollection)
{
    ScriptValue holderWrapper = wrap(mainWorld(), holder()->toGarbageCollectedScriptWrappable());

    Persistent<GCObservation> observation;
    {
        ScriptState::Scope scope(mainScriptState());
        observation = GCObservation::create(promise(DOMWrapperWorld::mainWorld()).v8Value());
    }

    gc();
    EXPECT_FALSE(observation->wasCollected());

    holderWrapper.clear();
    gc();
    EXPECT_TRUE(observation->wasCollected());

    EXPECT_EQ(Property::Pending, property()->state());
}

TEST_F(ScriptPromisePropertyGarbageCollectedTest, Resolve_ResolvesScriptPromise)
{
    ScriptPromise promise = property()->promise(DOMWrapperWorld::mainWorld());
    ScriptPromise otherPromise = property()->promise(otherWorld());
    ScriptValue actual, otherActual;
    size_t nResolveCalls = 0;
    size_t nOtherResolveCalls = 0;

    {
        ScriptState::Scope scope(mainScriptState());
        promise.then(stub(currentScriptState(), actual, nResolveCalls), notReached(currentScriptState()));
    }

    {
        ScriptState::Scope scope(otherScriptState());
        otherPromise.then(stub(currentScriptState(), otherActual, nOtherResolveCalls), notReached(currentScriptState()));
    }

    EXPECT_NE(promise, otherPromise);

    GarbageCollectedScriptWrappable* value = new GarbageCollectedScriptWrappable("value");
    property()->resolve(value);
    EXPECT_EQ(Property::Resolved, property()->state());

    isolate()->RunMicrotasks();
    EXPECT_EQ(1u, nResolveCalls);
    EXPECT_EQ(1u, nOtherResolveCalls);
    EXPECT_EQ(wrap(mainWorld(), value), actual);
    EXPECT_NE(actual, otherActual);
    EXPECT_EQ(wrap(otherWorld(), value), otherActual);
}

TEST_F(ScriptPromisePropertyGarbageCollectedTest, ResolveAndGetPromiseOnOtherWorld)
{
    ScriptPromise promise = property()->promise(DOMWrapperWorld::mainWorld());
    ScriptPromise otherPromise = property()->promise(otherWorld());
    ScriptValue actual, otherActual;
    size_t nResolveCalls = 0;
    size_t nOtherResolveCalls = 0;

    {
        ScriptState::Scope scope(mainScriptState());
        promise.then(stub(currentScriptState(), actual, nResolveCalls), notReached(currentScriptState()));
    }

    EXPECT_NE(promise, otherPromise);
    GarbageCollectedScriptWrappable* value = new GarbageCollectedScriptWrappable("value");
    property()->resolve(value);
    EXPECT_EQ(Property::Resolved, property()->state());

    isolate()->RunMicrotasks();
    EXPECT_EQ(1u, nResolveCalls);
    EXPECT_EQ(0u, nOtherResolveCalls);

    {
        ScriptState::Scope scope(otherScriptState());
        otherPromise.then(stub(currentScriptState(), otherActual, nOtherResolveCalls), notReached(currentScriptState()));
    }

    isolate()->RunMicrotasks();
    EXPECT_EQ(1u, nResolveCalls);
    EXPECT_EQ(1u, nOtherResolveCalls);
    EXPECT_EQ(wrap(mainWorld(), value), actual);
    EXPECT_NE(actual, otherActual);
    EXPECT_EQ(wrap(otherWorld(), value), otherActual);
}

TEST_F(ScriptPromisePropertyGarbageCollectedTest, Reject_RejectsScriptPromise)
{
    GarbageCollectedScriptWrappable* reason = new GarbageCollectedScriptWrappable("reason");
    property()->reject(reason);
    EXPECT_EQ(Property::Rejected, property()->state());

    ScriptValue actual, otherActual;
    size_t nRejectCalls = 0;
    size_t nOtherRejectCalls = 0;
    {
        ScriptState::Scope scope(mainScriptState());
        property()->promise(DOMWrapperWorld::mainWorld()).then(notReached(currentScriptState()), stub(currentScriptState(), actual, nRejectCalls));
    }

    {
        ScriptState::Scope scope(otherScriptState());
        property()->promise(otherWorld()).then(notReached(currentScriptState()), stub(currentScriptState(), otherActual, nOtherRejectCalls));
    }

    isolate()->RunMicrotasks();
    EXPECT_EQ(1u, nRejectCalls);
    EXPECT_EQ(wrap(mainWorld(), reason), actual);
    EXPECT_EQ(1u, nOtherRejectCalls);
    EXPECT_NE(actual, otherActual);
    EXPECT_EQ(wrap(otherWorld(), reason), otherActual);
}

TEST_F(ScriptPromisePropertyGarbageCollectedTest, Promise_DeadContext)
{
    Property* property = this->property();
    property->resolve(new GarbageCollectedScriptWrappable("value"));
    EXPECT_EQ(Property::Resolved, property->state());

    destroyContext();

    EXPECT_TRUE(property->promise(DOMWrapperWorld::mainWorld()).isEmpty());
}

TEST_F(ScriptPromisePropertyGarbageCollectedTest, Resolve_DeadContext)
{
    Property* property = this->property();

    {
        ScriptState::Scope scope(mainScriptState());
        property->promise(DOMWrapperWorld::mainWorld()).then(notReached(currentScriptState()), notReached(currentScriptState()));
    }

    destroyContext();
    EXPECT_TRUE(!property->executionContext() || property->executionContext()->activeDOMObjectsAreStopped());

    property->resolve(new GarbageCollectedScriptWrappable("value"));
    EXPECT_EQ(Property::Pending, property->state());

    v8::Isolate::GetCurrent()->RunMicrotasks();
}

TEST_F(ScriptPromisePropertyGarbageCollectedTest, Reset)
{
    ScriptPromise oldPromise, newPromise;
    ScriptValue oldActual, newActual;
    GarbageCollectedScriptWrappable* oldValue = new GarbageCollectedScriptWrappable("old");
    GarbageCollectedScriptWrappable* newValue = new GarbageCollectedScriptWrappable("new");
    size_t nOldResolveCalls = 0;
    size_t nNewRejectCalls = 0;

    {
        ScriptState::Scope scope(mainScriptState());
        property()->resolve(oldValue);
        oldPromise = property()->promise(mainWorld());
        oldPromise.then(stub(currentScriptState(), oldActual, nOldResolveCalls), notReached(currentScriptState()));
    }

    property()->reset();

    {
        ScriptState::Scope scope(mainScriptState());
        newPromise = property()->promise(mainWorld());
        newPromise.then(notReached(currentScriptState()), stub(currentScriptState(), newActual, nNewRejectCalls));
        property()->reject(newValue);
    }

    EXPECT_EQ(0u, nOldResolveCalls);
    EXPECT_EQ(0u, nNewRejectCalls);

    isolate()->RunMicrotasks();
    EXPECT_EQ(1u, nOldResolveCalls);
    EXPECT_EQ(1u, nNewRejectCalls);
    EXPECT_NE(oldPromise, newPromise);
    EXPECT_EQ(wrap(mainWorld(), oldValue), oldActual);
    EXPECT_EQ(wrap(mainWorld(), newValue), newActual);
    EXPECT_NE(oldActual, newActual);
}

// Tests that ScriptPromiseProperty works with a ref-counted holder.
class ScriptPromisePropertyRefCountedTest : public ScriptPromisePropertyTestBase, public ::testing::Test {
public:
    typedef RefCountedHolder::Property Property;

    ScriptPromisePropertyRefCountedTest()
        : m_holder(RefCountedHolder::create(&document()))
    {
    }

    RefCountedHolder* holder() { return m_holder.get(); }
    Property* property() { return m_holder->property(); }

private:
    RefPtr<RefCountedHolder> m_holder;
};

TEST_F(ScriptPromisePropertyRefCountedTest, Resolve)
{
    ScriptValue actual;
    size_t nResolveCalls = 0;

    {
        ScriptState::Scope scope(mainScriptState());
        property()->promise(DOMWrapperWorld::mainWorld()).then(stub(currentScriptState(), actual, nResolveCalls), notReached(currentScriptState()));
    }

    RefPtr<RefCountedScriptWrappable> value = RefCountedScriptWrappable::create("value");
    property()->resolve(value.get());
    EXPECT_EQ(Property::Resolved, property()->state());

    isolate()->RunMicrotasks();
    EXPECT_EQ(1u, nResolveCalls);
    EXPECT_EQ(wrap(mainWorld(), value), actual);
}

TEST_F(ScriptPromisePropertyRefCountedTest, Reject)
{
    ScriptValue actual;
    size_t nRejectCalls = 0;

    {
        ScriptState::Scope scope(mainScriptState());
        property()->promise(DOMWrapperWorld::mainWorld()).then(notReached(currentScriptState()), stub(currentScriptState(), actual, nRejectCalls));
    }

    RefPtr<RefCountedScriptWrappable> reason = RefCountedScriptWrappable::create("reason");
    property()->reject(reason);
    EXPECT_EQ(Property::Rejected, property()->state());

    isolate()->RunMicrotasks();
    EXPECT_EQ(1u, nRejectCalls);
    EXPECT_EQ(wrap(mainWorld(), reason), actual);
}

TEST_F(ScriptPromisePropertyRefCountedTest, ReSolveAndReset)
{
    RefPtr<RefCountedScriptWrappable> value = RefCountedScriptWrappable::create("value");

    {
        ScriptState::Scope scope(mainScriptState());
        property()->resolve(value);
    }

    EXPECT_EQ(2, value->refCount());
    property()->reset();
    EXPECT_EQ(1, value->refCount());
}

TEST_F(ScriptPromisePropertyRefCountedTest, RejectAndReset)
{
    RefPtr<RefCountedScriptWrappable> value = RefCountedScriptWrappable::create("value");

    {
        ScriptState::Scope scope(mainScriptState());
        property()->reject(value.get());
    }

    EXPECT_EQ(2, value->refCount());
    property()->reset();
    EXPECT_EQ(1, value->refCount());
}

// Tests that ScriptPromiseProperty works with a non ScriptWrappable resolution
// target.
class ScriptPromisePropertyNonScriptWrappableResolutionTargetTest : public ScriptPromisePropertyTestBase, public ::testing::Test {
public:
    template <typename T>
    void test(const T& value, const char* expected, const char* file, size_t line)
    {
        typedef ScriptPromiseProperty<Member<GarbageCollectedScriptWrappable>, T, ToV8UndefinedGenerator> Property;
        Property* property = new Property(&document(), new GarbageCollectedScriptWrappable("holder"), Property::Ready);
        size_t nResolveCalls = 0;
        ScriptValue actualValue;
        String actual;
        {
            ScriptState::Scope scope(mainScriptState());
            property->promise(DOMWrapperWorld::mainWorld()).then(stub(currentScriptState(), actualValue, nResolveCalls), notReached(currentScriptState()));
        }
        property->resolve(value);
        isolate()->RunMicrotasks();
        {
            ScriptState::Scope scope(mainScriptState());
            actual = toCoreString(actualValue.v8Value()->ToString(mainScriptState()->context()).ToLocalChecked());
        }
        if (expected != actual) {
            ADD_FAILURE_AT(file, line) << "toV8 returns an incorrect value.\n  Actual: " << actual.utf8().data() << "\nExpected: " << expected;
            return;
        }
    }
};

TEST_F(ScriptPromisePropertyNonScriptWrappableResolutionTargetTest, ResolveWithUndefined)
{
    test(ToV8UndefinedGenerator(), "undefined", __FILE__, __LINE__);
}

TEST_F(ScriptPromisePropertyNonScriptWrappableResolutionTargetTest, ResolveWithString)
{
    test(String("hello"), "hello", __FILE__, __LINE__);
}

TEST_F(ScriptPromisePropertyNonScriptWrappableResolutionTargetTest, ResolveWithInteger)
{
    test(-1, "-1", __FILE__, __LINE__);
}

} // namespace

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Text;
using MonoTorrent.Client.Messages;
using MonoTorrent.Common;

namespace MonoTorrent.Client
{
    public class NullPicker : PiecePicker
    {
        public NullPicker()
            : base(null)
        {

        }

        public override void CancelRequest(PeerId peer, int piece, int startOffset, int length)
        {

        }

        public override void CancelRequests(PeerId peer)
        {

        }

        public override void CancelTimedOutRequests()
        {

        }

        public override int CurrentRequestCount()
        {
            return 0;
        }

        public override List<Piece> ExportActiveRequests()
        {
            return new List<Piece>();
        }

        public override void Initialise(MonoTorrent.Common.BitField bitfield, MonoTorrent.Common.TorrentFile[] files, IEnumerable<Piece> requests)
        {

        }

        public override bool IsInteresting(MonoTorrent.Common.BitField bitfield)
        {
            return false;
        }

        public override MessageBundle PickPiece(PeerId id, BitField peerBitfield, List<PeerId> otherPeers, int count, int startIndex, int endIndex)
        {
            return null;
        }

        public override void Reset()
        {

        }

        public override bool ValidatePiece(PeerId peer, int pieceIndex, int startOffset, int length, out Piece piece)
        {
            piece = null;
            return false;
        }
    }
}


text:
require 'nokogiri'

module Bedsonline
  class AdditionalCost
    attr_accessor :currency, :type, :amount

    def self.from_node_list(node_list)
      additional_costs = []
      node_list.each do |cost_node|
        additional_cost_service = Nokogiri::XML(cost_node.to_s)
        additional_cost = AdditionalCost.new
        additional_cost.type   = additional_cost_service.at_css('AdditionalCost')['type']
        additional_cost.amount = additional_cost_service.at_css('AdditionalCost Price Amount').content
        additional_costs << additional_cost
      end
      additional_costs
    end
  end
end


text:
import readRequestBody from "./readRequestBody"
import readRequestHeaders from "./readRequestHeaders"
import readRequestMethod from "./readRequestMethod"
import readRequestUrl from "./readRequestUrl"
import readRequestPath from "./readRequestPath"
import readRequestQuery from "./readRequestQuery"
import readRequestVersion from "./readRequestVersion"

export default {
  readRequestMethod,
  readRequestVersion,
  readRequestUrl,
  readRequestHeaders,
  readRequestBody,
  readRequestPath,
  readRequestQuery
}


text:
var System = require('../../entities/systems/System');
var TextureGrid = require('../../shapes/TextureGrid');
var MeshDataComponent = require('../../entities/components/MeshDataComponent');

/**
 * Processes all entities with a text component<br>
 * @example-link http://code.gooengine.com/latest/visual-test/goo/entities/components/TextComponent/TextComponent-vtest.html Working example
 * @extends System
 */
function TextSystem() {
	System.call(this, 'TextSystem', ['TextComponent']);
}

TextSystem.prototype = Object.create(System.prototype);
TextSystem.prototype.constructor = TextSystem;

TextSystem.prototype.process = function (entities) {
	for (var i = 0; i < entities.length; i++) {
		var entity = entities[i];
		var textComponent = entity.textComponent;
		if (textComponent.dirty) {
			if (entity.hasComponent('MeshDataComponent')) {
				entity.getComponent('MeshDataComponent').meshData = TextureGrid.fromString(textComponent.text);
			}
			else {
				var meshData = TextureGrid.fromString(textComponent.text);
				var meshDataComponent = new MeshDataComponent(meshData);
				entity.setComponent(meshDataComponent);
			}
			this.dirty = false;
		}
	}
};

module.exports = TextSystem;


text:
from taemin import plugin
from .synonymes import Synonymes

class TaeminSynonymes(plugin.TaeminPlugin):
    helper = {"synonymes": "Cherche les synonymes d'un mot"}

    def on_pubmsg(self, msg):
        if msg.key not in self.helper:
            return

        chan = msg.chan.name

        synonymes = Synonymes.off(msg.value)

        if synonymes:
            self.privmsg(chan, "Synonymes de %s: %s" % (msg.value, ", ".join(synonymes)))
            return

        self.privmsg(chan, "Pas trouvé de synonymes...")


text:
package com.smartdevicelink.test.rpc.requests;

import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.ShowConstantTbt;
import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
import com.smartdevicelink.test.Validator;
import com.smartdevicelink.test.json.rpc.JsonFileReader;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

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

/**
 * This is a unit test class for the SmartDeviceLink library project class :
 * {@link com.smartdevicelink.rpc.ShowConstantTbt}
 */
public class ShowConstantTbtTests extends BaseRpcTests {

	@Override
	protected RPCMessage createMessage() {
		ShowConstantTbt msg = new ShowConstantTbt();

		msg.setDistanceToManeuver(Test.GENERAL_DOUBLE);
		msg.setDistanceToManeuverScale(Test.GENERAL_DOUBLE);
		msg.setEta(Test.GENERAL_STRING);
		msg.setManeuverComplete(true);
		msg.setNavigationText1(Test.GENERAL_STRING);
		msg.setNavigationText2(Test.GENERAL_STRING);
		msg.setNextTurnIcon(Test.GENERAL_IMAGE);
		msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
		msg.setTimeToDestination(Test.GENERAL_STRING);
		msg.setTotalDistance(Test.GENERAL_STRING);
		msg.setTurnIcon(Test.GENERAL_IMAGE);

		return msg;
	}

	@Override
	protected String getMessageType() {
		return RPCMessage.KEY_REQUEST;
	}

	@Override
	protected String getCommandType() {
		return FunctionID.SHOW_CONSTANT_TBT.toString();
	}

	@Override
	protected JSONObject getExpectedParameters(int sdlVersion) {
		JSONObject result = new JSONObject();

        try {
			result.put(ShowConstantTbt.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
        	result.put(ShowConstantTbt.KEY_ETA, Test.GENERAL_STRING);
        	result.put(ShowConstantTbt.KEY_MANEUVER_COMPLETE, true);
        	result.put(ShowConstantTbt.KEY_MANEUVER_DISTANCE, Test.GENERAL_DOUBLE);
        	result.put(ShowConstantTbt.KEY_MANEUVER_DISTANCE_SCALE, Test.GENERAL_DOUBLE);
        	result.put(ShowConstantTbt.KEY_TEXT1, Test.GENERAL_STRING);
        	result.put(ShowConstantTbt.KEY_TEXT2, Test.GENERAL_STRING);
        	result.put(ShowConstantTbt.KEY_TIME_TO_DESTINATION, Test.GENERAL_STRING);
        	result.put(ShowConstantTbt.KEY_TOTAL_DISTANCE, Test.GENERAL_STRING);
        	result.put(ShowConstantTbt.KEY_MANEUVER_IMAGE, Test.GENERAL_IMAGE.serializeJSON());
        	result.put(ShowConstantTbt.KEY_NEXT_MANEUVER_IMAGE, Test.GENERAL_IMAGE.serializeJSON());
        } catch(JSONException e){
        	fail(Test.JSON_FAIL);
        }

		return result;
	}

	/**
	 * Tests the expected values of the RPC message.
	 */
    public void testRpcValues () {
		// Test Values
    	Double  testScale                = ((ShowConstantTbt) msg).getDistanceToManeuverScale();
    	Double  testDistance             = ((ShowConstantTbt) msg).getDistanceToManeuver();
    	String  testEta                  = ((ShowConstantTbt) msg).getEta();
		String  testTimeToDestination    = ((ShowConstantTbt) msg).getTimeToDestination();
		String  testTotalDistance        = ((ShowConstantTbt) msg).getTotalDistance();
		String  testNavText2             = ((ShowConstantTbt) msg).getNavigationText2();
		String  testNavText1             = ((ShowConstantTbt) msg).getNavigationText1();
		Boolean testManeuverComplete     = ((ShowConstantTbt) msg).getManeuverComplete();
		Image   testTurnIcon             = ((ShowConstantTbt) msg).getTurnIcon();
		Image   testNextTurnIcon         = ((ShowConstantTbt) msg).getNextTurnIcon();
		List<SoftButton> testSoftButtons = ((ShowConstantTbt) msg).getSoftButtons();

		// Valid Test
		assertEquals(Test.MATCH, Test.GENERAL_STRING, testTimeToDestination);
		assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, testScale);
		assertEquals(Test.MATCH, Test.GENERAL_STRING, testNavText1);
		assertEquals(Test.MATCH, Test.GENERAL_STRING, testNavText2);
		assertEquals(Test.MATCH, Test.GENERAL_STRING, testEta);
		assertEquals(Test.MATCH, Test.GENERAL_STRING, testTotalDistance);
		assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, testDistance);
		assertTrue(Test.TRUE, testManeuverComplete);
		assertTrue(Test.TRUE, Validator.validateSoftButtons(Test.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
		assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, testTurnIcon));
		assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, testNextTurnIcon));

		// Invalid/Null Tests
		ShowConstantTbt msg = new ShowConstantTbt();
		assertNotNull(Test.NOT_NULL, msg);
        testNullBase(msg);

        assertNull(Test.NULL, msg.getSoftButtons());
        assertNull(Test.NULL, msg.getNavigationText1());
        assertNull(Test.NULL, msg.getNavigationText2());
        assertNull(Test.NULL, msg.getDistanceToManeuver());
        assertNull(Test.NULL, msg.getDistanceToManeuverScale());
        assertNull(Test.NULL, msg.getEta());
        assertNull(Test.NULL, msg.getManeuverComplete());
        assertNull(Test.NULL, msg.getNextTurnIcon());
        assertNull(Test.NULL, msg.getTimeToDestination());
        assertNull(Test.NULL, msg.getTotalDistance());
        assertNull(Test.NULL, msg.getTurnIcon());
	}

	/**
     * Tests a valid JSON construction of this RPC message.
     */
	public void testJsonConstructor () {
		JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
    	assertNotNull(Test.NOT_NULL, commandJson);

    	try {
    		Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
    		ShowConstantTbt cmd = new ShowConstantTbt(hash);
    		JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
			assertNotNull(Test.NOT_NULL, body);

			// Test everything in the json body.
			assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
			assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());

			JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
			assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_ETA), cmd.getEta());
			assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_COMPLETE), cmd.getManeuverComplete());
			assertEquals(Test.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_DISTANCE), cmd.getDistanceToManeuver());
			assertEquals(Test.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_DISTANCE_SCALE), cmd.getDistanceToManeuverScale());
			assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TEXT1), cmd.getNavigationText1());
			assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TEXT2), cmd.getNavigationText2());
			assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TIME_TO_DESTINATION), cmd.getTimeToDestination());
			assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TOTAL_DISTANCE), cmd.getTotalDistance());

			JSONObject icon1 = JsonUtils.readJsonObjectFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_IMAGE);
			Image refIcon1 = new Image(JsonRPCMarshaller.deserializeJSONObject(icon1));
			assertTrue(Test.TRUE, Validator.validateImage(refIcon1, cmd.getTurnIcon()));

			JSONObject icon2 = JsonUtils.readJsonObjectFromJsonObject(parameters, ShowConstantTbt.KEY_NEXT_MANEUVER_IMAGE);
			Image refIcon2 = new Image(JsonRPCMarshaller.deserializeJSONObject(icon2));
			assertTrue(Test.TRUE, Validator.validateImage(refIcon2, cmd.getNextTurnIcon()));

			JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, ShowConstantTbt.KEY_SOFT_BUTTONS);
			List<SoftButton> softButtonList = new ArrayList<SoftButton>();
			for (int index = 0; index < softButtonArray.length(); index++) {
				SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonArray.get(index)) );
				softButtonList.add(chunk);
			}
			assertTrue(Test.TRUE,  Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
    	} catch (JSONException e) {
    		fail(Test.JSON_FAIL);
		}
	}
}


text:
<?php

if (!defined('APPLICATION'))
   exit();

function ww_CheckPassword($Password, $StoredHash) {
   list($Salt, $Hash) = explode('$', $StoredHash);

   $CalcHash = ww_HashEncode($Password.$Salt);
   return $CalcHash == $Hash;
}

function ww_getSalt($intLen) {
   //extract($GLOBALS);;
// Function takes a given length x and generates a random hex value of x digits.
// Salt can be used to help protect passwords.  When a password is first stored in a
// database generate a salt value also.  Concatenate the salt value with the password,
// and then encrypt it using the HashEncode function below.  Store both the salt value,
// and the encrypted value in the database.  When a password needs to be verified, take
// the password concatenate the salt from the database.  Encode it using the HashEncode
// function below.  If the result matches the the encrypted password stored in the
// database, then it is a match.  If not then the password is invalid.
//
//
// Note: Passwords become case sensitive when using this encryption.
// For more information on Password HASH Encoding, and SALT visit: http://local.15seconds.com/issue/000217.htm
//
// Call this function if you wish to generate a random hex value of any given length
//
// Written By: Mark G. Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header is kept intact

   $strSalt = '';
   if (!is_numeric($intLen)) {

      $function_ret = "00000000";
      return $function_ret;
   } else
   if (intval($intLen) != doubleval($intLen) || intval($intLen) < 1) {

      $function_ret = "00000000";
      return $function_ret;
   }

   mt_srand((double) microtime() * 1000000);

   for ($intIndex = 1; $intIndex <= intval($intLen); $intIndex = $intIndex + 1) {
      $intRand = intval((mt_rand(0, 10000000) / 10000000)) % 16;
      //echo intval(mt_rand(0,10000000)/10000000);
      $strSalt = $strSalt . ww_getDecHex($intRand);
   }

   $function_ret = $strSalt;

   return $function_ret;
}

function ww_HashEncode($strSecret) {
   //extract($GLOBALS);;
// Function takes an ASCII string less than 2^61 characters long and
// one way hash encrypts it using 160 bit encryption into a 40 digit hex value.
// The encoded hex value cannot be decoded to the original string value.
//
// This is the only function that you need to call for encryption.
//
// Written By: Mark G. Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header is kept intact
//
// The author makes no warranties as to the validity, and/or authenticity of this code.
// You may use any code found herein at your own risk.
// This code was written to follow as closely as possible the standards found in
// Federal Information Processing Standards Publication (FIPS PUB 180-1)
// http://csrc.nist.gov/fips/fip180-1.txt -- Secure Hash Standard SHA-1
//
// This code is for private use only, and the security and/or encryption of the resulting
// hexadecimal value is not warrented or gaurenteed in any way.
//

   if (strlen($strSecret) == 0 || strlen($strSecret) >= pow(2, 61)) {
      return "0000000000000000000000000000000000000000";
   }

//Initial Hex words are used for encoding Digest.
//These can be any valid 8-digit hex value (0 to F)
   $strH[0] = "FB0C14C2";
   $strH[1] = "9F00AB2E";
   $strH[2] = "991FFA67";
   $strH[3] = "76FA2C3F";
   $strH[4] = "ADE426FA";

   for ($intPos = 1; $intPos <= strlen($strSecret); $intPos = $intPos + 56) {
      $strEncode = substr($strSecret, $intPos - 1, 56); //get 56 character chunks
      $strEncode = ww_WordToBinary($strEncode); //convert to binary
      $strEncode = ww_PadBinary($strEncode); //make it 512 bites
      $strEncode = ww_BlockToHex($strEncode); //convert to hex value
//   decho($strEncode, 'strEncode '.$intPos);
      //print $strEncode."<-
";
//Encode the hex value using the previous runs digest
//If it is the first run then use the initial values above
      $strEncode = ww_DigestHex($strEncode, $strH[0], $strH[1], $strH[2], $strH[3], $strH[4]);

//    decho($strEncode, "DigestHex $intPos");
//Combine the old digest with the new digest
      $strH[0] = ww_HexAdd(substr($strEncode, 0, 8), $strH[0]);
      $strH[1] = ww_HexAdd(substr($strEncode, 8, 8), $strH[1]);
      $strH[2] = ww_HexAdd(substr($strEncode, 16, 8), $strH[2]);
      $strH[3] = ww_HexAdd(substr($strEncode, 24, 8), $strH[3]);
      $strH[4] = ww_HexAdd(substr($strEncode, strlen($strEncode) - (8)), $strH[4]);
   }

//This is the final Hex Digest
   $function_ret = $strH[0] . $strH[1] . $strH[2] . $strH[3] . $strH[4];

   return $function_ret;
}

function ww_HexToBinary($btHex) {
   //extract($GLOBALS);;
// Function Converts a single hex value into it's binary equivalent
//
// Written By: Mark Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header is kept intact
//

   switch ($btHex) {
      case "0":
         $function_ret = "0000";
         break;
      case "1":
         $function_ret = "0001";
         break;
      case "2":
         $function_ret = "0010";
         break;
      case "3":
         $function_ret = "0011";
         break;
      case "4":
         $function_ret = "0100";
         break;
      case "5":
         $function_ret = "0101";
         break;
      case "6":
         $function_ret = "0110";
         break;
      case "7":
         $function_ret = "0111";
         break;
      case "8":
         $function_ret = "1000";
         break;
      case "9":
         $function_ret = "1001";
         break;
      case "A":
         $function_ret = "1010";
         break;
      case "B":
         $function_ret = "1011";
         break;
      case "C":
         $function_ret = "1100";
         break;
      case "D":
         $function_ret = "1101";
         break;
      case "E":
         $function_ret = "1110";
         break;
      case "F":
         $function_ret = "1111";
         break;
      default:

         $function_ret = "2222";
         break;
   }
   return $function_ret;
}

function ww_BinaryToHex($strBinary) {
   //extract($GLOBALS);;
// Function Converts a 4 bit binary value into it's hex equivalent
//
// Written By: Mark Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header is kept intact
//
   switch ($strBinary) {
      case "0000":
         $function_ret = "0";
         break;
      case "0001":
         $function_ret = "1";
         break;
      case "0010":
         $function_ret = "2";
         break;
      case "0011":
         $function_ret = "3";
         break;
      case "0100":
         $function_ret = "4";
         break;
      case "0101":
         $function_ret = "5";
         break;
      case "0110":
         $function_ret = "6";
         break;
      case "0111":
         $function_ret = "7";
         break;
      case "1000":
         $function_ret = "8";
         break;
      case "1001":
         $function_ret = "9";
         break;
      case "1010":
         $function_ret = "A";
         break;
      case "1011":
         $function_ret = "B";
         break;
      case "1100":
         $function_ret = "C";
         break;
      case "1101":
         $function_ret = "D";
         break;
      case "1110":
         $function_ret = "E";
         break;
      case "1111":
         $function_ret = "F";
         break;
      default:

         $function_ret = "Z";
         break;
   }
   return $function_ret;
}

function ww_WordToBinary($strWord) {
   //extract($GLOBALS);;
// Function Converts a 8 digit hex value into it's 32 bit binary equivalent
//
// Written By: Mark Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header kept intact
//
   $strBinary = '';
   for ($intPos = 1; $intPos <= strlen($strWord); $intPos = $intPos + 1) {
      $strTemp = substr($strWord, intval($intPos) - 1, 1);
      $strBinary = $strBinary . ww_IntToBinary(ord($strTemp));
   }

   $function_ret = $strBinary;

   return $function_ret;
}

function ww_HexToInt($strHex) {
   //extract($GLOBALS);;
// Function Converts a hex word to its base 10(decimal) equivalent
//
// Written By: Mark Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header is kept intact
//

   $intNew = 0;
   $intLen = doubleval(strlen($strHex)) - 1;

   for ($intPos = doubleval($intLen); $intPos >= 0; $intPos = $intPos - 1) {
      switch (substr($strHex, doubleval($intPos) + 1 - 1, 1)) {
         case "0":
            $intNew = doubleval($intNew) + (0 * 16 ^ doubleval($intLen - $intPos));
            break;
         case "1":
            $intNew = doubleval($intNew) + (1 * 16 ^ doubleval($intLen - $intPos));
            break;
         case "2":
            $intNew = doubleval($intNew) + (2 * 16 ^ doubleval($intLen - $intPos));
            break;
         case "3":
            $intNew = doubleval($intNew) + (3 * 16 ^ doubleval($intLen - $intPos));
            break;
         case "4":
            $intNew = doubleval($intNew) + (4 * 16 ^ doubleval($intLen - $intPos));
            break;
         case "5":
            $intNew = doubleval($intNew) + (5 * 16 ^ doubleval($intLen - $intPos));
            break;
         case "6":
            $intNew = doubleval($intNew) + (6 * 16 ^ doubleval($intLen - $intPos));
            break;
         case "7":
            $intNew = doubleval($intNew) + (7 * 16 ^ doubleval($intLen - $intPos));
            break;
         case "8":
            $intNew = doubleval($intNew) + (8 * 16 ^ doubleval($intLen - $intPos));
            break;
         case "9":
            $intNew = doubleval($intNew) + (9 * 16 ^ doubleval($intLen - $intPos));
            break;
         case "A":
            $intNew = doubleval($intNew) + (10 * 16 ^ doubleval($intLen - $intPos));
            break;
         case "B":
            $intNew = doubleval($intNew) + (11 * 16 ^ doubleval($intLen - $intPos));
            break;
         case "C":
            $intNew = doubleval($intNew) + (12 * 16 ^ doubleval($intLen - $intPos));
            break;
         case "D":
            $intNew = doubleval($intNew) + (13 * 16 ^ doubleval($intLen - $intPos));
            break;
         case "E":
            $intNew = doubleval($intNew) + (14 * 16 ^ doubleval($intLen - $intPos));
            break;
         case "F":
            $intNew = doubleval($intNew) + (15 * 16 ^ doubleval($intLen - $intPos));
            break;
      }
   }

   $function_ret = doubleval($intNew);

   return $function_ret;
}

function ww_IntToBinary($intNum) {
   //extract($GLOBALS);;
// Function Converts an integer number to it's binary equivalent
//
// Written By: Mark Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header is kept intact
//

   $intNew = $intNum;
   $strBinary = '';
   while ($intNew > 1) {

      $dblNew = doubleval($intNew) / 2;
      $intNew = round(doubleval($dblNew) - 0.1, 0);
      if (doubleval($dblNew) == doubleval($intNew)) {

         $strBinary = "0" . $strBinary;
      } else {

         $strBinary = "1" . $strBinary;
      }
   }

   $strBinary = $intNew . $strBinary;

   $intTemp = strlen($strBinary) % 8;

   for ($intNew = $intTemp; $intNew <= 7; $intNew = $intNew + 1) {
      $strBinary = "0" . $strBinary;
   }

   $function_ret = $strBinary;

   return $function_ret;
}

function ww_PadBinary($strBinary) {
   //extract($GLOBALS);;
// Function adds 0's to a binary string until it reaches 448 bits.
// The lenghth of the original string is incoded into the last 16 bits.
// The end result is a binary string 512 bits long
//
// Written By: Mark Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header is kept intact
//

   $intLen = strlen($strBinary);

   $strBinary = $strBinary . "1";

   for ($intPos = strlen($strBinary); $intPos <= 447; $intPos = $intPos + 1) {
      $strBinary = $strBinary . "0";
   }

   $strTemp = ww_IntToBinary($intLen);

   for ($intPos = strlen($strTemp); $intPos <= 63; $intPos = $intPos + 1) {
      $strTemp = "0" . $strTemp;
   }

   $strBinary = $strBinary . $strTemp;

   $function_ret = $strBinary;

   return $function_ret;
}

function ww_BlockToHex($strBinary) {
   //extract($GLOBALS);;
// Function Converts a 32 bit binary string into it's 8 digit hex equivalent
//
// Written By: Mark Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header is kept intact
//
   $strHex = '';
   for ($intPos = 1; $intPos <= strlen($strBinary); $intPos = $intPos + 4) {
      $strHex = $strHex . ww_BinaryToHex(substr($strBinary, $intPos - 1, 4));
   }

   $function_ret = $strHex;

   return $function_ret;
}

function ww_DigestHex($strHex, $strH0, $strH1, $strH2, $strH3, $strH4) {
   //extract($GLOBALS);;
// Main encoding function.  Takes a 128 digit/512 bit hex value and one way encrypts it into
// a 40 digit/160 bit hex value.
//
// Written By: Mark Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header is kept intact
//
//Constant hex words are used for encryption, these can be any valid 8 digit hex value
   $strK[0] = "5A827999";
   $strK[1] = "6ED9EBA1";
   $strK[2] = "8F1BBCDC";
   $strK[3] = "CA62C1D6";

//Hex words are used in the encryption process, these can be any valid 8 digit hex value
   $strH[0] = $strH0;
   $strH[1] = $strH1;
   $strH[2] = $strH2;
   $strH[3] = $strH3;
   $strH[4] = $strH4;

//divide the Hex block into 16 hex words
   for ($intPos = 0; $intPos <= (strlen($strHex) / 8) - 1; $intPos = $intPos + 1) {
      $strWords[intval($intPos)] = substr($strHex, (intval($intPos) * 8) + 1 - 1, 8);

//    decho($strWords[$intPos], "strWords $intPos");
   }

//encode the Hex words using the constants above
//innitialize 80 hex word positions
   for ($intPos = 16; $intPos <= 79; $intPos = $intPos + 1) {
      $strTemp = $strWords[intval($intPos) - 3];
      $strTemp1 = ww_HexBlockToBinary($strTemp);
      $strTemp = $strWords[intval($intPos) - 8];
      $strTemp2 = ww_HexBlockToBinary($strTemp);
      $strTemp = $strWords[intval($intPos) - 14];
      $strTemp3 = ww_HexBlockToBinary($strTemp);
      $strTemp = $strWords[intval($intPos) - 16];
      $strTemp4 = ww_HexBlockToBinary($strTemp);
      $strTemp = ww_BinaryXOR($strTemp1, $strTemp2);
      $strTemp = ww_BinaryXOR($strTemp, $strTemp3);
      $strTemp = ww_BinaryXOR($strTemp, $strTemp4);
      $strWords[intval($intPos)] = ww_BlockToHex(ww_BinaryShift($strTemp, 1));

//    decho($strWords[$intPos], "strWords2 $intPos");
      //print "
->".$strWords[intval($intPos)]."
";
   }

//initialize the changing word variables with the initial word variables
   $strA[0] = $strH[0];
   $strA[1] = $strH[1];
   $strA[2] = $strH[2];
   $strA[3] = $strH[3];
   $strA[4] = $strH[4];
//print "
->".$strWords[0]."
";
//Main encryption loop on all 80 hex word positions
   for ($intPos = 0; $intPos <= 79; $intPos = $intPos + 1) {
      $strTemp = ww_BinaryShift(ww_HexBlockToBinary($strA[0]), 5);
      $strTemp1 = ww_HexBlockToBinary($strA[3]);
      $strTemp2 = ww_HexBlockToBinary($strWords[intval($intPos)]);

//    decho($strTemp, "strTemp $intPos");
//    decho($strTemp1, "strTemp1 $intPos");
//    decho($strTemp2, "strTemp2 $intPos");
      //print "
".$intPos." -> ".$strA[4]."
";
      switch ($intPos) {
         case 0:
         case 1:
         case 2:
         case 3:
         case 4:
         case 5:
         case 6:
         case 7:
         case 8:
         case 9:
         case 10:
         case 11:
         case 12:
         case 13:
         case 14:
         case 15:
         case 16:
         case 17:
         case 18:
         case 19:
            $strTemp3 = ww_HexBlockToBinary($strK[0]);
            $strTemp4 = ww_BinaryOR(ww_BinaryAND(ww_HexBlockToBinary($strA[1]), ww_HexBlockToBinary($strA[2])), ww_BinaryAND(ww_BinaryNOT(ww_HexBlockToBinary($strA[1])), ww_HexBlockToBinary($strA[3])));
            //echo "
 - > Case1";
            break;
         case 20:
         case 21:
         case 22:
         case 23:
         case 24:
         case 25:
         case 26:
         case 27:
         case 28:
         case 29:
         case 30:
         case 31:
         case 32:
         case 33:
         case 34:
         case 35:
         case 36:
         case 37:
         case 38:
         case 39:
            $strTemp3 = ww_HexBlockToBinary($strK[1]);
            $strTemp4 = ww_BinaryXOR(ww_BinaryXOR(ww_HexBlockToBinary($strA[1]), ww_HexBlockToBinary($strA[2])), ww_HexBlockToBinary($strA[3]));
            break;
         case 40:
         case 41:
         case 42:
         case 43:
         case 44:
         case 45:
         case 46:
         case 47:
         case 48:
         case 49:
         case 50:
         case 51:
         case 52:
         case 53:
         case 54:
         case 55:
         case 56:
         case 57:
         case 58:
         case 59:
            $strTemp3 = ww_HexBlockToBinary($strK[2]);
            $strTemp4 = ww_BinaryOR(ww_BinaryOR(ww_BinaryAND(ww_HexBlockToBinary($strA[1]), ww_HexBlockToBinary($strA[2])), ww_BinaryAND(ww_HexBlockToBinary($strA[1]), ww_HexBlockToBinary($strA[3]))), ww_BinaryAND(ww_HexBlockToBinary($strA[2]), ww_HexBlockToBinary($strA[3])));
            break;
         case 60:
         case 61:
         case 62:
         case 63:
         case 64:
         case 65:
         case 66:
         case 67:
         case 68:
         case 69:
         case 70:
         case 71:
         case 72:
         case 73:
         case 74:
         case 75:
         case 76:
         case 77:
         case 78:
         case 79:
            $strTemp3 = ww_HexBlockToBinary($strK[3]);
            $strTemp4 = ww_BinaryXOR(ww_BinaryXOR(ww_HexBlockToBinary($strA[1]), ww_HexBlockToBinary($strA[2])), ww_HexBlockToBinary($strA[3]));
            break;
      }

      $strTemp = ww_BlockToHex($strTemp);
      $strTemp1 = ww_BlockToHex($strTemp1);
      $strTemp2 = ww_BlockToHex($strTemp2);
      $strTemp3 = ww_BlockToHex($strTemp3);
      $strTemp4 = ww_BlockToHex($strTemp4);

      $strTemp = ww_HexAdd($strTemp, $strTemp1);

      $strTemp = ww_HexAdd($strTemp, $strTemp2);
      $strTemp = ww_HexAdd($strTemp, $strTemp3);
      $strTemp = ww_HexAdd($strTemp, $strTemp4);

      $strA[4] = $strA[3];
      $strA[3] = $strA[2];
      $strA[2] = ww_BlockToHex(ww_BinaryShift(ww_HexBlockToBinary($strA[1]), 30));
      $strA[1] = $strA[0];
      $strA[0] = $strTemp;
   }

//Concatenate the final Hex Digest
   $function_ret = $strA[0] . $strA[1] . $strA[2] . $strA[3] . $strA[4];

   return $function_ret;
}

function ww_HexAdd($strHex1, $strHex2) {
   $n1 = hexdec($strHex1);
   $n2 = hexdec($strHex2);
   $sum = $n1 + $n2;
   $sum = sprintf("%08X", $sum);
   $sum = substr($sum, -strlen($strHex1));

//   decho("$strHex1 + $strHex2 = $sum", 'HexAdd');

   return $sum;
}

function ww_getHexDec($strHex) {
   //extract($GLOBALS);;
// Function Converts a single hex value into it's decimal equivalent
//
// Written By: Mark Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header is kept intact
//
   switch ($strHex) {
      case "0":
         $function_ret = 0;
         break;
      case "1":
         $function_ret = 1;
         break;
      case "2":
         $function_ret = 2;
         break;
      case "3":
         $function_ret = 3;
         break;
      case "4":
         $function_ret = 4;
         break;
      case "5":
         $function_ret = 5;
         break;
      case "6":
         $function_ret = 6;
         break;
      case "7":
         $function_ret = 7;
         break;
      case "8":
         $function_ret = 8;
         break;
      case "9":
         $function_ret = 9;
         break;
      case "A":
         $function_ret = 10;
         break;
      case "B":
         $function_ret = 11;
         break;
      case "C":
         $function_ret = 12;
         break;
      case "D":
         $function_ret = 13;
         break;
      case "E":
         $function_ret = 14;
         break;
      case "F":
         $function_ret = 15;
         break;
      default:

         $function_ret = -1;
         break;
   }
   return $function_ret;
}

function ww_getDecHex($strHex) {
   //extract($GLOBALS);;
// Function Converts a single decimal value(0 - 15) into it's hex equivalent
//
// Written By: Mark Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header is kept intact
//
   switch (intval($strHex)) {
      case 0:
         $function_ret = "0";
         break;
      case 1:
         $function_ret = "1";
         break;
      case 2:
         $function_ret = "2";
         break;
      case 3:
         $function_ret = "3";
         break;
      case 4:
         $function_ret = "4";
         break;
      case 5:
         $function_ret = "5";
         break;
      case 6:
         $function_ret = "6";
         break;
      case 7:
         $function_ret = "7";
         break;
      case 8:
         $function_ret = "8";
         break;
      case 9:
         $function_ret = "9";
         break;
      case 10:
         $function_ret = "A";
         break;
      case 11:
         $function_ret = "B";
         break;
      case 12:
         $function_ret = "C";
         break;
      case 13:
         $function_ret = "D";
         break;
      case 14:
         $function_ret = "E";
         break;
      case 15:
         $function_ret = "F";
         break;
      default:

         $function_ret = "Z";
         break;
   }
   return $function_ret;
}

function ww_BinaryShift($strBinary, $intPos) {
   //extract($GLOBALS);;
// Function circular left shifts a binary value n places
//
// Written By: Mark Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header is kept intact
//
   $function_ret = substr($strBinary, strlen($strBinary) - (strlen($strBinary) - intval($intPos))) .
   substr($strBinary, 0, intval($intPos));

   return $function_ret;
}

function ww_BinaryXOR($strBin1, $strBin2) {
   //extract($GLOBALS);;
// Function performs an exclusive or function on each position of two binary values
//
// Written By: Mark Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header is kept intact
//
   $strBinaryFinal = '';
   for ($intPos = 1; $intPos <= strlen($strBin1); $intPos = $intPos + 1) {
      switch (substr($strBin1, intval($intPos) - 1, 1)) {
         case ww_mid($strBin2, intval($intPos), 1):
            $strBinaryFinal = $strBinaryFinal . "0";
            break;
         default:

            $strBinaryFinal = $strBinaryFinal . "1";
            break;
      }
   }

   $function_ret = $strBinaryFinal;

   return $function_ret;
}

function ww_BinaryOR($strBin1, $strBin2) {
   //extract($GLOBALS);;
// Function performs an inclusive or function on each position of two binary values
//
// Written By: Mark Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header is kept intact
//
   $strBinaryFinal = '';
   for ($intPos = 1; $intPos <= strlen($strBin1); $intPos = $intPos + 1) {
      if (substr($strBin1, intval($intPos) - 1, 1) == "1" || substr($strBin2, intval($intPos) - 1, 1) == "1") {

         $strBinaryFinal = $strBinaryFinal . "1";
      } else {

         $strBinaryFinal = $strBinaryFinal . "0";
      }
   }

   $function_ret = $strBinaryFinal;
   return $function_ret;
}

function ww_BinaryAND($strBin1, $strBin2) {
   //extract($GLOBALS);;
// Function performs an AND function on each position of two binary values
//
// Written By: Mark Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header is kept intact
//
   $strBinaryFinal = '';
   for ($intPos = 1; $intPos <= strlen($strBin1); $intPos = $intPos + 1) {
      if (substr($strBin1, intval($intPos) - 1, 1) == "1" && substr($strBin2, intval($intPos) - 1, 1) == "1") {

         $strBinaryFinal = $strBinaryFinal . "1";
      } else {

         $strBinaryFinal = $strBinaryFinal . "0";
      }
   }

   $function_ret = $strBinaryFinal;
   return $function_ret;
}

function ww_BinaryNOT($strBinary) {
   //extract($GLOBALS);;
// Function makes each position of a binary value from 1 to 0 and 0 to 1
//
// Written By: Mark Jager
// Written Date: 8/10/2000
//
// Free to distribute as long as code is not modified, and header is kept intact
//
   $strBinaryFinal = '';
   for ($intPos = 1; $intPos <= strlen($strBinary); $intPos = $intPos + 1) {
      if (substr($strBinary, intval($intPos) - 1, 1) == "1") {

         $strBinaryFinal = $strBinaryFinal . "0";
      } else {

         $strBinaryFinal = $strBinaryFinal . "1";
      }
   }

   $function_ret = $strBinaryFinal;

   return $function_ret;
}

function ww_HexBlockToBinary($strHex) {
   //extract($GLOBALS);;
// Function Converts a 8 digit/32 bit hex value to its 32 bit binary equivalent
//
// Written By: Mark Jager
// Written Date: 8/10/2000
// Free to distribute as long as code is not modified, and header is kept intact
//
   $strTemp = '';
   for ($intPos = 1; $intPos <= strlen($strHex); $intPos = $intPos + 1) {
      $strTemp = $strTemp . ww_HexToBinary(substr($strHex, intval($intPos) - 1, 1));
   }

   $function_ret = $strTemp;

   return $function_ret;
}

function ww_left($s, $x) {
   return substr($s, 0, $x);
}

function ww_right($s, $x) {
   return substr($s, $x * -1);
}

function ww_mid($s, $x, $w = "") {  //$w is optional
   if ($w) {
      return substr($s, $x - 1, $w);
   } else {
      return substr($s, $x - 1);
   }
}


text:
module.exports = function(grunt) {

  require('load-grunt-tasks')(grunt);

  pkg: grunt.file.readJSON('package.json'),
  grunt.initConfig({

    // Concatenate CSS files
    concat: {
      dist: {
        src: [
          // _base.css required for .animated helper class
          'source/_base.css',
          'source/**/*.css'
        ],
        dest: 'animate.css'
      }
    },

    // Auto-prefix CSS properties using Can I Use?
    autoprefixer: {
      options: {
        browsers: ['last 3 versions', 'bb 10', 'android 3']
      },
      no_dest: {
        // File to output
        src: 'animate.css'
      },
    },

    // Minify CSS
    cssmin: {
      minify: {
        src: ['animate.css'],
        dest: 'animate.min.css',
      },
    },

    // Watch files for changes
    watch: {
      css: {
        files: [
          'source/**/*',
          '!node_modules',
          'animate-config.json'
        ],
        // Run Sass, autoprefixer, and CSSO
        tasks: ['concat-anim', 'autoprefixer', 'cssmin'],
      }
    }

  });

  // Register our tasks
  grunt.registerTask('default', ['concat-anim', 'autoprefixer', 'cssmin', 'watch']);

  grunt.registerTask('concat-anim', 'Concatenates activated animations', function () {
    var config = grunt.file.readJSON('animate-config.json'),
        target = [ 'source/_base.css' ],
        count = 0

    for (var cat in config) {
      for (var file in config[cat]) {
        if (config[cat][file]) {
          target.push('source/' + cat + '/' + file + '.css')
          count++
        }
      }
    }

    if (!count) {
      grunt.log.writeln('No animations activated.')
    }

    grunt.log.writeln(count + (count > 1 ? ' animations' : ' animation') + ' activated.')

    grunt.config('concat', { 'animate.css': target })
    grunt.task.run('concat')
  });
};


text:
class SysInfoLinuxImpl : public SysInfo
{
public:
    SysInfoLinuxImpl();
    void init() override;
    double cpuLoadAverage() override;
    double memoryUsed() override;

private:
    QVector<qulonglong> cpuRawData();

private:
    QVector<qulonglong> mCpuLoadLastValues;

};

#endif // SYSINFOLINUXIMPL_H


text:
'use strict';

module.exports = function (db) {
    db.Ticket.create({
        username: 10155,
        displayName: 'Gabriel Juchault',
        mail: 'gabriel.juchault@gmail.com',
        student: true,
        contributor: true,
        paid: true,
        paid_at: new Date(),
        paid_with: 'buckutt',
        temporarlyOut: false,
        barcode: '3780173904905',
        bdeCard: null,
        validatedMap: null,
        birthdate: '21/09/1994',
        mainTicket: 0
    }).complete(function (err, galaGJ) {
        if (err) {
            Error.emit(null, 500, '500 - SQL Server error', err.toString());
        }

        db.Price.find({ name: 'Gala 2015 - Prix étudiant cotisant en prévente' }).complete(function (err, price) {
            if (err) {
                Error.emit(null, 500, '500 - SQL Server error', err.toString());
            }

            galaGJ.setPrice(price);
        });

        galaGJ.setEvent(1);
    });

    db.Ticket.create({
        username: 55101,
        displayName: 'Gabriel Juchault',
        mail: 'gabriel.juchault@gmail.com',
        student: true,
        contributor: true,
        paid: true,
        paid_at: new Date(),
        paid_with: 'buckutt',
        temporarlyOut: false,
        barcode: '123456',
        bdeCard: null,
        validatedMap: null,
        birthdate: '22/09/1994',
        mainTicket: 0
    }).complete(function (err, galaGJ) {
        if (err) {
            Error.emit(null, 500, '500 - SQL Server error', err.toString());
        }

        db.Price.find({ name: 'Gala 2015 - Prix étudiant cotisant en prévente' }).complete(function (err, price) {
            if (err) {
                Error.emit(null, 500, '500 - SQL Server error', err.toString());
            }

            galaGJ.setPrice(price);
        });

        galaGJ.setEvent(1);
    });
};


text:
class MartialArtsController < ApplicationController
	before_action :authenticate_user!, only: [ :new, :create ]

  def index
    @martial_arts = MartialArt.all
  end

  def search
    @search = params[:query]
    @martial_arts = MartialArt.search(@search)
    @no_results = !@martial_art
  end

  def aikido
    @aikido= MartialArt.all
  end

  def brazillian_jui_jitsu
    @brazillian_jui_jitsu= MartialArt.all
  end

  def judo
    @judo= MartialArt.all
  end

  def jui_jitsu
    @jui_jitsu= MartialArt.all
  end

  def karate
    @karate = MartialArt.all
  end

  def krav_maga
    @krav_maga= MartialArt.all
  end

  def kung_fu
    @kung_fu = MartialArt.all
  end

  def muay_thai
    @muay_thai = MartialArt.all
  end

  def taekwondo
    @taekwondo = MartialArt.all
  end

  def thai_chi
    @thai_chi = MartialArt.all
  end

  def tang_soo_do
    @tang_soo_do = MartialArt.all
  end

  def add
    @martial_art = MartialArt.new
  end

  def create
  @martial_art = MartialArt.new(parameters)
  if @martial_art.valid?
    @martial_art.save
    flash[:info] = 'Your new Martial Art has now been added'
    return redirect_to root_path
  end

   flash[:error] = "You have errors"
  end

  def new
    @blog = Blog.new(user: current_user)
  end

  def blog
      @blog = Blog.new(parameters)
      if @blog.valid?
        @blog.save
        flash[:info] = 'Excellent news! Blog created'
        return redirect_to root_path
    end

    flash[:error] = "You have errors"
  end

  #def show
    #@martial_art = MartialArt.find params[:id]
  #end

  #def comment
    #@martial_art = MartialArt.new user_id: current_user.id
    #@martial_art = current_user.comments.new
  #end

  private

  def parameters
    params.require(:martial_art).permit(:name, :description, :image)
    params.require(:blog).permit(:title, :description, :category_id)
  end
end


text:
static UPLOAD: &'static str = "upload";
static NID: usize = 8;

extern crate rocket;
extern crate rocket_contrib;
extern crate rand;
extern crate serde;
#[macro_use] extern crate serde_derive;

use std::io;
use std::io::{Read, BufRead, Write};
use std::path::Path;
use std::collections::HashMap;
use std::fs::{File, create_dir, metadata, remove_file};

use rocket::Data;
use rocket::response::NamedFile;
use rocket_contrib::Template;
use rocket::request::Form;
use rocket::response::Redirect;

mod paste_id;
use paste_id::PasteID;

#[derive(Serialize)]
struct PasteInfo {
    paste_id: String,
    snippet: String,
    ellipsis: bool
}

#[get("/")]
fn index() -> io::Result<Template> {
    let dirents = std::fs::read_dir(UPLOAD)
                  .expect("could not open upload directory");
    let pastes = dirents.map(|d| {
        let paste_id = d.unwrap().file_name().into_string().unwrap();
        let paste_filename = Path::new(UPLOAD).join(&paste_id);
        let paste_file = NamedFile::open(&paste_filename)
                         .expect("could not open paste file");
        let mut paste_reader = io::BufReader::new(paste_file);
        let mut paste_line = String::new();
        let paste_len = paste_reader.read_line(&mut paste_line)
                        .expect("could not read first line of paste");
        let (ellipsis, snippet) =
            if paste_len < 24 {
                (false, paste_line)
            } else {
                let result = (&paste_line)[0..24].to_string();
                (true, result)
            };
        PasteInfo { paste_id: paste_id, snippet: snippet, ellipsis: ellipsis }
    }).collect::<Vec<PasteInfo>>();
    let mut context: HashMap<&str, _> = HashMap::new();
    context.insert("pastes", &pastes);
    Ok(Template::render("index", &context))
}

#[post("/", data = "<paste>")]
fn upload(paste: Data) -> io::Result<String> {
    let paste_id = PasteID::new(NID);
    let path = Path::new(UPLOAD).join(&paste_id.to_string());
    paste.stream_to_file(path)?;
    Ok(format!("/{}\n", paste_id))
}

fn open_paste(id: &PasteID) -> io::Result<NamedFile> {
    let filename = Path::new(UPLOAD).join(id.to_string());
    NamedFile::open(&filename)
}

fn create_paste(id: &PasteID) -> io::Result<File> {
    let filename = Path::new(UPLOAD).join(id.to_string());
    File::create(&filename)
}

#[get("/<id>")]
fn retrieve(id: PasteID) -> Option<NamedFile> {
    open_paste(&id).ok()
}

#[get("/new")]
fn edit_new() -> io::Result<Redirect> {
    let paste_id = PasteID::new(NID);
    let f = try!(create_paste(&paste_id));
    drop(f);
    Ok(Redirect::to(&format!("/edit/{}", paste_id.to_string())))
}

#[get("/edit/<id>")]
fn make_edit(id: PasteID) -> io::Result<Template> {
    let paste = open_paste(&id)?;
    let mut paste_reader = io::BufReader::new(paste);
    let mut paste_contents = String::new();
    paste_reader.read_to_string(&mut paste_contents)?;
    let paste_id = id.to_string();
    let paste_rows = format!("{}", 100);
    let mut context: HashMap<&str, _> = HashMap::new();
    context.insert("contents", &paste_contents);
    context.insert("paste_id", &paste_id);
    context.insert("paste_rows", &paste_rows);
    Ok(Template::render("edit", &context))
}

#[derive(FromForm)]
struct EditForm {
    paste: String
}

#[post("/edit/<id>", data = "<form>")]
fn accept_edit(id: PasteID, form: Form<EditForm>) -> io::Result<Redirect> {
    let edit = form.get();
    let paste = create_paste(&id)?;
    let mut paste_writer = io::BufWriter::new(paste);
    paste_writer.write_all(edit.paste.as_bytes())?;
    paste_writer.flush()?;
    Ok(Redirect::to("/"))
}

#[get("/delete/<id>")]
fn delete(id: PasteID) -> io::Result<Redirect> {
    let filename = Path::new(UPLOAD).join(id.to_string());
    try!(remove_file(&filename));
    Ok(Redirect::to("/"))
}

fn ok_dir<P: AsRef<Path>>(path: P) -> bool {
    match metadata(path.as_ref()) {
        Ok(md) => md.is_dir(),
        _ => false
    }
}

fn check_upload_dir() {
    if !ok_dir(UPLOAD) {
        create_dir(UPLOAD).expect("could not create upload directory");
    }
}

fn main() {
    check_upload_dir();
    let rocket = rocket::ignite();
    let rocket = rocket.mount("/", routes![index, upload, edit_new, retrieve,
                                           make_edit, accept_edit, delete]);
    rocket.launch()
}

#[cfg(test)]
mod test {
    extern crate scraper;

    use super::rocket;
    use rocket::testing::MockRequest;
    use rocket::http::{Status, Method};
    use self::scraper::{Html, Selector};

    #[test]
    fn index() {
        let rocket = rocket::ignite().mount("/", routes![super::index]);

        let mut req = MockRequest::new(Method::Get, "/");
        let mut response = req.dispatch_with(&rocket);

        assert_eq!(response.status(), Status::Ok);

        let body_str = response.body()
                       .and_then(|b| b.into_string())
                       .expect("Missing response body!");
        let body_html = Html::parse_fragment(&body_str);
        assert_has_text(&body_html, "Pastebin!");
        assert_has_selector(&body_html, "ul");
        assert_no_selector(&body_html, "ul li");
    }

    fn assert_has_text(body: &Html, expected: &str) {
        let selector = Selector::parse("*").unwrap();
        let nodes = body.select(&selector);
        let texts = nodes.map(|node| node.text().collect::<Vec<_>>().concat());
        let actual = texts.collect::<Vec<_>>().concat();
        assert!(&actual.contains(expected));
    }

    fn count_selectors(body: &Html, selector_text: &str) -> usize {
        let selector = Selector::parse(selector_text)
                       .expect("Invalid selector!");
        body.select(&selector).count()
    }

    fn assert_has_selector(body: &Html, selector_text: &str) {
        let count = count_selectors(body, selector_text);
        assert!(count > 0);
    }

    fn assert_no_selector(body: &Html, selector_text: &str) {
        let count = count_selectors(body, selector_text);
        assert_eq!(0, count);
    }
}


text:
from copy import deepcopy as clone_object
from fluent.sender import FluentSender
from math import isnan, isinf
from laikaboss.si_module import SI_MODULE
from laikaboss.util import get_option, log_module_error
from uuid import UUID

# XXX: Stub class for scanObject for spoofing log_module_error
class ScanObjectStub:
    def __init__(self,):
        self.parent = ''
        self.uuid = ''

# XXX: Stub class for result for spoofing log_module_error
class ResultStub:
    def __init__(self,):
        self.files = {}

class LOG_FLUENT(SI_MODULE):
    '''Laika module for logging scan results using fluentd.'''

    def __init__(self,):
        '''Main constructor'''
        self.module_name = "LOG_FLUENT"
        self._senders = {}

    def _run(self, scanObject, result, depth, args):
        """Main module execution. Logs the scan result to fluentd."""
        tag  = get_option(args, "tag",  "fluent_tag",  "laikaboss.log_fluent")
        host = get_option(args, "host", "fluent_host", "localhost")
        port = int(get_option(args, "port", "fluent_port", 24224))
        bufmax = int(get_option(args, "bufmax", "fluent_bufmax", 1048576)) # 1 MB
        timeout = float(get_option(args, "timeout", "fluent_timeout", 3.0))
        label = get_option(args, "label", "fluent_label", "scan_result")

        sender = self._get_sender(tag, host, port, bufmax, timeout)
        log_record = self._parse_log_record(result)
        sender.emit(label, log_record)
        if sender.pendings: # buffer in case of failed transmission
            log_module_error(self.module_name, scanObject, result,
                'Log event failed emition. Will retry on next emition.')
        return []

    def _close(self,):
        '''Laika framework destructor'''
        for sender in self._senders.itervalues():
            if sender.pendings:
                sender.emit('flush',
                    {'message':
                        'This event is to flush out the buffer of the python fluentd logger'})
                if sender.pendings:
                    # XXX: Laika logging hack using stubs
                    log_module_error(self.module_name, ScanObjectStub(), ResultStub(),
                        'Failed to flush buffer. Log events lost.')

    def _get_sender(self, tag, host, port, bufmax, timeout):
        '''
        Get the Fluentd sender for the given arguments.

        Arguments:
        tag     --  The base tag of the log event, representing the
                    application.
        host    --  The host name or IP address of the fluentd server.
        port    --  The port number the fluentd server is listeneing on.
        bufmax  --  The size of the buffer.
        timeout --  The timeout

        Returns:
        A FluentSender with the given configuration.
        '''
        sender = None
        key = "%s%s%d%d%f" % (tag, host, port, bufmax, timeout)
        if key in self._senders:
            sender = self._senders[key]
        else:
            sender = FluentSender(tag, host, port, bufmax, timeout)
            self._senders[key] = sender
        return sender

    def _parse_log_record(self, result):
        '''
        Construct a log record from data within the scan result.

        Arguments:
        result  --  The scan result.

        Returns:
        A log record respresenting the scan result.
        '''
        # Build the results portion of the log record. This will be a list of
        # dictionaries, where each dictionary is the result of a single buffer's
        # scan. The list will contain all of the buffers that were exploded from
        # a root buffer's scan in no particular order.
        buffer_results = []
        for scan_object in result.files.itervalues():
            # Do not damage the original result -> clone
            buffer_result = clone_object(scan_object.__dict__)
            # Don't log buffers here, just metadata
            if "buffer" in buffer_result:
                del buffer_result["buffer"]
            buffer_results.append(buffer_result)

        # Construct the log record with fields useful for log processing and
        # routing
        log_record = {
            'source': result.source,
            'scan_result': self._log_record_strainer(buffer_results)
        }

        return log_record

    def _log_record_strainer(self, thing):
        '''
        Prepare object for recording to log. The record must be able to be
        marshalled into JSON without using custom encoders, since this
        marshalling occurs after the log record has been emitted.

        Arguments:
        thing   --  The object that needs to be strained.

        Returns:
        The object converted into a state that can be emitted to the log.
        '''
        thing_type = type(thing)
        if thing_type in [list, set, frozenset]:
            new_thing = []
            for element in thing:
                new_thing.append(self._log_record_strainer(element))
            return new_thing
        elif thing_type is dict:
            new_thing = {}
            for key, value in thing.iteritems():
                new_key = self._log_record_strainer(key)
                new_value = self._log_record_strainer(value)
                new_thing[new_key] = new_value
            return new_thing
        elif thing_type is UUID:
            return str(thing)
        # JSON does not fully support NaN and Infinity in its spec, so some JSON libraries do not
        # handle these values and instead raise an error. Serializing these to the string
        # respresentation to prevent these errors from disrupting logging.
        elif thing_type is float:
            if isnan(thing):
                return 'NaN'
            elif isinf(thing):
                return 'Inf'
            else:
                return thing
        else:
            return thing


text:
(function(window,document,undefined){

var mi = (function () {
    'use strict';

    function filters() {

    }

    return {
        'filters': filters,
    }
});

}(window,document,undefined));


text:
var tilelive = require('tilelive');
var path = require('path');
var fs = require("fs");
var zlib = require("zlib");

const
MAX_ZOOM = 14;

require('tilelive-bridge').registerProtocols(tilelive);

var args = process.argv;
args.splice(0, 2); // Remove 'node' and the name of the script

var recursive = false;
var compress = false;
var outputPrefix = null;

// Check for flags
while (args.length > 0) {
	if (args[0] == '-r') { // Recursive mode
		recursive = true;
		args.splice(0, 1);
	} else if (args[0] == '-p') { // Output prefix
		outputPrefix = args[1];
		args.splice(0, 2);
	} else if (args[0] == '-c') { // Compression
		compress = true;
		args.splice(0, 1);
	} else {
		break; // Done processing flags
	}
}

if (args.length < 4) {
	console.error('Usage tile-conv <mapnik xlm file> <z> <x> <y>');
	process.exit(1);
}

var mapFile = path.resolve(__dirname, args[0]);
var originZ = args[1];
var originX = args[2];
var originY = args[3];

if (outputPrefix == null) {
	outputPrefix =  path.parse(mapFile).name;
}

var counter = 0;
var zoomLevels = MAX_ZOOM - originZ;
var totalCount = 0;
if (recursive) {
	while (zoomLevels >= 0) {
		totalCount += Math.pow(4, zoomLevels);
		zoomLevels--;
	}
} else {
	totalCount = 1;
}

console.log('Loading data from ' + mapFile);

tilelive.load("bridge://" + mapFile, function(err, source) {
	if (err)
		throw err;
	if (recursive) {
		processTileRecursive(source, originZ, originX, originY, function() {
			console.log('Done!');
			process.exit(0);
		});
	} else {
		processTile(source, originZ, originX, originY, function() {
			console.log('Done!');
			process.exit(0);
		});
	}
});

function processTileRecursive(source, z, x, y, callback) {
	processTile(source, z, x, y, function(empty) {
		if (z == MAX_ZOOM || empty) {
			callback();
			return;
		}
		var nextZ = ++z;
		var nextX = x * 2;
		var nextY = y * 2;
		// Process the four sub quads
		processTileRecursive(source, nextZ, nextX, nextY, function() {
			processTileRecursive(source, nextZ, nextX + 1, nextY, function() {
				processTileRecursive(source, nextZ, nextX, nextY + 1, function() {
					processTileRecursive(source, nextZ, nextX + 1, nextY + 1, function() {
						callback();
					});
				});
			});
		});
	});
}

function processTile(source, z, x, y, callback) {
	console.log('Processing tile ' + z + ' ' + x + ' ' + y);
	// Interface is in XYZ/Google coordinates.
	// Use `y = (1 << z) - 1 - y` to flip TMS coordinates.
	source.getTile(z, x, y, function(err, tile, headers) {
		if (err) {
			counter++;
			callback(true);
			return;
		}
		var fileName = 'out/' + outputPrefix + '-' + z + '-' + x + '-' + y + '.pbf';
		if (compress) {
			fileName += '.gz';
		}
		var finishedCallback = function() {
			counter++;
			console.log('Completed ' + counter + '/' + totalCount);
			callback(false);
		};
		if (compress) {
			writeFile(fileName, tile, finishedCallback);
		} else {
			zlib.gunzip(tile, function(err, decompressed) {
				writeFile(fileName, decompressed, finishedCallback);
			});
		}
	});
}

function writeFile(fileName, data, callback) {
	var out = fs.createWriteStream(fileName);
	out.on('finish', function() {
		callback();
	});
	out.write(data);
	out.end();
}


text:
package org.luaj.vm2.lib.jse;

import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.LibFunction;

/**
 * Subclass of {@link LibFunction} which implements the lua standard {@code math}
 * library.
 *

 * It contains all lua math functions, including those not available on the JME platform.
 * See {@link org.luaj.lib.MathLib} for the exception list.
 *

 * Typically, this library is included as part of a call to
 * {@link JsePlatform#standardGlobals()}
 *
 {@code
 * Globals globals = JsePlatform.standardGlobals();
 * System.out.println( globals.get("math").get("sqrt").call( LuaValue.valueOf(2) ) );
 * }

 *

 * For special cases where the smallest possible footprint is desired,
 * a minimal set of libraries could be loaded
 * directly via {@link Globals#load(LuaValue)} using code such as:
 *
 {@code
 * Globals globals = new Globals();
 * globals.load(new JseBaseLib());
 * globals.load(new PackageLib());
 * globals.load(new JseMathLib());
 * System.out.println( globals.get("math").get("sqrt").call( LuaValue.valueOf(2) ) );
 * }

 *
However, other libraries such as CoroutineLib are not loaded in this case.
 *

 * This has been implemented to match as closely as possible the behavior in the corresponding library in C.
 * @see LibFunction
 * @see JsePlatform
 * @see org.luaj.vm2.lib.jme.JmePlatform
 * @see JseMathLib
 * @see Lua 5.2 Math Lib Reference
 */
public class JseMathLib extends org.luaj.vm2.lib.MathLib {

	public JseMathLib() {}

	public LuaValue call(LuaValue modname, LuaValue env) {
		super.call(modname, env);
		LuaValue math = env.get("math");
		math.set("acos", new acos());
		math.set("asin", new asin());
		math.set("atan", new atan());
		math.set("atan2", new atan2());
		math.set("cosh", new cosh());
		math.set("exp", new exp());
		math.set("log", new log());
		math.set("pow", new pow());
		math.set("sinh", new sinh());
		math.set("tanh", new tanh());
		return math;
	}

	static final class acos extends UnaryOp { protected double call(double d) { return Math.acos(d); } }
	static final class asin extends UnaryOp { protected double call(double d) { return Math.asin(d); } }
	static final class atan extends UnaryOp { protected double call(double d) { return Math.atan(d); } }
	static final class atan2 extends BinaryOp { protected double call(double y, double x) { return Math.atan2(y, x); } }
	static final class cosh extends UnaryOp { protected double call(double d) { return Math.cosh(d); } }
	static final class exp extends UnaryOp { protected double call(double d) { return Math.exp(d); } }
	static final class log extends UnaryOp { protected double call(double d) { return Math.log(d); } }
	static final class pow extends BinaryOp { protected double call(double x, double y) { return Math.pow(x, y); } }
	static final class sinh extends UnaryOp { protected double call(double d) { return Math.sinh(d); } }
	static final class tanh extends UnaryOp { protected double call(double d) { return Math.tanh(d); } }

	/** Faster, better version of pow() used by arithmetic operator ^ */
	public double dpow_lib(double a, double b) {
		return Math.pow(a, b);
	}

}


text:
module Circle (area) where

	area :: Float -> Float
	area x = 3.14 * (x*x)


text:
package gensupport

import "syscall"

func init() {
	// Initialize syscallRetryable to return true on transient socket-level
	// errors. These errors are specific to Linux.
	syscallRetryable = func(err error) bool { return err == syscall.ECONNRESET || err == syscall.ECONNREFUSED }
}


text:
"""Script to create stem level has_bleed annotations."""

from __future__ import print_function

import argparse
import librosa
import numpy as np

from medleydb.multitrack import MultiTrack

def load_audio(filepath, samplerate):
    y, sr = librosa.load(filepath, sr=samplerate)
    return y, sr

def make_audio_stack(mtrack, fs=22050):
    stems = mtrack.stems
    n_stems = len(stems)

    print("loading stem 1...")
    stem1_audio, fs = load_audio(stems[1].audio_path, fs)
    n_samples = len(stem1_audio)

    audio_stack = np.zeros((n_stems, n_samples))

    for stem_idx in stems:
        if stem_idx == 1:
            audio_stack[0, :] = stem1_audio
        else:
            print("loading stem %s..." % stem_idx)
            audio_path = stems[stem_idx].file_path
            audio_stack[stem_idx - 1, :], _ = load_audio(audio_path, fs)

    return audio_stack, fs, n_samples

def compute_bleed_estimation_matrix(audio_stack, fs, n_samples):
    # TODO
    pass

def main(args):
    mtrack = MultiTrack(args.track_id)
    audio_stack, fs, n_samples = make_audio_stack(mtrack)
    compute_bleed_estimation_matrix(audio_stack, fs, n_samples)
    # TODO save output to file

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="")
    parser.add_argument("track_id",
                        type=str,
                        help="MedleyDB track id. Ex. MusicDelta_Rock")
    parser.add_argument("write_output",
                        type=bool,
                        default=True,
                        help="If true, write the output to a file")

    main(parser.parse_args())


text:
/*
HubGraph grabs the latest events from the GitHub's API and builds an entertaining graph upon them.

A frontend web page is exposed with a D3-powered (https://d3js.org/) force graph in it.
Both unauthenticated and authenticated (OAUTH2 token) requests are supported, enabling the use of the 60 req/hr and 5000 req/hr rate limits.

Consult the help by running `./hubgraph -h` to learn more about the configuration options.
*/
package main

import (
	"flag"
	"fmt"
	"log"
	"reflect"
	"time"
)

var (
	port string
	pages int
	token string
	delay int
	showDashboard bool
)

type (
	node struct {
		ID    string `json:"id"`
		Group int    `json:"group"`
		Title string `json:"title"`
	}

	link struct {
		Source string `json:"source"`
		Target string `json:"target"`
		Value  int    `json:"value"`
	}

	// D3 is the structure used to construct the data for the frontend D3 graph.
	D3 struct {
		Nodes []node `json:"nodes"`
		Links []link `json:"links"`
	}

	// Dashboard is the structure containing the necessary details for the dashboard.
	Dashboard struct {
		ShowDashboard   bool   `json:"showDashboard"`
		RequestsUsed    int    `json:"requestsUsed"`
		MaxRequests     int    `json:"maxRequests"`
		RefreshInterval int64  `json:"refreshInterval"`
		LastUpdate      string `json:"lastUpdate"`
	}
)

// stringInSlice determines whenever a string is already present in a slice.
func stringInSlice(a string, list []string) bool {
	for _, b := range list {
		if b == a {
			return true
		}
	}
	return false
}

// extractReposAsNodes parses the obtained data and creates the main nodes for every present repo.
func extractReposAsNodes(events GithubEvents, d3Data *D3) {
	var repos []string
	for _, evt := range events {
		if !stringInSlice(evt.Repo.Name, repos) {
			repos = append(repos, evt.Repo.Name)
		}
	}
	for _, repoName := range repos {
		d3Data.Nodes = append(d3Data.Nodes, node{repoName, 0, ""})
	}
}

// extractEventsAsLinks parses the obtained data and creates the links between the nodes.
func extractEventsAsLinks(events GithubEvents, d3Data *D3) {
	for _, evt := range events {
		// Generic handler
		group, title := GetSpecsFromEventType(evt.Type)
		d3Data.Nodes = append(d3Data.Nodes, node{evt.ID, group, title})
		d3Data.Links = append(d3Data.Links, link{evt.Repo.Name, evt.ID, 1})
		// Fork event
		if evt.Type == "ForkEvent" {
			d3Data.Nodes = append(d3Data.Nodes, node{evt.Payload.Forkee.FullName, 0, ""})
			d3Data.Links = append(d3Data.Links, link{evt.Repo.Name, evt.Payload.Forkee.FullName, 10})
		}
	}
}

// buildGraph wraps around the other graph-building functions to generate new graph data.
// It iterates on as many API event pages as specified via the CLI flag or the default value.
func buildGraph() {
	// Prepare graph struct
	var d3Data D3

	// Loop around API pages
	for page := 1; page < pages+1; page++ {
		// Output progress to console
		clearLine()
		fmt.Printf("Analyzing page %d...\r", page)
		// Get latest events from GitHub
		events, err := GetHubData(pages, page, token)

		if _err, ok := err.(*APIError); ok {
			if _err.status == 403 {
				secondsToWait := RateLimitSpecs.ResetTimestamp - time.Now().UTC().Unix() + 3
				for {
					if secondsToWait <= 0 {
						clearLine()
						break
					}
					fmt.Printf("Rate limit reached. Will reset in %d seconds.    \r", secondsToWait)
					time.Sleep(time.Second * 1)
					secondsToWait--
				}
				buildGraph()
				return
			} else if _err.status == 304 {
				clearLine()
				fmt.Println("No new data available.")
				time.Sleep(time.Second * 1)
				return
			}
		} else if events == nil {
			fmt.Println("No new data available!")
			return
		}

		// Create graph nodes
		extractReposAsNodes(events, &d3Data)
		// Create graph links
		extractEventsAsLinks(events, &d3Data)
	}

	// Output progress to console
	clearLine()
	fmt.Printf("Building graph data...\r")
	// Output graph data to memory
	MarshalD3ToMemory(d3Data)
}

func buildDashboard(refreshInterval int64) {
	var dashboardData Dashboard

	dashboardData.ShowDashboard = showDashboard
	dashboardData.RequestsUsed = RateLimitSpecs.Limit - RateLimitSpecs.Remaining
	dashboardData.MaxRequests = RateLimitSpecs.Limit
	dashboardData.RefreshInterval = refreshInterval
	dashboardData.LastUpdate = time.Now().Format(time.RFC1123Z)

	MarshalDashboardToMemory(dashboardData)
}

// clearLine makes sure the terminal line is (theoretically...) empty before writing on it.
func clearLine() {
	fmt.Printf("                                                                                \r")
}

func main() {
	flag.StringVar(&port, "port", "3000", "The port to listen on")
	flag.IntVar(&pages, "pages", 3, "How many pages to read (will impact rate limiting dramatically!)")
	flag.IntVar(&delay, "delay", (60 * pages), "Delay in seconds between data refreshes. Defaults to (60 * pages), a safe timing for unauthenticated requests")
	flag.StringVar(&token, "token", "", "The token to authenticate requests with (will bring rate limiting to 5000/hr instead of 60/hr - https://github.com/settings/tokens/new)")
	flag.BoolVar(&showDashboard, "dashboard", false, "Show the dashboard - EXPERIMENTAL.")  // TODO: issue #4
	flag.Parse()

	Listen(port)
	fmt.Println("Listening on port " + port + " - http://localhost:" + port + "/\n")

	GetRateLimits(token)

	var duration time.Duration
	if delay != (60 * pages) {
		duration = time.Second * time.Duration(delay)
	} else {
		if reflect.TypeOf(RateLimitSpecs.PollInterval).String() != "int" || RateLimitSpecs.PollInterval <= 0 {
			RateLimitSpecs.PollInterval = 60 * pages
		}
		duration = time.Second * time.Duration(RateLimitSpecs.PollInterval)
	}

	refreshInterval := int64(duration.Seconds())

	buildGraph()
	GetRateLimits(token)
	buildDashboard(refreshInterval)

	secondsToWait := refreshInterval
	lastUpdated := GetLastUpdateTime()

	for {
		for {
			if secondsToWait <= 0 {
				clearLine()
				break
			}

			nextRefresh, err := time.Parse(time.RFC1123Z, lastUpdated)

			if err != nil {
				log.Printf("Error while trying to parse last update time: \"%s\"\n", nextRefresh)
			} else {

				nextRefresh = nextRefresh.Add(time.Duration(refreshInterval) * time.Second)

				secondsToWait = int64(nextRefresh.Sub(time.Now()).Seconds())

				fmt.Printf("Content updated at %s - Next refresh in: %d (RL: %d/%d req/hr used)\r",
					lastUpdated, secondsToWait, (RateLimitSpecs.Limit - RateLimitSpecs.Remaining), RateLimitSpecs.Limit)
			}

			time.Sleep(time.Second * 1)
		}

		buildGraph()
		GetRateLimits(token)
		buildDashboard(refreshInterval)

		lastUpdated = GetLastUpdateTime()
		secondsToWait = refreshInterval
	}
}


text:
extern crate image;
extern crate imageproc;
extern crate rusttype;

use std::path::Path;
use std::env;
use imageproc::drawing::draw_text_mut;
use image::{Rgb, RgbImage};
use rusttype::{FontCollection, Scale};

fn main() {

    let arg = if env::args().count() == 2 {
            env::args().nth(1).unwrap()
        } else {
            panic!("Please enter a target file path")
        };

    let path = Path::new(&arg);

    let mut image = RgbImage::new(200, 200);

    let font = Vec::from(include_bytes!("DejaVuSans.ttf") as &[u8]);
    let font = FontCollection::from_bytes(font).unwrap().into_font().unwrap();

    let height = 12.4;
    let scale = Scale { x: height * 2.0, y: height };
    draw_text_mut(&mut image, Rgb([0u8, 0u8, 255u8]), 0, 0, scale, &font, "Hello, world!");

    let _ = image.save(path).unwrap();
}


text:
<?php
namespace Colibri\Application\Application;

use Colibri\Application\Application;
use Colibri\Cache\Cache;
use Colibri\Config\Config;
use Colibri\Http\Request;
use Colibri\Session\Session;

/**
 * Application API for most common functionality of app manipulation.
 */
class API
{
    /**
     * @var \Colibri\Application\Application
     */
    protected static $application = null;

    /**
     * API constructor.
     *
     * @param \Colibri\Application\Application $application
     */
    public function __construct(Application &$application)
    {
        self::$application = $application;
    }

    /**
     * @param string $division
     * @param string $module
     * @param string $method
     * @param array  $params
     *
     * @return string
     *
     * @throws \Colibri\Routing\Exception\NotFoundException
     */
    public static function getModuleView($division, $module, $method, ...$params)
    {
        return self::$application->getModuleView($division, $module, $method, $params);
    }

    /**
     * @param array $params
     *
     * @return string
     */
    private static function getCacheKeyForCall(array $params)
    {
        static $domainLevel = null;

        $params += $_GET;
        $keyStr = '';
        foreach ($params as $param) {
            $keyStr .= serialize($param);
        }

        $keyStr .= Request::domainPrefix(
            $domainLevel ?? $domainLevel = count(explode('.', Config::application('domain')))
        );

        return md5($keyStr);
    }

    /**
     * @param string $division
     * @param string $module
     * @param string $method
     * @param array  $params
     *
     * @return string
     *
     * @throws \Colibri\Routing\Exception\NotFoundException
     * @throws \Psr\SimpleCache\InvalidArgumentException
     */
    public static function getModuleViewCached($division, $module, $method, ...$params)
    {
        if (Config::application('useCache') && ! DEBUG) {
            $key      = self::getCacheKeyForCall(func_get_args());
            $retValue = Cache::remember($key, function () use ($division, $module, $method, $params) {
                return self::getModuleView($division, $module, $method, ...$params);
            });
        } else {
            $retValue = self::getModuleView($division, $module, $method, ...$params);
        }

        return $retValue;
    }

    /**
     * @param string $type
     * @param array  $values
     */
    protected static function pass($type, array $values)
    {
        Session::flash($type, $values);
    }

    /**
     * @param string $message
     */
    public static function passNotice(string $message)
    {
        Session::flash('app_notice', $message);
    }

    /**
     * Устанавливает и передаёт ошибки следующему вызванному скрипту
     * (однократно - удаляется в следующем вызванном скрипте).
     *
     * @param array $errors повторный вызов перезаписывет
     */
    public static function passErrors(array $errors)
    {
        self::pass('app_errors', $errors);
    }

    /**
     * Передаёт переменные в следующий вызванный скрипт.
     * Повторный вызов перезаписывет полностью все переменные.
     *
     * @param array $vars передаваемые переменные в виде ассоциативного массива
     */
    public static function passVars(array $vars)
    {
        self::pass('app_vars', $vars);
    }

    /**
     * @param string           $type
     * @param string|null      $key
     * @param array|mixed|null $default
     *
     * @return mixed
     */
    protected static function passed($type, $key = null, $default = null)
    {
        return Session::get(
            $type . ($key !== null ? '.' . $key : ''),
            $key === null && $default === null ? [] : $default
        );
    }

    /**
     * @return string|null
     */
    public static function notice()
    {
        return Session::get('app_notice');
    }

    /**
     * Возвращает переданные (из предыдущего скрипта) ошибки.
     * При вызове без параметров вернёт пустой массив.
     *
     * @param string|null      $key
     * @param array|mixed|null $default
     *
     * @return mixed
     */
    public static function errors($key = null, $default = null)
    {
        return self::passed('app_errors', $key, $default);
    }

    /**
     * Возвращает переданные (из предыдущего скрипта) переменные.
     * При вызове без параметров вернёт пустой массив.
     *
     * @param string|null      $key
     * @param array|mixed|null $default
     *
     * @return mixed
     */
    public static function vars($key = null, $default = null)
    {
        return self::passed('app_vars', $key, $default);
    }
}


text:
{% extends 'templates/nhs_transaction_layout.html' %}
{% import 'includes/form_macros.html' as form_macros %}

{% block afterHeader %}
  {% include "includes/service-headers/health-costs-checker.html" %}
{% endblock %}

{% block content %}

Back

         <form action="taxcredits-handler" method="get" class="form">

Do you get tax credits or do&#8203es your parent get Child Tax Credit because you live with them?

        <fieldset>

              <input type="radio" id="yes" name="taxcredits" value="yes">

                Yes

              <input type="radio" id="no" name="taxcredits" value="no">

                No

or

              <input type="radio" id="nk" name="taxcredits" value="nk">

                I don't know

        </fieldset>

    {{
      form_macros.button({
        label: 'Next'
      })
    }}

  </form>


text:
A small CSS file that creates an XL column option in materialize for larger screens

I work on a wide screen and I'm pretty sure I'm not the only one. In order to leverage the full width of these screens, the standard options for columns in the Materializecss grid are not enough.

I have created an extra large column, which means you can simply add an extra css file instead of creating a bunch of extra css.

The XL column is defined by screens larger than 1600px.

Simply download and link to the file in your header or concatenate it with the additional css files.

```html
<link href="css/MaterializeXL.min.css" type="text/css" rel="stylesheet" media="screen,projection"/>
```

It is referenced exactly like the other options in Materialize, only with an xl instead of an s, m or l.

# Usage
```html
<div class="container">
  <div class="section">

      <!--   Section   -->
      <div class="row">
        <div class="col s12 m4 xl2">
          <div class="icon-block">
            <h5 class="center">Speeds up development</h5>
          </div>
        </div>

        <div class="col s12 m4 xl2">
          <div class="icon-block">
            <h5 class="center">User Experience Focused</h5>
          </div>
        </div>

        <div class="col s12 m4 xl2">
          <div class="icon-block">
            <h5 class="center">Easy to work with</h5>
          </div>
        </div>
      </div>

    </div>
  </div>
```

Enjoy!


text:
exports.executeActivity = executeActivity;

function executeActivity(workflow, args, callback) {

    workflow.workflowCompleted(function () {
        callback({ success: true, activity: "completeWorkflow" });
    });

}