text:
namespace Gaffer
{

/// A Plug type which can store values derived from IECore::Object.
template<typename T>
class TypedObjectPlug : public ValuePlug
{

	public :

		typedef T ValueType;
		typedef typename ValueType::Ptr ValuePtr;
		typedef typename ValueType::ConstPtr ConstValuePtr;

		IECORE_RUNTIMETYPED_DECLARETEMPLATE( TypedObjectPlug<T>, ValuePlug );

		/// A copy of defaultValue is taken - it must not be null.
		TypedObjectPlug(
			const std::string &name,
			Direction direction,
			ConstValuePtr defaultValue,
			unsigned flags = Default
		);
		virtual ~TypedObjectPlug();

		/// Accepts only instances of TypedObjectPlug<T>, or derived classes.
		virtual bool acceptsInput( const Plug *input ) const;
		virtual PlugPtr createCounterpart( const std::string &name, Direction direction ) const;

		const ValueType *defaultValue() const;

		/// Sets the value, which must be non-null. The value is referenced directly
		/// and may be shared internally with other Plugs and the cache - under no
		/// circumstances should you /ever/ modify value after calling setValue( value ).
		/// Note that the python bindings perform an automatic copy before calling
		/// setValue() (unless instructed otherwise), to make it harder
		/// for less experienced coders to get this wrong.
		void setValue( ConstValuePtr value );
		/// Returns the value. Note that the returned value is not a copy
		/// and may be shared with other Plugs and the cache - it is therefore
		/// imperative that it not be modified in any way. The python bindings
		/// automatically return a copy from getValue() (unless instructed otherwise)
		/// to make it harder for less experienced coders to get this wrong.
		///
		/// If available, an optional precomputed hash may be passed to avoid the cost
		/// of computing it again. This hash must have been computed in the current context
		/// with the node graph in the current state. Passing an incorrect hash has dire
		/// consequences - use with care.
		///
		/// Precomputed hashes are intended to support the following use pattern :
		///
		/// MurmurHash currentHash = plug->hash();
		/// if( currentHash != storedHash )
		/// {
		/// 	ConstObjectPtr currentObject = plug->getValue( &currentHash );
		/// 	storedObject = convertObjectInSomeWay( currentObject );
		/// 	storedHash = currentHash;
		/// }
		///
		/// This pattern is particularly effective because it not only
		/// avoids unnecessary conversions, but it also avoids churn in
		/// the ValuePlug cache.
		ConstValuePtr getValue( const IECore::MurmurHash *precomputedHash = NULL ) const;

		virtual void setFrom( const ValuePlug *other );

	private :

		IE_CORE_DECLARERUNTIMETYPEDDESCRIPTION( TypedObjectPlug<T> );

};

typedef TypedObjectPlug<IECore::Object> ObjectPlug;
typedef TypedObjectPlug<IECore::BoolVectorData> BoolVectorDataPlug;
typedef TypedObjectPlug<IECore::IntVectorData> IntVectorDataPlug;
typedef TypedObjectPlug<IECore::FloatVectorData> FloatVectorDataPlug;
typedef TypedObjectPlug<IECore::StringVectorData> StringVectorDataPlug;
typedef TypedObjectPlug<IECore::InternedStringVectorData> InternedStringVectorDataPlug;
typedef TypedObjectPlug<IECore::V3fVectorData> V3fVectorDataPlug;
typedef TypedObjectPlug<IECore::Color3fVectorData> Color3fVectorDataPlug;
typedef TypedObjectPlug<IECore::ObjectVector> ObjectVectorPlug;
typedef TypedObjectPlug<IECore::CompoundObject> CompoundObjectPlug;

IE_CORE_DECLAREPTR( ObjectPlug );
IE_CORE_DECLAREPTR( BoolVectorDataPlug );
IE_CORE_DECLAREPTR( IntVectorDataPlug );
IE_CORE_DECLAREPTR( FloatVectorDataPlug );
IE_CORE_DECLAREPTR( StringVectorDataPlug );
IE_CORE_DECLAREPTR( InternedStringVectorDataPlug );
IE_CORE_DECLAREPTR( V3fVectorDataPlug );
IE_CORE_DECLAREPTR( Color3fVectorDataPlug );
IE_CORE_DECLAREPTR( ObjectVectorPlug );
IE_CORE_DECLAREPTR( CompoundObjectPlug );

typedef FilteredChildIterator<PlugPredicate<Plug::Invalid, ObjectPlug> > ObjectPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::In, ObjectPlug> > InputObjectPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::Out, ObjectPlug> > OutputObjectPlugIterator;

typedef FilteredChildIterator<PlugPredicate<Plug::Invalid, BoolVectorDataPlug> > BoolVectorDataPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::In, BoolVectorDataPlug> > InputBoolVectorDataPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::Out, BoolVectorDataPlug> > OutputBoolVectorDataPlugIterator;

typedef FilteredChildIterator<PlugPredicate<Plug::Invalid, IntVectorDataPlug> > IntVectorDataPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::In, IntVectorDataPlug> > InputIntVectorDataPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::Out, IntVectorDataPlug> > OutputIntVectorDataPlugIterator;

typedef FilteredChildIterator<PlugPredicate<Plug::Invalid, FloatVectorDataPlug> > FloatVectorDataPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::In, FloatVectorDataPlug> > InputFloatVectorDataPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::Out, FloatVectorDataPlug> > OutputFloatVectorDataPlugIterator;

typedef FilteredChildIterator<PlugPredicate<Plug::Invalid, StringVectorDataPlug> > StringVectorDataPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::In, StringVectorDataPlug> > InputStringVectorDataPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::Out, StringVectorDataPlug> > OutputStringVectorDataPlugIterator;

typedef FilteredChildIterator<PlugPredicate<Plug::Invalid, InternedStringVectorDataPlug> > InternedStringVectorDataPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::In, InternedStringVectorDataPlug> > InputInternedStringVectorDataPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::Out, InternedStringVectorDataPlug> > OutputInternedStringVectorDataPlugIterator;

typedef FilteredChildIterator<PlugPredicate<Plug::Invalid, V3fVectorDataPlug> > V3fVectorDataPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::In, V3fVectorDataPlug> > InputV3fVectorDataPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::Out, V3fVectorDataPlug> > OutputV3fVectorDataPlugIterator;

typedef FilteredChildIterator<PlugPredicate<Plug::Invalid, Color3fVectorDataPlug> > Color3fVectorDataPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::In, Color3fVectorDataPlug> > InputColor3fVectorDataPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::Out, Color3fVectorDataPlug> > OutputColor3fVectorDataPlugIterator;

typedef FilteredChildIterator<PlugPredicate<Plug::Invalid, ObjectVectorPlug> > ObjectVectorPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::In, ObjectVectorPlug> > InputObjectVectorPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::Out, ObjectVectorPlug> > OutputObjectVectorPlugIterator;

typedef FilteredChildIterator<PlugPredicate<Plug::Invalid, CompoundObjectPlug> > CompoundObjectPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::In, CompoundObjectPlug> > InputCompoundObjectPlugIterator;
typedef FilteredChildIterator<PlugPredicate<Plug::Out, CompoundObjectPlug> > OutputCompoundObjectPlugIterator;

typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Invalid, ObjectPlug>, PlugPredicate<> > RecursiveObjectPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::In, ObjectPlug>, PlugPredicate<> > RecursiveInputObjectPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Out, ObjectPlug>, PlugPredicate<> > RecursiveOutputObjectPlugIterator;

typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Invalid, BoolVectorDataPlug>, PlugPredicate<> > RecursiveBoolVectorDataPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::In, BoolVectorDataPlug>, PlugPredicate<> > RecursiveInputBoolVectorDataPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Out, BoolVectorDataPlug>, PlugPredicate<> > RecursiveOutputBoolVectorDataPlugIterator;

typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Invalid, IntVectorDataPlug>, PlugPredicate<> > RecursiveIntVectorDataPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::In, IntVectorDataPlug>, PlugPredicate<> > RecursiveInputIntVectorDataPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Out, IntVectorDataPlug>, PlugPredicate<> > RecursiveOutputIntVectorDataPlugIterator;

typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Invalid, FloatVectorDataPlug>, PlugPredicate<> > RecursiveFloatVectorDataPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::In, FloatVectorDataPlug>, PlugPredicate<> > RecursiveInputFloatVectorDataPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Out, FloatVectorDataPlug>, PlugPredicate<> > RecursiveOutputFloatVectorDataPlugIterator;

typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Invalid, StringVectorDataPlug>, PlugPredicate<> > RecursiveStringVectorDataPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::In, StringVectorDataPlug>, PlugPredicate<> > RecursiveInputStringVectorDataPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Out, StringVectorDataPlug>, PlugPredicate<> > RecursiveOutputStringVectorDataPlugIterator;

typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Invalid, InternedStringVectorDataPlug>, PlugPredicate<> > RecursiveInternedStringVectorDataPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::In, InternedStringVectorDataPlug>, PlugPredicate<> > RecursiveInputInternedStringVectorDataPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Out, InternedStringVectorDataPlug>, PlugPredicate<> > RecursiveOutputInternedStringVectorDataPlugIterator;

typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Invalid, V3fVectorDataPlug>, PlugPredicate<> > RecursiveV3fVectorDataPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::In, V3fVectorDataPlug>, PlugPredicate<> > RecursiveInputV3fVectorDataPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Out, V3fVectorDataPlug>, PlugPredicate<> > RecursiveOutputV3fVectorDataPlugIterator;

typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Invalid, Color3fVectorDataPlug>, PlugPredicate<> > RecursiveColor3fVectorDataPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::In, Color3fVectorDataPlug>, PlugPredicate<> > RecursiveInputColor3fVectorDataPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Out, Color3fVectorDataPlug>, PlugPredicate<> > RecursiveOutputColor3fVectorDataPlugIterator;

typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Invalid, ObjectVectorPlug>, PlugPredicate<> > RecursiveObjectVectorPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::In, ObjectVectorPlug>, PlugPredicate<> > RecursiveInputObjectVectorPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Out, ObjectVectorPlug>, PlugPredicate<> > RecursiveOutputObjectVectorPlugIterator;

typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Invalid, CompoundObjectPlug>, PlugPredicate<> > RecursiveCompoundObjectPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::In, CompoundObjectPlug>, PlugPredicate<> > RecursiveInputCompoundObjectPlugIterator;
typedef FilteredRecursiveChildIterator<PlugPredicate<Plug::Out, CompoundObjectPlug>, PlugPredicate<> > RecursiveOutputCompoundObjectPlugIterator;

} // namespace Gaffer

#endif // GAFFER_TYPEDOBJECTPLUG_H


text: void print_vector(std::vector<int>);

redpajama_set_name: RedPajamaGithub


text:
const cp = require('child_process')

const args = process.argv.slice(process.argv.indexOf('lint') + 1)
const eslint = require.resolve('eslint/bin/eslint')

cp.execSync(`${eslint} --cache ${args.join(' ')} src/`, { stdio: 'inherit' })


text:
#pragma once
#include <aws/datapipeline/DataPipeline_EXPORTS.h>
#include <aws/datapipeline/DataPipelineRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <utility>

namespace Aws
{
namespace DataPipeline
{
namespace Model
{

  /**
   *
Contains the parameters for RemoveTags.

See Also:
   AWS
   * API Reference

   */
  class AWS_DATAPIPELINE_API RemoveTagsRequest : public DataPipelineRequest
  {
  public:
    RemoveTagsRequest();
    Aws::String SerializePayload() const override;

    Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;

    /**
     *
The ID of the pipeline.

     */
    inline const Aws::String& GetPipelineId() const{ return m_pipelineId; }

    /**
     *
The ID of the pipeline.

     */
    inline void SetPipelineId(const Aws::String& value) { m_pipelineIdHasBeenSet = true; m_pipelineId = value; }

    /**
     *
The ID of the pipeline.

     */
    inline void SetPipelineId(Aws::String&& value) { m_pipelineIdHasBeenSet = true; m_pipelineId = std::move(value); }

    /**
     *
The ID of the pipeline.

     */
    inline void SetPipelineId(const char* value) { m_pipelineIdHasBeenSet = true; m_pipelineId.assign(value); }

    /**
     *
The ID of the pipeline.

     */
    inline RemoveTagsRequest& WithPipelineId(const Aws::String& value) { SetPipelineId(value); return *this;}

    /**
     *
The ID of the pipeline.

     */
    inline RemoveTagsRequest& WithPipelineId(Aws::String&& value) { SetPipelineId(std::move(value)); return *this;}

    /**
     *
The ID of the pipeline.

     */
    inline RemoveTagsRequest& WithPipelineId(const char* value) { SetPipelineId(value); return *this;}

    /**
     *
The keys of the tags to remove.

     */
    inline const Aws::Vector<Aws::String>& GetTagKeys() const{ return m_tagKeys; }

    /**
     *
The keys of the tags to remove.

     */
    inline void SetTagKeys(const Aws::Vector<Aws::String>& value) { m_tagKeysHasBeenSet = true; m_tagKeys = value; }

    /**
     *
The keys of the tags to remove.

     */
    inline void SetTagKeys(Aws::Vector<Aws::String>&& value) { m_tagKeysHasBeenSet = true; m_tagKeys = std::move(value); }

    /**
     *
The keys of the tags to remove.

     */
    inline RemoveTagsRequest& WithTagKeys(const Aws::Vector<Aws::String>& value) { SetTagKeys(value); return *this;}

    /**
     *
The keys of the tags to remove.

     */
    inline RemoveTagsRequest& WithTagKeys(Aws::Vector<Aws::String>&& value) { SetTagKeys(std::move(value)); return *this;}

    /**
     *
The keys of the tags to remove.

     */
    inline RemoveTagsRequest& AddTagKeys(const Aws::String& value) { m_tagKeysHasBeenSet = true; m_tagKeys.push_back(value); return *this; }

    /**
     *
The keys of the tags to remove.

     */
    inline RemoveTagsRequest& AddTagKeys(Aws::String&& value) { m_tagKeysHasBeenSet = true; m_tagKeys.push_back(std::move(value)); return *this; }

    /**
     *
The keys of the tags to remove.

     */
    inline RemoveTagsRequest& AddTagKeys(const char* value) { m_tagKeysHasBeenSet = true; m_tagKeys.push_back(value); return *this; }

  private:
    Aws::String m_pipelineId;
    bool m_pipelineIdHasBeenSet;
    Aws::Vector<Aws::String> m_tagKeys;
    bool m_tagKeysHasBeenSet;
  };

} // namespace Model
} // namespace DataPipeline
} // namespace Aws


text:
<?php
/**
 * Created by PhpStorm.
 * User: jjose00
 * Date: 11/10/17
 * Time: 9:37 AM
 */

namespace Giftcards\Encryption\Tests\Rotator;

use Giftcards\Encryption\CipherText\Rotator\Bounds;
use Giftcards\Encryption\CipherText\Rotator\NullRotatorObserver;
use Giftcards\Encryption\CipherText\Rotator\Record;
use Giftcards\Encryption\CipherText\Rotator\Rotator;
use Mockery;
use Omni\TestingBundle\TestCase\Extension\AbstractExtendableTestCase;

class RotatorTest extends AbstractExtendableTestCase
{
    public function testRotation()
    {
        $records = [
            new Record(0, ['record0_encrypted']),
            new Record(1, ['record1_encrypted']),
            new Record(2, ['record2_encrypted']),
            new Record(3, ['record3_encrypted']),
        ];
        $rotatedRecords = [
            new Record(0, ['record0_rotated']),
            new Record(1, ['record1_rotated']),
            new Record(2, ['record2_rotated']),
            new Record(3, ['record3_rotated']),
        ];

        $observer = new NullRotatorObserver();

        $encryptor = Mockery::mock("Giftcards\\Encryption\\Encryptor");
        $encryptor->shouldReceive("decrypt")->with("record0_encrypted")->andReturn("record0_decrypted");
        $encryptor->shouldReceive("decrypt")->with("record1_encrypted")->andReturn("record1_decrypted");
        $encryptor->shouldReceive("decrypt")->with("record2_encrypted")->andReturn("record2_decrypted");
        $encryptor->shouldReceive("decrypt")->with("record3_encrypted")->andReturn("record3_decrypted");

        $encryptor->shouldReceive("encrypt")->with("record0_decrypted", "test_profile")->andReturn("record0_rotated");
        $encryptor->shouldReceive("encrypt")->with("record1_decrypted", "test_profile")->andReturn("record1_rotated");
        $encryptor->shouldReceive("encrypt")->with("record2_decrypted", "test_profile")->andReturn("record2_rotated");
        $encryptor->shouldReceive("encrypt")->with("record3_decrypted", "test_profile")->andReturn("record3_rotated");

        $store = Mockery::mock("Giftcards\\Encryption\\CipherText\\Rotator\\Store\\StoreInterface");
        $store->shouldReceive("fetch")->once()->ordered()->with(0, 3)->andReturn(
            [
                $records[0],
                $records[1],
                $records[2],
            ]);
        $store->shouldReceive("save")->once()->ordered()->with(
            [
                $rotatedRecords[0],
                $rotatedRecords[1],
                $rotatedRecords[2],
            ]
        );
        $store->shouldReceive("fetch")->once()->ordered()->with(3, 3)->andReturn([$records[3]]);
        $store->shouldReceive("save")->once()->ordered()->with(
            [
                $rotatedRecords[3]
            ]
        );
        $store->shouldReceive("fetch")->once()->ordered()->with(6, 3)->andReturn([]);

        $storeRegistry = Mockery::mock("Giftcards\\Encryption\\CipherText\\Rotator\\Store\\StoreRegistry");
        $storeRegistry
            ->shouldReceive("get")
            ->with("test_store")
            ->andReturn($store);

        $rotator = new Rotator($encryptor, $storeRegistry);
        $rotator->rotate("test_store", "test_profile", new Bounds(0, 9, 3), $observer);

        $storeRegistry->shouldHaveReceived("get")->with("test_store");

        $store->shouldHaveReceived("fetch")->withArgs([0, 3]);
        $store->shouldHaveReceived("fetch")->withArgs([3, 3]);
        $store->shouldHaveReceived("fetch")->withArgs([6, 3]);

        $encryptor->shouldHaveReceived("decrypt")->with("record0_encrypted");
        $encryptor->shouldHaveReceived("decrypt")->with("record1_encrypted");
        $encryptor->shouldHaveReceived("decrypt")->with("record2_encrypted");
        $encryptor->shouldHaveReceived("decrypt")->with("record3_encrypted");

        $encryptor->shouldHaveReceived("encrypt")->with("record0_decrypted", "test_profile");
        $encryptor->shouldHaveReceived("encrypt")->with("record1_decrypted", "test_profile");
        $encryptor->shouldHaveReceived("encrypt")->with("record2_decrypted", "test_profile");
        $encryptor->shouldHaveReceived("encrypt")->with("record3_decrypted", "test_profile");

        $store->shouldHaveReceived("save")->with([
            new Record(0, ['record0_rotated']),
            new Record(1, ['record1_rotated']),
            new Record(2, ['record2_rotated']),
        ]);

        $store->shouldHaveReceived("save")->with([
            new Record(3, ['record3_rotated']),
        ]);
    }
}


text:
// cd /var/www/sm/sail; sails lift --verbose
// sudo apt-get install npm; sudo npm -g install sails
// sails new sail --template=jade // (new project name)
// npm --save install grunt sails-mysql sails-disk jade bcrypt
// package.json
// npm i
/**
 * PneumaticController
 *
 * @module		:: Controller
 * @description	:: A set of functions called `actions`.
 *
 *					Actions contain code telling Sails how to respond to a certain type of request.
 *					(i.e. do stuff, then send some JSON, show an HTML page, or redirect to another URL)
 *
 *					You can configure the blueprint URLs which trigger these actions (`config/controllers.js`)
 *					and/or override them with custom routes (`config/routes.js`)
 *					NOTE: The code you write here supports both HTTP and Socket.io automatically.
 * @docs		:: http://sailsjs.org/#!documentation/controllers
 */
'use strict';
//var fs = require('fs');
//var async = require('async');
module.exports = {
	/**
	 * @function name:	index: function (req, res)
	 * @description:	This function renders home page.
	 * @related issues:	SM-001
	 * @param:			object req
	 * @param:			object res
	 * @return:			void
	 * @author:			Don Hsieh
	 * @since:			10/26/2014
	 * @last modified: 	10/26/2014
	 * @called by:		URL '/'
	 */
	index: function (req, res) {
		console.log('PneumaticController - index: function (req, res)');
		var fs = require('fs');
		//var _ = require('lodash');
		//var arr = fs.readFileSync('../data/pneumatic.csv').toString().split('\n');
		var arr = fs.readFileSync('../data/pneumatic.txt').toString().split('\n');
		console.log('arr =', arr);
		var items = [];
		var item = [];
		for(var i in arr) {
			if (i > 0 && arr[i]) {
				item = arr[i].split(',');
				items.push(item);
			}
		}
		console.log('items =', items);

		var rows = [];
		var row = [];
		for(var i in items) {
			item = items[i];
			row.push(item);
			if (row.length >= 3) {
				rows.push(row);
				row = [];
			}
		}
		if (row !== []) rows.push(row);
		console.log('rows =', rows);
		res.view({
			rows: rows
		});
	},

	/**
	 * Overrides for the settings in `config/controllers.js`
	 * (specific to PneumaticController)
	 */
	_config: {}
};


text:
package com.tc.restful.security;

import java.lang.reflect.Method;
import java.util.Vector;

import javax.ws.rs.core.Response;

import lotus.domino.Database;
import lotus.domino.NotesException;
import lotus.domino.Session;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

import com.tc.utils.XSPUtils;

public class RestInterceptor implements MethodInterceptor {

	@Override
	public Object invoke(MethodInvocation invocation) throws Throwable {
		Method method = invocation.getMethod();
		RolesAllowed rolesAllowed = method.getAnnotation(RolesAllowed.class);
		boolean isAuth = this.isAuthorized(rolesAllowed.value());

		if(!isAuth){
			return Response.status(403).type("text/plain").entity("You are not authorized to perform this operation.").build();
		}

		return invocation.proceed();
	}

	//check to see if the current user belongs to any of the roles
	//associated with the database context
	@SuppressWarnings("unchecked")
	private boolean isAuthorized(String[] rolesAllowed) {
		boolean b = false;

		try{
			Session s= XSPUtils.session();
			Database db = XSPUtils.database();

			if(s!=null && db!=null){

				Vector<String> roles = db.queryAccessRoles(s.getEffectiveUserName());

				for(String role : rolesAllowed){
					if(roles.contains(role)){
						b = true;
						break;
					}
				}
			}
		}catch(NotesException n){
			n.printStackTrace();
		}
		return b;
	}

}


text:
using UnityEngine;
using System.Collections;

public class TriggerSound : MonoBehaviour {

	AudioSource audio;

	// Use this for initialization
	void Start () {

		audio = GetComponent<AudioSource> ();
	}

	// Update is called once per frame
	void Update () {

	}

	void OnCollisionEnter(Collision thing){

		if (thing.gameObject.tag == "Player") {

			audio.Play ();
		}
	}
}


text:
@implementation PHCachingImageManagerInstance

#pragma mark Singleton Methods

+ (PHCachingImageManager *)sharedCachingManager {
  static PHCachingImageManager *sharedMyManager = nil;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    sharedMyManager = [[PHCachingImageManager alloc] init];
    [sharedMyManager setAllowsCachingHighQualityImages:NO];
  });
  return sharedMyManager;
}
@end


text:
// <copyright file="BucketTypePropertiesTests.cs" company="Basho Technologies, Inc.">
// Copyright 2017 - Basho Technologies, Inc.
//
// This file is provided to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file
// except in compliance with the License.  You may obtain
// a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.
// </copyright>

namespace Test.Integration.KV
{
    using System;
    using NUnit.Framework;
    using RiakClient;
    using RiakClient.Commands.KV;
    using RiakClient.Models;

    public class BucketTypePropertiesTests : TestBase
    {
        protected override RiakString BucketType
        {
            get { return new RiakString("plain"); }
        }

        [OneTimeSetUp]
        public void Setup()
        {
            RiakMinVersion(2, 0, 0);
        }

        [Test]
        public void Should_Not_Store_For_Default_BucketType()
        {
            RiakBucketProperties props = new RiakBucketProperties().SetHllPrecision(16);
            Assert.Throws<ArgumentNullException>(() => new StoreBucketTypeProperties(RiakConstants.DefaultBucketType, props));
        }

        [Test]
        public void Can_Fetch_BucketType_Properties()
        {
            var fetch = new FetchBucketTypeProperties(BucketType);

            RiakResult rslt = client.Execute(fetch);
            Assert.IsTrue(rslt.IsSuccess, rslt.ErrorMessage);

            FetchBucketTypePropertiesResponse response = fetch.Response;
            Assert.IsNotNull(response);
            Assert.IsFalse(response.NotFound);
            Assert.IsNotNull(response.Value);

            RiakBucketProperties properties = response.Value;
            Assert.AreEqual(3, (int)properties.NVal);
        }

        [Test]
        public void Can_Store_And_Fetch_BucketType_Properties()
        {
            {
                var nval4Props = new RiakBucketProperties().SetNVal(new NVal(4));
                var storeNval4Props = new StoreBucketTypeProperties(BucketType, nval4Props);

                var storeNval4Result = client.Execute(storeNval4Props);
                Assert.IsTrue(storeNval4Result.IsSuccess, storeNval4Result.ErrorMessage);
                var storeBucketTypePropertiesResponse = storeNval4Props.Response;
                Assert.IsFalse(storeBucketTypePropertiesResponse.NotFound);
            }

            {
                var fetch = new FetchBucketTypeProperties(BucketType);
                var fetchResult = client.Execute(fetch);
                var fetchResponse = fetch.Response;
                Assert.IsTrue(fetchResult.IsSuccess, fetchResult.ErrorMessage);
                Assert.AreEqual(4, (int)fetchResponse.Value.NVal);
            }

            {
                var nval3Props = new RiakBucketProperties().SetNVal(new NVal(3));
                var storeNval3Props = new StoreBucketTypeProperties(BucketType, nval3Props);
                var storeNval3Result = client.Execute(storeNval3Props);
                Assert.IsTrue(storeNval3Result.IsSuccess, storeNval3Result.ErrorMessage);
            }
        }
    }
}


text:
package compiler.syntax.nonTerminal;

public class GenericVariable extends NonTerminal {

    private final String name;
    private final String type;
    private final String identifier;
    private final Integer value;

    public GenericVariable(String name, String type) {
        this.name = name;
        this.type = type;
        this.identifier = null;
        this.value = null;
    }

    public GenericVariable(String name, String type, String identifier) {
        this.name = name;
        this.type = type;
        this.identifier = identifier;
        this.value = null;
    }

    public GenericVariable(String name, String type, Integer value) {
        this.name = name;
        this.type = type;
        this.value = value;
        this.identifier = null;
    }

    public String getName() {
        return name;
    }

    public String getType() {
        return type;
    }
}


text:
<?php

namespace GrumPHP\Configuration;

use RuntimeException;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\Filesystem\Filesystem;

final class ContainerFactory
{
    /**
     * @param string $path path to grumphp.yml
     *
     * @return ContainerBuilder
     */
    public static function buildFromConfiguration($path)
    {
        $container = new ContainerBuilder();
        $container->addCompilerPass(new TaskCompilerPass());

        // Load basic service file + custom user configuration
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../../../resources/config'));
        $loader->load('services.yml');

        // Load grumphp.yml file:
        $filesystem = new Filesystem();
        if ($filesystem->exists($path)) {
            $loader->load($path);
        }

        // Compile configuration to make sure that tasks are added to the taskrunner
        $container->compile();

        return $container;
    }
}


text:
A discord LoL Trivia bot written in Python, based on
[the original #r/leagueoflegends IRC version](https://github.com/SaschaMann/TriviaBot/)

[Invite Link](https://discordapp.com/oauth2/authorize?client_id=272459645673668608&scope=bot&permissions=101440) (BETA: Please report bugs on the GitHub issue tracker!)

the code needs a cleanup pls no flamerino ty

# USAGE
- Base command: `!trivia [num=1]` - Starts a game of LoL Trivia.
    - `[num]` specifies the number of games to play. Max 15. Only staff* can play more than 5 game.
    - 10 second cooldown.

- `!trivia force [num] [force_index]` - Staff* only, force starts a game of trivia, regardless of cooldown.
    - If `[force_index]` is specified, that specific question type will be played.

- `!trivia cancel` - Staff* only, cancels all current games in the channel.

- `!trivia info <arg1> [arg2]` - Returns info on a champion, skin or item (best guess).
    - If `[arg1]` is the name of a champion, returns info on the champion (title, passive, spells).
        - Additionally, `[arg2]` can be specified as one of "Q", "W", "E", "R", "P", returning specific info about that spell.

    - If `[arg1]` is the name of a skin, returns info on price/release date as well as splash art. Can specify [arg2] as "loading" to get loading screen slice.

    - `[arg1]` can also be the name of a summoner spell, rune, mastery or an item.

- `!trivia <champ/skin/item/mastery/summ/rune> <arg> [arg2]` - `!trivia info` but forced to a specific type.

- `!trivia top` - Returns a list of the top 10 players and their scores.

- `!trivia score [user]` - Returns the score of `[user]`. Defaults to you.

- If the bot is given a role named `DisableTrivia`, it will disable the `!trivia` game. (Info commands will continue to function, however)

\*Those who have the "Manage Messages" permission.

***These next two sections are only for those who plan on running their own instance of the bot.
Most users can just invite the public bot to their server***

# REQUIREMENTS
* Python 3.6
* [discord.py](https://github.com/Rapptz/discord.py) - Discord API wrapper
* [cassiopeia **< 3.0**](https://github.com/meraki-analytics/cassiopeia) - Riot API wrapper
* [html2text](https://github.com/aaronsw/html2text) - Used to sanitize certain API results (tooltips, descriptions, etc)
* [fuzzywuzzy](https://github.com/seatgeek/fuzzywuzzy) - Fuzzy string matching for trivia questions

# RUNNING THE BOT
1. Rename config.example.json to config.json
2. Fill in the "discord_token", "owner_id", "api_region" and "api_key" sections.
Modify anything else to your content.
    - [Valid values for `allowed_modes` and `allowed_maps` can be found here](https://developer.riotgames.com/game-constants.html#mapNames)
    - Note that `allowed_maps` will also accept integer mapids.
3. You need to generate your own `quotes.json` and `skins.json` in the `data` folder.
There are example files showing the format. I will eventually make them optional.
4. Run `run.py`.

# TODO

- [ ] Move to new cassiopeia (new version missing certain things for now)

# DISCLAIMER

LoLTrivia isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc.


text:
module CeleryScript
  # Supporting class for CSHeap (below this class)
  # PROBLEM:  CSHeap uses numbers to address sibling/parent nodes.
  # PROBLEM:  Numbers are very easy to mix up. Is it an array index? A SQL
  #           primary key? A primitive value? It's not always easy to say.
  # SOLUTION: Create a `HeapAddress` value type to remove ambiguity.
  #           Prevents confusion between index IDs and SQL IDs.
  class HeapAddress
    attr_reader :value

    def initialize(value)
      raise "BAD INPUT" unless value.is_a?(Integer)
      @value = value.to_i
    end

    def self.[](value)
      return self.new(value)
    end

    def inspect
      "HeapAddress(#{value})"
    end

    def hash
      self.value
    end

    def ==(other)
      self.value == other.try(:value)
    end

    def eql?(other)
      self.value == other.value
    end

    def +(val)
      HeapAddress[@value + 1]
    end

    def is_address?
      true
    end

    def to_i
      @value
    end

    def to_s
      @value.to_s
    end
  end

  class CSHeap
    class BadAddress < Exception; end;
    BAD_ADDR = "Bad node address: "
    # Nodes that point to other nodes rather than primitive data types (eg:
    # `locals` and friends) will be prepended with a LINK.
    LINK    = "__"
    # Points to the originator (parent) of an `arg` or `body` node.
    PARENT  = (LINK + "parent").to_sym
    # Points to the first element in the `body``
    BODY    = (LINK + "body").to_sym
    # Points to the next node in the body chain. Pointing to NOTHING indicates
    # the end of the body linked list.
    NEXT    = (LINK + "next").to_sym
    # Unique key name. See `celery_script_settings_bag.rb`
    KIND    = :__KIND__
    COMMENT = :__COMMENT__

    # Keys that primary nodes must have
    PRIMARY_FIELDS = [PARENT, BODY, KIND, NEXT, COMMENT]

    # Index 0 of the heap represents a null pointer of sorts.
    # If a field points to this address, it is considered empty.
    NULL    = HeapAddress[0]

    # What you will find at index 0 of the heap:
    NOTHING = {
      KIND   => "nothing",
      PARENT => NULL,
      BODY   => NULL,
      NEXT   => NULL
    }

    # A dictionary of nodes in the CeleryScript tree, as stored in the heap.
    # Nodes will have:
    #   * A `KIND` field   - What kind of node is it?
    #                        `send_message`, `move_rel`, etc..
    #   * A `PARENT` field - The node directly above the current node.
    #   * A `BODY` field   - If a node has a body member (and it might not!),
    #                        this field will point to the first node in the
    #                        chain. NOTHING pointer indicates that the node has
    #                        no body.
    #   * A `NEXT` field   - If you are inside a node's BODY, the next node in
    #                        chain is denoted by the address of NEXT. A NEXT
    #                        value of NOTHING means you hit the end of the chain
    attr_accessor :entries

    # "here" represents the last item added to the heap and, often, the item that
    # is currently being edited.
    attr_accessor :here

    # Set "here" to "null". Prepopulates "here" with an empty entry.
    def initialize
      @here    = NULL
      @entries = { @here => NOTHING }
    end

    # Grow the heap and fill it was a CS node of type `__KIND__`.
    # Returns the new value of `@here` after expansion.
    # "Create a new empty heap object and return its address for access later"
    def allot(__KIND__)
      entries[@here += 1] = { KIND => __KIND__ }
      return @here
    end

    # augment a heap entry with a new key/value pair.
    # Throws an exception when given a bad heap index.
    # "Put this VALUE into this ADDRESS and annotate it with the KEY provided"
    def put(address, key, value)
      address.is_address?
      block = entries[address]
      if (block)
        block[key.to_sym] = value
        return
      else
        raise BadAddress, BAD_ADDR + address.inspect
      end
    end

    # Just an alias
    def values
      entries.values
    end

    # Dump the heap as an easy-to-traverse JSON object.
    # We need this to reconstruct the node from its IR form to its canonical form.
    def dump
      return values
    end
  end
end


text:
import subprocess, os

def http_client_post(ip, port, url, entries = {}):
	import urllib.request, urllib.parse, json
	url = url if not url.startswith('/') else url[1:]
	response = urllib.request.urlopen('http://%s:%d/%s' % (ip, port, url), urllib.parse.urlencode(entries).encode())
	obj = json.loads(response.read().decode().strip())
	response.close()
	return obj

class case_handler:
	# [Order-by] lexicographic order

	# curl -L -X POST http://0.0.0.0:1728/v1/minions/list
	def minions_list(form, args):
		minions = []
		for item in args.conn:
			minions.append(args.conn[item][1])
		return {"minions": minions}

	# curl -L -X POST -F mem=4096 -F cpu=2 http://0.0.0.0:1728/v1/resource/allocation
	def resource_allocation(form, args):
		mem = int(form['mem'])
		cpu = int(form['cpu'])
		candidates = {}
		from daemon.http import minion_http_handler
		for item in args.conn:
			addr = args.conn[item][1]
			obj = http_client_post(addr, minion_http_handler.http_port, '/v1/system/memsw/available')
			if obj['success'] and obj['data']['Mbytes'] >= mem:
				candidates[addr] = obj['data']

		if len(candidates) <= 0:
			raise Exception("no minions")
		else:
			from policy.allocate import candidates_selector
			one = candidates_selector.select(candidates)
			return {"recommend": one}

	# curl -L -X POST -F user=docklet http://0.0.0.0:1728/v1/user/live/add
	def user_live_add(form, args):
		if not os.path.exists('/var/lib/docklet/global/users/%s' % form['user']):
			return False
		subprocess.getoutput('echo live > /var/lib/docklet/global/users/%s/status' % form['user'])
		return True

	# curl -L -X POST -F user=docklet http://0.0.0.0:1728/v1/user/live/remove
	def user_live_remove(form, args):
		subprocess.getoutput('rm -f /var/lib/docklet/global/users/%s/status' % form['user'])
		return True

	# curl -L -X POST http://0.0.0.0:1728/v1/user/live/list
	def user_live_list(form, args):
		return subprocess.getoutput('ls -1 /var/lib/docklet/global/users/*/status 2>/dev/null | awk -F\/ \'{print $(NF-1)\'}').split()


text:
Study on Railtie Plugin

## Usage

New rails project

```
$ rails new railtie_test
```

Add to Gemfile and bundle update

```
$ vim Gemfile
gem 'simple_auth_plugin', require: 'simple_auth_plugin/railtie', path: '../simple_auth_plugin'

$ bundle update
```

Create user model

```
$ rake simple_auth:generate:model
SimpleAuthPlugin is loaded!
      invoke  active_record
      create    db/migrate/20141216152311_create_users.rb
      create    app/models/user.rb
      invoke    test_unit
      create      test/models/user_test.rb
      create      test/fixtures/users.yml
```

Generate config

```
$ rails generate simple_auth_plugin:simple_auth
SimpleAuthPlugin is loaded!
 initializer  simple_auth_plugin.rb
```


text:
set -eu -o pipefail

PROTO_PATH=proto/*.proto
GOPATH=$(go env GOPATH)

clean() {
  echo "==== Initiating Clean Process ===="
  # clean cmd, internal
  rm -rf internal/*
  rm -rf cmd/*
  mkdir internal/swagger
  echo "==== Finish Clean Process ===="
}

build_proto_files(){
  go get -u -v github.com/spf13/cobra/cobra && \
  go get -u -v google.golang.org/grpc && \
  go get -u -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway && \
  go get -u -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger && \
  go get -u -v github.com/golang/protobuf/protoc-gen-go

  for filename in ${PROTO_PATH}; do
    protoc -I/usr/local/include -I. \
      -I${GOPATH}/src \
      -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
      --plugin=protoc-gen-go=${GOPATH}/bin/protoc-gen-go \
      --go_out=plugins=grpc:./internal \
      ${filename}
  done

  for filename in ${PROTO_PATH}; do
    protoc -I/usr/local/include -I. \
      -I${GOPATH}/src/google.golang.org/genproto/googleapis \
      -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
      -I${GOPATH}/src/github.com/golang/protobuf/ptypes \
      -I${GOPATH}/src \
      --plugin=protoc-gen-grpc-gateway=${GOPATH}/bin/protoc-gen-grpc-gateway \
      --grpc-gateway_out=logtostderr=true:./internal \
      ${filename}
   done

  for filename in ${PROTO_PATH}; do
    protoc -I/usr/local/include -I. \
      -I${GOPATH}/src \
      -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
      --plugin=protoc-gen-swagger=${GOPATH}/bin/protoc-gen-swagger \
      --swagger_out=logtostderr=true:./internal/swagger \
      ${filename}
  done
}

build() {
  echo "==== Initiating Build Process ===="
  build_proto_files

  install

  docker build -t kafka-pubsub-emulator-gateway:1.0.0.0 .
  echo "==== Finish Build Process ===="
}

install() {
  echo "==== Initiating Install Process ===="
  clean

  build_proto_files

  CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o cmd/kafka-pubsub-emulator-gateway .
  echo "==== Finish Install Process ===="
}

execute() {
  clean
  build
}

if [[ "${1:-}" == "clean" ]] ; then
  clean
elif [[ "${1:-}" == "build" ]] ; then
  build
elif [[ "${1:-}" == "install" ]] ; then
  install
else
  execute
fi