text:
using System.Collections.Generic;
using Fpm.ProfileData.Entities.Core;

namespace Fpm.MainUI.ViewModels.Areas
{
    public class AreasIndexViewModel
    {
        public int SearchAreaTypeId { get; set; }
        public string SearchText { get; set; }
        public IList<Area> AreaGrid { get; set; }
    }
}


text:
#include "stdafx.h"

#include <d3d10.h>

#include "../Utilities.h"

#include "BlendStateDescription.h"

using namespace System;
using namespace System::Collections::Generic;
using namespace System::Collections::ObjectModel;

namespace SlimDX
{
namespace Direct3D10
{
	BlendStateDescription::BlendStateDescription( const D3D10_BLEND_DESC& native )
	{
		m_AlphaToCoverageEnable = native.AlphaToCoverageEnable ? true : false;
		m_SrcBlend = static_cast<BlendOption>( native.SrcBlend );
		m_DestBlend = static_cast<BlendOption>( native.DestBlend );
		m_BlendOp = static_cast<Direct3D10::BlendOperation>( native.BlendOp );
		m_SrcBlendAlpha = static_cast<BlendOption>( native.SrcBlendAlpha );
		m_DestBlendAlpha = static_cast<BlendOption>( native.DestBlendAlpha );
		m_BlendOpAlpha = static_cast<Direct3D10::BlendOperation>( native.BlendOpAlpha );

		ConstructLazyProperties();
		for(int index = 0; index < 8; ++index)
		{
			m_BlendEnable[ index ] = (native.BlendEnable[ index ] > 0);
			m_RenderTargetWriteMask[ index ] = static_cast<ColorWriteMaskFlags>( native.RenderTargetWriteMask[ index ] );
		}
	}

	D3D10_BLEND_DESC BlendStateDescription::CreateNativeVersion()
	{
		D3D10_BLEND_DESC native;
		native.AlphaToCoverageEnable = m_AlphaToCoverageEnable;
		native.SrcBlend = static_cast<D3D10_BLEND>( m_SrcBlend );
		native.DestBlend = static_cast<D3D10_BLEND>( m_DestBlend );
		native.BlendOp = static_cast<D3D10_BLEND_OP>( m_BlendOp );
		native.SrcBlendAlpha = static_cast<D3D10_BLEND>( m_SrcBlendAlpha );
		native.DestBlendAlpha = static_cast<D3D10_BLEND>( m_DestBlendAlpha );
		native.BlendOpAlpha = static_cast<D3D10_BLEND_OP>( m_BlendOpAlpha );

		ConstructLazyProperties();
		for(int index = 0; index < 8; ++index)
		{
			native.BlendEnable[ index ] = m_BlendEnable[ index ];
			native.RenderTargetWriteMask[ index ] = static_cast<UINT8>( m_RenderTargetWriteMask[ index ] );
		}

		return native;
	}

	bool BlendStateDescription::IsAlphaToCoverageEnabled::get()
	{
		return m_AlphaToCoverageEnable;
	}

	void BlendStateDescription::IsAlphaToCoverageEnabled::set( bool value )
	{
		m_AlphaToCoverageEnable = value;
	}

	BlendOption BlendStateDescription::SourceBlend::get()
	{
		return m_SrcBlend;
	}

	void BlendStateDescription::SourceBlend::set( BlendOption value )
	{
		m_SrcBlend = value;
	}

	BlendOption BlendStateDescription::DestinationBlend::get()
	{
		return m_DestBlend;
	}

	void BlendStateDescription::DestinationBlend::set( BlendOption value )
	{
		m_DestBlend = value;
	}

	Direct3D10::BlendOperation BlendStateDescription::BlendOperation::get()
	{
		return m_BlendOp;
	}

	void BlendStateDescription::BlendOperation::set( Direct3D10::BlendOperation value )
	{
		m_BlendOp = value;
	}

	BlendOption BlendStateDescription::SourceAlphaBlend::get()
	{
		return m_SrcBlendAlpha;
	}

	void BlendStateDescription::SourceAlphaBlend::set( BlendOption value )
	{
		m_SrcBlendAlpha = value;
	}

	BlendOption BlendStateDescription::DestinationAlphaBlend::get()
	{
		return m_DestBlendAlpha;
	}

	void BlendStateDescription::DestinationAlphaBlend::set( BlendOption value )
	{
		m_DestBlendAlpha = value;
	}

	Direct3D10::BlendOperation BlendStateDescription::AlphaBlendOperation::get()
	{
		return m_BlendOpAlpha;
	}

	void BlendStateDescription::AlphaBlendOperation::set( Direct3D10::BlendOperation value )
	{
		m_BlendOpAlpha = value;
	}

	bool BlendStateDescription::GetBlendEnable( UInt32 index )
	{
		ConstructLazyProperties();
		return m_BlendEnable[ index ];
	}

	void BlendStateDescription::SetBlendEnable( UInt32 index, bool value )
	{
		ConstructLazyProperties();
		m_BlendEnable[ index ] = value;
	}

	ColorWriteMaskFlags BlendStateDescription::GetWriteMask( UInt32 index )
	{
		ConstructLazyProperties();
		return m_RenderTargetWriteMask[ index ];
	}

	void BlendStateDescription::SetWriteMask( UInt32 index, ColorWriteMaskFlags value )
	{
		ConstructLazyProperties();
		m_RenderTargetWriteMask[ index ] = value;
	}

	void BlendStateDescription::ConstructLazyProperties()
	{
		if( m_BlendEnable == nullptr )
		{
			m_BlendEnable = gcnew array<bool>(8);
			m_RenderTargetWriteMask = gcnew array<ColorWriteMaskFlags>(8);
			for(int index = 0; index < 8; ++index)
			{
				m_BlendEnable[ index ] = false;
				m_RenderTargetWriteMask[ index ] = ColorWriteMaskFlags::All;
			}
		}
	}

	bool BlendStateDescription::operator == ( BlendStateDescription left, BlendStateDescription right )
	{
		return BlendStateDescription::Equals( left, right );
	}

	bool BlendStateDescription::operator != ( BlendStateDescription left, BlendStateDescription right )
	{
		return !BlendStateDescription::Equals( left, right );
	}

	int BlendStateDescription::GetHashCode()
	{
		ConstructLazyProperties();
		return (
			m_AlphaToCoverageEnable.GetHashCode() +
			Utilities::GetElementHashCode( m_BlendEnable ) +
			m_SrcBlend.GetHashCode() +
			m_DestBlend.GetHashCode() +
			m_BlendOp.GetHashCode() +
			m_SrcBlendAlpha.GetHashCode() +
			m_DestBlendAlpha.GetHashCode() +
			m_BlendOpAlpha.GetHashCode() +
			m_RenderTargetWriteMask->GetHashCode()
		);
	}

	bool BlendStateDescription::Equals( Object^ value )
	{
		if( value == nullptr )
			return false;

		if( value->GetType() != GetType() )
			return false;

		return Equals( safe_cast<BlendStateDescription>( value ) );
	}

	bool BlendStateDescription::Equals( BlendStateDescription value )
	{
		ConstructLazyProperties();
		value.ConstructLazyProperties();
		return (
			m_AlphaToCoverageEnable == value.m_AlphaToCoverageEnable &&
			Utilities::CheckElementEquality( m_BlendEnable, value.m_BlendEnable ) &&
			m_SrcBlend == value.m_SrcBlend &&
			m_DestBlend == value.m_DestBlend &&
			m_BlendOp == value.m_BlendOp &&
			m_SrcBlendAlpha == value.m_SrcBlendAlpha &&
			m_DestBlendAlpha == value.m_DestBlendAlpha &&
			m_BlendOpAlpha == value.m_BlendOpAlpha &&
			Utilities::CheckElementEquality( m_RenderTargetWriteMask, value.m_RenderTargetWriteMask )
		);
	}

	bool BlendStateDescription::Equals( BlendStateDescription% value1, BlendStateDescription% value2 )
	{
		value1.ConstructLazyProperties();
		value2.ConstructLazyProperties();
		return (
			value1.m_AlphaToCoverageEnable == value2.m_AlphaToCoverageEnable &&
			Utilities::CheckElementEquality( value1.m_BlendEnable, value2.m_BlendEnable ) &&
			value1.m_SrcBlend == value2.m_SrcBlend &&
			value1.m_DestBlend == value2.m_DestBlend &&
			value1.m_BlendOp == value2.m_BlendOp &&
			value1.m_SrcBlendAlpha == value2.m_SrcBlendAlpha &&
			value1.m_DestBlendAlpha == value2.m_DestBlendAlpha &&
			value1.m_BlendOpAlpha == value2.m_BlendOpAlpha &&
			Utilities::CheckElementEquality( value1.m_RenderTargetWriteMask, value2.m_RenderTargetWriteMask )
		);
	}
}
}

redpajama_set_name: RedPajamaGithub


text:
require_relative '../../spec_helper'

describe "Time#hash" do
  it "returns a Fixnum" do
    Time.at(100).hash.should be_an_instance_of(Fixnum)
  end

  it "is stable" do
    Time.at(1234).hash.should == Time.at(1234).hash
  end
end


text:
from django.core.management.base import NoArgsCommand
from logging import getLogger
from mks.models import Member
from django.core.cache import cache

logger = getLogger(__name__)

class Command(NoArgsCommand):
    help = "Recalculates bill statistics for mks of current knesset"
    info_types = ['bills_proposed', 'bills_pre', 'bills_approved', 'bills_first']

    def handle_noargs(self, **options):
        for mk in Member.objects.filter(is_current=True):
            logger.info(u'Recalculate bill statistics For mk: {0}'.format(mk.name))
            mk.recalc_bill_statistics()

        self._invalidate_cache()

    def _invalidate_cache(self):
        for info_type in self.info_types:
            if cache.get('object_list_by_%s' % info_type):
                cache.delete('object_list_by_%s' % info_type)


text:
<?php

/*
 *
 * HttpResponse component configuration file
 *
 */

return [
];


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

namespace PHPUnit\TestFixture;

use PHPUnit\Framework\TestCase;

final class TestWithDifferentOutput extends TestCase
{
    public function testThatDoesNotGenerateOutput(): void
    {
        $this->assertTrue(true);
    }

    public function testThatExpectsOutputRegex(): void
    {
        $this->expectOutputRegex('.*');

        print 'Hello!';
    }

    public function testThatExpectsOutputString(): void
    {
        $this->expectOutputString('Hello!');

        print 'Hello!';
    }

    public function testThatGeneratesOutput(): void
    {
        print 'Hello!';

        $this->assertTrue(true);
    }
}


text:
package me.aartikov.simplescreenswitchersample.ui;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import me.aartikov.alligator.annotations.RegisterScreen;
import me.aartikov.simplescreenswitchersample.R;
import me.aartikov.simplescreenswitchersample.screens.TabScreen;

@RegisterScreen(TabScreen.Dog.class)
public class DogFragment extends Fragment {
	@Override
	public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
		return inflater.inflate(R.layout.fragment_dog, container, false);
	}
}


text:
/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!
  \file			ydatetime.h
  \date			June 2014
  \author		Nicu Tofan

*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
#ifndef YT_ydatetime_h_INCLUDE
#define YT_ydatetime_h_INCLUDE
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

#include <yt/yt.h>

#ifdef __cplusplus
extern "C" {
#endif

/*  INCLUDES    ============================================================ */
//
//
//
//
/*  DEFINITIONS    --------------------------------------------------------- */

struct _ydatetime_t;
struct timeval;
struct tm;

//! a logger structure
///
typedef struct _ydatetime_t {

    const char * app_name_;     /**< the reported name of the application */

} ydatetime_t;

//! may be used to add special directives to export function
/// @{
#ifndef YDATETIME_EXPORT
#define YDATETIME_EXPORT
#endif
/// @}

//! not yet implemented
/// @{
#ifndef YDATETIME_IMPLEMENT_ME
#define YDATETIME_IMPLEMENT_ME
#endif
/// @}

/*  DEFINITIONS    ========================================================= */
//
//
//
//
/*  DATA    ---------------------------------------------------------------- */

/*  DATA    ================================================================ */
//
//
//
//
/*  FUNCTIONS    ----------------------------------------------------------- */

// == == == == == == == == == == == == == == == == == == == == == ==
/** @name Base
 *  Constructors, destructors and so on
 */
///@{

//! initialize
///
/// Provides the structure with default callbacks.
///
YDATETIME_EXPORT yt_func_exit_code_t
ydatetime_init (
        struct _ydatetime_t * ydatetime,
        const char * app_name);

//! terminate
///
YDATETIME_EXPORT void
ydatetime_end (
        struct _ydatetime_t * ydatetime);

///@}
// == == == == == == == == == == == == == == == == == == == == == ==

//! convert a unix timestamp to a timeval structure
///
/// Unix timestamp is represented as a double value where integer part
/// is the number of seconds and fractional part is the fraction of seconds.
///
YDATETIME_EXPORT void
ydatetime_unix_to_timeval (
        double unix_time,
        struct timeval * out);

//! convert a unix timestamp to a tm time structure
///
/// Unix timestamp is represented as a double value where integer part
/// is the number of seconds and fractional part is the fraction of seconds.
///
YDATETIME_EXPORT void
ydatetime_unix_to_tm (
        double unix_time,
        struct tm * out);

/*  FUNCTIONS    =========================================================== */
//
//
//
//
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
#ifdef __cplusplus
}
#endif
#endif // YT_ydatetime_h_INCLUDE


text:
LEVEL = ../../../make

C_SOURCES := myModule.c

OBJC_SOURCES := main.m

include $(LEVEL)/Makefile.rules

CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS) -I$(PWD)


text:
<?php
include("../../app/conf/Connection.php");
include("../../app/inc/Model.php");
include("../../app/models/Database.php");
include("../../app/models/Dbchecks.php");
include("sqls.php");

\app\conf\Connection::$param["postgisdb"]  = $_REQUEST['db'];
$conn = new \app\inc\Model();
try {
	$conn->connect();
} catch (Exception $e) {
	echo $e->getMessage()."\n";
	die();
}

$conn->begin();
//Try to drop schema
/*
$result = $conn->execQuery("DROP SCHEMA settings CASCADE","PDO","transaction");
if (!$conn->PDOerror[0]) {
	echo "Schema dropped
";
}
else {
	echo "Something went wrong; {$conn->PDOerror[0]}";
	$conn->rollback();
}
*/

//Try to create schema
$result = $conn->execQuery($sqls['schema'],"PDO","transaction");
if (!$conn->PDOerror[0]) {
	echo "Schema created
";
}
else {
	echo "Something went wrong; {$conn->PDOerror[0]}";
	$conn->rollback();
}

//Try to create view
$result = $conn->execQuery($sqls['view'],"PDO","transaction");
if (!$conn->PDOerror[0]) {
	echo "View created
";
}
else {
	echo "Something went wrrtong; {$conn->PDOerror[0]}";
	$conn->rollback();

}
if (!$conn->PDOerror[0]) {
	$conn->commit();
}


text: Data analysis code for the CONA project


text:
using System;

namespace MsgPack.Rpc.Server.Protocols
{
	/// <summary>
	///		The null object of <see cref="ServerTransport"/> class.
	/// </summary>
	internal sealed class NullServerTransport : ServerTransport
	{
		protected override bool CanResumeReceiving
		{
			get { return true; }
		}

		/// <summary>
		///		Occurs when response is sent.
		/// </summary>
		public event EventHandler<SentEventArgs> Sent;

		/// <summary>
		/// Initializes a new instance of the <see cref="NullServerTransport"/> class.
		/// </summary>
		/// <param name="manager">The manager.</param>
		public NullServerTransport( ServerTransportManager<NullServerTransport> manager ) : base( manager ) { }

		/// <summary>
		/// Performs protocol specific asynchronous 'Receive' operation.
		/// </summary>
		/// <param name="context">Context information.</param>
		protected override void ReceiveCore( ServerRequestContext context )
		{
			return;
		}

		/// <summary>
		/// Performs protocol specific asynchronous 'Send' operation.
		/// </summary>
		/// <param name="context">Context information.</param>
		protected override void SendCore( ServerResponseContext context )
		{
			var handler = this.Sent;
			if ( handler != null )
			{
				handler( this, new SentEventArgs( context ) );
			}

			return;
		}

		/// <summary>
		///		Contains event data for <see cref="Sent"/> event.
		/// </summary>
		public sealed class SentEventArgs : EventArgs
		{
			private readonly ServerResponseContext _context;

			/// <summary>
			///		Gets the <see cref="ServerResponseContext"/> to be sent.
			/// </summary>
			/// <value>
			///		The <see cref="ServerResponseContext"/> to be sent.
			/// </value>
			public ServerResponseContext Context
			{
				get { return this._context; }
			}

			internal SentEventArgs( ServerResponseContext context )
			{
				this._context = context;
			}
		}
	}
}


text:
namespace ui {

class AXNode;

// A basic implementation of AXTreeManager.
//
// For simplicity, this class supports only a single tree and doesn't perform
// any walking across multiple trees.
class AX_EXPORT AXDummyTreeManager : public AXTreeManager {
 public:
  // This constructor does not create an empty AXTree. Call "SetTree" if you
  // need to manage a specific tree. Useful when you need to test for the
  // situation when no AXTree has been loaded yet.
  AXDummyTreeManager();

  // Takes ownership of |tree|.
  explicit AXDummyTreeManager(std::unique_ptr<AXTree> tree);

  ~AXDummyTreeManager() override;

  AXDummyTreeManager(const AXDummyTreeManager& manager) = delete;
  AXDummyTreeManager& operator=(const AXDummyTreeManager& manager) = delete;

  AXDummyTreeManager(AXDummyTreeManager&& manager);
  AXDummyTreeManager& operator=(AXDummyTreeManager&& manager);

  void DestroyTree();
  AXTree* GetTree() const;
  // Takes ownership of |tree|.
  void SetTree(std::unique_ptr<AXTree> tree);

  // AXTreeManager implementation.
  AXNode* GetParentNodeFromParentTree() const override;
};

}  // namespace ui

#endif  // UI_ACCESSIBILITY_AX_DUMMY_TREE_MANAGER_H_


text:
@interface ViewController : UIViewController

- (void)refresh;

@end


text:
batterycsv="$HOME/.battery_profile.csv"

function charge(){
  echo $(system_profiler SPPowerDataType | grep 'Charge Remaining' | sed 's/[^0-9]*//g')
}

function capacity(){
  echo $(system_profiler SPPowerDataType | grep 'Full Charge Capacity' | sed 's/[^0-9]*//g')
}

function counts(){
  echo $(system_profiler SPPowerDataType | grep 'Cycle Count' | sed 's/[^0-9]*//g')
}

function amperage(){
  echo $(system_profiler SPPowerDataType | grep 'Amperage' | sed 's/[^0-9]*//g')
}

function voltage(){
  echo $(system_profiler SPPowerDataType | grep 'Voltage' | sed 's/[^0-9]*//g')
}

export GREP_OPTIONS="--color=never"
# saving order:
# hh:mm:ss, dd.mm.yy, charge, capacity, counts, amperage, voltage
printf "$(date +%H:%M:%S,%d.%m.%Y),%s,%s,%s,%s,%s\n" $(charge) $(capacity) $(counts) $(amperage) $(voltage) >> $batterycsv


text:
import praw

r = praw.Reddit(user_agent='my_cool_application')
submissions = list(r.get_subreddit('opensource').get_hot(limit=1))
for x in submissions: print x.title


text:
package org.kie.internal.task.api;

public interface UserGroupCallback extends org.kie.api.task.UserGroupCallback {

}


text:
mat-list-item {
  margin-bottom: 5px;
  cursor: pointer;
}

mat-chip-list {
  display: inline-block;
}


text:
package org.cyclops.cyclopscore.fluid;

import com.google.common.collect.Lists;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.registries.ForgeRegistries;
import org.cyclops.cyclopscore.persist.IDirtyMarkListener;

import java.util.List;
import java.util.Objects;

import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;

/**
 * A simple tank that can accept and drain fluids until the capacity is reached.
 * Only one fluid can be accepted, which must be specified with {@link SingleUseTank#setAcceptedFluid(Fluid)}.
 * Based on the Buildcraft SingleUseTank.
 *
 * @author rubensworks
 *
 */
public class SingleUseTank extends Tank {

    /**
     * The NBT name for the fluid tank.
     */
    public static final String NBT_ACCEPTED_FLUID = "acceptedFluid";

    private final List<IDirtyMarkListener> dirtyMarkListeners = Lists.newLinkedList();

    private Fluid acceptedFluid;

    /**
     * Make a new tank instance.
     * @param capacity The capacity (mB) for the tank.
     */
    public SingleUseTank(int capacity) {
        super(capacity);
        setAcceptedFluid(Fluids.EMPTY);
    }

    /**
     * Add a dirty marking listener.
     * @param dirtyMarkListener The dirty mark listener.
     */
    public synchronized void addDirtyMarkListener(IDirtyMarkListener dirtyMarkListener) {
        this.dirtyMarkListeners.add(dirtyMarkListener);
    }

    /**
     * Remove a dirty marking listener.
     * @param dirtyMarkListener The dirty mark listener.
     */
    public synchronized void removeDirtyMarkListener(IDirtyMarkListener dirtyMarkListener) {
        this.dirtyMarkListeners.remove(dirtyMarkListener);
    }

    @Override
    public int fill(FluidStack resource, FluidAction action) {
        Fluid acceptedFluid = getAcceptedFluid();
        int filled = 0;
        if (resource.isEmpty()) {
            filled = 0;
        } else {
            if (action.execute() && acceptedFluid == Fluids.EMPTY) {
                acceptedFluid = resource.getFluid();
            }
            if (acceptedFluid == Fluids.EMPTY || acceptedFluid == resource.getFluid()) {
                filled = super.fill(resource, action);
            }
        }
        if(action.execute() && filled > 0) {
            sendUpdate();
        }
        return filled;
    }

    @Override
    public FluidStack drain(int maxDrain, FluidAction action) {
        FluidStack drained = super.drain(maxDrain, action);
        if (action.execute() && !drained.isEmpty()) {
            sendUpdate();
        }
        return drained;
    }

    @Override
    public FluidStack drain(FluidStack resource, FluidAction action) {
        FluidStack drained = super.drain(resource, action);
        if (action.execute() && !drained.isEmpty()) {
            sendUpdate();
        }
        return drained;
    }

    protected void sendUpdate() {
        List<IDirtyMarkListener> dirtyMarkListeners;
        synchronized (this) {
            dirtyMarkListeners = Lists.newLinkedList(this.dirtyMarkListeners);
        }
        for(IDirtyMarkListener dirtyMarkListener : dirtyMarkListeners) {
            dirtyMarkListener.onDirty();
        }
    }

    /**
     * Reset the tank by setting the inner fluid to null.
     */
    public void reset() {
        acceptedFluid = Fluids.EMPTY;
        setValidator(fluidStack -> true);
    }

    /**
     * Set the accepted fluid for this tank.
     * @param fluid The accepted fluid
     */
    public void setAcceptedFluid(Fluid fluid) {
        this.acceptedFluid = Objects.requireNonNull(fluid);
        if (fluid == Fluids.EMPTY) {
            setValidator(fluidStack -> true);
        } else {
            setValidator(fluidStack -> fluidStack.getFluid() == fluid);
        }
    }

    /**
     * Get the accepted fluid for this tank.
     * @return The accepted fluid.
     */
    public Fluid getAcceptedFluid() {
        return acceptedFluid;
    }

    @Override
    public void writeTankToNBT(CompoundTag nbt) {
        super.writeTankToNBT(nbt);
        nbt.putString(NBT_ACCEPTED_FLUID, ForgeRegistries.FLUIDS.getKey(acceptedFluid).toString());
    }

    @Override
    public void readTankFromNBT(CompoundTag nbt) {
        super.readTankFromNBT(nbt);
        setAcceptedFluid(ForgeRegistries.FLUIDS.getValue(new ResourceLocation(nbt.getString(NBT_ACCEPTED_FLUID))));
    }

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Symb. bot. upsal. 13(2): 162 (1954)

#### Original name
Collema tenax var. expansum Degel.

### Remarks
null


text:
/*
 * Antonin Bas (antonin@barefootnetworks.com)
 *
 */

#include "bm_apps/learn.h"

#include <nanomsg/pubsub.h>

#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/transport/TSocket.h>
#include <thrift/transport/TTransportUtils.h>
#include <thrift/protocol/TMultiplexedProtocol.h>

#include <iostream>
#include <string>

#include <cassert>

#include "nn.h"

#include "Standard.h"
#include "SimplePre.h"

namespace bm_apps {

namespace runtime = bm_runtime::standard;

namespace {

typedef struct {
  char sub_topic[4];
  int switch_id;
  int cxt_id;
  int list_id;
  uint64_t buffer_id;
  unsigned int num_samples;
  char _padding[4];
} __attribute__((packed)) learn_hdr_t;

}  // namespace

LearnListener::LearnListener(const std::string &learn_socket,
                             const std::string &thrift_addr,
                             const int thrift_port)
  : socket_name(learn_socket),
    thrift_addr(thrift_addr), thrift_port(thrift_port) { }

LearnListener::~LearnListener() {
  {
    std::unique_lock<std::mutex> lock(mutex);
    stop_listen_thread = false;
  }
  listen_thread.join();
}

void
LearnListener::register_cb(const LearnCb &cb, void *cookie) {
  std::unique_lock<std::mutex> lock(mutex);
  cb_fn = cb;
  cb_cookie = cookie;
}

void
LearnListener::ack_buffer(cxt_id_t cxt_id, list_id_t list_id,
                          buffer_id_t buffer_id) {
  assert(bm_client);
  bm_client->bm_learning_ack_buffer(cxt_id, list_id, buffer_id);
}

void
LearnListener::start() {
  using apache::thrift::protocol::TProtocol;
  using apache::thrift::protocol::TBinaryProtocol;
  using apache::thrift::protocol::TMultiplexedProtocol;
  using apache::thrift::transport::TSocket;
  using apache::thrift::transport::TTransport;
  using apache::thrift::transport::TBufferedTransport;

  boost::shared_ptr<TTransport> tsocket(new TSocket("localhost", 9090));
  boost::shared_ptr<TTransport> transport(new TBufferedTransport(tsocket));
  boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));

  boost::shared_ptr<TMultiplexedProtocol> standard_protocol(
      new TMultiplexedProtocol(protocol, "standard"));

  bm_client = boost::shared_ptr<runtime::StandardClient>(
      new runtime::StandardClient(standard_protocol));

  transport->open();

  listen_thread = std::thread(&LearnListener::listen_loop, this);
}

void
LearnListener::listen_loop() {
  nn::socket s(AF_SP, NN_SUB);
  // only subscribe to learn notifications
  s.setsockopt(NN_SUB, NN_SUB_SUBSCRIBE, "LEA", 3);
  int to = 200;
  s.setsockopt(NN_SOL_SOCKET, NN_RCVTIMEO, &to, sizeof(to));
  s.connect(socket_name.c_str());

  struct nn_msghdr msghdr;
  struct nn_iovec iov[2];
  learn_hdr_t learn_hdr;
  char data[4096];
  iov[0].iov_base = &learn_hdr;
  iov[0].iov_len = sizeof(learn_hdr);
  iov[1].iov_base = data;
  iov[1].iov_len = sizeof(data);  // apparently only max size needed ?
  memset(&msghdr, 0, sizeof(msghdr));
  msghdr.msg_iov = iov;
  msghdr.msg_iovlen = 2;

  while (true) {
    if (s.recvmsg(&msghdr, 0) <= 0) {
      std::unique_lock<std::mutex> lock(mutex);
      if (stop_listen_thread) return;
      continue;
    }

    LearnCb cb_fn_;
    void *cb_cookie_;
    std::cout << "I received " << learn_hdr.num_samples << " samples\n";

    {
      std::unique_lock<std::mutex> lock(mutex);
      // I don't believe this is expensive
      cb_fn_ = cb_fn;
      cb_cookie_ = cb_cookie;
    }

    if (!cb_fn_) {
      std::cout << "No callback\n";
      continue;
    }

    std::cout << "Calling callback function\n";
    MsgInfo info = {learn_hdr.switch_id, learn_hdr.cxt_id, learn_hdr.list_id,
                    learn_hdr.buffer_id, learn_hdr.num_samples};
    cb_fn_(info, data, cb_cookie_);
  }
}

}  // namespace bm_apps


text:
require File.dirname(__FILE__) + '/../../spec_helper'

describe Howcast::Client::Video, "initialize" do
  it "should create a video object with all the inputted attributes" do
    video = Howcast::Client::Video.new :title => "video_title"
    video.title.should == 'video_title'
  end

  it "should ignore inputs which are not video attributes" do
    video = Howcast::Client::Video.new :not_an_attribute => "value", :title => "video_title"
    video.respond_to?(:not_an_attribute).should be_false
    video.title.should == "video_title"
  end
end

describe Howcast::Client, "video" do
  before do
    @hc = Howcast::Client.new(:key => "myapikey")
    @hc.stub!(:open).and_return(video_xml)
  end

  it "should establish a connection with the correct video url" do
    @hc.should_receive(:open).with("http://www.howcast.com/videos/2.xml?api_key=myapikey").and_return(video_xml)
    @hc.video(2)
  end

  it "should raise Howcast::ApiKeyNotFound error when the response contains Invalid API Key" do
    lambda {
      @hc.stub!(:open).and_return(invalid_api_key_xml)
      @hc.video(2)
    }.should raise_error(Howcast::ApiKeyNotFound)
  end

  it "should return nil whenever the result xml is empty" do
    @hc.stub!(:open).and_return(blank_video_xml)
    @hc.video(2).should be_nil
  end

  it "should set the embed attribute in the video model response" do
    @hc.video(2).embed.should == %(<object width="425" height="352" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="howcastplayer"><param name="movie" value="http://www.howcast.com/flash/howcast_player.swf?file=233"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.howcast.com/flash/howcast_player.swf?file=233" type="application/x-shockwave-flash" width="425" height="352" allowFullScreen="true" allowScriptAccess="always" ></embed></object>)
  end

  it "should set the title attribute in the video model response" do
    @hc.video(2).title.should == "How To Do a Noble Pose"
  end

  it "should set the views attribute in the video model response" do
    @hc.video(2).views.should == "38"
  end

  it "should set the badges in the video model response" do
    @hc.video(2).badges.should == "Howcast Studios"
  end

  it "should set the easy_steps boolean in the video model response" do
    @hc.video(2).easy_steps?.should be_true
  end

  it "should set the rating attribute in the video model response" do
    @hc.video(2).rating.should == "2.0"
  end

  it "should set the description attribute in the video model response" do
    @hc.video(2).description.should == "You recognize the Noble Pose as the dreaded \"sit-and-reach\" from your childhood gym class. A sample link"
  end

  it "should set the permalink attribute in the video model response" do
    @hc.video(2).permalink.should == "http://www.howcast.com/videos/233-How-To-Do-a-Noble-Pose"
  end
end

describe Howcast::Client, "videos" do
  before do
    @hc = Howcast::Client.new(:key => "myapikey")
  end

  it "should establish a connection with videos/most_recent/howcast_studios.xml by default" do
    @hc.should_receive(:open).with("http://www.howcast.com/videos/most_recent/howcast_studios.xml?api_key=myapikey").and_return(videos_xml)
    @hc.videos
  end

  it "should establish a connection with videos/most_recent/howcast_studios/2.xml when :page => 2" do
    @hc.should_receive(:open).with("http://www.howcast.com/videos/most_recent/howcast_studios/2.xml?api_key=myapikey").and_return(videos_xml)
    @hc.videos(:page => 2)
  end

  it "should establish a connection with videos/most_viewed/howcast_studios.xml when :sort => most_viewed" do
    @hc.should_receive(:open).with("http://www.howcast.com/videos/most_viewed/howcast_studios.xml?api_key=myapikey").and_return(videos_xml)
    @hc.videos(:sort => "most_viewed")
  end

  it "should establish a connection with videos/most_viewed/directors_program.xml when :sort => most_viewed and :filter => directors_program" do
    @hc.should_receive(:open).with("http://www.howcast.com/videos/most_viewed/directors_program.xml?api_key=myapikey").and_return(videos_xml)
    @hc.videos(:sort => "most_viewed", :filter => "directors_program")
  end

  it "should establish a connection with videos/top_rated/directors_program.xml when :sort => most_viewed and :filter => directors_program" do
    @hc.should_receive(:open).with("http://www.howcast.com/videos/top_rated/directors_program.xml?api_key=myapikey").and_return(videos_xml)
    @hc.videos(:sort => "top_rated", :filter => "directors_program")
  end

  it "should raise a Howcast::ApiNotFound if url is invalid" do
    lambda {
      @hc.should_receive(:open).and_raise(URI::InvalidURIError)
      @hc.videos
    }.should raise_error(Howcast::ApiNotFound)
  end

  it "should return an empty array if there are no results" do
    @hc.should_receive(:open).and_return(blank_videos_xml)
    @hc.videos.should be_empty
  end

  it "should return an array of video objects if there are some returned" do
    @hc.should_receive(:open).and_return(videos_xml)
    videos = @hc.videos
    videos.size.should == 3
    videos.first.permalink.should == "http://www.howcast.com/videos/1101-How-To-Pretend-Youre-a-Real-New-Yorker"
    videos.last.permalink.should == "http://www.howcast.com/videos/866-How-To-Make-a-Water-Gun-Alarm-Clock"
  end
end


text:
<?php

namespace MusicBrainz\Relation\Type\Artist\Recording\Misc;

use MusicBrainz\Relation\Type\Artist\Recording\Misc;
use MusicBrainz\Value\Name;

/**
 * This credits a person who was responsible for booking the studio or performance venue where the recording was recorded.
 *
 * @link https://musicbrainz.org/relationship/b1edc6f6-283d-4e32-b625-b96cfb192056
 */
class Booking extends Misc
{
    /**
     * Returns the name of the relation.
     *
     * @return Name
     */
    public static function getRelationName(): Name
    {
        return new Name('booking');
    }
}


text:
@interface DTCoreTextGlyphRun ()

@property (nonatomic, assign) CGRect frame;
@property (nonatomic, assign) NSInteger numberOfGlyphs;
@property (nonatomic, assign) NSDictionary *attributes;

@end

@implementation DTCoreTextGlyphRun

- (id)initWithRun:(CTRunRef)run layoutLine:(DTCoreTextLayoutLine *)layoutLine origin:(CGPoint)origin
{
	self = [super init];

	if (self)
	{
    attributes = nil;
		_run = run;
		CFRetain(_run);

		_baselineOrigin = origin;
		_line = layoutLine;

		// calculate metrics
		width = CTRunGetTypographicBounds((CTRunRef)_run, CFRangeMake(0, 0), &ascent, &descent, &leading);

		_frame = CGRectMake(origin.x, origin.y - ascent, width, ascent + descent);
	}

	return self;
}

- (void)dealloc
{
	CFRelease(_run);
	[_attachment release];
    [stringIndices release];

	[super dealloc];
}

- (NSString *)description
{
	return [NSString stringWithFormat:@"<%@ glyphs=%d %@>", [self class], [self numberOfGlyphs], NSStringFromCGRect(_frame)];
}

#pragma mark Calculations
- (CGRect)frameOfGlyphAtIndex:(NSInteger)index
{
	if (!glyphPositionPoints)
	{
		glyphPositionPoints = CTRunGetPositionsPtr(_run);
	}

	if (index >= self.numberOfGlyphs)
	{
		return CGRectNull;
	}

	CGPoint glyphPosition = glyphPositionPoints[index];

	CGRect rect = CGRectMake(_line.frame.origin.x + glyphPosition.x, _line.frame.origin.y, CGRectGetMaxX(_frame) - _line.frame.origin.x - glyphPosition.x, _line.frame.size.height);

    if (index < self.numberOfGlyphs-1)
    {
        rect.size.width = glyphPositionPoints[index+1].x - glyphPosition.x;
    }

	return rect;
}

- (NSArray *)stringIndices {
    if (!stringIndices) {
        const CFIndex *indices = CTRunGetStringIndicesPtr(_run);
        NSInteger count = self.numberOfGlyphs;
        NSMutableArray *array = [NSMutableArray arrayWithCapacity:count];
        NSInteger i;
        for (i = 0; i < count; i++) {
            [array addObject:[NSNumber numberWithInteger:indices[i]]];
        }
        stringIndices = [array retain];
    }
    return stringIndices;
}

// bounds of an image encompassing the entire run
- (CGRect)imageBoundsInContext:(CGContextRef)context
{
	return CTRunGetImageBounds(_run, context, CFRangeMake(0, 0));
}

// range of the characters from the original string
- (NSRange)stringRange
{
	CFRange range = CTRunGetStringRange(_run);

	return NSMakeRange(range.location, range.length);
}

- (void)drawInContext:(CGContextRef)context
{
	if (!_run || !context)
	{
		return;
	}

	CTRunDraw(_run, context, CFRangeMake(0, 0));
}

#pragma mark Properites
- (NSInteger)numberOfGlyphs
{
	if (!numberOfGlyphs)
	{
		numberOfGlyphs = CTRunGetGlyphCount(_run);
	}

	return numberOfGlyphs;
}

- (NSDictionary *)attributes
{
	if (!attributes)
	{
		attributes = (NSDictionary *)CTRunGetAttributes(_run);
	}

	return attributes;
}

- (DTTextAttachment *)attachment
{
	if (!_attachment)
	{
		if (!_didCheckForAttachmentInAttributes)
		{
			_attachment = [[self.attributes objectForKey:@"DTTextAttachment"] retain];

			_didCheckForAttachmentInAttributes = YES;
		}
	}

	return _attachment;
}

@synthesize frame = _frame;
@synthesize numberOfGlyphs;
@synthesize attributes;

@synthesize ascent;
@synthesize descent;
@synthesize leading;
@synthesize baselineOrigin = _baselineOrigin;
@synthesize attachment = _attachment;

@end


text:
package com.kmwllc.brigade.stage.dict;

import com.kmwllc.brigade.utils.Range;

import java.io.InputStream;
import java.util.List;
import java.util.Map;

/**
 * Created by matt on 4/19/17.
 */
public interface DictionaryManager {
    void loadDictionary(InputStream in);
    boolean hasTokens(List<String> t);
    EntityInfo getEntity(List<String> t);
    List<String> findEntityStrings(String input, boolean doNested, boolean doOverlap);
    Map<Range, EntityInfo> findEntities(String input, boolean doNested, boolean doOverlap);
}


text:
set -ev
cd $(dirname $(readlink -f $0))

# Download wagon-http recommended by Oracle.
# On maven latest version this is not needed, but travis doesn't have it.
if [ ! -f $CACHE_DIR/wagon-http-2.8-shaded.jar ]; then
    curl -L -O "http://central.maven.org/maven2/org/apache/maven/wagon/wagon-http/2.8/wagon-http-2.8-shaded.jar"
    mv wagon-http-2.8-shaded.jar $CACHE_DIR/
    sudo cp $CACHE_DIR/wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/
else
    echo "Using cached wagon-http..."
    sudo cp $CACHE_DIR/wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/
fi

# Create the settings file with oracle server config.
# If file already exists, Oracle dependencies were cached on previous build.
if [ ! -f $MAVEN_CFG/.cached ]; then
    cp settings.xml $MAVEN_CFG/settings.xml
    touch $MAVEN_CFG/.cached
else
    echo "Using cached maven settings..."
fi

# The Java API is not available on a public repository yet, we need to download and install it locally.
# Always downloading the latest development version.
git clone https://github.com/utPLSQL/utPLSQL-java-api.git
cd utPLSQL-java-api
mvn package install -DskipTests


text:
@interface P2MSSelectionView(){
    UIView *_leftDot;
    UIView *_rightDot;
    UIView *_leftCaret;
    UIView *_rightCaret;
}

@end

@implementation P2MSSelectionView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        self.userInteractionEnabled = NO;
        self.layer.geometryFlipped = YES;
    }
    return self;
}

- (void)beginCaretForRect:(CGRect)begin endCaretForRect:(CGRect)end{
    if(!self.superview) return;
    self.frame = CGRectMake(begin.origin.x, begin.origin.y + begin.size.height, end.origin.x - begin.origin.x, (end.origin.y-end.size.height)-begin.origin.y);
    begin = [self.superview convertRect:begin toView:self];
    end = [self.superview convertRect:end toView:self];

    if (_leftCaret == nil) {
        _leftCaret = [[UIView alloc] initWithFrame:begin];
        _leftCaret.backgroundColor = [P2MSGlobalFunctions caretColor];
        [self addSubview:_leftCaret];

        UIImage *image = [UIImage imageNamed:@"selection-dot.png"];
        _leftDot = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, image.size.width, image.size.height)];
        [(UIImageView *)_leftDot setImage:image];
        [self addSubview:_leftDot];

        _rightCaret = [[UIView alloc] initWithFrame:end];
        _rightCaret.backgroundColor = [P2MSGlobalFunctions caretColor];
        [self addSubview:_rightCaret];

        _rightDot = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, image.size.width, image.size.height)];
        [(UIImageView *)_rightDot setImage:[UIImage imageNamed:@"selection-dot.png"]];
        [self addSubview:_rightDot];
    }

    _leftCaret.frame = begin;
    _leftDot.frame = CGRectMake(floorf(_leftCaret.center.x - (_leftDot.bounds.size.width/2)), _leftCaret.frame.origin.y-(_leftDot.bounds.size.height-5.0f), _leftDot.bounds.size.width, _leftDot.bounds.size.height);

    _rightCaret.frame = end;
    _rightDot.frame = CGRectMake(floorf(_rightCaret.center.x - (_rightDot.bounds.size.width/2)), CGRectGetMaxY(_rightCaret.frame), _rightDot.bounds.size.width, _rightDot.bounds.size.height);
}
@end


text:
/***************************************************************************/
/*                                                                         */
/*  ahglyph.h                                                              */
/*                                                                         */
/*    Routines used to load and analyze a given glyph before hinting       */
/*    (specification).                                                     */
/*                                                                         */
/*  Copyright 2000-2001, 2002 Catharon Productions Inc.                    */
/*  Author: David Turner                                                   */
/*                                                                         */
/*  This file is part of the Catharon Typography Project and shall only    */
/*  be used, modified, and distributed under the terms of the Catharon     */
/*  Open Source License that should come with this file under the name     */
/*  `CatharonLicense.txt'.  By continuing to use, modify, or distribute    */
/*  this file you indicate that you have read the license and              */
/*  understand and accept it fully.                                        */
/*                                                                         */
/*  Note that this license is compatible with the FreeType license.        */
/*                                                                         */
/***************************************************************************/

#ifndef __AHGLYPH_H__
#define __AHGLYPH_H__

#include <ft2build.h>
#include "ahtypes.h"

FT_BEGIN_HEADER

  typedef enum  AH_UV_
  {
    AH_UV_FXY,
    AH_UV_FYX,
    AH_UV_OXY,
    AH_UV_OYX,
    AH_UV_OX,
    AH_UV_OY,
    AH_UV_YX,
    AH_UV_XY  /* should always be last! */

  } AH_UV;

  FT_LOCAL( void )
  ah_setup_uv( AH_Outline  outline,
               AH_UV       source );

  /* AH_OutlineRec functions - they should be typically called in this order */

  FT_LOCAL( FT_Error )
  ah_outline_new( FT_Memory    memory,
                  AH_Outline*  aoutline );

  FT_LOCAL( FT_Error )
  ah_outline_load( AH_Outline  outline,
                   FT_Fixed    x_scale,
                   FT_Fixed    y_scale,
                   FT_Face     face );

  FT_LOCAL( void )
  ah_outline_compute_segments( AH_Outline  outline );

  FT_LOCAL( void )
  ah_outline_link_segments( AH_Outline  outline );

  FT_LOCAL( void )
  ah_outline_detect_features( AH_Outline  outline );

  FT_LOCAL( void )
  ah_outline_compute_blue_edges( AH_Outline       outline,
                                 AH_Face_Globals  globals );

  FT_LOCAL( void )
  ah_outline_scale_blue_edges( AH_Outline       outline,
                               AH_Face_Globals  globals );

  FT_LOCAL( void )
  ah_outline_save( AH_Outline  outline,
                   AH_Loader   loader );

  FT_LOCAL( void )
  ah_outline_done( AH_Outline  outline );

FT_END_HEADER

#endif /* __AHGLYPH_H__ */

/* END */


text:
//
// FastTemplate
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Jeff Panici

// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

using NUnit.Framework;
using PaniciSoftware.FastTemplate.Common;

namespace PaniciSoftware.FastTemplate.Test
{
    [TestFixture]
    public class LogicalOperatorTests
    {
        [Test]
        public void AndOperatorYieldsProperBooleanResult()
        {
            var dict = new TemplateDictionary();
            const string template1 = "#if ($foo == null && $bar != null) true #else false #end";

            var result1 = Template.ImmediateApply(dict, template1);
            Assert.False(result1.Errors.ContainsError());
            Assert.AreEqual(" false ", result1.Output);

            var result2 = Template.CompileAndRun("test", template1, dict);
            Assert.False(result2.Errors.ContainsError());
            Assert.AreEqual(" false ", result2.Output);

            dict["foo"] = "not null";
            dict["bar"] = null;
            const string template2 = "#if ($foo == null && $bar != null) true #else false #end";
            var result3 = Template.ImmediateApply(dict, template2);
            Assert.False(result3.Errors.ContainsError());
            Assert.AreEqual(" false ", result3.Output);

            var result4 = Template.CompileAndRun("test", template2, dict);
            Assert.False(result4.Errors.ContainsError());
            Assert.AreEqual(" false ", result4.Output);

            dict["foo"] = null;
            dict["bar"] = "not null";
            const string template3 = "#if ($foo == null && $bar != null) true #else false #end";
            var result5 = Template.ImmediateApply(dict, template3);
            Assert.False(result5.Errors.ContainsError());
            Assert.AreEqual(" true ", result5.Output);

            var result6 = Template.CompileAndRun("test", template3, dict);
            Assert.False(result6.Errors.ContainsError());
            Assert.AreEqual(" true ", result6.Output);

            dict["foo"] = false;
            dict["bar"] = true;
            const string template4 = "#if (!$foo && $bar) true #else false #end";
            var result7 = Template.ImmediateApply(dict, template4);
            Assert.False(result7.Errors.ContainsError());
            Assert.AreEqual(" true ", result7.Output);

            var result8 = Template.CompileAndRun("test", template4, dict);
            Assert.False(result8.Errors.ContainsError());
            Assert.AreEqual(" true ", result8.Output);
        }

        [Test]
        public void LogicalAndWithLogicalOrYieldsProperBooleanResult()
        {
            var dict = new TemplateDictionary();
            const string template1 = "#if (($foo == null || $bar == null) || ($baz != 'bing!')) true #else false #end";

            var result1 = Template.ImmediateApply(dict, template1);
            Assert.False(result1.Errors.ContainsError());
            Assert.AreEqual(" true ", result1.Output);

            var result2 = Template.CompileAndRun("test", template1, dict);
            Assert.False(result2.Errors.ContainsError());
            Assert.AreEqual(" true ", result2.Output);
        }

        [Test]
        public void OrOperatorYieldsProperBooleanResult()
        {
            var dict = new TemplateDictionary();
            const string template1 = "#if ($foo == null || $bar != null) true #else false #end";

            var result1 = Template.ImmediateApply(dict, template1);
            Assert.False(result1.Errors.ContainsError());
            Assert.AreEqual(" true ", result1.Output);

            var result2 = Template.CompileAndRun("test", template1, dict);
            Assert.False(result2.Errors.ContainsError());
            Assert.AreEqual(" true ", result2.Output);

            dict["foo"] = "not null";
            dict["bar"] = null;
            const string template2 = "#if ($foo == null || $bar != null) true #else false #end";
            var result3 = Template.ImmediateApply(dict, template2);
            Assert.False(result3.Errors.ContainsError());
            Assert.AreEqual(" false ", result3.Output);

            var result4 = Template.CompileAndRun("test", template2, dict);
            Assert.False(result4.Errors.ContainsError());
            Assert.AreEqual(" false ", result4.Output);

            dict["foo"] = null;
            dict["bar"] = "not null";
            const string template3 = "#if ($foo == null || $bar != null) true #else false #end";
            var result5 = Template.ImmediateApply(dict, template3);
            Assert.False(result5.Errors.ContainsError());
            Assert.AreEqual(" true ", result5.Output);

            var result6 = Template.CompileAndRun("test", template3, dict);
            Assert.False(result6.Errors.ContainsError());
            Assert.AreEqual(" true ", result6.Output);
        }
    }
}


text:
package com.github.easyjsonapi.exceptions;

/**
 * Exception when it was defined invalid classes to cast meta annotations
 *
 * @author Nuno Bento (nbento.neves@gmail.com)
 */
public class EasyJsonApiCastException extends EasyJsonApiEntityException {

    /**
     * UID Generated
     */
    private static final long serialVersionUID = -1976439574590963666L;

    public EasyJsonApiCastException(String message) {
        super(message);
    }

    public EasyJsonApiCastException(String message, Throwable cause) {
        super(message, cause);
    }

}


text:
var gulp = require('gulp');
var zip = require('gulp-zip');
var del = require('del');
var install = require('gulp-install');
var runSequence = require('run-sequence');
var awsLambda = require("node-aws-lambda");

gulp.task('clean', function() {
    return del(['./dist', './dist.zip']);
});

gulp.task('js', function() {
    return gulp.src('index.js')
        .pipe(gulp.dest('dist/'));
});

gulp.task('node-mods', function() {
    return gulp.src('./package.json')
        .pipe(gulp.dest('dist/'))
        .pipe(install({production: true}));
});

gulp.task('zip', function() {
    return gulp.src(['dist/**/*', '!dist/package.json'])
        .pipe(zip('dist.zip'))
        .pipe(gulp.dest('./'));
});

gulp.task('upload', function(callback) {
    awsLambda.deploy('./dist.zip', require("./lambda-config.js"), callback);
});

gulp.task('deploy', function(callback) {
    return runSequence(
        ['clean'],
        ['js', 'node-mods'],
        ['zip'],
        ['upload'],
        callback
    );
});


text:
using std::cout;
using std::endl;
using std::swap;
using std::vector;
using std::copy;
using std::ostream_iterator;
using std::iter_swap;

template <class Iterator>
inline void BubbleSort(Iterator begin, Iterator end) {
    for (Iterator i = begin; i+1 != end; ++i)
        if (*i > *(i+1))
            iter_swap(i, i+1);
}

vector<int> bubbleSortOnce(vector<int> input) {
  vector<int> result = input;
  BubbleSort(result.begin(), result.end());
  return result;
}

int main() {
  vector<int> expected = { 7, 5, 3, 1, 2, 4, 6, 8, 9 };
  // printing a vector
  copy(expected.begin(), expected.end(), ostream_iterator<int>(cout, " "));
  cout << endl;
  vector<int> actual = bubbleSortOnce({ 9, 7, 5, 3, 1, 2, 4, 6, 8 });
  // printing a vector
  copy(actual.begin(), actual.end(), ostream_iterator<int>(cout, " "));

  return 0;
}


text:
<!DOCTYPE html>

    <link href="css/awsdocs.css" rel="stylesheet" type="text/css">

    <meta charset="utf-8">

AWS IoT Analytics Pipeline Math

The Math property type specifies
                        an arithmetic expression which is computed using the message's attributes and whose
                        result is added to
                        the message for an AWS IoT Analytics pipeline.

                        Math is a property of the Activity property type.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{
  "Attribute" : String,
  "Math" : String,
  "Name" : String,
  "Next" : String
}

YAML

Attribute: String
Math: String
Name: String
Next: String

Properties

Attribute

The name of the attribute that will contain the result of the math operation.

                                 Required: No

                                 Type: String

                                 Update requires: No interruption

Math

An expression that uses one or more existing attributes and must return an integer
                                 value.

                                 Required: No

                                 Type: String

                                 Update requires: No interruption

Name

The name of the 'math' activity.

                                 Required: No

                                 Type: String

                                 Update requires: No interruption

Next

The next activity in the pipeline.

                                 Required: No

                                 Type: String

                                 Update requires: No interruption

See Also

                                    CreatePipeline in the AWS IoT Analytics User Guide


text:
Then /^I (should|should not) see the batch action "([^"]*)"$/ do |maybe, title|
  %{Then I #{maybe} see the batch action :#{title.gsub(' ','').gsub(" Selected", "").underscore} "#{title}"}
end

Then /^I (should|should not) be asked to confirm "([^"]*)" for "([^"]*)"$/ do |maybe, confirmation, title|
  within "#batch_actions_popover" do
    unless maybe == "should not"
      link = page.find "a.batch_action", :text => title
      link["data-confirm"].should match( confirmation )
    else
      page.should_not have_css("a.batch_action", :text => title)
    end
  end
end

Then /^I (should|should not) see the batch action :([^\s]*) "([^"]*)"$/ do |maybe, sym, title|
  within "#batch_actions_selector" do
    unless maybe == "should not"
      link = page.find "a.batch_action", :text => title
      link["data-action"].should match( sym )
      link[:href].should match( "#" )
    else
      page.should_not have_css("a.batch_action", :text => title)
    end
  end
end

Then /^the (\d+)(?:st|nd|rd|th) batch action should be "([^"]*)"$/ do |index, title|
  within "#batch_actions_selector" do
    page.all( "a.batch_action" )[index.to_i - 1].text.should match( title )
  end
end

When /^I check the (\d+)(?:st|nd|rd|th) record$/ do |index|
  page.all( "table.index_table input[type=checkbox]" )[index.to_i].set( true )
end

When /^I uncheck the (\d+)(?:st|nd|rd|th) record$/ do |index|
  page.all( "table.index_table input[type='checkbox']" )[index.to_i].set( false )
end

When /^I toggle the collection selection$/ do
  toggle_box = page.find( "#collection_selection_toggle_all" )
  toggle_box.click
end

Then /^I should see (\d+) record(?:s)? selected$/ do |count|
  within "table.index_table" do
    unless count.to_i == 0
      page.should have_xpath(".//input[@type='checkbox' and @checked='checked']", :count => count)
    else
      page.should have_no_xpath(".//input[@type='checkbox' and @checked='checked']")
    end
  end
end

Then /^I should see that the batch action button is disabled$/ do
  page.should have_css("#batch_actions_selector .dropdown_menu_button.disabled")
end

Then /^I (should|should not) see the batch action button$/ do |maybe|
  if maybe == "should not"
    page.should_not have_css("div.table_tools #batch_actions_selector .dropdown_menu_button")
  else
    page.should have_css("div.table_tools #batch_actions_selector .dropdown_menu_button")
  end
end

Then "I should not see the batch actions selector" do
  page.should_not have_css("div.table_tools #batch_actions_selector")
end

Then /^I should see the batch action popover exists$/ do
  page.should have_css("#batch_actions_selector")
end

Given /^I submit the batch action form with "([^"]*)"$/ do |action|
  page.find(:css, "#batch_action").set(action)

  within("#main_content") do
    @params = page.all("input").reduce({}) do |acc, input|
      param_key = input['name']
      param_value = input['value']

      if param_key == 'collection_selection[]'
        # the collection_selection should be sent as an array containing only IDs of checked rows
        acc[param_key] ||= Array.new
        acc[param_key] << param_value if input.checked?
      else
        # other inputs, just send the value normally
        acc.store(param_key, param_value)
      end
      acc
    end
  end

  form = page.find("#collection_selection")

  page.driver.submit(form['method'].to_sym, form['action'], @params)
end

Then /^I should not see checkboxes in the table$/ do
  page.should_not have_css( ".paginated_collection table input[type=checkbox]" )
end


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
                                   style="@style/GeneralToolbar"
                                   android:id="@+id/general_toolbar"
                                   android:layout_width="match_parent"
                                   android:layout_height="wrap_content"
                                   android:background="?attr/colorPrimary"
                                   android:layout_marginBottom="@dimen/gap_small"
                                   android:minHeight="?attr/actionBarSize"/>


text:
/*
 * This file is generated by jOOQ.
 */
package com.epam.ta.reportportal.jooq.tables.records;

import com.epam.ta.reportportal.jooq.tables.JIssueTypeProject;

import javax.annotation.processing.Generated;

import org.jooq.Field;
import org.jooq.Record2;
import org.jooq.Row2;
import org.jooq.impl.UpdatableRecordImpl;

/**
 * This class is generated by jOOQ.
 */
@Generated(
    value = {
        "http://www.jooq.org",
        "jOOQ version:3.12.4"
    },
    comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class JIssueTypeProjectRecord extends UpdatableRecordImpl<JIssueTypeProjectRecord> implements Record2<Long, Long> {

    private static final long serialVersionUID = -272281122;

    /**
     * Setter for public.issue_type_project.project_id.
     */
    public void setProjectId(Long value) {
        set(0, value);
    }

    /**
     * Getter for public.issue_type_project.project_id.
     */
    public Long getProjectId() {
        return (Long) get(0);
    }

    /**
     * Setter for public.issue_type_project.issue_type_id.
     */
    public void setIssueTypeId(Long value) {
        set(1, value);
    }

    /**
     * Getter for public.issue_type_project.issue_type_id.
     */
    public Long getIssueTypeId() {
        return (Long) get(1);
    }

    // -------------------------------------------------------------------------
    // Primary key information
    // -------------------------------------------------------------------------

    @Override
    public Record2<Long, Long> key() {
        return (Record2) super.key();
    }

    // -------------------------------------------------------------------------
    // Record2 type implementation
    // -------------------------------------------------------------------------

    @Override
    public Row2<Long, Long> fieldsRow() {
        return (Row2) super.fieldsRow();
    }

    @Override
    public Row2<Long, Long> valuesRow() {
        return (Row2) super.valuesRow();
    }

    @Override
    public Field<Long> field1() {
        return JIssueTypeProject.ISSUE_TYPE_PROJECT.PROJECT_ID;
    }

    @Override
    public Field<Long> field2() {
        return JIssueTypeProject.ISSUE_TYPE_PROJECT.ISSUE_TYPE_ID;
    }

    @Override
    public Long component1() {
        return getProjectId();
    }

    @Override
    public Long component2() {
        return getIssueTypeId();
    }

    @Override
    public Long value1() {
        return getProjectId();
    }

    @Override
    public Long value2() {
        return getIssueTypeId();
    }

    @Override
    public JIssueTypeProjectRecord value1(Long value) {
        setProjectId(value);
        return this;
    }

    @Override
    public JIssueTypeProjectRecord value2(Long value) {
        setIssueTypeId(value);
        return this;
    }

    @Override
    public JIssueTypeProjectRecord values(Long value1, Long value2) {
        value1(value1);
        value2(value2);
        return this;
    }

    // -------------------------------------------------------------------------
    // Constructors
    // -------------------------------------------------------------------------

    /**
     * Create a detached JIssueTypeProjectRecord
     */
    public JIssueTypeProjectRecord() {
        super(JIssueTypeProject.ISSUE_TYPE_PROJECT);
    }

    /**
     * Create a detached, initialised JIssueTypeProjectRecord
     */
    public JIssueTypeProjectRecord(Long projectId, Long issueTypeId) {
        super(JIssueTypeProject.ISSUE_TYPE_PROJECT);

        set(0, projectId);
        set(1, issueTypeId);
    }
}


text:
package com.android.settings.deviceinfo;

import android.os.Bundle;
import android.os.storage.StorageEventListener;
import android.os.storage.VolumeInfo;
import android.util.Log;

import com.android.settings.R;

import java.util.Objects;

public class StorageWizardReady extends StorageWizardBase {
    private static final String TAG = "StorageWizardReady";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (mDisk == null) {
            finish();
            return;
        }
        setContentView(R.layout.storage_wizard_generic);

        setHeaderText(R.string.storage_wizard_ready_title, mDisk.getDescription());

        // TODO: handle mixed partition cases instead of just guessing based on
        // first volume type we encounter
        final VolumeInfo publicVol = findFirstVolume(VolumeInfo.TYPE_PUBLIC);
        final VolumeInfo privateVol = findFirstVolume(VolumeInfo.TYPE_PRIVATE);
        Log.d(TAG, "onCreate(), publicVol : " + publicVol + " privateVol : " + privateVol);

        if (publicVol != null) {
            setIllustrationInternal(false);
            setBodyText(R.string.storage_wizard_ready_external_body,
                    mDisk.getDescription());
        } else if (privateVol != null) {
            setIllustrationInternal(true);
            setBodyText(R.string.storage_wizard_ready_internal_body,
                    mDisk.getDescription());
        }

        getNextButton().setText(R.string.done);
        /// M:
        mStorage.registerListener(mStorageMountListener);
    }

    @Override
    public void onNavigateNext() {
        finishAffinity();
    }
    /// M: ALPS02300202, add StorageEventListenner to update UI @{
    private final StorageEventListener mStorageMountListener = new StorageEventListener() {
        @Override
        public void onVolumeStateChanged(VolumeInfo vol, int oldState, int newState) {
            Log.d(TAG, "onVolumeStateChanged, disk : " + vol.getDiskId()
                    + ", type : " + vol.getType() + ", state : " + vol.getState());
            if (Objects.equals(mDisk.getId(), vol.getDiskId())
                    && (vol.getType() == VolumeInfo.TYPE_PUBLIC)
                    && (newState == VolumeInfo.STATE_MOUNTED)) {
                setIllustrationInternal(false);
                setBodyText(R.string.storage_wizard_ready_external_body,
                        mDisk.getDescription());
            }
        }
    };

    @Override
    protected void onDestroy() {
        mStorage.unregisterListener(mStorageMountListener);
        super.onDestroy();
    }
    /// }@
}


text:
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" arrays:required="true" comp:required="true" fbc:required="false" layout:required="false" level="3" version="1" xmlns:arrays="http://www.sbml.org/sbml/level3/version1/arrays/version1" xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:layout="http://www.sbml.org/sbml/level3/version1/layout/version1">
  <comp:listOfExternalModelDefinitions xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1">
    <comp:externalModelDefinition comp:id="degradation_template" comp:md5="2e27db9006c94342c23bedc3b2bb053a" comp:source="degradation_template.xml"/>
  </comp:listOfExternalModelDefinitions>
  <model fbc:strict="false" id="cds_template" metaid="iBioSim1">
    <annotation>
      <ModelToSBOL xmlns="http://sbolstandard.org/modeltosbol/1.0#">
        <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:mts="http://sbolstandard.org/modeltosbol/1.0#">
          <rdf:Description rdf:about="#iBioSim1">
            <mts:ModuleDefinitions>
              <rdf:Bag>
                <rdf:li rdf:resource="http://www.async.ece.utah.edu/cds_template"/></rdf:Bag></mts:ModuleDefinitions></rdf:Description></rdf:RDF></ModelToSBOL>
    </annotation>
      <comp:listOfSubmodels xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1">
      <comp:submodel comp:id="cdsproduct_degradation" comp:modelRef="degradation_template" metaid="iBioSim3">
        <annotation>
          <ModelToSBOL xmlns="http://sbolstandard.org/modeltosbol/1.0#">
            <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:mts="http://sbolstandard.org/modeltosbol/1.0#">
              <rdf:Description rdf:about="#iBioSim3">
                <mts:Modules>
                  <rdf:Bag>
                    <rdf:li rdf:resource="http://www.async.ece.utah.edu/degradation_template"/></rdf:Bag></mts:Modules></rdf:Description></rdf:RDF></ModelToSBOL>
        </annotation>
            </comp:submodel>
    </comp:listOfSubmodels>
    <comp:listOfPorts xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1">
      <comp:port comp:id="compartment__Cell" comp:idRef="Cell" sboTerm="SBO:0000601"/>
      <comp:port comp:id="output__protein" comp:idRef="protein" sboTerm="SBO:0000601"/>
    </comp:listOfPorts>
    <layout:listOfLayouts xmlns:layout="http://www.sbml.org/sbml/level3/version1/layout/version1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <layout:layout layout:id="iBioSim">
        <layout:dimensions layout:depth="0" layout:height="40" layout:width="80"/>
        <layout:listOfAdditionalGraphicalObjects>
          <layout:generalGlyph layout:id="Glyph__cdsproduct_degradation" layout:reference="cdsproduct_degradation">
            <layout:boundingBox>
              <layout:position layout:x="0" layout:y="0"/>
              <layout:dimensions layout:height="40" layout:width="80"/>
            </layout:boundingBox>
          </layout:generalGlyph>
        </layout:listOfAdditionalGraphicalObjects>
        <layout:listOfTextGlyphs>
          <layout:textGlyph layout:graphicalObject="Glyph__cdsproduct_degradation" layout:id="TextGlyph__cdsproduct_degradation" layout:text="cdsproduct_degradation">
            <layout:boundingBox>
              <layout:position layout:x="0" layout:y="0"/>
              <layout:dimensions layout:height="40" layout:width="80"/>
            </layout:boundingBox>
          </layout:textGlyph>
        </layout:listOfTextGlyphs>
      </layout:layout>
    </layout:listOfLayouts>
    <listOfCompartments>
      <compartment constant="true" id="Cell" size="1" spatialDimensions="3">
        <comp:listOfReplacedElements xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1">
          <comp:replacedElement comp:portRef="compartment__Cell" comp:submodelRef="cdsproduct_degradation"/>
        </comp:listOfReplacedElements>
      </compartment>
    </listOfCompartments>
    <listOfSpecies>
      <species boundaryCondition="false" compartment="Cell" constant="false" hasOnlySubstanceUnits="true" id="protein" initialAmount="0" metaid="iBioSim2" sboTerm="SBO:0000252">
        <annotation>
          <ModelToSBOL xmlns="http://sbolstandard.org/modeltosbol/1.0#">
            <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:mts="http://sbolstandard.org/modeltosbol/1.0#">
              <rdf:Description rdf:about="#iBioSim2">
                <mts:ComponentDefinitions>
                  <rdf:Bag>
                    <rdf:li rdf:resource="http://www.async.ece.utah.edu/cds_template__protein"/></rdf:Bag></mts:ComponentDefinitions><mts:FunctionalComponents>
                  <rdf:Bag>
                    <rdf:li rdf:resource="http://www.async.ece.utah.edu/cds_template__protein"/></rdf:Bag></mts:FunctionalComponents></rdf:Description></rdf:RDF></ModelToSBOL>
        </annotation>
              <comp:listOfReplacedElements xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1">
          <comp:replacedElement comp:portRef="output__species" comp:submodelRef="cdsproduct_degradation" metaid="iBioSim4">
            <annotation>
              <ModelToSBOL xmlns="http://sbolstandard.org/modeltosbol/1.0#">
                <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:mts="http://sbolstandard.org/modeltosbol/1.0#">
                  <rdf:Description rdf:about="#iBioSim4">
                    <mts:MapsTos>
                      <rdf:Bag>
                        <rdf:li rdf:resource="http://www.async.ece.utah.edu/cds_template/cdsproduct_degradation/protein"/></rdf:Bag></mts:MapsTos></rdf:Description></rdf:RDF></ModelToSBOL>
            </annotation>
                    </comp:replacedElement>
        </comp:listOfReplacedElements>
      </species>
    </listOfSpecies>
    <listOfReactions>
      <reaction fast="false" id="translation" reversible="false" sboTerm="SBO:0000176">
        <listOfProducts>
          <speciesReference constant="true" sboTerm="SBO:0000011" species="protein" stoichiometry="1"/>
        </listOfProducts>
        <kineticLaw>
          <math xmlns="http://www.w3.org/1998/Math/MathML">
            <ci> k </ci>
          </math>
                  <listOfLocalParameters>
            <localParameter id="k" value="0.1"/>
          </listOfLocalParameters>
        </kineticLaw>
      </reaction>
    </listOfReactions>
  </model>
</sbml>


text:
using System;
using UnityEngine;
using System.Collections;
using System.IO;
using System.IO.Compression;
using UnityEditor;
using Object = UnityEngine.Object;

namespace BansheeGz.BGSpline.Editor
{
	public class BGEditorIcon
	{
		public const string ResourcesGuid = "24c6ad7c8291acc41914cdd6572f2f54";

		private static byte[] data;
		private static bool loadTried;

		private readonly int width;
		private readonly int height;
		private Texture2D texture;

		private readonly int offset;
		private readonly int length;

		public int Offset
		{
			get { return offset; }
		}

		public int Length
		{
			get { return length; }
		}

		public Texture2D Texture
		{
			get
			{
				if (texture != null) return texture;

				var data = Data;
				if (data == null) throw new Exception("Can not access data stream to load resource: stream is null");
				if (data.Length < Offset + Length) throw new Exception("Can not read resource from stream: not enough data: " + data.Length + "<" + (Offset + Length));

				texture = new Texture2D(width, height, TextureFormat.RGBA32, false);
/*
                //this wont compile without unsafe switch for compiler
                unsafe
                {
                    fixed (byte* p = data)
                    {
                        var ptr = new IntPtr(((IntPtr) p).ToInt64() + sizeof(byte) * Offset);
                        texture.LoadRawTextureData(ptr, Length);
                    }
                }
*/

				//this is probably much slower than using  unsafe code above
				var textureData = new byte[Length];
				Buffer.BlockCopy(data, Offset, textureData, 0, Length);
				texture.LoadRawTextureData(textureData);

				texture.Apply();

				Object.DontDestroyOnLoad(texture);
				texture.hideFlags = HideFlags.DontUnloadUnusedAsset;

				return texture;
			}
		}

		private byte[] Data
		{
			get
			{
				if (data != null || loadTried) return data;

				loadTried = true;
				var path = AssetDatabase.GUIDToAssetPath(ResourcesGuid);
				if (path == null) throw new Exception("Can not resolve icons resource asset with GUID: " + ResourcesGuid);
				data = Unzip(File.ReadAllBytes(path));

				return data;
			}
		}

		public BGEditorIcon(int offset, int length, int width, int height)
		{
			this.offset = offset;
			this.length = length;
			this.width = width;
			this.height = height;
		}

		public static implicit operator Texture2D(BGEditorIcon icon)
		{
			return icon.Texture;
		}

		private static byte[] Unzip(byte[] input)
		{
			using (var deflateStream = new DeflateStream(new MemoryStream(input), CompressionMode.Decompress))
			{
				using (var outputStream = new MemoryStream())
				{
					CopyTo(deflateStream, outputStream);
					return outputStream.ToArray();
				}
			}
		}

		private  static void CopyTo(Stream input, Stream output)
		{
			var buffer = new byte[64 * 1024];
			int bytesRead;
			while ((bytesRead = input.Read(buffer, 0, buffer.Length)) > 0) output.Write(buffer, 0, bytesRead);
		}
	}
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using QuantConnect.Parameters;

namespace QuantConnect.Tests.Common.Parameters
{
    [TestFixture]
    public class ParameterAttributeTests
    {
        [Test]
        public void SetsParameterValues()
        {
            var instance = new Instance();
            var parameters = new Dictionary<string, string>
            {
                {"PublicField", "1"},
                {"PublicProperty", "1"},
                {"ProtectedField", "1"},
                {"ProtectedProperty", "1"},
                {"InternalField", "1"},
                {"InternalProperty", "1"},
                {"PrivateField", "1"},
                {"PrivateProperty", "1"},
            };

            ParameterAttribute.ApplyAttributes(parameters, instance);
        }

        class Instance
        {
            [Parameter]
            public int PublicField;
            [Parameter]
            public int PublicProperty { get; set; }
            [Parameter]
            protected int ProtectedField;
            [Parameter]
            protected int ProtectedProperty { get; set; }
            [Parameter]
            internal int InternalField;
            [Parameter]
            internal int InternalProperty { get; set; }
            [Parameter]
            private int PrivateField;
            [Parameter]
            private int PrivateProperty { get; set; }

            public void AssertValues(int expected)
            {

                Assert.AreEqual(expected, PublicField);
                Assert.AreEqual(expected, PublicProperty);
                Assert.AreEqual(expected, ProtectedField);
                Assert.AreEqual(expected, ProtectedProperty);
                Assert.AreEqual(expected, InternalField);
                Assert.AreEqual(expected, InternalProperty);
                Assert.AreEqual(expected, PrivateField);
                Assert.AreEqual(expected, PrivateProperty);
            }
        }
    }
}