text:
<?php

namespace Academe\Condition;

use Academe\Condition\Resolvers\FieldExistsMongoDBResolver;
use Academe\Constant\ConnectionConstant;
use Academe\Contracts\Connection\Condition as ConditionContract;

class FieldExists extends BaseCondition implements ConditionContract
{
    /**
     * @var array
     */
    static protected $connectionToResolverClassMap = [
        ConnectionConstant::TYPE_MONGODB => FieldExistsMongoDBResolver::class,
    ];

    /**
     * @var array
     */
    protected $parameters;

    /**
     * FieldExists constructor.
     *
     * @param $field
     * @param $isExists
     */
    public function __construct($field, $isExists)
    {
        $this->parameters = [$field, $isExists];
    }

    /**
     * @return array
     */
    public function getParameters()
    {
        return $this->parameters;
    }

}

redpajama_set_name: RedPajamaGithub


text:
({
    afterRender : function(cmp, helper){
        //set id attribute for aria-controls
    	cmp.find("tabBody").getElement().setAttribute("id", cmp.getConcreteComponent().getGlobalId());
        this.superAfterRender();
    }
})


text:
$:.unshift(File.expand_path("../../../samples", __FILE__))

require 'aws_iot_device'
require 'config_shadow'

client = setting_mqtt_client

client2 =  setting_mqtt_client

callback = Proc.new do |message|
  p " Client1 catch message event"
  p "--- Topic: #{message.topic}"
  p "--- Payload: #{message.payload}"
end

callback2 = Proc.new do |message|
  p " Client2 catch message event"
  p "--- Topic: #{message.topic}"
  p "--- Payload: #{message.payload}"
end

client.subscribe("topic_2", 0, callback)
client2.subscribe("topic_1", 0,callback2)

puts "# STARTING EXAMPLE #"
client.publish("topic_1", "Hello Sir. My name is client 1. How do you do? ")
client2.publish("topic_2", "Hello Mister Client 1. My name is client 2. How do you do?")
sleep 1

2.times do
  client.publish("topic_1", "How do you do?")
  sleep 1
  client2.publish("topic_2", "How do you do?")
  sleep 1
end
sleep 2
client.disconnect
client2.disconnect


text:
class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicationsController
  include PageLayoutHelper

  layout 'profile'

  def index
    respond_to do |format|
      format.html { render "errors/not_found", layout: "errors", status: :not_found }
      format.json { render json: "", status: :not_found }
    end
  end

  def destroy
    if params[:token_id].present?
      current_resource_owner.oauth_authorized_tokens.find(params[:token_id]).revoke
    else
      Doorkeeper::Application.revoke_tokens_and_grants_for(params[:id], current_resource_owner)
    end

    redirect_to applications_profile_url,
                status: :found,
                notice: I18n.t(:notice, scope: [:doorkeeper, :flash, :authorized_applications, :destroy])
  end
end


text:
package de.iritgo.aktera.persist;

import de.iritgo.aktera.model.ModelException;
import de.iritgo.aktera.model.ModelResponse;
import org.apache.avalon.framework.configuration.Configuration;
import java.util.Set;

/**
 * A PersistentFactory is a class that generates new Persistent
 * objects, Transactions, and Queries.
 */
public interface PersistentFactory
{
	public static String ROLE = "de.iritgo.aktera.persist.PersistentFactory";

	/**
	 * Create a new persistent object with the specified name. The name must be
	 * of the form "schema.persistent".
	 */
	public Persistent create(String name) throws PersistenceException;

	/**
	 * Create a new Persistent which participates in a transaction.
	 */
	public Persistent create(String name, Transaction trx) throws PersistenceException;

	/**
	 * Begin a new transaction and pass the transaction back to the caller. Used when we want a number of database
	 * operations to be processed in a single transaction.
	 */
	public Transaction begin() throws PersistenceException;

	/**
	 * A different factory is used to talk to each different database that the application requires. Each factory has
	 * a unique name.
	 */
	public String getName();

	/**
	 * Initialize the specified schema, creating all tables as required. Logs any differences between existing
	 * tables and specified tables.
	 */
	public void createTables(String schemaName) throws PersistenceException;

	/**
	 * Initialize all schemas defined in this persistent factory, creating all tables as required.
	 * Logs any differences between existing tables and specified tables.
	 */
	public void createTables() throws PersistenceException;

	/**
	 * Return a set of Schema names this factory knows about.
	 */
	public Set getSchemas();

	/**
	 * Get the human-readable description of the specified schema
	 * @param schemaName The name of the schema
	 * @return String The human-readable description of this schema
	 */
	public String getSchemaDescription(String schemaName);

	/**
	 * Get the Configuration object for the specified schema, if this
	 * schema is defined in this PersistentFactory
	 * @param schemaName The name of the schema to retrieve configuration for
	 * @return A Configuration for the named schema, or null if no such schema exists
	 * @throws PersistenceException If a parameter error is made (e.g. null schema name), or an error
	 * occurrs retrieving the specified schema's configuration
	 */
	public Configuration getSchemaConfiguration(String schemaName);

	/**
	 * Return a list of the names of all persistent object in the specified
	 * schema.
	 */
	public Set getPersistents(String schemaName) throws PersistenceException;

	/**
	 * Convenience method to add an Input ResponseElement to the specified
	 * ModelResponse for every field in the supplied Persistent. Each Input will
	 * have a default value the same as the current value of the field in the
	 * Persistent, and the Input will have valid values if the field has a list
	 * of supplied valid values.
	 *
	 * @param res A ModelResponse object
	 * @param p A persistent to be used to create Inputs
	 * @throws PersistenceException If a problem occurs retrieving the fields
	 * @throws ModelException If a problem occurs creating the Inputs
	 */
	public void addInputs(ModelResponse res, Persistent p) throws PersistenceException, ModelException;

	/**
	 * Convenience method to add an Output ResponseElement to the specified
	 * ModelResponse for every field in the supplied Persistent. Each output
	 * will be named according to the field name from the persistent, and the
	 * content of the output will be the value of the field.
	 *
	 * @param res A ModelResponse object
	 * @param p A persistent to be used to create Outputs
	 * @throws PersistenceException If an exception occurs retrieving the fields
	 * @throws ModelException If an exception occurs creating the outputs.
	 */
	public void addOutputs(ModelResponse res, Persistent p) throws PersistenceException, ModelException;

	/**
	 * Convenience method to add a List of nested Output ResponseElements to the
	 * specified ModelRepsonse.  Similiar to addOutputs, for the individiual rows.
	 * Each row is added to the "outer" Output as row # (useful for logic:iterate).
	 * Rows are added to the Output Response Element specified by outputName.
	 *
	 * @param res A ModelResponse object
	 * @param p A persistent to be used to create Outputs
	 * @param outputName Name of Output ResponseElement to add the List to.
	 * @throws PersistenceException If an exception occurs retrieving the fields
	 * @throws ModelException If an exception occurs creating the outputs.
	 * @see #addOutputs(ModelReponse, Persistent)
	 */
	public void addQuery(final ModelResponse res, final Persistent p, final String outputName)
		throws PersistenceException, ModelException;

	/**
	 * Convenience method to add a List of nested Output ResponseElements to the
	 * specified ModelRepsonse.  Similiar to addOutputs, for the individiual rows.
	 * Each row is added to the "outer" Output as row # (useful for logic:iterate).
	 * Rows are added to the Output Response Element specified by outputName.
	 *
	 * @param res A ModelResponse object
	 * @param p A persistent to be used to create Outputs
	 * @param outputName Name of Output ResponseElement to add the List to.
	 * @param fieldNames The fields to be added to the Output.  Fields will be added in the same order as in the list.
	 * @throws PersistenceException If an exception occurs retrieving the fields
	 * @throws ModelException If an exception occurs creating the outputs.
	 * @see #addOutputs(ModelReponse, Persistent)
	 */
	public void addQuery(final ModelResponse res, final Persistent p, final String outputName, final String[] fieldNames)
		throws PersistenceException, ModelException;

	/**
	 * Return the name of an another persistent factory where we find
	 * the definitions of the Keel security persistent objects. If we get null
	 * we find them here.
	 */
	public String getSecurity();

	/**
	 * A convenience method which gets another factory (other than the current
	 * one).
	 * @param factoryName The name of the factory being requested
	 * @return A new PersistentFactory
	 * @throws PersistenceException If the factory cannot be initialized, or
	 * there is no such factory configured
	 */
	public PersistentFactory getFactory(String factoryName) throws PersistenceException;
}


text:
package io.hekate.codec.internal;

import io.hekate.codec.Codec;
import io.hekate.codec.CodecService;
import io.hekate.codec.DataReader;
import io.hekate.codec.DataWriter;
import io.hekate.codec.DecodeFunction;
import io.hekate.codec.EncodeFunction;
import io.hekate.codec.EncoderDecoder;
import io.hekate.codec.StreamDataReader;
import io.hekate.codec.StreamDataWriter;
import io.hekate.core.internal.util.ArgAssert;
import io.hekate.util.format.ToString;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

class DefaultEncoderDecoder<T> implements EncoderDecoder<T> {
    private final Class<T> type;

    private final ByteArrayOutputStreamPool buffers;

    private final EncodeFunction<T> encoder;

    private final DecodeFunction<T> decoder;

    public DefaultEncoderDecoder(ByteArrayOutputStreamPool buffers, Codec<T> codec) {
        this.type = codec.baseType();
        this.buffers = buffers;
        this.encoder = codec;
        this.decoder = codec;
    }

    public DefaultEncoderDecoder(
        Class<T> type,
        ByteArrayOutputStreamPool buffers,
        EncodeFunction<T> encoder,
        DecodeFunction<T> decoder
    ) {
        this.type = type;
        this.buffers = buffers;
        this.encoder = encoder;
        this.decoder = decoder;
    }

    @Override
    public void encode(T obj, OutputStream out) {
        checkType(obj);

        encode(obj, (DataWriter)new StreamDataWriter(out));
    }

    @Override
    public void encode(T obj, DataWriter out) {
        checkType(obj);

        ArgAssert.notNull(obj, "Object to encode");
        ArgAssert.notNull(out, "Output stream");

        encoder.encodeUnchecked(obj, out);
    }

    @Override
    public byte[] encode(T obj) {
        ArgAssert.notNull(obj, "Object to encode");

        checkType(obj);

        ByteArrayOutputStream buf = buffers.acquire();

        try {
            encoder.encodeUnchecked(obj, new StreamDataWriter(buf));

            return buf.toByteArray();
        } finally {
            buffers.recycle(buf);
        }
    }

    @Override
    public T decode(byte[] bytes) {
        ArgAssert.notNull(bytes, "Byte array");

        ByteArrayInputStream buf = new ByteArrayInputStream(bytes);

        return decoder.decodeUnchecked(new StreamDataReader(buf));
    }

    @Override
    public T decode(byte[] bytes, int offset, int limit) {
        ArgAssert.notNull(bytes, "Byte array");

        ByteArrayInputStream buf = new ByteArrayInputStream(bytes, offset, limit);

        return decoder.decodeUnchecked(new StreamDataReader(buf));
    }

    @Override
    public T decode(InputStream in) {
        return decode((DataReader)new StreamDataReader(in));
    }

    @Override
    public T decode(DataReader in) {
        ArgAssert.notNull(in, "Input stream");

        return decoder.decodeUnchecked(in);
    }

    private void checkType(T obj) {
        if (obj != null && !type.isInstance(obj)) {
            throw new ClassCastException("Can't encode/decode " + obj.getClass().getName() + " (expected " + type.getName() + ")");
        }
    }

    @Override
    public String toString() {
        return ToString.format(CodecService.class, this);
    }
}


text:
namespace MultiMiner.UX.Data
{
    public static class UserAgent
    {
        public const string AgentString = "MultiMiner/V3";
    }
}


text:
FAILSTATUS=""

check_pkg() {
	pkgname=$1
	add_define=$2
	atleast_version=$3
	printf "Checking for package ${pkgname}... "
	if pkg-config --silence-errors "${pkgname}" ; then
		echo "found"
		if [ -n "$atleast_version" ] ; then
			if ! pkg-config --atleast-version=$atleast_version ${pkgname} ; then
				echo "at least ${pkgname} $atleast_version required."
				return 1
			fi
		fi
		echo "# configuration for package ${pkgname}" >> config.mk
		result=`pkg-config --cflags ${pkgname}`
		if [ -n "$result" ] ; then
			echo "DEFINES+=$result" >> config.mk
		fi
		if [ -n "$add_define" ] ; then
			echo "DEFINES+=${add_define}" >> config.mk
		fi
		echo "LDFLAGS+=`pkg-config --libs ${pkgname}`" >> config.mk
		echo "" >> config.mk
	else
		echo "not found"
		return 1
	fi
	return 0
}

check_custom() {
	pkgname=$1
	customconfig=$2
	add_define=$3
	printf "Checking for package ${pkgname} using ${customconfig}... "
	if ${customconfig} --cflags > /dev/null 2>&1 ; then
		echo "found"
		echo "# configuration for package ${pkgname}" >> config.mk
		result=`${customconfig} --cflags`
		if [ -n "$result" ] ; then
			echo "DEFINES+=${result}" >> config.mk
		fi
		if [ -n "$add_define" ] ; then
			echo "DEFINES+=${add_define}" >> config.mk
		fi
		echo "LDFLAGS+=`${customconfig} --libs`" >> config.mk
		echo "" >> config.mk
	else
		echo "not found"
		return 1
	fi
	return 0
}

fail() {
	pkgname=$1
	rm -f config.mk
	dlurl=`grep -i "$pkgname" README | awk '{ print $NF }'`
	echo ""
	echo "You need package ${pkgname} in order to compile this program."
	echo "Please make sure it is installed."
	echo ""
	echo "You can download ${pkgname} from here: ${dlurl}"
	FAILSTATUS="1"
}

fail_custom() {
	err=$1
	echo ""
	echo "ERROR: ${err}"
	FAILSTATUS="1"
}

all_aboard_the_fail_boat() {
	if [ "x$FAILSTATUS" != "x" ] ; then
		rm -f config.mk
		echo ""
		echo "One or more dependencies couldn't be found. Please install"
		echo "these packages and retry compilation."
		exit 1
	fi
}

check_ssl_implementation() {
	if curl-config --static-libs | egrep -- "-lssl( |^)" > /dev/null 2>&1 ; then
		check_pkg "libcrypto" || fail "libcrypto"
		echo "DEFINES+=-DHAVE_OPENSSL=1" >> config.mk
	elif curl-config --static-libs | grep -- -lgcrypt > /dev/null 2>&1 ; then
		check_pkg "gnutls" || fail "gnutls"
		check_custom "libgcrypt" "libgcrypt-config" || fail "libgcrypt"
		echo "DEFINES+=-DHAVE_GCRYPT=1" >> config.mk
	fi
}

echo "# overrides of LDFLAGS and LDFLAGS from environment" > config.mk
[ -n "$CXXFLAGS" ] && echo "CXXFLAGS+=$CXXFLAGS" >> config.mk
[ -n "$LDFLAGS" ] && echo "LDFLAGS+=$LDFLAGS" >> config.mk
echo "" >> config.mk

check_pkg "sqlite3" || fail "sqlite3"
check_pkg "libcurl" || check_custom "libcurl" "curl-config" || fail "libcurl"
check_pkg "libxml-2.0" || check_custom "libxml2" "xml2-config" || fail "libxml2"
check_pkg "stfl" || fail "stfl"
( check_pkg "json" "" 0.11 || check_pkg "json-c" "" 0.11 ) || fail "json-c"

if [ `uname -s` = "Darwin" ]; then
	check_custom "ncurses5.4" "ncurses5.4-config" || fail "ncurses5.4"
elif [ `uname -s` != "OpenBSD" ]; then
	check_custom "ncursesw5" "ncursesw5-config" ||  fail "ncursesw"
fi
check_ssl_implementation
all_aboard_the_fail_boat


text:
.class public interface abstract Lcom/htc/protobuf/Service;
.super Ljava/lang/Object;
.source "Service.java"

# virtual methods
.method public abstract callMethod(Lcom/htc/protobuf/Descriptors$MethodDescriptor;Lcom/htc/protobuf/RpcController;Lcom/htc/protobuf/Message;Lcom/htc/protobuf/RpcCallback;)V
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lcom/htc/protobuf/Descriptors$MethodDescriptor;",
            "Lcom/htc/protobuf/RpcController;",
            "Lcom/htc/protobuf/Message;",
            "Lcom/htc/protobuf/RpcCallback",
            "<",
            "Lcom/htc/protobuf/Message;",
            ">;)V"
        }
    .end annotation
.end method

.method public abstract getDescriptorForType()Lcom/htc/protobuf/Descriptors$ServiceDescriptor;
.end method

.method public abstract getRequestPrototype(Lcom/htc/protobuf/Descriptors$MethodDescriptor;)Lcom/htc/protobuf/Message;
.end method

.method public abstract getResponsePrototype(Lcom/htc/protobuf/Descriptors$MethodDescriptor;)Lcom/htc/protobuf/Message;
.end method


text:
namespace Stove.RabbitMQ.Tests.Contracts
{
    public interface IOrderPlacedEvent
    {
        int OrderId { get; set; }
    }
}


text:
external help file: Microsoft.Azure.Commands.LogicApp.dll-Help.xml
Module Name: AzureRM.LogicApp
ms.assetid: 3D4E44E3-0B55-4699-944F-412EE80CEEEF
online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.logicapp/set-azurermintegrationaccountschema
schema: 2.0.0
---

# Set-AzureRmIntegrationAccountSchema

## SYNOPSIS
Modifies an integration account schema.

## SYNTAX

```
Set-AzureRmIntegrationAccountSchema -ResourceGroupName <String> -Name <String> -SchemaName <String>
 [-SchemaFilePath <String>] [-SchemaDefinition <String>] [-SchemaType <String>] [-ContentType <String>]
 [-Metadata <Object>] [-Force] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
 [<CommonParameters>]
```

## DESCRIPTION
The **Set-AzureRmIntegrationAccountSchema** cmdlet modifies an integration account schema.
This cmdlet returns an object that represents the integration account schema.
Specify the integration account name, resource group name, and schema name.
Template parameter file values that you specify at the command line take precedence over template parameter values in a template parameter object.
This module supports dynamic parameters.
To use a dynamic parameter, type it in the command.
To discover the names of dynamic parameters, type a hyphen (-) after the cmdlet name, and then press the Tab key repeatedly to cycle through the available parameters.
If you omit a required template parameter, the cmdlet prompts you for the value.

## EXAMPLES

### Example 1: Modify an integration account schema
```
PS C:\>Set-AzureRmIntegrationAccountSchema -ResourceGroupName "ResourceGroup11" -Name "IntegrationAccount31" -SchemaName "IntegrationAccountSchema43" -SchemaFilePath "c:\temp\schema1"
Id          : /subscriptions/<SusbcriptionId>/resourceGroups/ResourceGroup11/providers/Microsoft.Logic/integrationAccounts/IntegrationAccount31/schemas/IntegrationAccountSchema43
Name        : IntegrationAccountSchema43
Type        : Microsoft.Logic/integrationAccounts/schemas
CreatedTime : 3/26/2016 7:21:10 PM
ChangedTime : 3/26/2016 7:21:10 PM
SchemaType  : Xml
ContentLink : https://<baseurl>/integrationaccounts68a13b6b49f14995ba7c5f3aedcbd7ad/3839E_XML_INTEGRATIONACCOUNTSCHEMA2-5A6650B914454A2CAB16
              B4A8D3F9840D?sv=2014-02-14&sr=b&sig=<value>
ContentSize : 7901
```

This command modifies the integration account schema named IntegrationAccountSchema43.

## PARAMETERS

### -ContentType
Specifies a content type for the integration account schema.
This cmdlet supports application/xml as a map content type.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure

```yaml
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContextContainer
Parameter Sets: (All)
Aliases: AzureRmContext, AzureCredential

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Force
Forces the command to run without asking for user confirmation.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Metadata
Specifies a metadata object for the schema.

```yaml
Type: System.Object
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Name
Specifies the name of the integration account.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases: IntegrationAccountName, ResourceName

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -ResourceGroupName
Specifies the name of a resource group.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -SchemaDefinition
Specifies a definition object for integration account schema.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -SchemaFilePath
Specifies the file path of a definition for the integration account schema.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -SchemaName
Specifies the name of the integration account schema.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -SchemaType
Specifies the type for the integration account schema.
This parameter supports Xml as the type.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:
Accepted values: Xml

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Confirm
Prompts you for confirmation before running the cmdlet.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```

### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

### System.String

## OUTPUTS

### Microsoft.Azure.Management.Logic.Models.IntegrationAccountSchema

## NOTES

## RELATED LINKS

[Get-AzureRmIntegrationAccountSchema](./Get-AzureRmIntegrationAccountSchema.md)

[New-AzureRmIntegrationAccountSchema](./New-AzureRmIntegrationAccountSchema.md)

[Remove-AzureRmIntegrationAccountSchema](./Remove-AzureRmIntegrationAccountSchema.md)


text:
#ifndef FLUX_GLOBALCOREMUTEX_H
#define FLUX_GLOBALCOREMUTEX_H

#include <flux/Object>
#include <flux/SpinLock>
#include <flux/Ref>

namespace flux {

class GlobalCoreMutex;

class GlobalCoreMutexInitializer
{
public:
    GlobalCoreMutexInitializer();
private:
    static int count_;
};

namespace { GlobalCoreMutexInitializer globalCoreMutexInitializer; }

class GlobalCoreMutex: public SpinLock
{
public:
    static GlobalCoreMutex *instance();

private:
    GlobalCoreMutex() {}
};

inline GlobalCoreMutex *globalCoreMutex() { return GlobalCoreMutex::instance(); }

} // namespace flux

#endif // FLUX_GLOBALCOREMUTEX_H


text:
require "spec_helper"

module SocialNetworking
  module Reports
    RSpec.describe OffTopicPost do
      fixtures :all

      def data
        @data ||= OffTopicPost.all
      end

      describe ".all" do
        context "when no 'on the mind' statements made" do
          it "returns an empty array" do
            SocialNetworking::OnTheMindStatement.destroy_all
            expect(data).to be_empty
          end
        end

        context "when 'on the mind' statements made" do
          it "returns accurate summaries" do
            participant = participants(:participant1)
            statement = SocialNetworking::OnTheMindStatement.first
            expect(data.count).to eq 2
            expect(data).to include(
              participant_id: participant.study_id,
              occurred_at: statement.created_at.iso8601,
              description: statement.description
            )
          end
        end
      end
    end
  end
end


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package dk.netdesign.common.osgi.config.filters;

import dk.netdesign.common.osgi.config.exception.TypeFilterException;
import dk.netdesign.common.osgi.config.service.TypeFilter;
import java.net.MalformedURLException;
import java.net.URL;

/**
 * The URL filter takes a URL as a String object. It then parses the String to a URL object, throwing an exception if the input String is not a valid URL.
 * @author mnn
 */
public class URLFilter extends TypeFilter<String, URL>{

    @Override
    public URL parse(String input) throws TypeFilterException {
	try {
	    return new URL(input);
	} catch (MalformedURLException ex) {
	    throw new TypeFilterException("Could not create an URL from the input", ex);
	}
    }

    @Override
    public String revert(URL input) throws TypeFilterException {
        return input.toString();
    }

}


text:
package main

import (
	"log"
	"os"
	"os/exec"
	"os/signal"
	"path/filepath"
	"strings"
	"syscall"
)

const etcService = "/etc/service"

func main() {
	log.SetFlags(0)

	runsvdir, err := exec.LookPath("runsvdir")
	if err != nil {
		log.Fatal(err)
	}

	sv, err := exec.LookPath("sv")
	if err != nil {
		log.Fatal(err)
	}

	if fi, err := os.Stat(etcService); err != nil {
		log.Fatal(err)
	} else if !fi.IsDir() {
		log.Fatalf("%s is not a directory", etcService)
	}

	if pid := os.Getpid(); pid != 1 {
		log.Printf("warning: I'm not PID 1, I'm PID %d", pid)
	}

	go reapAll()

	supervisor := cmd(runsvdir, etcService)
	if err := supervisor.Start(); err != nil {
		log.Fatal(err)
	}

	log.Printf("%s started", runsvdir)

	go shutdown(sv, supervisor.Process)

	if err := supervisor.Wait(); err != nil {
		log.Printf("%s exited with error: %v", runsvdir, err)
	} else {
		log.Printf("%s exited cleanly", runsvdir)
	}
}

func reapAll() {
	c := make(chan os.Signal)
	signal.Notify(c, syscall.SIGCHLD)
	for range c {
		go reapOne()
	}
}

// From https://github.com/ramr/go-reaper/blob/master/reaper.go
func reapOne() {
	var (
		ws  syscall.WaitStatus
		pid int
		err error
	)
	for {
		pid, err = syscall.Wait4(-1, &ws, 0, nil)
		if err != syscall.EINTR {
			break
		}
	}
	if err == syscall.ECHILD {
		return
	}
	log.Printf("reaped child process %d (%+v)", pid, ws)
}

type signaler interface {
	Signal(os.Signal) error
}

func shutdown(sv string, s signaler) {
	c := make(chan os.Signal)
	signal.Notify(c, syscall.SIGTERM, syscall.SIGINT)
	sig := <-c
	log.Printf("received %s", sig)

	matches, err := filepath.Glob(filepath.Join(etcService, "*"))
	if err != nil {
		log.Printf("when shutting down services: %v", err)
		return
	}

	var stopped []string
	for _, match := range matches {
		fi, err := os.Stat(match)
		if err != nil {
			log.Printf("%s: %v", match, err)
			continue
		}
		if !fi.IsDir() {
			log.Printf("%s: not a directory", match)
			continue
		}
		service := filepath.Base(match)
		stop := cmd(sv, "stop", service)
		if err := stop.Run(); err != nil {
			log.Printf("%s: %v", strings.Join(stop.Args, " "), err)
			continue
		}
		stopped = append(stopped, service)
	}

	log.Printf("stopped %d: %s", len(stopped), strings.Join(stopped, ", "))
	log.Printf("stopping supervisor with signal %s...", sig)
	if err := s.Signal(sig); err != nil {
		log.Print(err)
	}
	log.Printf("shutdown handler exiting")
}

func cmd(path string, args ...string) *exec.Cmd {
	return &exec.Cmd{
		Path:   path,
		Args:   append([]string{path}, args...),
		Env:    os.Environ(),
		Stdin:  os.Stdin,
		Stdout: os.Stdout,
		Stderr: os.Stderr,
	}
}


text:
import verbs from './verb.js'
import adjectives from './adjective.js'
import nouns from './noun.js'

const byWord = {}
const setup = function (senses, tag) {
  Object.keys(senses).forEach(ambig => {
    const words = {}
    let fallback = null
    Object.keys(senses[ambig]).forEach(name => {
      if (senses[ambig][name].words) {
        senses[ambig][name].words.forEach(w => {
          words[w] = name
        })
      }
      if (senses[ambig][name].fallback) {
        fallback = name
      }
    })
    byWord[ambig] = byWord[ambig] || []
    byWord[ambig].push({
      tag: tag,
      fallback,
      words,
    })
  })
}

setup(verbs, 'Verb')
setup(nouns, 'Noun')
setup(adjectives, 'Adjective')

export default byWord


text:
namespace Yahtzee
{
    partial class AboutDialog
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutDialog));
            this.pnlSidera = new System.Windows.Forms.TableLayoutPanel();
            this.pnlViolet = new System.Windows.Forms.Panel();
            this.pnlBlue = new System.Windows.Forms.Panel();
            this.pnlGreen = new System.Windows.Forms.Panel();
            this.pnlYellow = new System.Windows.Forms.Panel();
            this.pnlOrange = new System.Windows.Forms.Panel();
            this.pnlRed = new System.Windows.Forms.Panel();
            this.pnlBlack = new System.Windows.Forms.Panel();
            this.pnlLogo = new System.Windows.Forms.FlowLayoutPanel();
            this.picSideraLogo = new System.Windows.Forms.PictureBox();
            this.picSideraText = new System.Windows.Forms.PictureBox();
            this.pnlMain = new System.Windows.Forms.Panel();
            this.pnlAboutApp = new System.Windows.Forms.TableLayoutPanel();
            this.picAppIcon = new System.Windows.Forms.PictureBox();
            this.pnlAboutBox = new System.Windows.Forms.FlowLayoutPanel();
            this.lblAppName = new System.Windows.Forms.Label();
            this.lblAppVersion = new System.Windows.Forms.Label();
            this.lblAppDeveloper = new System.Windows.Forms.Label();
            this.lnkGitHub = new System.Windows.Forms.LinkLabel();
            this.pnlBottom = new System.Windows.Forms.Panel();
            this.pnlOptions = new System.Windows.Forms.TableLayoutPanel();
            this.lnkLicense = new System.Windows.Forms.LinkLabel();
            this.btnClose = new System.Windows.Forms.Button();
            this.lnkCheckUpdates = new System.Windows.Forms.LinkLabel();
            this.lblBottomDiv = new System.Windows.Forms.Label();
            this.pnlSidera.SuspendLayout();
            this.pnlBlack.SuspendLayout();
            this.pnlLogo.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.picSideraLogo)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.picSideraText)).BeginInit();
            this.pnlMain.SuspendLayout();
            this.pnlAboutApp.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.picAppIcon)).BeginInit();
            this.pnlAboutBox.SuspendLayout();
            this.pnlBottom.SuspendLayout();
            this.pnlOptions.SuspendLayout();
            this.SuspendLayout();
            //
            // pnlSidera
            //
            this.pnlSidera.ColumnCount = 6;
            this.pnlSidera.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
            this.pnlSidera.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
            this.pnlSidera.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
            this.pnlSidera.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
            this.pnlSidera.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
            this.pnlSidera.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
            this.pnlSidera.Controls.Add(this.pnlViolet, 5, 1);
            this.pnlSidera.Controls.Add(this.pnlBlue, 4, 1);
            this.pnlSidera.Controls.Add(this.pnlGreen, 3, 1);
            this.pnlSidera.Controls.Add(this.pnlYellow, 2, 1);
            this.pnlSidera.Controls.Add(this.pnlOrange, 1, 1);
            this.pnlSidera.Controls.Add(this.pnlRed, 0, 1);
            this.pnlSidera.Controls.Add(this.pnlBlack, 0, 0);
            this.pnlSidera.Dock = System.Windows.Forms.DockStyle.Top;
            this.pnlSidera.Location = new System.Drawing.Point(0, 0);
            this.pnlSidera.Name = "pnlSidera";
            this.pnlSidera.RowCount = 2;
            this.pnlSidera.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.pnlSidera.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 6F));
            this.pnlSidera.Size = new System.Drawing.Size(364, 71);
            this.pnlSidera.TabIndex = 0;
            //
            // pnlViolet
            //
            this.pnlViolet.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(0)))), ((int)(((byte)(240)))));
            this.pnlViolet.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pnlViolet.Location = new System.Drawing.Point(300, 65);
            this.pnlViolet.Margin = new System.Windows.Forms.Padding(0);
            this.pnlViolet.Name = "pnlViolet";
            this.pnlViolet.Size = new System.Drawing.Size(64, 6);
            this.pnlViolet.TabIndex = 6;
            //
            // pnlBlue
            //
            this.pnlBlue.BackColor = System.Drawing.Color.DodgerBlue;
            this.pnlBlue.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pnlBlue.Location = new System.Drawing.Point(240, 65);
            this.pnlBlue.Margin = new System.Windows.Forms.Padding(0);
            this.pnlBlue.Name = "pnlBlue";
            this.pnlBlue.Size = new System.Drawing.Size(60, 6);
            this.pnlBlue.TabIndex = 5;
            //
            // pnlGreen
            //
            this.pnlGreen.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(204)))), ((int)(((byte)(0)))));
            this.pnlGreen.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pnlGreen.Location = new System.Drawing.Point(180, 65);
            this.pnlGreen.Margin = new System.Windows.Forms.Padding(0);
            this.pnlGreen.Name = "pnlGreen";
            this.pnlGreen.Size = new System.Drawing.Size(60, 6);
            this.pnlGreen.TabIndex = 4;
            //
            // pnlYellow
            //
            this.pnlYellow.BackColor = System.Drawing.Color.Gold;
            this.pnlYellow.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pnlYellow.Location = new System.Drawing.Point(120, 65);
            this.pnlYellow.Margin = new System.Windows.Forms.Padding(0);
            this.pnlYellow.Name = "pnlYellow";
            this.pnlYellow.Size = new System.Drawing.Size(60, 6);
            this.pnlYellow.TabIndex = 3;
            //
            // pnlOrange
            //
            this.pnlOrange.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(160)))), ((int)(((byte)(0)))));
            this.pnlOrange.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pnlOrange.Location = new System.Drawing.Point(60, 65);
            this.pnlOrange.Margin = new System.Windows.Forms.Padding(0);
            this.pnlOrange.Name = "pnlOrange";
            this.pnlOrange.Size = new System.Drawing.Size(60, 6);
            this.pnlOrange.TabIndex = 2;
            //
            // pnlRed
            //
            this.pnlRed.BackColor = System.Drawing.Color.Red;
            this.pnlRed.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pnlRed.Location = new System.Drawing.Point(0, 65);
            this.pnlRed.Margin = new System.Windows.Forms.Padding(0);
            this.pnlRed.Name = "pnlRed";
            this.pnlRed.Size = new System.Drawing.Size(60, 6);
            this.pnlRed.TabIndex = 1;
            //
            // pnlBlack
            //
            this.pnlBlack.BackColor = System.Drawing.Color.Black;
            this.pnlSidera.SetColumnSpan(this.pnlBlack, 6);
            this.pnlBlack.Controls.Add(this.pnlLogo);
            this.pnlBlack.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pnlBlack.Location = new System.Drawing.Point(0, 0);
            this.pnlBlack.Margin = new System.Windows.Forms.Padding(0);
            this.pnlBlack.Name = "pnlBlack";
            this.pnlBlack.Size = new System.Drawing.Size(364, 65);
            this.pnlBlack.TabIndex = 0;
            //
            // pnlLogo
            //
            this.pnlLogo.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.pnlLogo.AutoSize = true;
            this.pnlLogo.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            this.pnlLogo.Controls.Add(this.picSideraLogo);
            this.pnlLogo.Controls.Add(this.picSideraText);
            this.pnlLogo.Location = new System.Drawing.Point(78, 5);
            this.pnlLogo.Name = "pnlLogo";
            this.pnlLogo.Size = new System.Drawing.Size(209, 54);
            this.pnlLogo.TabIndex = 0;
            //
            // picSideraLogo
            //
            this.picSideraLogo.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("picSideraLogo.BackgroundImage")));
            this.picSideraLogo.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
            this.picSideraLogo.Location = new System.Drawing.Point(3, 3);
            this.picSideraLogo.Name = "picSideraLogo";
            this.picSideraLogo.Size = new System.Drawing.Size(48, 48);
            this.picSideraLogo.TabIndex = 0;
            this.picSideraLogo.TabStop = false;
            //
            // picSideraText
            //
            this.picSideraText.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("picSideraText.BackgroundImage")));
            this.picSideraText.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
            this.picSideraText.Location = new System.Drawing.Point(57, 3);
            this.picSideraText.Name = "picSideraText";
            this.picSideraText.Size = new System.Drawing.Size(149, 48);
            this.picSideraText.TabIndex = 0;
            this.picSideraText.TabStop = false;
            //
            // pnlMain
            //
            this.pnlMain.BackColor = System.Drawing.SystemColors.Window;
            this.pnlMain.Controls.Add(this.pnlAboutApp);
            this.pnlMain.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pnlMain.Location = new System.Drawing.Point(0, 71);
            this.pnlMain.Name = "pnlMain";
            this.pnlMain.Size = new System.Drawing.Size(364, 139);
            this.pnlMain.TabIndex = 1;
            //
            // pnlAboutApp
            //
            this.pnlAboutApp.ColumnCount = 2;
            this.pnlAboutApp.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            this.pnlAboutApp.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.pnlAboutApp.Controls.Add(this.picAppIcon, 0, 0);
            this.pnlAboutApp.Controls.Add(this.pnlAboutBox, 1, 0);
            this.pnlAboutApp.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pnlAboutApp.Location = new System.Drawing.Point(0, 0);
            this.pnlAboutApp.Name = "pnlAboutApp";
            this.pnlAboutApp.RowCount = 1;
            this.pnlAboutApp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.pnlAboutApp.Size = new System.Drawing.Size(364, 139);
            this.pnlAboutApp.TabIndex = 0;
            //
            // picAppIcon
            //
            this.picAppIcon.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("picAppIcon.BackgroundImage")));
            this.picAppIcon.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
            this.picAppIcon.Location = new System.Drawing.Point(3, 3);
            this.picAppIcon.Name = "picAppIcon";
            this.picAppIcon.Size = new System.Drawing.Size(48, 48);
            this.picAppIcon.TabIndex = 7;
            this.picAppIcon.TabStop = false;
            //
            // pnlAboutBox
            //
            this.pnlAboutBox.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            this.pnlAboutBox.Controls.Add(this.lblAppName);
            this.pnlAboutBox.Controls.Add(this.lblAppVersion);
            this.pnlAboutBox.Controls.Add(this.lblAppDeveloper);
            this.pnlAboutBox.Controls.Add(this.lnkGitHub);
            this.pnlAboutBox.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pnlAboutBox.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
            this.pnlAboutBox.Location = new System.Drawing.Point(57, 3);
            this.pnlAboutBox.Name = "pnlAboutBox";
            this.pnlAboutBox.Size = new System.Drawing.Size(304, 133);
            this.pnlAboutBox.TabIndex = 8;
            //
            // lblAppName
            //
            this.lblAppName.AutoSize = true;
            this.lblAppName.Location = new System.Drawing.Point(3, 3);
            this.lblAppName.Margin = new System.Windows.Forms.Padding(3);
            this.lblAppName.Name = "lblAppName";
            this.lblAppName.Size = new System.Drawing.Size(49, 13);
            this.lblAppName.TabIndex = 0;
            this.lblAppName.Text = "Yahtzee!";
            //
            // lblAppVersion
            //
            this.lblAppVersion.AutoSize = true;
            this.lblAppVersion.Location = new System.Drawing.Point(3, 22);
            this.lblAppVersion.Margin = new System.Windows.Forms.Padding(3);
            this.lblAppVersion.Name = "lblAppVersion";
            this.lblAppVersion.Size = new System.Drawing.Size(24, 13);
            this.lblAppVersion.TabIndex = 1;
            this.lblAppVersion.Text = "v*.*";
            //
            // lblAppDeveloper
            //
            this.lblAppDeveloper.AutoSize = true;
            this.lblAppDeveloper.Location = new System.Drawing.Point(3, 41);
            this.lblAppDeveloper.Margin = new System.Windows.Forms.Padding(3);
            this.lblAppDeveloper.Name = "lblAppDeveloper";
            this.lblAppDeveloper.Size = new System.Drawing.Size(287, 52);
            this.lblAppDeveloper.TabIndex = 2;
            this.lblAppDeveloper.Text = "Copyright © 2017 Sidera Enterprises. Project developed by Jeff Walker.\r\n\r\nBased o" +
    "n the Hasbro dice game.";
            //
            // lnkGitHub
            //
            this.lnkGitHub.AutoSize = true;
            this.lnkGitHub.Location = new System.Drawing.Point(3, 99);
            this.lnkGitHub.Margin = new System.Windows.Forms.Padding(3);
            this.lnkGitHub.Name = "lnkGitHub";
            this.lnkGitHub.Size = new System.Drawing.Size(164, 13);
            this.lnkGitHub.TabIndex = 3;
            this.lnkGitHub.TabStop = true;
            this.lnkGitHub.Text = "Source code available on GitHub";
            this.lnkGitHub.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkGitHub_LinkClicked);
            //
            // pnlBottom
            //
            this.pnlBottom.Controls.Add(this.pnlOptions);
            this.pnlBottom.Controls.Add(this.lblBottomDiv);
            this.pnlBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
            this.pnlBottom.Location = new System.Drawing.Point(0, 210);
            this.pnlBottom.Name = "pnlBottom";
            this.pnlBottom.Size = new System.Drawing.Size(364, 41);
            this.pnlBottom.TabIndex = 2;
            //
            // pnlOptions
            //
            this.pnlOptions.ColumnCount = 3;
            this.pnlOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.pnlOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.pnlOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.pnlOptions.Controls.Add(this.lnkLicense, 0, 0);
            this.pnlOptions.Controls.Add(this.btnClose, 1, 0);
            this.pnlOptions.Controls.Add(this.lnkCheckUpdates, 2, 0);
            this.pnlOptions.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pnlOptions.Location = new System.Drawing.Point(0, 2);
            this.pnlOptions.Name = "pnlOptions";
            this.pnlOptions.RowCount = 1;
            this.pnlOptions.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.pnlOptions.Size = new System.Drawing.Size(364, 39);
            this.pnlOptions.TabIndex = 1;
            //
            // lnkLicense
            //
            this.lnkLicense.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.lnkLicense.AutoSize = true;
            this.lnkLicense.Location = new System.Drawing.Point(27, 13);
            this.lnkLicense.Name = "lnkLicense";
            this.lnkLicense.Size = new System.Drawing.Size(66, 13);
            this.lnkLicense.TabIndex = 0;
            this.lnkLicense.TabStop = true;
            this.lnkLicense.Text = "MIT License";
            this.lnkLicense.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkLicense_LinkClicked);
            //
            // btnClose
            //
            this.btnClose.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnClose.Location = new System.Drawing.Point(144, 8);
            this.btnClose.Name = "btnClose";
            this.btnClose.Size = new System.Drawing.Size(75, 23);
            this.btnClose.TabIndex = 1;
            this.btnClose.Text = "Close";
            this.btnClose.UseVisualStyleBackColor = true;
            this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
            //
            // lnkCheckUpdates
            //
            this.lnkCheckUpdates.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.lnkCheckUpdates.AutoSize = true;
            this.lnkCheckUpdates.Location = new System.Drawing.Point(255, 13);
            this.lnkCheckUpdates.Name = "lnkCheckUpdates";
            this.lnkCheckUpdates.Size = new System.Drawing.Size(96, 13);
            this.lnkCheckUpdates.TabIndex = 2;
            this.lnkCheckUpdates.TabStop = true;
            this.lnkCheckUpdates.Text = "Check for Updates";
            this.lnkCheckUpdates.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkCheckUpdates_LinkClicked);
            //
            // lblBottomDiv
            //
            this.lblBottomDiv.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.lblBottomDiv.Dock = System.Windows.Forms.DockStyle.Top;
            this.lblBottomDiv.Location = new System.Drawing.Point(0, 0);
            this.lblBottomDiv.MaximumSize = new System.Drawing.Size(0, 2);
            this.lblBottomDiv.Name = "lblBottomDiv";
            this.lblBottomDiv.Size = new System.Drawing.Size(364, 2);
            this.lblBottomDiv.TabIndex = 0;
            //
            // AboutDialog
            //
            this.AcceptButton = this.btnClose;
            this.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.btnClose;
            this.ClientSize = new System.Drawing.Size(364, 251);
            this.Controls.Add(this.pnlMain);
            this.Controls.Add(this.pnlSidera);
            this.Controls.Add(this.pnlBottom);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "AboutDialog";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "About Yahtzee!";
            this.pnlSidera.ResumeLayout(false);
            this.pnlBlack.ResumeLayout(false);
            this.pnlBlack.PerformLayout();
            this.pnlLogo.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.picSideraLogo)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.picSideraText)).EndInit();
            this.pnlMain.ResumeLayout(false);
            this.pnlAboutApp.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.picAppIcon)).EndInit();
            this.pnlAboutBox.ResumeLayout(false);
            this.pnlAboutBox.PerformLayout();
            this.pnlBottom.ResumeLayout(false);
            this.pnlOptions.ResumeLayout(false);
            this.pnlOptions.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.TableLayoutPanel pnlSidera;
        private System.Windows.Forms.Panel pnlViolet;
        private System.Windows.Forms.Panel pnlBlue;
        private System.Windows.Forms.Panel pnlGreen;
        private System.Windows.Forms.Panel pnlYellow;
        private System.Windows.Forms.Panel pnlOrange;
        private System.Windows.Forms.Panel pnlRed;
        private System.Windows.Forms.Panel pnlBlack;
        private System.Windows.Forms.FlowLayoutPanel pnlLogo;
        private System.Windows.Forms.PictureBox picSideraLogo;
        private System.Windows.Forms.PictureBox picSideraText;
        private System.Windows.Forms.Panel pnlMain;
        private System.Windows.Forms.FlowLayoutPanel pnlAboutBox;
        private System.Windows.Forms.Label lblAppName;
        private System.Windows.Forms.Label lblAppVersion;
        private System.Windows.Forms.Label lblAppDeveloper;
        private System.Windows.Forms.LinkLabel lnkGitHub;
        private System.Windows.Forms.PictureBox picAppIcon;
        private System.Windows.Forms.Panel pnlBottom;
        private System.Windows.Forms.TableLayoutPanel pnlOptions;
        private System.Windows.Forms.LinkLabel lnkLicense;
        private System.Windows.Forms.Button btnClose;
        private System.Windows.Forms.LinkLabel lnkCheckUpdates;
        private System.Windows.Forms.Label lblBottomDiv;
        private System.Windows.Forms.TableLayoutPanel pnlAboutApp;
    }
}


text:
import { DittoOptions } from "./types"

export default abstract class Page {
    ins: any
    options: DittoOptions

    constructor(options: DittoOptions, ins: any) {
        this.options = options
        this.ins = ins
    }

    isClosed(): boolean {
        return !this.ins
    }

    async close() {
        await this.ins.close()
        this.ins = null
    }

    async goto(url: string) {
        await this.ins.goto(url)
    }

    async type(selector: string, text: string) {
        await this.ins.type(selector, text)
    }

    async click(selector: string) {
        await this.ins.click(selector)
    }

    async setViewport(width: number, height: number) {
        await this.ins.setViewport(width, height)
    }

    async setUserAgent(ua: string) {
        await this.ins.setUserAgent(ua)
    }

    async wait(...args: any[]) {
        await this.ins.wait(...args)
    }

    async waitOne(waitings: Array<any>, timeout: number) {
        timeout = timeout >= 0 ? timeout : this.options.waitTimeout

        const promises = waitings.map((w, i) => {
            return this.wait(w, timeout).then(() => i)
        })

        let index = await Promise.race(promises)

        return index
    }

    evaluate(...args): Promise<any> {
        return this.ins.evaluate(...args)
    }

    abstract html(): Promise<string>
    abstract screenshot(path: string): Promise<any>
}


text:
package com.epam.rft.atsy.service.converter;

/**
 * Interface for custom converters encapsulated in {@link ConverterAdapter}s.
 * This interface is used internally in the ConverterService.
 * @param <S> the source type
 * @param <T> the target type
 */
public interface CustomConverter<S, T> {

  /**
   * Converts the {@code source} to {@code T} type.
   * @param source the object to convert
   * @return the converted object
   */
  T convert(S source);

}


text:
$ErrorActionPreference = 'Stop'

$packageArgs = @{
  packageName   = 'clipcache'
  unzipLocation = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
  fileType      = 'exe'
  url           = 'http://www.xrayz.co.uk/download/ccsetup.exe'
  silentArgs    = '/VERYSILENT'
  validExitCodes= @(0)
  softwareName  = 'clipcache*'
  checksum      = '424E0A11588AAAE19D5DA0BE287DDE3EB7032AB6398416CAB2974422DC2A9A04'
  checksumType  = 'sha256'
}

Install-ChocolateyPackage @packageArgs


text:
// Test program for the CalcAllTablesPBN function.
// Uses the hands pre-set in hands.cpp.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../include/dll.h"
#include "hands.h"

int main()
{
  ddTableDealsPBN DDdealsPBN;
  ddTablesRes tableRes;
  allParResults pres;

  int mode = 0; // No par calculation
  int trumpFilter[DDS_STRAINS] = {0, 0, 0, 0, 0}; // All
  int res;
  char line[80];
  bool match;

#if defined(__linux) || defined(__APPLE__)
  SetMaxThreads(0);
#endif

  DDdealsPBN.noOfTables = 3;

  for (int handno = 0; handno < 3; handno++)
  {
    strcpy(DDdealsPBN.deals[handno].cards, PBN[handno]);
  }

  res = CalcAllTablesPBN(&DDdealsPBN, mode, trumpFilter,
                         &tableRes, &pres);

  if (res != RETURN_NO_FAULT)
  {
    ErrorMessage(res, line);
    printf("DDS error: %s\n", line);
  }

  for (int handno = 0; handno < 3; handno++)
  {
    match = CompareTable(&tableRes.results[handno], handno);

    sprintf(line,
            "CalcDDtable, hand %d: %s\n",
            handno + 1, (match ? "OK" : "ERROR"));

    PrintPBNHand(line, DDdealsPBN.deals[handno].cards);

    PrintTable(&tableRes.results[handno]);
  }
}


text:
ppscripts
=========

Post-processing scripts for Sick Beard and CouchPotato Server


text:
import pwn

def fmtstring(towrite, buf_offset, writesize = 1, pre_written = 0, use_posix_extension = True):
    out = ''
    if not (1 <= writesize <= 4):
        pwn.die('fmtstring: writesize has to be between 1-4')
    if not isinstance(towrite,dict):
        pwn.die('fmtstring: towrite has to be {address,data}')

    for address in towrite.keys():
        data = towrite[address]
        out += pwn.flat(address + n * writesize for n in range(len(data)))
    if '%' in out:
        pwn.die('I do not know how to handle addresses with "%" in them')
    if '\x00' in out:
        pwn.die('I do not know how to handle addresses with null characters in them')

    bytes_written = len(out) + pre_written

    for data in towrite.values():
        bufsize = len(data)
        data = [pwn.uint(dat) for dat in pwn.group(writesize, data)]
        for n, dat in enumerate(data):
            bufpos = writesize*n
            bufleft = bufsize - bufpos

            mod_value = 0x100 ** min(bufleft, writesize)

            cur_num_bytes = (dat - bytes_written) % mod_value
            cur_num_bytes = (cur_num_bytes + mod_value) % mod_value
            bytes_written += cur_num_bytes

            if cur_num_bytes == 0:
                pass
            if cur_num_bytes == 1:
                out += '%c'
            elif cur_num_bytes > 1:
                out += '%' + str(cur_num_bytes) + 'c'

            out += '%' + str(buf_offset+n) + '$'

            if use_posix_extension:
                if bufleft == 1:
                    out += 'hh'
                elif bufleft == 2:
                    out += 'h'
            out += 'n'

    return out

def fmt_findoffset(fun, limit=None, num=6, delim='.'):
    ''' This function attempts to find the offset of the input format string on a buffer
See pwn/test/fmtstring/doit.py for example usage
'''
    dummy = "AAAA" + (delim+"%x") * num
    idx = False
    step = 5
    for i in range(1, 10, step):
        dummy = "AAAA"
        for x in range(i, i+step):
            dummy += (delim+"%"+str(x)+"$x")
        conn = fun(dummy)
        line = conn.recvline()
        splitted = line.split(delim)
        if '41414141' in splitted:
            idx = splitted.index('41414141') + i-1
            break
        else:
            conn.close()
    return idx

if __name__ == '__main__':
    testdict = {0x8040bbbb:'hej verden',0x8888aaaa:'ged'}
    a = fmtstring(testdict,2)
    print map(hex,map(ord,a))
    print a


text:
import { address } from "./address";

export namespace shipping {
    interface ShippingData {
        /**
         * The name of the user
         */
        FirstName: string;

        /**
         * The last name of the user
         */
        LastName: string;

        /**
         * The address
         */
        Address: address.AddressData;
    }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.beans;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.servlet.http.HttpSession;
import org.primefaces.event.SelectEvent;
import org.primefaces.model.DefaultScheduleEvent;
import org.primefaces.model.DefaultScheduleModel;
import org.primefaces.model.ScheduleEvent;
import org.primefaces.model.ScheduleModel;
import procuradoria.crud.ProcuradoriaMethods;
import procuradoria.map.Uzatcita;
import procuradoria.map.Uzatfunci;

/**
 *
 * @author FANNY
 */
@ManagedBean
@ViewScoped
public class CalendarBean {

    /**
     * Creates a new instance of CalendarBean
     */
    private ScheduleModel eventModel;
    private ArrayList<Uzatcita> ListCitas;
    private Uzatcita selectedCita;
    private ScheduleEvent event = new DefaultScheduleEvent();

    private Uzatfunci funcionarioCreador;

    public CalendarBean() {
        eventModel = new DefaultScheduleModel();
        this.funcionarioCreador= new Uzatfunci();
        this.init();
    }

    public void init() {
        this.selectedCita = new Uzatcita();
        this.setListCitas(new ArrayList<Uzatcita>());
        this.loadData();
    }

    public void loadData() {
        this.ListCitas.clear();
        this.ListCitas = ProcuradoriaMethods.GetCitasCalendar(StringToday());
        BigDecimal id = this.getUserAttribute();

        for (int i = 0; i < ListCitas.size(); i++) {

            DefaultScheduleEvent obj;

            if (ListCitas.get(i).getUzatfase().getUzatcaso().getFuncionarioAsignado().getUzatfuncionarioId().equals(id)) {

                if (ListCitas.get(i).getUzatcitaFlag().equals(new BigDecimal(BigInteger.ZERO))) {
                    obj = new DefaultScheduleEvent(ListCitas.get(i).getUzatfase().getUzatcaso().getUzatcasoNumcausa(),
                            dateBegin(ListCitas.get(i).getUzatcitaFecha()),
                            dateFinish(ListCitas.get(i).getUzatcitaFecha()), "color2");
                } else {
                    obj = new DefaultScheduleEvent(ListCitas.get(i).getUzatfase().getUzatcaso().getUzatcasoNumcausa(),
                            dateBegin(ListCitas.get(i).getUzatcitaFecha()),
                            dateFinish(ListCitas.get(i).getUzatcitaFecha()), "color");
                }
            } else {
                if (ListCitas.get(i).getUzatcitaFlag().equals(new BigDecimal(BigInteger.ZERO))) {
                    obj = new DefaultScheduleEvent(ListCitas.get(i).getUzatfase().getUzatcaso().getUzatcasoNumcausa(),
                            dateBegin(ListCitas.get(i).getUzatcitaFecha()),
                            dateFinish(ListCitas.get(i).getUzatcitaFecha()), "color2");
                } else {
                    obj = new DefaultScheduleEvent(ListCitas.get(i).getUzatfase().getUzatcaso().getUzatcasoNumcausa(),
                            dateBegin(ListCitas.get(i).getUzatcitaFecha()),
                            dateFinish(ListCitas.get(i).getUzatcitaFecha()));
                }

            }

            obj.setDescription(ListCitas.get(i).getId().getUzatcitaId().toString());
            eventModel.addEvent(obj);
        }

    }

    private BigDecimal getUserAttribute() {
        String UserAttribute = "";
        BigDecimal id = new BigDecimal(BigInteger.ZERO);
        FacesContext facesContext = FacesContext.getCurrentInstance();
        HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false);
        if (session == null) {
        } else {
            Object IdBanner = session.getAttribute("uzatfuncionarioId");
            UserAttribute = IdBanner.toString();
            id = new BigDecimal(UserAttribute);
        }
        return id;
    }

    public Uzatcita getSelectedCita(BigDecimal uzatcitaId) {
        Uzatcita cita = new Uzatcita();
        for (Uzatcita cta : this.ListCitas) {
            if (cta.getId().getUzatcitaId().equals(uzatcitaId)) {
                cita = cta;
                break;
            }
        }
        return cita;
    }

    public ScheduleModel getEventModel() {
        return eventModel;
    }

    private String StringToday() {
        Calendar calendar = Calendar.getInstance();
        String fechaActual = "";
        SimpleDateFormat f1 = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
        fechaActual = f1.format(calendar.getTime());
        return fechaActual;
    }

    private Date dateBegin(String FechaInicio) {

        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
        try {
            cal.setTime(sdf.parse(FechaInicio));
        } catch (ParseException ex) {
            System.out.println(">> " + ex.getMessage());
        }

        return cal.getTime();

    }

    private Date dateFinish(String FechaInicio) {

        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
        try {
            cal.setTime(sdf.parse(FechaInicio));
        } catch (ParseException ex) {
            Logger.getLogger(CalendarBean.class.getName()).log(Level.SEVERE, null, ex);
        }

        cal.set(Calendar.HOUR, cal.get(Calendar.HOUR) + 2);

        return cal.getTime();
    }

    public ScheduleEvent getEvent() {
        return event;
    }

    public void setEvent(DefaultScheduleEvent event) {
        this.event = event;
    }

    public void addEvent(ActionEvent actionEvent) {
        if (event.getId() == null) {
            eventModel.addEvent(event);
        } else {
            eventModel.updateEvent(event);
        }

        event = new DefaultScheduleEvent();
    }

    public void onEventSelect(SelectEvent selectEvent) {
        event = (ScheduleEvent) selectEvent.getObject();
        String id = event.getDescription();
        BigDecimal uzatcitaId = new BigDecimal(id);
        this.selectedCita = getSelectedCita(uzatcitaId);
        this.funcionarioCreador =ProcuradoriaMethods.FindFuncionarioByIdFunci(this.selectedCita.getUzatfuncionarioId());
    }

    public ArrayList<Uzatcita> getListCitas() {
        return ListCitas;
    }

    public void setListCitas(ArrayList<Uzatcita> ListCitas) {
        this.ListCitas = ListCitas;
    }

    public Uzatcita getSelectedCita() {
        return selectedCita;
    }

    public void setSelectedCita(Uzatcita selectedCita) {
        this.selectedCita = selectedCita;
    }

    public Uzatfunci getFuncionarioCreador() {
        return funcionarioCreador;
    }

    public void setFuncionarioCreador(Uzatfunci funcionarioCreador) {
        this.funcionarioCreador = funcionarioCreador;
    }

}


text:
@implementation Timer

- (id) init {
	self = [super init];
	if (self != nil) {
		start = nil;
		end = nil;
		[self start];
	}
	return self;
}

- (void) start {
	start = [NSDate date];
}

- (void) stop {
	end = [NSDate date];
}

- (double) elapsedSecs {
	return [end timeIntervalSinceDate:start];
}

- (double) elapsedMillis {
	return [self elapsedSecs] * 1000.0f;
}

- (double) elapsedMinutes {
	return [self elapsedSecs] / 60.0f;
}

- (void) logElapsed {
	NSLog(@"Elapsed ms: %g", [self elapsedMillis]);
}

- (void) logCheckPoint:(NSString*)name {
	[self stop];
	NSLog(@"Completed \"%@\" in %gms", name, [self elapsedMillis]);
	[self start];
}

@end


text:
const handleStyle = require("../lib/handleStyle");

const get = require("../lib/get");

const pingImg = reuqire("../lib/pingImg");


text:
//-----------------------------------------------------------------------
// <copyright file="ClusterDomainEventPublisherSpec.cs" company="Akka.NET Project">
//     Copyright (C) 2009-2016 Lightbend Inc. <http://www.lightbend.com>
//     Copyright (C) 2013-2016 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------

using System;
using System.Collections.Immutable;
using Akka.Actor;
using Akka.TestKit;
using Xunit;

namespace Akka.Cluster.Tests
{
    public class ClusterDomainEventPublisherSpec : AkkaSpec
    {
        const string Config = @"
        akka.cluster {
            auto-down-unreachable-after = 0s
            periodic-tasks-initial-delay = 120 s // turn off scheduled tasks
            publish-stats-interval = 0 s # always, when it happens
        }
        akka.actor.provider = ""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster""
        akka.remote.helios.tcp.port = 0";

        readonly IActorRef _publisher;
        static readonly Member aUp = TestMember.Create(new Address("akka.tcp", "sys", "a", 2552), MemberStatus.Up);
        static readonly Member aLeaving = aUp.Copy(MemberStatus.Leaving);
        static readonly Member aExiting = aLeaving.Copy(MemberStatus.Exiting);
        static readonly Member aRemoved = aExiting.Copy(MemberStatus.Removed);
        static readonly Member bExiting = TestMember.Create(new Address("akka.tcp", "sys", "b", 2552), MemberStatus.Exiting);
        static readonly Member bRemoved = bExiting.Copy(MemberStatus.Removed);
        static readonly Member cJoining = TestMember.Create(new Address("akka.tcp", "sys", "c", 2552), MemberStatus.Joining, ImmutableHashSet.Create("GRP"));
        static readonly Member cUp = cJoining.Copy(MemberStatus.Up);
        static readonly Member cRemoved = cUp.Copy(MemberStatus.Removed);
        static readonly Member a51Up = TestMember.Create(new Address("akk.tcp", "sys", "a", 2551), MemberStatus.Up);
        static readonly Member dUp = TestMember.Create(new Address("akka.tcp", "sys", "d", 2552), MemberStatus.Up, ImmutableHashSet.Create("GRP"));

        static readonly Gossip g0 = new Gossip(ImmutableSortedSet.Create(aUp)).Seen(aUp.UniqueAddress);
        static readonly Gossip g1 = new Gossip(ImmutableSortedSet.Create(aUp, bExiting, cJoining)).Seen(aUp.UniqueAddress).Seen(bExiting.UniqueAddress).Seen(cJoining.UniqueAddress);
        static readonly Gossip g2 = new Gossip(ImmutableSortedSet.Create(aUp, bExiting, cUp)).Seen(aUp.UniqueAddress);
        static readonly Gossip g3 = g2.Seen(bExiting.UniqueAddress).Seen(cUp.UniqueAddress);
        static readonly Gossip g4 = new Gossip(ImmutableSortedSet.Create(a51Up, aUp, bExiting, cUp)).Seen(aUp.UniqueAddress);
        static readonly Gossip g5 = new Gossip(ImmutableSortedSet.Create(a51Up, aUp, bExiting, cUp)).Seen(aUp.UniqueAddress).Seen(bExiting.UniqueAddress).Seen(cUp.UniqueAddress).Seen(a51Up.UniqueAddress);
        static readonly Gossip g6 = new Gossip(ImmutableSortedSet.Create(aLeaving, bExiting, cUp)).Seen(aUp.UniqueAddress);
        static readonly Gossip g7 = new Gossip(ImmutableSortedSet.Create(aExiting, bExiting, cUp)).Seen(aUp.UniqueAddress);
        static readonly Gossip g8 = new Gossip(ImmutableSortedSet.Create(aUp, bExiting, cUp, dUp), new GossipOverview(Reachability.Empty.Unreachable(aUp.UniqueAddress, dUp.UniqueAddress))).Seen(aUp.UniqueAddress);

        readonly TestProbe _memberSubscriber;

        public ClusterDomainEventPublisherSpec() : base(Config)
        {
            _memberSubscriber = CreateTestProbe();
            Sys.EventStream.Subscribe(_memberSubscriber.Ref, typeof(ClusterEvent.IMemberEvent));
            Sys.EventStream.Subscribe(_memberSubscriber.Ref, typeof(ClusterEvent.LeaderChanged));
            Sys.EventStream.Subscribe(_memberSubscriber.Ref, typeof(ClusterEvent.ClusterShuttingDown));

            _publisher = Sys.ActorOf(Props.Create<ClusterDomainEventPublisher>());
            //TODO: If parent told of exception then test should fail (if not expected in some way)?
            _publisher.Tell(new InternalClusterAction.PublishChanges(g0));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberUp(aUp));
            _memberSubscriber.ExpectMsg(new ClusterEvent.LeaderChanged(aUp.Address));
        }

        [Fact]
        public void ClusterDomainEventPublisher_must_publish_member_up()
        {
            _publisher.Tell(new InternalClusterAction.PublishChanges(g2));
            _publisher.Tell(new InternalClusterAction.PublishChanges(g3));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberExited(bExiting));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberUp(cUp));
        }

        [Fact]
        public void ClusterDomainEventPublisher_must_publish_leader_changed()
        {
            _publisher.Tell(new InternalClusterAction.PublishChanges(g4));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberUp(a51Up));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberExited(bExiting));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberUp(cUp));
            _memberSubscriber.ExpectMsg(new ClusterEvent.LeaderChanged(a51Up.Address));
            _memberSubscriber.ExpectNoMsg(TimeSpan.FromMilliseconds(500));
        }

        [Fact]
        public void ClusterDomainEventPublisher_must_publish_leader_changed_when_old_leader_leaves_and_is_removed()
        {
            _publisher.Tell(new InternalClusterAction.PublishChanges(g3));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberExited(bExiting));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberUp(cUp));
            _publisher.Tell(new InternalClusterAction.PublishChanges(g6));
            _memberSubscriber.ExpectNoMsg(TimeSpan.FromMilliseconds(500));
            _publisher.Tell(new InternalClusterAction.PublishChanges(g7));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberExited(aExiting));
            _memberSubscriber.ExpectMsg(new ClusterEvent.LeaderChanged(cUp.Address));
            _memberSubscriber.ExpectNoMsg(TimeSpan.FromMilliseconds(500));
            // at the removed member a an empty gossip is the last thing
            _publisher.Tell(new InternalClusterAction.PublishChanges(Gossip.Empty));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberRemoved(aRemoved, MemberStatus.Exiting));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberRemoved(bRemoved, MemberStatus.Exiting));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberRemoved(cRemoved, MemberStatus.Up));
            //TODO: Null leader stuff is messy. Better approach?
            _memberSubscriber.ExpectMsg(new ClusterEvent.LeaderChanged(null));
        }

        [Fact]
        public void ClusterDomainEventPublisher_must_not_publish_leader_changed_when_same_leader()
        {
            _publisher.Tell(new InternalClusterAction.PublishChanges(g4));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberUp(a51Up));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberExited(bExiting));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberUp(cUp));
            _memberSubscriber.ExpectMsg(new ClusterEvent.LeaderChanged(a51Up.Address));

            _publisher.Tell(new InternalClusterAction.PublishChanges(g5));
            _memberSubscriber.ExpectNoMsg(TimeSpan.FromMilliseconds(500));
        }

        [Fact]
        public void ClusterDomainEventPublisher_must_publish_role_leader_changed()
        {
            var subscriber = CreateTestProbe();
            _publisher.Tell(new InternalClusterAction.Subscribe(subscriber.Ref, ClusterEvent.SubscriptionInitialStateMode.InitialStateAsSnapshot, ImmutableHashSet.Create(typeof(ClusterEvent.RoleLeaderChanged))));
            subscriber.ExpectMsg<ClusterEvent.CurrentClusterState>();
            // but only to the new subscriber
            _memberSubscriber.ExpectNoMsg(TimeSpan.FromMilliseconds(500));
        }

        [Fact]
        public void ClusterDomainEventPublisher_must_send_current_cluster_state_when_subscribe()
        {
            var subscriber = CreateTestProbe();
            _publisher.Tell(new InternalClusterAction.Subscribe(subscriber.Ref, ClusterEvent.SubscriptionInitialStateMode.InitialStateAsSnapshot, ImmutableHashSet.Create(typeof(ClusterEvent.IClusterDomainEvent))));
            subscriber.ExpectMsg<ClusterEvent.CurrentClusterState>();
            // but only to the new subscriber
            _memberSubscriber.ExpectNoMsg(TimeSpan.FromMilliseconds(500));
        }

        [Fact]
        public void ClusterDomainEventPublisher_must_send_events_corresponding_to_current_state_when_subscribe()
        {
            var subscriber = CreateTestProbe();
            _publisher.Tell(new InternalClusterAction.PublishChanges(g8));
            _publisher.Tell(new InternalClusterAction.Subscribe(subscriber.Ref, ClusterEvent.SubscriptionInitialStateMode.InitialStateAsEvents, ImmutableHashSet.Create(typeof(ClusterEvent.IMemberEvent), typeof(ClusterEvent.ReachabilityEvent))));
            var received = subscriber.ReceiveN(4);
            XAssert.Equivalent(
                new object[]
                {
                    new ClusterEvent.MemberUp(aUp), new ClusterEvent.MemberUp(cUp), new ClusterEvent.MemberUp(dUp),
                    new ClusterEvent.MemberExited(bExiting)
                }, received );
            subscriber.ExpectMsg(new ClusterEvent.UnreachableMember(dUp));
            subscriber.ExpectNoMsg(TimeSpan.FromMilliseconds(500));
        }

        [Fact]
        public void ClusterDomainEventPublisher_should_support_unsubscribe()
        {
            var subscriber = CreateTestProbe();
            _publisher.Tell(new InternalClusterAction.Subscribe(subscriber.Ref, ClusterEvent.SubscriptionInitialStateMode.InitialStateAsSnapshot, ImmutableHashSet.Create(typeof(ClusterEvent.IMemberEvent))));
            subscriber.ExpectMsg<ClusterEvent.CurrentClusterState>();
            _publisher.Tell(new InternalClusterAction.Unsubscribe(subscriber.Ref, typeof(ClusterEvent.IMemberEvent)));
            _publisher.Tell(new InternalClusterAction.PublishChanges(g3));
            subscriber.ExpectNoMsg(TimeSpan.FromMilliseconds(500));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberExited(bExiting));
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberUp(cUp));
        }

        [Fact]
        public void ClusterDomainEventPublisher_must_publish_seen_changed()
        {
            var subscriber = CreateTestProbe();
            _publisher.Tell(new InternalClusterAction.Subscribe(subscriber.Ref, ClusterEvent.SubscriptionInitialStateMode.InitialStateAsSnapshot, ImmutableHashSet.Create(typeof(ClusterEvent.SeenChanged))));
            subscriber.ExpectMsg<ClusterEvent.CurrentClusterState>();
            _publisher.Tell(new InternalClusterAction.PublishChanges(g2));
            subscriber.ExpectMsg<ClusterEvent.SeenChanged>();
            subscriber.ExpectNoMsg(TimeSpan.FromMilliseconds(500));
            _publisher.Tell(new InternalClusterAction.PublishChanges(g3));
            subscriber.ExpectMsg<ClusterEvent.SeenChanged>();
            subscriber.ExpectNoMsg(TimeSpan.FromMilliseconds(500));
        }

        [Fact]
        public void ClusterDomainEventPublisher_must_publish_removed_when_stopped()
        {
            _publisher.Tell(PoisonPill.Instance);
            _memberSubscriber.ExpectMsg(ClusterEvent.ClusterShuttingDown.Instance);
            _memberSubscriber.ExpectMsg(new ClusterEvent.MemberRemoved(aRemoved, MemberStatus.Up));
        }

    }
}


text:
<?php namespace Rollbar;

use Rollbar\Rollbar;
use Rollbar\Payload\Level;
use Monolog\Logger;
use Rollbar\Monolog\Handler\RollbarHandler;

// used in testBasicUsage()
function do_something()
{
    throw new \Exception();
}

class ReadmeTest extends BaseRollbarTest
{

    /**
     * @expectedException \Exception
     */
    public function testQuickStart()
    {
        // installs global error and exception handlers
        Rollbar::init(
            array(
                'access_token' => $this->getTestAccessToken(),
                'environment' => 'production'
            )
        );

        try {
            throw new \Exception('test exception');
        } catch (\Exception $e) {
            Rollbar::log(Level::ERROR, $e);
        }

        // Message at level 'info'
        Rollbar::log(Level::INFO, 'testing info level');

        // With extra data (3rd arg) and custom payload options (4th arg)
        Rollbar::log(
            Level::INFO,
            'testing extra data',
            array("some_key" => "some value") // key-value additional data
        );

        // If you want to check if logging with Rollbar was successful
        $response = Rollbar::log(Level::INFO, 'testing wasSuccessful()');
        if (!$response->wasSuccessful()) {
            throw new \Exception('logging with Rollbar failed');
        }

        // raises an E_NOTICE which will *not* be reported by the error handler
        // $foo = $bar;

        // will be reported by the exception handler
        throw new \Exception('testing exception handler');
    }

    public function testSetup1()
    {
        $config = array(
            // required
            'access_token' => $this->getTestAccessToken(),
            // optional - environment name. any string will do.
            'environment' => 'production',
            // optional - path to directory your code is in. used for linking stack traces.
            'root' => '/Users/brian/www/myapp'
        );
        Rollbar::init($config);

        $this->assertTrue(true);
    }

    public function testSetup2()
    {
        $config = array(
            // required
            'access_token' => $this->getTestAccessToken(),
            // optional - environment name. any string will do.
            'environment' => 'production',
            // optional - path to directory your code is in. used for linking stack traces.
            'root' => '/Users/brian/www/myapp'
        );

        $set_exception_handler = false;
        $set_error_handler = false;
        Rollbar::init($config, $set_exception_handler, $set_error_handler);

        $this->assertTrue(true);
    }

    public function testBasicUsage()
    {
        Rollbar::init(
            array(
                'access_token' => $this->getTestAccessToken(),
                'environment' => 'test'
            )
        );

        try {
            do_something();
        } catch (\Exception $e) {
            $result1 = Rollbar::log(Level::ERROR, $e);
            // or
            $result2 = Rollbar::log(Level::ERROR, $e, array("my" => "extra", "data" => 42));
        }

        $this->assertEquals(200, $result1->getStatus());
        $this->assertEquals(200, $result2->getStatus());
    }

    public function testBasicUsage2()
    {
        Rollbar::init(
            array(
                'access_token' => $this->getTestAccessToken(),
                'environment' => 'test'
            )
        );

        $result1 = Rollbar::log(Level::WARNING, 'could not connect to mysql server');
        $result2 = Rollbar::log(
            Level::INFO,
            'Here is a message with some additional data',
            array('x' => 10, 'code' => 'blue')
        );

        $this->assertEquals(200, $result1->getStatus());
        $this->assertEquals(200, $result2->getStatus());
    }

    public function testMonolog()
    {
        Rollbar::init(
            array(
                'access_token' => $this->getTestAccessToken(),
                'environment' => 'development'
            )
        );

        // create a log channel
        $log = new Logger('RollbarHandler');
        $log->pushHandler(new RollbarHandler(Rollbar::logger(), Logger::WARNING));

        // add records to the log
        $log->addWarning('Foo');
    }
}


text:
#ifndef GAME_H
#define GAME_H

#ifdef __cplusplus
extern "C" {
#endif

#define MAX_FRAMEDROP 10

struct NS;
struct NS_Settings;
struct NS_Player;
struct NS_Bullet;
struct NS_Effect;

typedef struct NS NS;
typedef struct NS_Settings NS_Settings;
typedef struct NS_Player NS_Player;
typedef struct NS_Bullet NS_Bullet;
typedef struct NS_Effect NS_Effect;

#include "ai.h"
#include "glue.h"
#include "menu.h"

void NS_init(void);
void NS_uninit(void);
void NS_newgame(unsigned short width,unsigned short height, short gametype);
void NS_newround(unsigned short width,unsigned short height);
short NS_frame(void); //returns one of FrameStatus
void NS_schedule_redraw(void);
short NS_draw(void);

NS_Player *NS_find_player_by_type(short type, const NS_Player *dont_pick);
	//the argument is 'dont_pick' instead of 'not' because 'not' is a C++ keyword

static inline void NS_redraw(void)
{
	NS_schedule_redraw();
	NS_draw();
}

//None of the max values should be zero
#define PLAYER_MAX 2
#define BULLET_MAX 256
#define EFFECT_MAX 256

struct NS
{
	signed char *board; //board==NULL means there is no game open right now
		//The board's data consists of two parts, each width*height bytes
			//The current half is the cells the game engine will write to in order to request draws of cells
			//The actual half is what is drawn to the screen at the last redraw
		//Both board halves are used in NS_draw in order to bring the actual half up to date
	unsigned short width;
	unsigned short height;
	signed char *overlay; //This is where explosions and respawn animations are drawn
	struct NS_Settings
	{
		unsigned short
			sound:1,
			mines:1, mine_detonators:1, clusters:1,
			bullets:1, bullet_ammo:1, rockets:1, rocket_ammo:1, nukes:1, nuke_ammo:1,
			linear_terrain:1, fractal_terrain:1, stop_at_water:1,
			diagonals:1, walls:1, rubber_walls:1;
		unsigned short tails:1, explosion_blocks:1, total_war:1;
			//total_war means there are no new rounds; players simply respawn
		unsigned char game_speed; //undefined units
		unsigned char bullet_speed; //speed in relation to player (should be 2...6)
	} settings;
	unsigned short phase; //counts down
	unsigned short paused:1, player_dying:1, reset_scheduled:1;
	struct NS_Player
	{
		char type; //Any of PlayerTypes or 0 for hole
		char direction;
		unsigned short x,y;
		signed char covering; //The tile this object replaced to be drawn at (x,y).  It will restore this tile when it moves
		char phase;
		signed char icon; //Any of TileTypes
		char alive;
		char has_tail;
		signed char fire_phase; //counts down, <=0 means the player can fire right now (minimum is -bullet_maxphase, after-fire is +bullet_maxphase)
		char trudge; //number of updates to wait before player can move
		unsigned short bullet_count; //only matters if settings.bullet_ammo==1
		unsigned short rocket_count; //only matters if settings.rocket_ammo==1
		unsigned short nuke_count; //only matters if settings.nuke_ammo==1
		unsigned short deaths;
		union
		{
			//PT_Right and PT_Left (players controlled by the keyboard) have no controller state information
			NS_AI ai; //defined in ai.h
			NS_Net net; //defined in glue.h
		} cs; //controller state
	} players[PLAYER_MAX];
	struct NS_Bullet
	{
		char type; //Any of BulletTypes or 0 for hole
		char direction;
		unsigned short x,y;
		signed char covering; //see description in NS_Player::covering
		char phase; //counts down
	} bullets[BULLET_MAX];
	struct NS_Effect
	{
		char type; //Any of EffectTypes or 0 for hole
		char frame; //counts down
		unsigned short x,y;
		char unused;
		char phase; //counts down
		short respawn;
			//players[respawn] will respawn at the end of this effect if type == ET_Respawn
			//a respawn effect will be generated at the end of this effect if type == ET_Explosion and respawn>=0
	} effects[EFFECT_MAX];
};

extern NS ns;

#define dir_vec(dir) (_dir_vec[(int)(dir)])
extern const signed char _dir_vec[][2];
#define vec_dir(x,y) (_vec_dir[(y)+1][(x)+1]);
extern const char _vec_dir[3][3];
static inline short average_dir(short a, short b)
{
	short ret=vec_dir((dir_vec(a)[0]+dir_vec(b)[0])/2, (dir_vec(a)[1]+dir_vec(b)[1])/2);
	if (ret<0 || ret>=8)
	{
		Bug("vec_dir returned an invalid direction %d.",ret);
		ret=0;
	}
	return ret;
}

#define bullet_icon(type,direction) (BulletH + ((type)-1)*4 + dir_hvfb[(int)(direction)])
extern const char dir_hvfb[9];

extern const char dir_opposite[9];
extern const char dir_xflip[9];
extern const char dir_yflip[9];

//evaluates 'dir' twice
#define dir_isdiagonal(dir) (dir ? ~dir&1 : 0)

enum TileTypes
{
	Floor=0,
	BluePiece, RedPiece,
	BulletH, BulletV, BulletF, BulletB,
	RocketH, RocketV, RocketF, RocketB,
	NukeH, NukeV, NukeF, NukeB,
	Explode1, Explode2,
	AmmoPack, RocketPack, NukePack,
	Mine, MineDetonator, Coal, Tree, Wall, Water, Swamp,
	BlueTail, RedTail,
	TILE_TYPE_COUNT, NullTile
};

extern const char tile_class[TILE_TYPE_COUNT];
enum TileClasses
{
	TC_Floor=0,
	TC_Player,
	TC_Bullet, //includes rockets
	TC_Explosion,
	TC_Tail,
	TC_Other
};

enum PlayerTypes
{
	PT_Right=1, PT_Left=2, PT_AI=3, PT_Network=4
};

enum BulletTypes
{
	BT_Bullet=1, BT_Rocket=2, BT_Nuke=3
};

enum EffectTypes
{
	ET_Explosion=1, ET_Respawn=2
};

enum Directions
{
	NoDirection=0, Right, DownRight, Down, DownLeft, Left, UpLeft, Up, UpRight
};

enum FrameStatus
{
	NSF_NORMAL=0, NSF_SOMEONEDIED=1
};

enum EventTypes
{
	EV_Explosion, EV_PlayerKilled,
	EV_BulletFired, EV_RocketFired, EV_NukeFired,
	EV_AmmoPickedUp, EV_RocketPickedUp, EV_NukePickedUp, EV_PlayerLost
};

enum MeansOfDeath
{
	MOD_Player, MOD_Bullet, MOD_Rocket, MOD_Nuke, MOD_Explosion, MOD_NukeRadius, MOD_Mine, MOD_Coal, MOD_Wall, MOD_Tail, MOD_ShotHimself, MOD_MineDetonator
};

#ifdef __cplusplus
}
#endif

#endif //ifndef GAME_H


text:
A command line tool for easily install prebuilds for multiple version of node/iojs on a specific platform.

`prebuild-install` supports installing prebuilt binaries from GitHub by default.

## Usage

Change your package.json install script to:
```
...
  "scripts": {
    "install": "prebuild-install || node-gyp rebuild"
  }
...
```

### Requirements

You need to provide prebuilds made by [prebuild](https://github.com/mafintosh/prebuild)

### Help
```
prebuild-install [options]

  --download    -d  [url]       (download prebuilds, no url means github)
  --target      -t  version     (version to install for)
  --runtime     -r  runtime     (Node runtime [node or electron] to build or install for, default is node)
  --path        -p  path        (make a prebuild-install here)
  --build-from-source           (skip prebuild download)
  --verbose                     (log verbosely)
  --libc                        (use provided libc rather than system default)
  --debug                       (set Debug or Release configuration)
  --version                     (print prebuild-install version and exit)
 ```

## License

MIT


text:
title: Calendar Hours
theme: light
background-color: '#ffffff'
text-color: '#000000'
hex-color: '#2980b9'
hex-icon: 'calendar-hours-icon.png'
construction: false
priority: 7
timeframe: Fall 2017
tags:
- Vue
- Google App Script
categories:
- Projects
links:
- rocket, Use Calendar Hours, https://script.google.com/macros/s/AKfycbx5o3RitgxGoHj5UNUplln_bfe-_N_OijCZHOJHsjWWfnqHPMU/exec
- github, View on GitHub, https://github.com/andreybutenko/calendar-hours
---
Calculate time spent on tasks on your Google Calendar through queries ranging from simple to advanced.

Search across multiple calendars and filter results by title or color. You can even combine several search strings and various event colors to create advanced queries!

{% raw %}

{% endraw %}


text:
echo "_post/karabiner"
exit

mkdir -p ~/.config/karabiner
cd ~/.config/karabiner
ln -s ~/workspace/config/platforms/macosx/karabiner.json ./


text:
using System;
using System.Collections.Generic;
using System.Linq;
using BlueSheep.Common.Protocol.Types;
using BlueSheep.Common.IO;
using BlueSheep.Engine.Types;

namespace BlueSheep.Common.Protocol.Messages
{
    public class TreasureHuntFlagRemoveRequestMessage : Message
    {
        public new const uint ID =6510;
        public override uint ProtocolID
        {
            get { return ID; }
        }

        public sbyte questType;
        public sbyte index;

        public TreasureHuntFlagRemoveRequestMessage()
        {
        }

        public TreasureHuntFlagRemoveRequestMessage(sbyte questType, sbyte index)
        {
            this.questType = questType;
            this.index = index;
        }

        public override void Serialize(BigEndianWriter writer)
        {
            writer.WriteSByte(questType);
            writer.WriteSByte(index);
        }

        public override void Deserialize(BigEndianReader reader)
        {
            questType = reader.ReadSByte();
            if (questType < 0)
                throw new Exception("Forbidden value on questType = " + questType + ", it doesn't respect the following condition : questType < 0");
            index = reader.ReadSByte();
            if (index < 0)
                throw new Exception("Forbidden value on index = " + index + ", it doesn't respect the following condition : index < 0");
        }

    }

}


text:
namespace rubinius {
  class InternalThread;
  class VM;

  typedef std::list<InternalThread*> InternalThreadList;

  class InternalThread {
    VM* vm_;
    bool thread_running_;
    uint32_t stack_size_;

  protected:

    bool thread_exit_;

  public:

    enum StackSize {
      eSmall  = 0x1000,
      eLarge  = 0x10000,
      eXLarge = 0x100000,
    };

    InternalThread(STATE, std::string name, StackSize stack_size=eLarge);
    virtual ~InternalThread() { };

    // OS thread trampoline
    static void* run(void*);

    // Events
    virtual void before_exec(STATE) { };
    virtual void after_exec(STATE) { };
    virtual void before_fork_exec(STATE) { };
    virtual void after_fork_exec_parent(STATE) { };
    virtual void after_fork_exec_child(STATE) { };
    virtual void before_fork(STATE) { };
    virtual void after_fork_parent(STATE) { };
    virtual void after_fork_child(STATE);
    virtual void run(STATE) { };

    // Object interface
    VM* vm() {
      return vm_;
    }

    virtual void initialize(STATE);
    virtual void start(STATE);
    virtual void start_thread(STATE);
    virtual void wakeup(STATE);
    virtual void stop_thread(STATE);
    virtual void stop(STATE);
  };

  class InternalThreads {
  private:
    bool fork_in_progress_;
    bool exec_in_progress_;
    bool fork_exec_in_progress_;
    bool shutdown_in_progress_;
    utilities::thread::Mutex mutex_;
    InternalThreadList threads_;

  public:
    InternalThreads()
      : fork_in_progress_(false)
      , exec_in_progress_(false)
      , fork_exec_in_progress_(false)
      , shutdown_in_progress_(false)
    {
    }

    void register_thread(InternalThread* thread);
    void unregister_thread(InternalThread* thread);

    void init();
    void shutdown(STATE);
    void before_exec(STATE);
    void after_exec(STATE);
    void before_fork_exec(STATE);
    void after_fork_exec_parent(STATE);
    void after_fork_exec_child(STATE);
    void before_fork(STATE);
    void after_fork_parent(STATE);
    void after_fork_child(STATE);
  };
}

#endif


text:
using namespace arangodb;

////////////////////////////////////////////////////////////////////////////////
/// @brief unwrap a LogicalCollection wrapped via WrapCollection(...)
/// @return collection or nullptr on failure
////////////////////////////////////////////////////////////////////////////////
arangodb::LogicalCollection* UnwrapCollection(
    v8::Isolate* isolate, v8::Local<v8::Object> const& holder) {
  return TRI_UnwrapClass<arangodb::LogicalCollection>(
      holder, WRP_VOCBASE_COL_TYPE, TRI_IGETC);
}

////////////////////////////////////////////////////////////////////////////////
/// @brief wraps a LogicalCollection
////////////////////////////////////////////////////////////////////////////////
v8::Handle<v8::Object> WrapCollection(
    v8::Isolate* isolate,
    std::shared_ptr<arangodb::LogicalCollection> const& collection) {
  v8::EscapableHandleScope scope(isolate);
  TRI_GET_GLOBALS();
  auto context = TRI_IGETC;
  TRI_GET_GLOBAL(VocbaseColTempl, v8::ObjectTemplate);
  v8::Handle<v8::Object> result =
      VocbaseColTempl->NewInstance(TRI_IGETC).FromMaybe(
          v8::Local<v8::Object>());

  if (result.IsEmpty()) {
    return scope.Escape<v8::Object>(result);
  }

  LOG_TOPIC("44ea5", TRACE, arangodb::Logger::V8)
      << "Wrapping Collection " << collection->name() << " with ptr "
      << (void*)collection.get() << " to context ID " << v8g->_id;

  auto value = std::shared_ptr<void>(  // persistent value
      collection.get(),                // value
      [collection](
          void*) -> void {  // ensure collection shared_ptr is not deallocated
        TRI_ASSERT(!collection->vocbase().isDangling());
        collection->vocbase()
            .release();  // decrease the reference-counter for the database
      });
  auto itr = TRI_v8_global_t::SharedPtrPersistent::emplace(*isolate, value);
  auto& entry = itr.first;

  TRI_ASSERT(!collection->vocbase().isDangling());
  collection->vocbase()
      .forceUse();  // increase the reference-counter for the database (will be
                    // decremented by 'value' distructor above, valid for both
                    // new and existing mappings)

  result->SetInternalField(  // required for TRI_UnwrapClass(...)
      SLOT_CLASS_TYPE, v8::Integer::New(isolate, WRP_VOCBASE_COL_TYPE)  // args
  );
  result->SetInternalField(SLOT_CLASS, entry.get());

  TRI_GET_GLOBAL_STRING(_IdKey);
  TRI_GET_GLOBAL_STRING(_DbNameKey);
  TRI_GET_GLOBAL_STRING(VersionKeyHidden);
  result
      ->DefineOwnProperty(  // define own property
          TRI_IGETC,        // context
          _IdKey,           // key
          TRI_V8UInt64String<DataSourceId::BaseType>(
              isolate, collection->id().id()),  // value
          v8::ReadOnly                          // attributes
          )
      .FromMaybe(false);  // Ignore result...
  result
      ->Set(context,  // set value
            _DbNameKey,
            TRI_V8_STD_STRING(isolate, collection->vocbase().name())  // args
            )
      .FromMaybe(false);
  result
      ->DefineOwnProperty(   // define own property
          TRI_IGETC,         // context
          VersionKeyHidden,  // key
          v8::Integer::NewFromUnsigned(isolate,
                                       collection->v8CacheVersion()),  // value
          v8::DontEnum  // attributes
          )
      .FromMaybe(false);  // ignore return value

  return scope.Escape<v8::Object>(result);
}