text:
package org.spoofax.terms;

import java.util.List;

import javax.annotation.Nullable;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.spoofax.DummyStrategoConstructor;
import org.spoofax.TestUtils;
import org.spoofax.interpreter.terms.ISimpleTermTests;
import org.spoofax.interpreter.terms.IStrategoApplTests;
import org.spoofax.interpreter.terms.IStrategoConstructor;
import org.spoofax.interpreter.terms.IStrategoList;
import org.spoofax.interpreter.terms.IStrategoTerm;
import org.spoofax.interpreter.terms.IStrategoTermTests;
import org.spoofax.terms.attachments.ITermAttachment;

/**
 * Tests the {@link StrategoAppl} class.
 */
@DisplayName("StrategoAppl")
public class StrategoApplTests {

    public interface Fixture extends IStrategoApplTests.Fixture {

        @Override
        StrategoAppl createIStrategoAppl(@Nullable IStrategoConstructor constructor,
                                         @Nullable List<IStrategoTerm> subterms,
                                         @Nullable IStrategoList annotations,
                                         @Nullable List<ITermAttachment> attachments);

    }

    public static class FixtureImpl extends StrategoTermTests.FixtureImpl implements Fixture {

        @Override
        public StrategoAppl createIStrategoAppl(@Nullable IStrategoConstructor constructor,
                                                @Nullable List<IStrategoTerm> subterms,
                                                @Nullable IStrategoList annotations,
                                                @Nullable List<ITermAttachment> attachments) {
            if (constructor == null) {
                switch (subterms != null ? subterms.size() : 0) {
                    case 0:
                        constructor = DummyStrategoConstructor.Dummy0;
                        break;
                    case 1:
                        constructor = DummyStrategoConstructor.Dummy1;
                        break;
                    case 2:
                        constructor = DummyStrategoConstructor.Dummy2;
                        break;
                    case 3:
                        constructor = DummyStrategoConstructor.Dummy3;
                        break;
                    case 4:
                        constructor = DummyStrategoConstructor.Dummy4;
                        break;
                    default:
                        constructor = new DummyStrategoConstructor("Dummy", subterms.size());
                        break;
                }
            }
            //noinspection EqualsAndHashcode
            return TestUtils.putAttachments(new StrategoAppl(constructor,
                subterms != null ? subterms.toArray(AbstractTermFactory.EMPTY_TERM_ARRAY) :
                    AbstractTermFactory.EMPTY_TERM_ARRAY, annotations != null ? annotations : TermFactory.EMPTY_LIST) {
                @Override
                public int hashCode() {
                    return 0;
                }
            }, attachments);
        }

        @Override
        public StrategoTerm createIStrategoTerm(@Nullable List<IStrategoTerm> subterms,
                                                @Nullable IStrategoList annotations,
                                                @Nullable List<ITermAttachment> attachments) {
            return createIStrategoAppl(null, subterms, annotations, attachments);
        }

    }

    // @formatter:off
    // IStrategoAppl
    @Nested class GetConstructorTests    extends FixtureImpl implements IStrategoApplTests.GetConstructorTests {}
    @Nested class GetNameTests           extends FixtureImpl implements IStrategoApplTests.GetNameTests {}
    @Nested class GetTypeTests           extends FixtureImpl implements IStrategoApplTests.GetTypeTests {}
    @Nested class MatchTests             extends FixtureImpl implements IStrategoApplTests.MatchTests {}
    @Nested class ToStringTests          extends FixtureImpl implements IStrategoApplTests.ToStringTests {}
    @Nested class WriteAsStringTests     extends FixtureImpl implements IStrategoApplTests.WriteAsStringTests {}

    // IStrategoTerm
    @Nested class GetAllSubtermsTests    extends FixtureImpl implements IStrategoTermTests.GetAllSubtermsTests {}
    @Nested class GetSubtermsTests       extends FixtureImpl implements IStrategoTermTests.GetSubtermsTests {}
    @Nested class GetAnnotationsTests    extends FixtureImpl implements IStrategoTermTests.GetAnnotationsTests {}
    @Nested class GetSubtermCountTests   extends FixtureImpl implements IStrategoTermTests.GetSubtermCountTests {}
    @Nested class GetSubtermTests        extends FixtureImpl implements IStrategoTermTests.GetSubtermTests {}

    // ISimpleTerm
    @Nested class GetAttachmentTests     extends FixtureImpl implements ISimpleTermTests.GetAttachmentTests {}
    @Nested class PutAttachmentTests     extends FixtureImpl implements ISimpleTermTests.PutAttachmentTests {}
    @Nested class RemoveAttachmentTests  extends FixtureImpl implements ISimpleTermTests.RemoveAttachmentTests {}
    // @formatter:on

}


text:
import React from 'react'
import PropTypes from 'prop-types'
import SVGDeviconInline from '../../_base/SVGDeviconInline'

import iconSVG from './AndroidPlainWordmark.svg'

/** AndroidPlainWordmark */
function AndroidPlainWordmark({ width, height, className }) {
  return (
    <SVGDeviconInline
      className={'AndroidPlainWordmark' + ' ' + className}
      iconSVG={iconSVG}
      width={width}
      height={height}
    />
  )
}

AndroidPlainWordmark.propTypes = {
  className: PropTypes.string,
  width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
}

export default AndroidPlainWordmark

redpajama_set_name: RedPajamaGithub


text:
@interface TitleScene : CCLayer {
    CCMenu* titleMenu;
    CCMenu* gameTypeMenu;
}

+(id) scene;

-(void) singlePlayMenuTouched:(id) sender;
-(void) skirmishTouched:(id) sender;
-(void) infiltrationTouched:(id) sender;
-(void) resistanceTouched:(id) sender;
-(void) backTouched:(id)sender;
-(void) onlinePlayMenuTouched:(id) sender;
-(void) localPlayMenuTouched:(id) sender;
-(void) leaderboardsTouched:(id) sender;
@end


text:
/**
 *
 */
package me.learn.personal.month4;

/**
 * Title 1060 :
 *
 * Given a sorted array A of unique numbers, find the K-th missing number
 * starting from the leftmost number of the array.
 *
 * Example 1:
 *
 * Input: A = [4,7,9,10], K = 1 Output: 5 Explanation: The first missing number
 * is 5.
 *
 * Example 2:
 *
 * Input: A = [4,7,9,10], K = 3 Output: 8 Explanation: The missing numbers are
 * [5,6,8,...], hence the third missing number is 8.
 *
 *
 * @author bramanarayan
 * @date Aug 23, 2020
 */
public class MissingElementSortedArray {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		MissingElementSortedArray solutino = new MissingElementSortedArray();
		System.out.println(solutino.missingElement(new int[] { 4, 7, 9, 10 }, 3));
	}

	public int missingElement(int[] nums, int k) {

		int n = nums.length;

		// if kth missing number is larger than last element of the array
		if (k > missing(n - 1, nums)) {
			return nums[n - 1] + k - missing(n - 1, nums);
		}

		// binary
		int low = 0;
		int high = n - 1;
		while (low != high) {
			int mid = low + (high - low) / 2;
			if (missing(mid, nums) < k) {
				low = mid + 1;
			} else {
				high = mid;
			}
		}

		// kth missing number is greater than nums[idx - 1]
		// and less than nums[idx]
		return nums[low - 1] + k - missing(low - 1, nums);

	}

	// return how many numbers are missing until nums[i]
	private int missing(int i, int[] nums) {
		return nums[i] - nums[0] - i;

	}
}


text:
package com.corundumstudio.socketio;

/**
 * TCP socket configuration contains configuration for main server channel
 * and client channels
 *
 * @see java.net.SocketOptions
 */
public class SocketConfig {

    private boolean tcpNoDelay = true;

    private int tcpSendBufferSize = -1;

    private int tcpReceiveBufferSize = -1;

    private boolean tcpKeepAlive = false;

    private int soLinger = -1;

    private boolean reuseAddress = false;

    private int acceptBackLog = 1024;

    public boolean isTcpNoDelay() {
        return tcpNoDelay;
    }
    public void setTcpNoDelay(boolean tcpNoDelay) {
        this.tcpNoDelay = tcpNoDelay;
    }

    public int getTcpSendBufferSize() {
        return tcpSendBufferSize;
    }
    public void setTcpSendBufferSize(int tcpSendBufferSize) {
        this.tcpSendBufferSize = tcpSendBufferSize;
    }

    public int getTcpReceiveBufferSize() {
        return tcpReceiveBufferSize;
    }
    public void setTcpReceiveBufferSize(int tcpReceiveBufferSize) {
        this.tcpReceiveBufferSize = tcpReceiveBufferSize;
    }

    public boolean isTcpKeepAlive() {
        return tcpKeepAlive;
    }
    public void setTcpKeepAlive(boolean tcpKeepAlive) {
        this.tcpKeepAlive = tcpKeepAlive;
    }

    public int getSoLinger() {
        return soLinger;
    }
    public void setSoLinger(int soLinger) {
        this.soLinger = soLinger;
    }

    public boolean isReuseAddress() {
        return reuseAddress;
    }
    public void setReuseAddress(boolean reuseAddress) {
        this.reuseAddress = reuseAddress;
    }

    public int getAcceptBackLog() {
        return acceptBackLog;
    }
    public void setAcceptBackLog(int acceptBackLog) {
        this.acceptBackLog = acceptBackLog;
    }

}


text:
package org.springframework.cloud.vault.config;

import java.util.Collections;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.vault.util.VaultRule;
import org.springframework.core.env.Environment;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import static org.assertj.core.api.Assertions.*;

import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

/**
 * Integration test using config infrastructure with token authentication.
 * <p>
 * In case this test should fail because of SSL make sure you run the test within the
 * spring-cloud-vault-config/spring-cloud-vault-config directory as the keystore is
 * referenced with {@code ../work/keystore.jks}.
 *
 * @author Mark Paluch
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = VaultConfigGenericBackendDisabledTests.TestApplication.class, properties = "spring.cloud.vault.generic.enabled=false")
public class VaultConfigGenericBackendDisabledTests {

	@BeforeClass
	public static void beforeClass() throws Exception {

		VaultRule vaultRule = new VaultRule();
		vaultRule.before();

		vaultRule
				.prepare()
				.getVaultOperations()
				.write("secret/testVaultApp",
						Collections.singletonMap("vault.value", "foo"));
	}

	@Autowired
	Environment environment;

	@Test
	public void shouldNotContainVaultProperties() {

		assertThat(environment.containsProperty("vault.value")).isFalse();
	}

	@SpringBootApplication
	public static class TestApplication {

		public static void main(String[] args) {
			SpringApplication.run(TestApplication.class, args);
		}
	}
}


text: dojo.require("dojo.undo.Manager");dojo.provide("dojo.undo.*");


text:
CXX=clang++
CXXFLAGS=-O3 -Werror -Wall -pedantic -std=c++11
CXXFLAGS+=$(shell pkg-config --cflags eigen3)

lennard-jones: lennard-jones.cc

clean:
	rm -f lennard-jones


text:
<?php
/**
 * Represents a permission assigned to a group.
 * @package sapphire
 * @subpackage security
 */
class Permission extends DataObject {

  // the (1) after Type specifies the DB default value which is needed for
	// upgrades from older SilverStripe versions
	static $db = array(
		"Code" => "Varchar",
		"Arg" => "Int",
		"Type" => "Int(1)"
	);
	static $has_one = array(
		"Group" => "Group"
	);
	static $indexes = array(
		"Code" => true
	);
	static $defaults = array(
		"Type" => 1
	);
	static $has_many = array();

	static $many_many = array();

	static $belongs_many_many = array();

	/**
	 * This is the value to use for the "Type" field if a permission should be
	 * granted.
	 */
	const GRANT_PERMISSION = 1;

	/**
	 * This is the value to use for the "Type" field if a permission should be
	 * denied.
	 */
	const DENY_PERMISSION = -1;

	/**
	 * This is the value to use for the "Type" field if a permission should be
	 * inherited.
	 */
	const INHERIT_PERMISSION = 0;

	/**
	 * Method to globally disable "strict" checking, which means a permission
	 * will be granted if the key does not exist at all.
	 *
	 * @var bool
	 */
	static $declared_permissions = null;

  /**
	 * Linear list of declared permissions in the system.
	 *
	 * @var array
	 */
	protected static $declared_permissions_list = null;

	/**
	 * @var $strict_checking Boolean Method to globally disable "strict" checking,
	 * which means a permission will be granted if the key does not exist at all.
	 */
	static $strict_checking = true;

	/**
	 * If this setting is set, then permissions can imply other permissions
	 *
	 * @var bool
	 */
	static $implied_permissions = false;

	/**
	 * Set to false to prevent the 'ADMIN' permission from implying all
	 * permissions in the system
	 *
	 * @var bool
	 */
	static $admin_implies_all = true;

	/**
	 * a list of permission codes which doesn't appear in the Permission list
	 * when make the {@link PermissionCheckboxSetField}
	 * @var array;
	 */
	static $hidden_permissions = array();

	/**
	 * Check that the current member has the given permission.
	 *
	 * @param string $code Code of the permission to check (case-sensitive)
	 * @param string $arg Optional argument (e.g. a permissions for a specific page)
	 * @param int|Member $member Optional member instance or ID. If set to NULL, the permssion
	 *  will be checked for the current user
	 * @param bool $strict Use "strict" checking (which means a permission
	 *  will be granted if the key does not exist at all)?
	 * @return int|bool The ID of the permission record if the permission
	 *  exists; FALSE otherwise. If "strict" checking is
	 *  disabled, TRUE will be returned if the permission does not exist at all.
	 */
	public static function check($code, $arg = "any", $member = null, $strict = true) {
		if(!$member) {
			if(!Member::currentUserID()) {
				return false;
			}
			$member = Member::currentUserID();
		}

		return self::checkMember($member, $code, $arg, $strict);
	}

	/**
	 * Permissions cache.  The format is a map, where the keys are member IDs, and the values are
	 * arrays of permission codes.
	 */
	private static $cache_permissions = array();

	/**
	 * Flush the permission cache, for example if you have edited group membership or a permission record.
	 * @todo Call this whenever Group_Members is added to or removed from
	 */
	public static function flush_permission_cache() {
		self::$cache_permissions = array();
	}

	/**
	 * Check that the given member has the given permission.
	 *
	 * @param int|Member memberID The ID of the member to check. Leave blank for the current member.
	 *  Alternatively you can use a member object.
	 * @param string|array $code Code of the permission to check (case-sensitive)
	 * @param string $arg Optional argument (e.g. a permissions for a specific page)
	 * @param bool $strict Use "strict" checking (which means a permission
	 *  will be granted if the key does not exist at all)?
	 * @return int|bool The ID of the permission record if the permission
	 *  exists; FALSE otherwise. If "strict" checking is
	 *  disabled, TRUE will be returned if the permission does not exist at all.
	 */
	public static function checkMember($member, $code, $arg = "any", $strict = true) {
		if(!$member) {
			$memberID = $member = Member::currentUserID();
		} else {
			$memberID = (is_object($member)) ? $member->ID : $member;
		}

		if($arg == 'any') {
			// Cache the permissions in memory
			if(!isset(self::$cache_permissions[$memberID])) {
				self::$cache_permissions[$memberID] = self::permissions_for_member($memberID);
			}

			// If $admin_implies_all was false then this would be inefficient, but that's an edge
			// case and this keeps the code simpler
			if(!is_array($code)) $code = array($code);
			if(self::$admin_implies_all) $code[] = "ADMIN";

			// Multiple $code values - return true if at least one matches, ie, intersection exists
			return (bool)array_intersect($code, self::$cache_permissions[$memberID]);
		}

		// The following code should only be used if you're not using the "any" arg.  This is kind
		// of obselete functionality and could possibly be deprecated.

		$groupList = self::groupList($memberID);
		if(!$groupList) return false;

		$groupCSV = implode(", ", $groupList);

		// Arg component
		switch($arg) {
			case "any":
				$argClause = "";
				break;
			case "all":
				$argClause = " AND \"Arg\" = -1";
				break;
			default:
				if(is_numeric($arg)) {
					$argClause = "AND \"Arg\" IN (-1, $arg) ";
				} else {
					user_error("Permission::checkMember: bad arg '$arg'", E_USER_ERROR);
				}
		}

		if(is_array($code)) {
			$SQL_codeList = "'" . implode("', '", Convert::raw2sql($code)) . "'";
		} else {
			$SQL_codeList = "'" . Convert::raw2sql($code) . "'";
		}

		$SQL_code = Convert::raw2sql($code);

		$adminFilter = (self::$admin_implies_all) ?  ",'ADMIN'" : '';

		// Raw SQL for efficiency
		$permission = DB::query("
			SELECT \"ID\"
			FROM \"Permission\"
			WHERE (
				\"Code\" IN ($SQL_codeList $adminFilter)
				AND \"Type\" = " . self::GRANT_PERMISSION . "
				AND \"GroupID\" IN ($groupCSV)
				$argClause
			)
		")->value();

		if($permission) return $permission;

		// Strict checking disabled?
		if(!self::$strict_checking || !$strict) {
			$hasPermission = DB::query("
				SELECT COUNT(*)
				FROM \"Permission\"
				WHERE (
					(\"Code\" IN '$SQL_code')'
					AND (\"Type\" = " . self::GRANT_PERMISSION . ")
				)
			")->value();

			if(!$hasPermission) return;
		}

		return false;
	}

	/**
	 * Get all the 'any' permission codes available to the given member.
	 * @return array();
	 */
	public static function permissions_for_member($memberID) {
		$groupList = self::groupList($memberID);
		if($groupList) {
			$groupCSV = implode(", ", $groupList);

			// Raw SQL for efficiency
			return array_unique(DB::query("
				SELECT \"Code\"
				FROM \"Permission\"
				WHERE \"Type\" = " . self::GRANT_PERMISSION . " AND \"GroupID\" IN ($groupCSV)

				UNION

				SELECT \"Code\"
				FROM \"PermissionRoleCode\" AS PRC
				INNER JOIN \"PermissionRole\" AS PR ON PRC.\"RoleID\" = PR.\"ID\"
				INNER JOIN \"Group_Roles\" AS GR ON GR.\"PermissionRoleID\" = PR.\"ID\"
				WHERE \"GroupID\" IN ($groupCSV)
			")->column());

		} else {
			return array();
		}
	}

	/**
	 * Get the list of groups that the given member belongs to.
	 *
	 * Call without an argument to get the groups that the current member
	 * belongs to. In this case, the results will be session-cached.
	 *
	 * @param int $memberID The ID of the member. Leave blank for the current
	 *                      member.
	 * @return array Returns a list of group IDs to which the member belongs
	 *               to or NULL.
	 */
	public static function groupList($memberID = null) {
		// Default to current member, with session-caching
		if(!$memberID) {
			$member = Member::currentUser();
			if($member && isset($_SESSION['Permission_groupList'][$member->ID]))
				return $_SESSION['Permission_groupList'][$member->ID];
		} else {
			$member = DataObject::get_by_id("Member", $memberID);
		}

		if($member) {
			// Build a list of the IDs of the groups.  Most of the heavy lifting
			// is done by Member::Groups
			// NOTE: This isn't effecient; but it's called once per session so
			// it's a low priority to fix.
			$groups = $member->Groups();
			$groupList = array();

			if($groups) {
				foreach($groups as $group)
					$groupList[] = $group->ID;
			}

			// Session caching
			if(!$memberID) {
				$_SESSION['Permission_groupList'][$member->ID] = $groupList;
			}

			return isset($groupList) ? $groupList : null;
		}
	}

	/**
	 * Grant the given permission code/arg to the given group
	 *
	 * @param int $groupID The ID of the group
	 * @param string $code The permission code
	 * @param string Optional: The permission argument (e.g. a page ID).
	 * @returns Permission Returns the new permission object.
	 */
	public static function grant($groupID, $code, $arg = "any") {
		$perm = new Permission();
		$perm->GroupID = $groupID;
		$perm->Code = $code;
		$perm->Type = self::GRANT_PERMISSION;

		// Arg component
		switch($arg) {
			case "any":
				break;
			case "all":
				$perm->Arg = -1;
			default:
				if(is_numeric($arg)) {
					$perm->Arg = $arg;
				} else {
					user_error("Permission::checkMember: bad arg '$arg'",
										E_USER_ERROR);
				}
		}

		$perm->write();
		return $perm;
	}

	/**
	 * Deny the given permission code/arg to the given group
	 *
	 * @param int $groupID The ID of the group
	 * @param string $code The permission code
	 * @param string Optional: The permission argument (e.g. a page ID).
	 * @returns Permission Returns the new permission object.
	 */
	public static function deny($groupID, $code, $arg = "any") {
		$perm = new Permission();
		$perm->GroupID = $groupID;
		$perm->Code = $code;
		$perm->Type = self::DENY_PERMISSION;

		// Arg component
		switch($arg) {
			case "any":
				break;
			case "all":
				$perm->Arg = -1;
			default:
				if(is_numeric($arg)) {
					$perm->Arg = $arg;
				} else {
					user_error("Permission::checkMember: bad arg '$arg'",
										E_USER_ERROR);
				}
		}

		$perm->write();
		return $perm;
	}

	/**
	 * Returns all members for a specific permission.
	 *
	 * @param $code String|array Either a single permission code, or a list of permission codes
	 * @return DataObjectSet Returns a set of member that have the specified
	 *                       permission.
	 */
	public static function get_members_by_permission($code) {
		$toplevelGroups = self::get_groups_by_permission($code);
		if (!$toplevelGroups) return false;

		$groupIDs = array();
		foreach($toplevelGroups as $group) {
			$familyIDs = $group->collateFamilyIDs();
			if(is_array($familyIDs)) {
				$groupIDs = array_merge($groupIDs, array_values($familyIDs));
			}
		}

		if(!count($groupIDs))
			return false;

		$members = DataObject::get(
			Object::getCustomClass('Member'),
			$_filter = "\"Group\".\"ID\" IN (" . implode(",",$groupIDs) . ")",
			$_sort = "",
			$_join = "LEFT JOIN \"Group_Members\" ON \"Member\".\"ID\" = \"Group_Members\".\"MemberID\" " .
				"LEFT JOIN \"Group\" ON \"Group_Members\".\"GroupID\" = \"Group\".\"ID\" "
		);

		return $members;
	}

	/**
	 * Return all of the groups that have one of the given permission codes
	 * @param $codes array|string Either a single permission code, or an array of permission codes
	 * @return DataObjectSet The matching group objects
	 */
	static function get_groups_by_permission($codes) {
		if(!is_array($codes)) $codes = array($codes);

		$SQLa_codes = Convert::raw2sql($codes);
		$SQL_codes = join("','", $SQLa_codes);

		// Via Roles are groups that have the permission via a role
		return DataObject::get('Group',
			"\"PermissionRoleCode\".\"Code\" IN ('$SQL_codes') OR \"Permission\".\"Code\" IN ('$SQL_codes')",
			"",
			"LEFT JOIN \"Permission\" ON \"Permission\".\"GroupID\" = \"Group\".\"ID\"
			LEFT JOIN \"Group_Roles\" ON \"Group_Roles\".\"GroupID\" = \"Group\".\"ID\"
			LEFT JOIN \"PermissionRole\" ON \"Group_Roles\".\"PermissionRoleID\" = \"PermissionRole\".\"ID\"
			LEFT JOIN \"PermissionRoleCode\" ON \"PermissionRoleCode\".\"RoleID\" = \"PermissionRole\".\"ID\"");
	}

	/**
	 * Get a list of all available permission codes, both defined through the
	 * {@link PermissionProvider} interface, and all not explicitly defined codes existing
	 * as a {@link Permission} database record. By default, the results are
	 * grouped as denoted by {@link Permission_Group}.
	 *
	 * @param bool $grouped Group results into an array of permission groups.
	 * @return array Returns an array of all available permission codes. The
	 *  array indicies are the permission codes as used in
	 *  {@link Permission::check()}. The value is a description
	 *  suitable for using in an interface.
	 */
	public static function get_codes($grouped = true) {
		$classes = ClassInfo::implementorsOf('PermissionProvider');

		$allCodes = array();
		$adminCategory = _t('Permission.AdminGroup', 'Administrator');
		$allCodes[$adminCategory]['ADMIN'] = array(
			'name' => _t('Permission.FULLADMINRIGHTS', 'Full administrative rights'),
			'help' => _t(
				'Permission.FULLADMINRIGHTS_HELP',
				'Implies and overrules all other assigned permissions.'
			),
			'sort' => 100000
		);

		if($classes) foreach($classes as $class) {
			$SNG = singleton($class);
			if($SNG instanceof TestOnly) continue;

			$someCodes = $SNG->providePermissions();
			if($someCodes) {
				foreach($someCodes as $k => $v) {
					if (is_array($v)) {
						// There must be a category and name key.
						if (!isset($v['category'])) user_error("The permission $k must have a category key", E_USER_WARNING);
						if (!isset($v['name'])) user_error("The permission $k must have a name key", E_USER_WARNING);

						if (!isset($allCodes[$v['category']])) $allCodes[$v['category']] = array();

						$allCodes[$v['category']][$k] = array(
							'name' => $v['name'],
							'help' => isset($v['help']) ? $v['help'] : null,
							'sort' => isset($v['sort']) ? $v['sort'] : 0
						);

					} else {
						$allCodes['Other'][$k] = array(
							'name' => $v,
							'help' => null,
							'sort' => 0
						);
					}
				}
			}
		}

		$flatCodeArray = array();
		foreach($allCodes as $category) foreach($category as $code => $permission) $flatCodeArray[] = $code;
		$otherPerms = DB::query("SELECT DISTINCT \"Code\" From \"Permission\" WHERE \"Code\" != ''")->column();

		if($otherPerms) foreach($otherPerms as $otherPerm) {
			if(!in_array($otherPerm, $flatCodeArray))
				$allCodes['Other'][$otherPerm] = array(
					'name' => $otherPerm,
					'help' => null,
					'sort' => 0
				);
		}

		// Don't let people hijack ADMIN rights
		if(!Permission::check("ADMIN")) unset($allCodes['ADMIN']);

		ksort($allCodes);

		$returnCodes = array();
		foreach($allCodes as $category => $permissions) {
			if($grouped) {
				uasort($permissions, array(__CLASS__, 'sort_permissions'));
				$returnCodes[$category] = $permissions;
			} else {
				$returnCodes = array_merge($returnCodes, $permissions);
			}
		}

		return $returnCodes;
	}

	/**
	 * Sort permissions based on their sort value, or name
	 *
	 */
	static function sort_permissions($a, $b) {
		if ($a['sort'] == $b['sort']) {
			// Same sort value, do alpha instead
			return strcmp($a['name'], $b['name']);
		} else {
			// Just numeric.
			return $a['sort'] < $b['sort'] ? -1 : 1;
		}
	}

	/**
	 * add a permission represented by the $code to the {@link slef::$hidden_permissions} list
	 *
	 * @param $code string - the permissions code
	 * @return void
	 */
	static function add_to_hidden_permissions($code){
		self::$hidden_permissions[] = $code;
	}

	/**
	 * remove a permission represented by the $code from the {@link slef::$hidden_permissions} list
	 *
	 * @param $code string - the permissions code
	 * @return void
	 */
	static function remove_from_hidden_permissions($code){
		self::$hidden_permissions = array_diff(self::$hidden_permissions, array($code));
	}

	/**
	 * Declare an array of permissions for the system.
	 *
	 * Permissions can be grouped by nesting arrays. Scalar values are always
	 * treated as permissions.
	 *
	 * @param array $permArray A (possibly nested) array of permissions to
	 *                         declare for the system.
	 */
	static function declare_permissions($permArray) {
		if(is_array(self::$declared_permissions)) {
			self::$declared_permissions =
				array_merge_recursive(self::$declared_permissions, $permArray);
		}
		else {
			self::$declared_permissions = $permArray;
		}
	}

	/**
	 * Get a linear list of the permissions in the system.
	 *
	 * @return array Linear list of declared permissions in the system.
	 */
	public static function get_declared_permissions_list() {
		if(!self::$declared_permissions)
			return null;

		if(self::$declared_permissions_list)
			return self::$declared_permissions_list;

		self::$declared_permissions_list = array();

		self::traverse_declared_permissions(self::$declared_permissions,
																				self::$declared_permissions_list);

		return self::$declared_permissions_list;
	}

	/**
	 * Look up the human-readable title for the permission as defined by Permission::declare_permissions
	 *
	 * @param $perm Permission code
	 * @return Label for the given permission, or the permission itself if the label doesn't exist
	 */
	public static function get_label_for_permission($perm) {
		$list = self::get_declared_permissions_list();
		if(array_key_exists($perm, $list)) return $list[$perm];
		return $perm;
	}

	/**
	 * Recursively traverse the nested list of declared permissions and create
	 * a linear list.
	 *
	 * @param aeeay $declared Nested structure of permissions.
	 * @param $list List of permissions in the structure. The result will be
	 *              written to this array.
	 */
	protected static function traverse_declared_permissions($declared,
																													&$list) {
		if(!is_array($declared))
			return;

		foreach($declared as $perm => $value) {
			if($value instanceof Permission_Group) {
				$list[] = $value->getName();
				self::traverse_declared_permissions($value->getPermissions(), $list);
			} else {
				$list[$perm] = $value;
			}
		}
	}

	public function onBeforeWrite() {
		parent::onBeforeWrite();

		// Just in case we've altered someone's permissions
		Permission::flush_permission_cache();
	}
}

/**
 * Permission_Group class
 *
 * This class is used to group permissions together for showing on an
 * interface.
 * @package sapphire
 * @subpackage security
 */
class Permission_Group {

	/**
	 * Name of the permission group (can be used as label in an interface)
	 * @var string
	 */
	protected $name;

	/**
	 * Associative array of permissions in this permission group. The array
	 * indicies are the permission codes as used in
	 * {@link Permission::check()}. The value is suitable for using in an
	 * interface.
	 * @var string
	 */
	protected $permissions = array();

	/**
	 * Constructor
	 *
	 * @param string $name Text that could be used as label used in an
	 *                     interface
	 * @param array $permissions Associative array of permissions in this
	 *                           permission group. The array indicies are the
	 *                           permission codes as used in
	 *                           {@link Permission::check()}. The value is
	 *                           suitable for using in an interface.
	 */
	public function __construct($name, $permissions) {
		$this->name = $name;
		$this->permissions = $permissions;
	}

	/**
	 * Get the name of the permission group
	 *
	 * @return string Name (label) of the permission group
	 */
	public function getName() {
		return $this->name;
	}

	/**
	 * Get permissions
	 *
	 * @return array Associative array of permissions in this permission
	 *               group. The array indicies are the permission codes as
	 *               used in {@link Permission::check()}. The value is
	 *               suitable for using in an interface.
	 */
	public function getPermissions() {
		return $this->permissions;
	}
}

?>


text:
<router-outlet></router-outlet>

<p-toast position="top-right" key="mainToast"></p-toast>


text:
#pragma once

#include "Entity.h"

// tolua_begin
class cHangingEntity :
	public cEntity
{
	typedef cEntity super;

public:

	// tolua_end

	CLASS_PROTODEF(cHangingEntity)

	cHangingEntity(eEntityType a_EntityType, eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z);

	// tolua_begin

	/** Returns the direction in which the entity is facing. */
	eBlockFace GetFacing() const { return cHangingEntity::ProtocolFaceToBlockFace(m_Facing); }

	/** Set the direction in which the entity is facing. */
	void SetFacing(eBlockFace a_Facing)
	{
		m_Facing = cHangingEntity::BlockFaceToProtocolFace(a_Facing);
	}

	// tolua_end

	/** Returns the direction in which the entity is facing. */
	Byte GetProtocolFacing() const { return m_Facing; }

	/** Set the direction in which the entity is facing. */
	void SetProtocolFacing(Byte a_Facing)
	{
		ASSERT(a_Facing <= 3);
		m_Facing = a_Facing;
	}

protected:

	Byte m_Facing;

	virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
	virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override
	{
		UNUSED(a_Dt);
		UNUSED(a_Chunk);
	}

	/** Converts protocol hanging item facing to eBlockFace values */
	inline static eBlockFace ProtocolFaceToBlockFace(Byte a_ProtocolFace)
	{
		eBlockFace Dir;

		// The client uses different values for item frame directions and block faces. Our constants are for the block faces, so we convert them here to item frame faces
		switch (a_ProtocolFace)
		{
			case 0: Dir = BLOCK_FACE_ZP; break;
			case 2: Dir = BLOCK_FACE_ZM; break;
			case 1: Dir = BLOCK_FACE_XM; break;
			case 3: Dir = BLOCK_FACE_XP; break;
			default:
			{
				LOGINFO("Invalid facing (%d) in a cHangingEntity, adjusting to BLOCK_FACE_XP.", a_ProtocolFace);
				ASSERT(!"Tried to convert a bad facing!");

				Dir = cHangingEntity::ProtocolFaceToBlockFace(3);
			}
		}

		return Dir;
	}

	/** Converts eBlockFace values to protocol hanging item faces */
	inline static Byte BlockFaceToProtocolFace(eBlockFace a_BlockFace)
	{
		Byte Dir;

		// The client uses different values for item frame directions and block faces. Our constants are for the block faces, so we convert them here to item frame faces
		switch (a_BlockFace)
		{
			case BLOCK_FACE_ZP: Dir = 0; break;
			case BLOCK_FACE_ZM: Dir = 2; break;
			case BLOCK_FACE_XM: Dir = 1; break;
			case BLOCK_FACE_XP: Dir = 3; break;
			case BLOCK_FACE_YP:
			case BLOCK_FACE_YM:
			case BLOCK_FACE_NONE:
			{
				// Uncomment when entities are initialised with their real data, instead of dummy values:
				// LOGINFO("Invalid facing (%d) in a cHangingEntity, adjusting to BLOCK_FACE_XP.", a_BlockFace);
				// ASSERT(!"Tried to convert a bad facing!");

				Dir = cHangingEntity::BlockFaceToProtocolFace(BLOCK_FACE_XP);
				break;
			}
			#if !defined(__clang__)
			default:
			{
				ASSERT(!"Unknown BLOCK_FACE");
				return 0;
			}
			#endif
		}

		return Dir;
	}
};  // tolua_export


text:
package galaxyspace.systems.SolarSystem.planets.overworld.tile;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Random;

import galaxyspace.core.GSItems;
import galaxyspace.core.configs.GSConfigEnergy;
import galaxyspace.systems.SolarSystem.planets.overworld.blocks.machines.BlockRocketAssembler;
import galaxyspace.systems.SolarSystem.planets.overworld.inventory.RocketAssemblyInventory;
import galaxyspace.systems.SolarSystem.planets.overworld.recipes.RocketAssemblyRecipes;
import micdoodle8.mods.galacticraft.api.recipe.ShapedRecipesGC;
import micdoodle8.mods.galacticraft.api.recipe.ShapelessOreRecipeGC;
import micdoodle8.mods.galacticraft.core.energy.item.ItemElectricBase;
import micdoodle8.mods.galacticraft.core.energy.tile.TileBaseElectricBlockWithInventory;
import micdoodle8.mods.galacticraft.core.network.IPacketReceiver;
import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore;
import micdoodle8.mods.miccore.Annotations.NetworkedField;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.SoundCategory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.oredict.OreDictionary;

public class TileEntityRocketAssembler extends TileBaseElectricBlockWithInventory implements ISidedInventory, IPacketReceiver{

	private static final float PROCESS_TIME_REQUIRED_BASE = 3600 * GSConfigEnergy.coefficientSpeedRocketAssembly;
    @NetworkedField(targetSide = Side.CLIENT)
    public float processTimeRequired = PROCESS_TIME_REQUIRED_BASE;
    @NetworkedField(targetSide = Side.CLIENT)
    public int processTicks = 0;
    private ItemStack producingStack = ItemStack.EMPTY;
    private long ticks;
    private static Random rand = new Random();

    public RocketAssemblyInventory rocketCraftMatrix = new RocketAssemblyInventory();

    public TileEntityRocketAssembler()
    {
    	super("tile.rocket_assembler.name");
        this.storage.setMaxExtract(ConfigManagerCore.hardMode ? 90 : 75);
        this.inventory = NonNullList.withSize(3 + 4, ItemStack.EMPTY);
        this.setTierGC(1);
    }

    @Override
    public void update()
    {
        super.update();

        if (!this.world.isRemote)
        {
            boolean updateInv = false;

            if (this.hasEnoughEnergyToRun)
            {
                if (this.canCompress())
                {
                    //++this.processTicks;
                	//this.processTicks += 100;

                	//////////
                	int boost_speed = 0, energy_boost = 0;

                	for(int i = 0; i <= 3; i++)
                	{
                		if(this.getInventory().get(3 + i).isItemEqual(new ItemStack(GSItems.UPGRADES, 1, 2)))
                			boost_speed++;
                		if(this.getInventory().get(3 + i).isItemEqual(new ItemStack(GSItems.UPGRADES, 1, 3)))
                			energy_boost++;
                	}

                    this.processTicks += 5 * (1 + boost_speed);
                    this.storage.setMaxExtract(ConfigManagerCore.hardMode ? 90 + (40 * boost_speed) - (20 * energy_boost): 75 + (35 * boost_speed) - (15 * energy_boost));
                    /////////////

                    //this.processTimeRequired = PROCESS_TIME_REQUIRED_BASE * 2 / (1 + this.poweredByTierGC);

                    if (this.processTicks >= this.processTimeRequired)
                    {
                    	this.world.playSound(null, this.getPos(), SoundEvents.BLOCK_METAL_PLACE, SoundCategory.BLOCKS, 0.3F, this.world.rand.nextFloat() * 0.1F + 0.9F);
                        this.processTicks = 0;
                        this.compressIntoSlot(1);
                        updateInv = true;

                    }
                }
                else
                {
                    this.processTicks = 0;
                }
            }

            if (updateInv)
            {
                this.markDirty();
            }
        }

        if (this.ticks >= Long.MAX_VALUE)
        {
            this.ticks = 0;
        }

        this.ticks++;
    }

    private boolean canCompress()
    {
        ItemStack itemstack = this.producingStack;
        if (itemstack == ItemStack.EMPTY)
        {
            return false;
        }
        if (this.getInventory().get(1).isEmpty())
        {
            return true;
        }
        if (!this.getInventory().get(1).isEmpty() && !this.getInventory().get(1).isItemEqual(itemstack))
        {
            return false;
        }

        int result = this.getInventory().get(1).isEmpty() ? 0 : this.getInventory().get(1).getCount() + itemstack.getCount();
        return result <= this.getInventoryStackLimit() && result <= itemstack.getMaxStackSize();
    }

    public void updateInput()
    {
        this.producingStack = RocketAssemblyRecipes.findMatchingRecipe(this.rocketCraftMatrix, this.world);
    }

    private void compressIntoSlot(int slot)
    {
        if (this.canCompress())
        {
            ItemStack resultItemStack = this.producingStack;
/*
            if(!this.getInventory().get(2).isEmpty())
            {
            	if(!resultItemStack.hasTagCompound())
            		resultItemStack.setTagCompound(new NBTTagCompound());

            	ItemStack engine = this.getInventory().get(2);
            	switch(engine.getItemDamage())
            	{
            		case 4:
            			resultItemStack.getTagCompound().setInteger("engine_type", 1);
            			break;
            		case 5:
            			resultItemStack.getTagCompound().setInteger("engine_type", 2);
            			break;
            		case 6:
            			resultItemStack.getTagCompound().setInteger("engine_type", 3);
            			break;
            		case 7:
            			resultItemStack.getTagCompound().setInteger("engine_type", 4);
            			break;
            	}

            	this.getInventory().set(2, ItemStack.EMPTY);
            }*/
            if (this.getInventory().get(slot).isEmpty())
            {
            	this.getInventory().set(slot, resultItemStack);
            }

            /*
            else if (this.stacks.get(slot).isItemEqual(resultItemStack))
            {
                if (this.stacks.get(slot).getCount() + resultItemStack.getCount() > 64)
                {
                    for (int i = 0; i < this.stacks.get(slot).getCount() + resultItemStack.getCount() - 64; i++)
                    {
                        float var = 0.7F;
                        double dx = this.world.rand.nextFloat() * var + (1.0F - var) * 0.5D;
                        double dy = this.world.rand.nextFloat() * var + (1.0F - var) * 0.5D;
                        double dz = this.world.rand.nextFloat() * var + (1.0F - var) * 0.5D;
                        EntityItem entityitem = new EntityItem(this.world, this.getPos().getX() + dx, this.getPos().getY() + dy, this.getPos().getZ() + dz, new ItemStack(resultItemStack.getItem(), 1, resultItemStack.getItemDamage()));

                        entityitem.setPickupDelay(10);

                        this.world.spawnEntity(entityitem);
                    }
                }

                this.stacks.get(slot).grow(resultItemStack.getCount());
            }
            */
            for (int i = 0; i < this.rocketCraftMatrix.getSizeInventory(); i++)
            {
                this.rocketCraftMatrix.decrStackSize(i, 1);
            }

            this.updateInput();
        }
    }

    @Override
    public void readFromNBT(NBTTagCompound nbt)
    {
        super.readFromNBT(nbt);
        this.processTicks = nbt.getInteger("smeltingTicks");

        this.inventory = NonNullList.withSize(this.getSizeInventory() - this.rocketCraftMatrix.getSizeInventory(), ItemStack.EMPTY);
        NBTTagList nbttaglist = nbt.getTagList("Items", 10);

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
            int j = nbttagcompound.getByte("Slot") & 255;

            if (j >= 0 && j < this.getInventory().size())
            {
                this.getInventory().set(j, new ItemStack(nbttagcompound));
            }
            else if (j < this.getInventory().size() + this.rocketCraftMatrix.getSizeInventory())
            {
                this.rocketCraftMatrix.setInventorySlotContents(j - this.getInventory().size(), new ItemStack(nbttagcompound));
            }
        }

        this.updateInput();
    }

    @Override
    public NBTTagCompound writeToNBT(NBTTagCompound nbt)
    {
        super.writeToNBT(nbt);
        nbt.setInteger("smeltingTicks", this.processTicks);
        NBTTagList var2 = new NBTTagList();
        int var3;

        for (var3 = 0; var3 < this.getInventory().size(); ++var3)
        {
            if (!this.getInventory().get(var3).isEmpty())
            {
                NBTTagCompound var4 = new NBTTagCompound();
                var4.setByte("Slot", (byte) var3);
                this.getInventory().get(var3).writeToNBT(var4);
                var2.appendTag(var4);
            }
        }

        for (var3 = 0; var3 < this.rocketCraftMatrix.getSizeInventory(); ++var3)
        {
            if (!this.rocketCraftMatrix.getStackInSlot(var3).isEmpty())
            {
                NBTTagCompound var4 = new NBTTagCompound();
                var4.setByte("Slot", (byte) (var3 + this.getInventory().size()));
                this.rocketCraftMatrix.getStackInSlot(var3).writeToNBT(var4);
                var2.appendTag(var4);
            }
        }

        nbt.setTag("Items", var2);
        return nbt;
    }

    @Override
    public int getSizeInventory()
    {
        return this.getInventory().size() + this.rocketCraftMatrix.getSizeInventory();
    }

    @Override
    public ItemStack getStackInSlot(int par1)
    {
        if (par1 >= this.getInventory().size())
        {
            return this.rocketCraftMatrix.getStackInSlot(par1 - this.getInventory().size());
        }

        return this.getInventory().get(par1);
    }

    @Override
    public ItemStack decrStackSize(int par1, int par2)
    {
        if (par1 >= this.getInventory().size())
        {
            ItemStack result = this.rocketCraftMatrix.decrStackSize(par1 - this.getInventory().size(), par2);
            if (!result.isEmpty())
            {
                this.updateInput();
            }
            this.markDirty();
            return result;
        }

        if (!this.getInventory().get(par1).isEmpty())
        {
            ItemStack var3;

            if (this.getInventory().get(par1).getCount() <= par2)
            {
                var3 = this.getInventory().get(par1);
                this.getInventory().set(par1, ItemStack.EMPTY);
                this.markDirty();
                return var3;
            }
            else
            {
                var3 = this.getInventory().get(par1).splitStack(par2);

                if (this.getInventory().get(par1).isEmpty())
                {
                    this.getInventory().set(par1, ItemStack.EMPTY);
                }

                this.markDirty();
                return var3;
            }
        }
        else
        {
        	return ItemStack.EMPTY;
        }
    }

    @Override
    public ItemStack removeStackFromSlot(int par1)
    {
        if (par1 >= this.getInventory().size())
        {
        	this.markDirty();
            return this.rocketCraftMatrix.removeStackFromSlot(par1 - this.getInventory().size());
        }

        if (!this.getInventory().get(par1).isEmpty())
        {
            ItemStack var2 = this.getInventory().get(par1);
            this.getInventory().set(par1, ItemStack.EMPTY);
            this.markDirty();
            return var2;
        }
        else
        {
        	return ItemStack.EMPTY;
        }
    }

    @Override
    public void setInventorySlotContents(int par1, ItemStack stack)
    {
        if (par1 >= this.getInventory().size())
        {
            this.rocketCraftMatrix.setInventorySlotContents(par1 - this.getInventory().size(), stack);
            this.updateInput();
        }
        else
        {
            this.getInventory().set(par1, stack);

            if (!stack.isEmpty() && stack.getCount() > this.getInventoryStackLimit())
            {
                stack.setCount(this.getInventoryStackLimit());
            }
        }
        this.markDirty();
    }

    @Override
    public int getInventoryStackLimit()
    {
        return 64;
    }

    @Override
    public boolean isUsableByPlayer(EntityPlayer entityplayer)
    {
    	return this.world.getTileEntity(this.getPos()) == this && entityplayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D;
    }

    @Override
    public boolean isItemValidForSlot(int slotID, ItemStack itemStack)
    {
        if (slotID == 0)
        {
            return itemStack != ItemStack.EMPTY && ItemElectricBase.isElectricItem(itemStack.getItem());
        }
        else if (slotID >= 2)
        {
        	if (this.producingStack != ItemStack.EMPTY)
        	{
                ItemStack stackInSlot = this.getStackInSlot(slotID);
                return stackInSlot != ItemStack.EMPTY && stackInSlot.isItemEqual(itemStack);
        	}
        	return this.isItemCompressorInput(itemStack, slotID - 2);
        }

        return false;
    }

    @Override
    public int[] getSlotsForFace(EnumFacing side)
    {
    	if (side == EnumFacing.DOWN)
        {
            return new int[] { 1 };
        }

    	int[] slots = new int[] { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
    	ArrayList<Integer> removeSlots = new ArrayList();

    	for (int i = 2; i < 11; i++)
    	{
			if (removeSlots.contains(i)) continue;

    		ItemStack stack1 = this.getStackInSlot(i);
    		if (stack1.isEmpty()) continue;

    		for (int j = i + 1; j < 11; j++)
    		{
    			if (removeSlots.contains(j)) continue;

    			ItemStack stack2 = this.getStackInSlot(j);
    			if (stack2.isEmpty()) continue;

    			if (stack1.isItemEqual(stack2))
    			{
    				if (stack2.getCount() >= stack1.getCount())
    					removeSlots.add(j);
    				else
    					removeSlots.add(i);
    				break;
    			}
    		}
    	}

    	if (removeSlots.size() > 0)
    	{
    		int[] returnSlots = new int[slots.length - removeSlots.size()];
        	int j = 0;
        	for (int i = 0; i < slots.length; i++)
        	{
    			if (i > 0 && removeSlots.contains(slots[i])) { continue; }
    			returnSlots[j] = slots[i];
    			j++;
        	}

        	return returnSlots;
    	}

    	return slots;
    }

    @Override
    public boolean canInsertItem(int slotID, ItemStack par2ItemStack, EnumFacing par3)
    {
    	return this.isItemValidForSlot(slotID, par2ItemStack);
    }

    @Override
    public boolean canExtractItem(int slotID, ItemStack par2ItemStack, EnumFacing par3)
    {
        return slotID == 1;
    }

    @Override
    public boolean shouldUseEnergy()
    {
        return this.processTicks > 0;
    }

    @Override
    public ItemStack getBatteryInSlot()
    {
        return this.getStackInSlot(0);
    }

    public boolean isItemCompressorInput(ItemStack stack, int id)
    {
        for (IRecipe recipe : RocketAssemblyRecipes.getRecipeList())
        {
            if (recipe instanceof ShapedRecipesGC)
            {
            	if (id >= ((ShapedRecipesGC) recipe).recipeItems.length) continue;
            	ItemStack itemstack1 = ((ShapedRecipesGC) recipe).recipeItems[id];
                if (stack.getItem() == itemstack1.getItem() && (itemstack1.getItemDamage() == 32767 || stack.getItemDamage() == itemstack1.getItemDamage()))
                {
                	for (int i = 0; i < ((ShapedRecipesGC) recipe).recipeItems.length; i++)
                	{
                		if (i == id) continue;
                        ItemStack itemstack2 = ((ShapedRecipesGC) recipe).recipeItems[i];
                        if (stack.getItem() == itemstack2.getItem() && (itemstack2.getItemDamage() == 32767 || stack.getItemDamage() == itemstack2.getItemDamage()))
                        {
                        	ItemStack is3 = this.getStackInSlot(id + 3);
                        	ItemStack is4 = this.getStackInSlot(i + 3);
                        	return is3.isEmpty() || !is4.isEmpty() && is3.getCount() < is4.getCount();
                        }
                	}
                	return true;
                }
            }
            else if (recipe instanceof ShapelessOreRecipeGC)
            {
                ArrayList<Object> required = new ArrayList<Object>(((ShapelessOreRecipeGC) recipe).getInput());

                Iterator<Object> req = required.iterator();

                int match = 0;

                while (req.hasNext())
                {
                    Object next = req.next();

                    if (next instanceof ItemStack)
                    {
                        if ( OreDictionary.itemMatches((ItemStack)next, stack, false)) match++;
                    }
                    else if (next instanceof ArrayList)
                    {
                        Iterator<ItemStack> itr = ((ArrayList<ItemStack>)next).iterator();
                        while (itr.hasNext())
                        {
                            if (OreDictionary.itemMatches(itr.next(), stack, false))
                            {
                            	match++;
                            	break;
                            }
                        }
                    }
                }

                if (match == 0) continue;

                if (match == 1) return true;

                //Shapeless recipe can go into (match) number of slots
                int slotsFilled = 0;
                for (int i = 3; i < 12; i++)
                {
                	ItemStack inMatrix = this.getStackInSlot(i);
                	if (!inMatrix.isEmpty() && inMatrix.isItemEqual(stack))
                		slotsFilled++;
                }
                if (slotsFilled < match)
                {
                	return this.getStackInSlot(id + 3).isEmpty();
                }

                return rand.nextInt(match) == 0;
            }
        }

        return false;
    }

    @Override
	public EnumFacing getElectricInputDirection() {
		return getFront().rotateY();
	}

	@Override
	public EnumFacing getFront() {
		IBlockState state = this.world.getBlockState(getPos());
		if (state.getBlock() instanceof BlockRocketAssembler) {
			return state.getValue(BlockRocketAssembler.FACING);
		}
		return EnumFacing.NORTH;
	}
}


text:
package org.openqa.selenium.safari;

import com.google.auto.service.AutoService;

import org.openqa.selenium.Capabilities;
import org.openqa.selenium.ImmutableCapabilities;
import org.openqa.selenium.SessionNotCreatedException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebDriverInfo;

import java.util.Optional;

import static org.openqa.selenium.remote.Browser.SAFARI;
import static org.openqa.selenium.remote.CapabilityType.BROWSER_NAME;

@AutoService(WebDriverInfo.class)
public class SafariDriverInfo implements WebDriverInfo {

  @Override
  public String getDisplayName() {
    return "Safari";
  }

  @Override
  public Capabilities getCanonicalCapabilities() {
    return new ImmutableCapabilities(BROWSER_NAME, SAFARI.browserName());
  }

  @Override
  public boolean isSupporting(Capabilities capabilities) {
    if (SAFARI.is(capabilities)) {
      return true;
    }

    return capabilities.asMap().keySet().parallelStream()
      .map(key -> key.startsWith("safari:"))
      .reduce(Boolean::logicalOr)
      .orElse(false);
  }

  @Override
  public boolean isSupportingCdp() {
    return false;
  }

  @Override
  public boolean isAvailable() {
    try {
      SafariDriverService.createDefaultService();
      return true;
    } catch (IllegalStateException | WebDriverException e) {
      return false;
    }
  }

  @Override
  public int getMaximumSimultaneousSessions() {
    return 1;
  }

  @Override
  public Optional<WebDriver> createDriver(Capabilities capabilities)
      throws SessionNotCreatedException {
    if (!isAvailable()) {
      return Optional.empty();
    }

    return Optional.of(new SafariDriver(new SafariOptions().merge(capabilities)));
  }
}


text:
Version 1.2.0 (16-03-2015)
=====================================

Thanks to Christian Long (@christianmlong)
*   ``mkvirtualenv`` hooks


text:
package io.novaordis.playground.wildfly.hornetq.util;

import java.util.TimerTask;
import java.util.concurrent.atomic.AtomicLong;

public class MessageReceivedReporter extends TimerTask
{
    // Constants -------------------------------------------------------------------------------------------------------

    // Static ----------------------------------------------------------------------------------------------------------

    // Attributes ------------------------------------------------------------------------------------------------------

    private long reportedSoFar;
    private AtomicLong messageReceived;

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

    public MessageReceivedReporter(AtomicLong messageReceived)
    {
        this.messageReceived = messageReceived;
    }

    // TimerTask implementation ---------------------------------------------------------------------------------------

    @Override
    public void run()
    {
        long total = messageReceived.get();
        System.out.println(total - reportedSoFar);
        reportedSoFar = total;
    }

    // Public ----------------------------------------------------------------------------------------------------------

    // Package protected -----------------------------------------------------------------------------------------------

    // Protected -------------------------------------------------------------------------------------------------------

    // Private ---------------------------------------------------------------------------------------------------------

    // Inner classes ---------------------------------------------------------------------------------------------------

}


text:
package com.munepuyo.enums;

import java.nio.charset.Charset;

/**
 *
 * Enums of Charset
 *
 * @author munepuyo
 *
 */
public enum EnumCharset {
	UTF8 (Charset.forName("UTF-8")),
	CP932 (Charset.forName("Windows-31J")),
	SJIS (Charset.forName("Shift-JIS")),
	EUC_JP (Charset.forName("EUC-JP")),
	JIS (Charset.forName("ISO-2022-JP")),
	Latain1 (Charset.forName("ISO-8859-1")),
	;

	private Charset charset;
	private EnumCharset(Charset charset) {
		this.charset = charset;
	}

	public Charset getCharset() {
		return this.charset;
	}
}


text:
"""
@brief Run QuickBot class for Beaglebone Black
***
@author Rowland O'Flaherty (rowlandoflaherty.com)
@date 02/07/2014
@version: 1.0
@copyright: Copyright (C) 2014, Georgia Tech Research Corporation see the LICENSE file included with this software (see LINENSE file)
"""

import sys
import time
from QuickBot import *

print "Running QuickBot"

baseIP = '192.168.0.3'
robotIP = '192.168.0.15'

if len(sys.argv) > 3:
    print 'Invalid number of command line arguments.'
    print 'Proper syntax:'
    print '>> QuickBotRun.py baseIP robotIP'
    print 'Example:'
    print '>> QuickBotRun.py ', baseIP, ' ', robotIP
    sys.exit()

if len(sys.argv) >= 2:
    baseIP = sys.argv[1]

if len(sys.argv) >= 3:
    robotIP = sys.argv[2]

print 'Running QuickBot Program'
print '    Base IP: ', baseIP
print '    Robot IP: ', robotIP

QB = QuickBot(baseIP, robotIP)
QB.run()


text:
layout: community_section
breadcrumb: Community
---

# Mesos User Groups

Mesos User Groups (MUGs) are responsible for organizing local meetups, hackathons, and other events to foster the adoption of Mesos and support its community.

## Local Groups

### China
* [Shanghai](http://www.weibo.com/u/3068800961)
* [Shenzhen](http://www.meetup.com/Shenzhen-Mesos-User-Group/)
* [Xian](http://www.meetup.com/Xian-Mesos-User-Group/)

### France
* [Paris](http://www.meetup.com/Paris-Mesos-Users-Group/)

### Germany
* [Berlin](http://www.meetup.com/Berlin-Mesos-User-Group/)
* [Cologne](http://www.meetup.com/Mesos-User-Group-Cologne/)
* [Hamburg](http://www.meetup.com/Hamburg-Mesos-User-Group/)

### India
* [Bangalore](http://www.meetup.com/Bangalore-Mesos-User-Group/)
* [Pune](http://www.meetup.com/Pune-Mesos-Users-Group/)

### Japan
* [Tokyo](https://mesos.connpass.com/)

### Netherlands
* [Amsterdam](http://www.meetup.com/Mesos-Amsterdam/)

### Poland
* [Warsaw](http://www.meetup.com/Warsaw-Mesos-User-Group/)

### United Kingdom
* [London](http://www.meetup.com/London-Mesos-User-Group/)

### USA
* [Atlanta, GA](http://www.meetup.com/mesosatl/)
* [Dallas, TX](http://www.meetup.com/Metroplex-Mesos-Group/)
* [Denver, CO](http://www.meetup.com/Denver-Mesos-User-Group/)
* [Los Angeles / Santa Monica, CA](http://www.meetup.com/Los-Angeles-Santa-Monica-Mesos-Users-Group/)
* [New York, NY](http://www.meetup.com/Apache-Mesos-NYC-Meetup/)
* [Raleigh/Durham, NC](http://www.meetup.com/Triangle-Area-Mesos-User-Group/)
* [San Francisco, CA](http://www.meetup.com/Bay-Area-Mesos-User-Group/)
* [Seattle, WA](http://www.meetup.com/Seattle-Mesos-Meetup/)

## Start Your Own MUG

It's easy. If you're interested in organizing a MUG in your city, share your interest on the user mailing list (user@mesos.apache.org) and we'll add you to our list. MUGs typically use Meetup.com or Twitter to coordinate. We encourage groups to be organized by at least two organizations, and share responsibility for hosting and organizing events.


text:
package br.com.six2six.template;

import br.com.six2six.fixturefactory.Fixture;
import br.com.six2six.fixturefactory.Rule;
import br.com.six2six.fixturefactory.loader.TemplateLoader;
import br.com.six2six.fixturefactory.model.City;
import br.com.six2six.fixturefactory.model.Neighborhood;
import br.com.six2six.fixturefactory.model.Route;
import br.com.six2six.fixturefactory.model.RouteId;

public class RouteTemplate implements TemplateLoader {

	@Override
	public void load() {
		Fixture.of(Route.class).addTemplate("routeWithDifferentCities", new Rule() {{
			add("id", one(RouteId.class, "valid"));
    		add("cities", has(2).of(City.class, "saoPaulo", "rioDeJaneiro"));
		}});

		Fixture.of(City.class).addTemplate("saoPaulo", new Rule() {{
	        add("name", "São Paulo");
	        add("neighborhoods", has(2).of(Neighborhood.class, "valid"));
	    }}).addTemplate("rioDeJaneiro", new Rule() {{
	    	add("name", "Rio de Janeiro");
	        add("neighborhoods", has(2).of(Neighborhood.class, "valid"));
	    }});
	}

}


text:
stelligent_commons
==================

Scripts and other utilities we commonly use at Stelligent

# Development Environment
Check out the [wiki](https://github.com/stelligent/stelligent_commons/wiki/Development-Environment-Setup) for some development environment options.

# VPC Networking

## Basic Usage to create a VPC

Prerequisites: Ruby 2.1 with Bundler should be installed.

1. From the stelligent_commons root directory, run:

        bundle install

2. Run one of the example scripts under the bin directory to generate a CloudFormation template.  The name of the script
   roughly reflects the type of VPC it is going to create.

        bin/generate_private_vpc > private_vpc_cfn_template.json
        bin/generate_3az_vpc --ip-to-allow-to-bastion xx.xx.xx.xx --nat-keypair-name key-name --bastion-keypair-name key-name > 3az_vpc_cfn_template.json
        bin/generate_typical_2az_vpc --ip-to-allow-to-bastion xx.xx.xx.xx --nat-keypair-name key-name --bastion-keypair-name key-name > 2az_vpc_cfn_template.json
NOTE: --nat-keypair-name and --bastion-keypair-name are optional and will default to 'nat_keypair' and 'bastion_keypair', respectively.

3. Feed the template to CloudFormation through the method of choice: AWS CLI, console, or use the CfnExecutor object.

## Customizing the created VPC

The VpcCfnGenerator is meant to be flexible enough (at the cost of a fair amount of complexity and over-engineering!?!??) to create a variety of different
VPC configurations.  The typical customization will be to set the cidr blocks and to decide how many subnets of each type to
create (public, natt-ed, private).

The basic tool is meant more for a developer to use instead of an "end user", but calls to VpcCfnGenerator
should be wrapped up in a one-click script that can be incorporated into a deployment pipeline or just used by an arbitrary person
without programming experience.

It would also be possible to make an elaborate CLI interface to exercise the API if desired.

To create a new script, one can use the examples in the bin directory as a starting point.  From here you can either add
command line arguments or customize the VPC created as desired.  The basic flow of the script is:

0. Elicit any command line arguments such as IP addresses of hosts that should be allowed ingress on port 22 to the bastion
1. Construct a VpcDescription object

      This is where all the customizations will happen.  More subnets, less subnets, different masks, etc. Include
      a bastion, don't include one, etc.

2. Construct a VpcCfnGenerator object
3. Execute emit against VpcCfnGenerator

## Extending the VpcCfnGenerator and further work

* would be good to add support for an OpenVPN server
* setup HA NAT
* setup HA OpenVPN
* the implementation for VpcCfnGenerator is "brute force" at this point.  Perhaps interesting to decompose into a better dsl that encapsulates some of the horrific hash building

## Testing the created VPC

In order to test that the created VPC matches expectations, serverspec + stelligent/serverspec-aws-resources can be
used to specify the expectations.  For the three stock scripts, there are matching serverspec specifications
under serverspec/default.

To execute them, you must pass in the VPC_ID for all tests, and then BASTION_INGRESS except for the private VPC which has no bastion.
The SPEC_OPTS setting will use tags to determine which test to run - so pick the tag according to which script you have run previously.
If you have yet to actually construct a VPC to test, these tests should fail pretty much across the board depending on
what VPC_ID is specified.

    bundle install
    VPC_ID=vpc-xxxxx BASTION_INGRESS=xx.xx.xx.xx SPEC_OPTS="-t basic_two_az" bundle exec rake serverspec
    VPC_ID=vpc-xxxxx BASTION_INGRESS=xx.xx.xx.xx SPEC_OPTS="-t three_az" bundle exec rake serverspec
    VPC_ID=vpc-xxxxx SPEC_OPTS="-t private" bundle exec rake serverspec

## Running unit tests against VpcCfnGenerator
    bundle exec rspec


text:
package im.actor.messenger.app.fragment.main;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;

import im.actor.android.view.BindedViewHolder;
import im.actor.messenger.R;
import im.actor.messenger.app.util.Screen;
import im.actor.messenger.app.view.AvatarView;
import im.actor.messenger.app.view.Fonts;
import im.actor.messenger.app.view.OnItemClickedListener;
import im.actor.messenger.app.view.SearchHighlight;
import im.actor.model.entity.SearchEntity;

/**
 * Created by ex3ndr on 05.04.15.
 */
public class SearchHolder extends BindedViewHolder {

    private AvatarView avatar;
    private TextView title;
    private View separator;
    private SearchEntity entity;

    private int highlightColor;

    public SearchHolder(Context context, final OnItemClickedListener<SearchEntity> clickedListener) {
        super(new FrameLayout(context));

        itemView.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));

        highlightColor = context.getResources().getColor(R.color.primary);

        avatar = new AvatarView(context);
        avatar.init(Screen.dp(52), 24);
        {
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(Screen.dp(52), Screen.dp(52));
            layoutParams.leftMargin = Screen.dp(12);
            layoutParams.topMargin = Screen.dp(6);
            layoutParams.bottomMargin = Screen.dp(6);
            layoutParams.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
            ((ViewGroup) itemView).addView(avatar, layoutParams);
        }

        title = new TextView(context);
        title.setTextColor(context.getResources().getColor(R.color.text_primary));
        title.setPadding(Screen.dp(74), 0, Screen.dp(12), 0);
        title.setTextSize(16);
        title.setSingleLine(true);
        title.setEllipsize(TextUtils.TruncateAt.END);
        title.setTypeface(Fonts.regular());
        {
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
            layoutParams.gravity = Gravity.CENTER_VERTICAL;
            layoutParams.topMargin = Screen.dp(10);
            layoutParams.bottomMargin = Screen.dp(10);
            ((ViewGroup) itemView).addView(title, layoutParams);
        }

        separator = new View(context);
        separator.setBackgroundColor(context.getResources().getColor(R.color.chats_divider));
        {
            FrameLayout.LayoutParams divLayoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                    context.getResources().getDimensionPixelSize(R.dimen.div_size));
            divLayoutParams.leftMargin = Screen.dp(74);
            divLayoutParams.rightMargin = Screen.dp(12);
            divLayoutParams.gravity = Gravity.BOTTOM;
            ((ViewGroup) itemView).addView(separator, divLayoutParams);
        }

        itemView.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.selector_fill));
        itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                clickedListener.onClicked(entity);
            }
        });
    }

    public void bind(SearchEntity entity, String query, boolean isLast) {
        this.entity = entity;

        avatar.bind(entity.getAvatar(), entity.getTitle(), entity.getPeer().getPeerId());
        if (query != null) {
            title.setText(SearchHighlight.highlightQuery(entity.getTitle(), query, highlightColor));
        } else {
            title.setText(entity.getTitle());
        }

        if (isLast) {
            separator.setVisibility(View.GONE);
        } else {
            separator.setVisibility(View.VISIBLE);
        }
    }
}


text:
package commands;

import annotations.Cmd;
import exceptions.UsageException;

/**
 * Prints the name of the present working directory.
 *
 * @author Jason Campos <jcampos8782@gmail.com>
 */
@Cmd("pwd")
public class Pwd extends AbstractCommand {

	@Override
	public Void call() throws UsageException {
		out.println(System.getProperty("user.dir"));
		return null;
	}
}


text:
title: Cake v0.38.0 released
category: Release Notes
author: gep13
---

Version 0.38.0 of Cake has been released.

In this version we've got a few features and improvements and one bug fix, full list of changes at end of this post

One of the main features is the enabling of ANSI escape codes. Cake will now automatically detect whether a CI system supports ANSI escape codes, and if it does it will use them, rather than using System.Console.ForegroundColor, or similar.  This gives a much richer output on systems such as GitHub Actions.

Within the timeframe of this release, we were very happy to welcome [Enrico Campidoglio](https://github.com/ecampidoglio) into the Cake Team.  Enrico is the person behind the creation of the [GitHub Action for Cake](https://github.com/cake-build/cake-action), which has now been brought into the Cake GitHub Organisation.  We are very grateful to Enrico for the work in creating this action!  Welcome to the Team!

🍰Huge thanks to our community! It wouldn't have been possible without your support and contributions!❤

Contributions were included from:

- [devlead](https://github.com/devlead)
- [gitfool](https://github.com/gitfool)
- [Roemer](https://github.com/Roemer)
- [Marusyk](https://github.com/Marusyk)
- [kcamp](https://github.com/kcamp)
- [bernarden](https://github.com/bernarden)
- [janniksam](https://github.com/janniksam)
- [pascalberger](https://github.com/pascalberger)
- [Myoxocephalus](https://github.com/Myoxocephalus)
- [gep13](https://github.com/gep13)
- [patriksvensson](https://github.com/patriksvensson)
- Dave Moor
- [trondhindenes](https://github.com/trondhindenes)

Full details of everything that was included in this release can be seen below.

<!--excerpt-->

### Issues

As part of this release we had [26 issues](https://github.com/cake-build/cake/milestone/65?closed=1) closed.

__Features__

- [__#2784__](https://github.com/cake-build/cake/issues/2784) Add NuGet Delete functionality.
- [__#2749__](https://github.com/cake-build/cake/issues/2749) Add support for ANSI escape codes.
- [__#2728__](https://github.com/cake-build/cake/issues/2728) Add dotnet NuGet source commands.
- [__#2718__](https://github.com/cake-build/cake/issues/2718) Add binary logger to dotnet MSBuild settings.

__Improvements__

- [__#2785__](https://github.com/cake-build/cake/issues/2785) Provide additional logging for tool resolver.
- [__#2778__](https://github.com/cake-build/cake/issues/2778) Update Roslyn to 3.6.0.
- [__#2768__](https://github.com/cake-build/cake/issues/2768) Add an option to skip the default warning/error output when running JetBrains command line tools.
- [__#2764__](https://github.com/cake-build/cake/issues/2764) Additional Jenkins information.
- [__#2752__](https://github.com/cake-build/cake/issues/2752) MSTestRunner prioritizes VS2017 over VS2019.
- [__#2745__](https://github.com/cake-build/cake/issues/2745) Extend XmlPeekSettings with FileShare.* option.
- [__#2733__](https://github.com/cake-build/cake/issues/2733) NuGetSetApiKey with Verbosity set to Quiet causes an exception.
- [__#2730__](https://github.com/cake-build/cake/pull/2730) Better handling for GitVersion failure cases.
- [__#2715__](https://github.com/cake-build/cake/issues/2715) Add missing dotnet NuGet command options.
- [__#2714__](https://github.com/cake-build/cake/issues/2714) Squash warning when skip package version check.
- [__#2710__](https://github.com/cake-build/cake/issues/2710) Add GitHub Actions GITHUB_RUN_ID & GITHUB_RUN_NUMBER.
- [__#2658__](https://github.com/cake-build/cake/issues/2658) Rename TFBuild alias to AzurePipelines.
- [__#2077__](https://github.com/cake-build/cake/issues/2077) Locating the correct vstest.console.exe (VS2017).

__Documentation__

- [__#2735__](https://github.com/cake-build/cake/issues/2735) Improve documentation for MSBuild alias to make clear that also MSBuild projects can be passed.

__Build__

- [__#2777__](https://github.com/cake-build/cake/issues/2777) Add additional tests for Cake.Core.IO.
- [__#2773__](https://github.com/cake-build/cake/issues/2773) Bump .NET Core SDK to 3.1.300.
- [__#2770__](https://github.com/cake-build/cake/issues/2770) Bump Cake script dependencies.
- [__#2766__](https://github.com/cake-build/cake/issues/2766) Update to .NET Core SDK 3.1.202.
- [__#2759__](https://github.com/cake-build/cake/issues/2759) Update to .NET Core SDK 3.1.201.
- [__#2739__](https://github.com/cake-build/cake/issues/2739) Bump .NET Core SDK to 3.1.200.
- [__#2378__](https://github.com/cake-build/cake/issues/2378) Publish Cake packages with symbols and EmbedAllSources or SourceLink.

__Bug__

- [__#2721__](https://github.com/cake-build/cake/issues/2721) NuGet package name/path should be added in quotes .


text:
package com.jivesoftware.robot.intellij.plugin.parser;

import com.jivesoftware.robot.intellij.plugin.lang.RobotPsiFile;
import com.jivesoftware.robot.intellij.plugin.psi.RobotTestCase;
import com.jivesoftware.robot.intellij.plugin.psi.RobotTestCaseTimeoutMeta;
import com.jivesoftware.robot.intellij.plugin.psi.RobotTestCasesTable;
import org.junit.Test;

/**
 * Created by charlescapps on 12/6/14.
 */
public class TimeoutValueTests extends RobotParserTest {
    public static final String TIMEOUT_TEST_CASES =
            "*** Test Cases***\n" +
            "Timeout Test 1\n" +
            "    [Timeout]   1 min 30 secs\n" +
            "    Log         Foo1\n" +
            "\n" +
            "Timeout Test 2\n" +
            "    [Timeout]   1min30secs\n" +
            "    Log         Foo2\n" +
            "\n" +
            "Timeout Test 3\n" +
            "    [Timeout]   1 m 30 s\n" +
            "    Log         Foo3\n" +
            "\n" +
            "Timeout Test 4\n" +
            "    [Timeout]   1m30s\n" +
            "    Log         Foo4\n" +
            "\n" +
            "Timeout Test 5\n" +
            "    [Timeout]   -1m30s\n" +
            "    Log         Foo5\n" +
            "\n" +
            "Timeout Test 6\n" +
            "    [Timeout]   -1.23\n" +
            "    Log         Foo6\n" +
            "\n" +
            "Timeout Test 7\n" +
            "    [Timeout]   00\n" +
            "    Log         Foo6";

    private static final String LONG_UNITS_PLURAL =
            "*** Test Cases ***\n" +
            "Test All Units Plural\n" +
            "    [Timeout]  0.1 days 0.2 hours 0.3 minutes 0.4 seconds 0.5 milliseconds\n" +
            "    Log  FOO\n";

    private static final String LONG_UNITS_SINGULAR =
            "*** Test Cases ***\n" +
            "Test All Units Singular\n" +
            "    [Timeout]  0.1 day 0.2 hour 0.3 minute 0.4 second 0.5 millisecond\n" +
            "    Log  FOO\n";

    // TODO: We could test all the possible units

    @Test
    public void testManyTimeoutValues() {
        RobotPsiFile file = doTestParseSucceeds(TIMEOUT_TEST_CASES);
        assertFileHasPsiElements(file, RobotTestCasesTable.class, 1);
        assertFileHasPsiElements(file, RobotTestCase.class, 7);
        assertFileHasPsiElements(file, RobotTestCaseTimeoutMeta.class, 7);
    }

    @Test
    public void testLongUnitsPlural() {
        RobotPsiFile file = doTestParseSucceeds(LONG_UNITS_PLURAL);
        assertFileHasPsiElements(file, RobotTestCasesTable.class, 1);
        assertFileHasPsiElements(file, RobotTestCase.class, 1);
        assertFileHasPsiElements(file, RobotTestCaseTimeoutMeta.class, 1);
    }

    @Test
    public void testLongUnitsSingular() {
        RobotPsiFile file = doTestParseSucceeds(LONG_UNITS_SINGULAR);
        assertFileHasPsiElements(file, RobotTestCasesTable.class, 1);
        assertFileHasPsiElements(file, RobotTestCase.class, 1);
        assertFileHasPsiElements(file, RobotTestCaseTimeoutMeta.class, 1);
    }
}


text:
// - -------------------------------------------------------------------- - //

var app = angular.module("BonsaiTasks",["ngTouch"]);

app.run(function($window,$rootScope,Lang) {

  // Applies language resources.
  $rootScope.lang = Lang;

  function hideSplash() {
    var elm = $window.document.getElementById("splash-style");
    if (elm) {
      angular.element(elm).remove();
    }
  }

  // Doesn't use the ApplicationCache if running from local file.
  // This is necessary to support atom-shell distribution.
  if ($window.location.protocol === "file:") {
    hideSplash();
  } else {
    var appCache = $window.applicationCache;
    if (appCache.status === appCache.UNCACHED) {
      appCache.update();
    }
    appCache.addEventListener("cached",hideSplash);
    appCache.addEventListener("noupdate",hideSplash);
    appCache.addEventListener("error",function() {
      hideSplash();
    });
    appCache.addEventListener("obsolete",function() {
      appCache.update();
    });
    appCache.addEventListener("updateready",function() {
      appCache.swapCache();
      $window.location.reload();
    });
  }

});

// - -------------------------------------------------------------------- - //


text:
@custom_value = @doc[@value] if @doc[@value] != nil and @doc[@value].kind_of? String
@custom_value = @doc['content'] if @custom_value == nil


text:
Integration with FOSUserBundle
------------------------------

>If you still want to use the FOSUserBudle form login add the "chainprovider" configuration parameter to your security.yml
>
>      providers:
>        chainprovider:
>           chain:
>               providers: [fos_user_bundle, my_fos_facebook_provider]
>        fos_user_bundle: ...
>        my_fos_facebook_provider: ...

This requires adding a service for the custom user provider which is then set
to the provider id in the "provider" section in the config.yml:
  ```
    services:
        my.facebook.user:
            class: Acme\MyBundle\Security\User\Provider\FacebookProvider
            arguments:
                facebook: "@fos_facebook.api"
                userManager: "@fos_user.user_manager"
                validator: "@validator"
                container: "@service_container"

  ```
    <?php

    namespace Acme\MyBundle\Security\User\Provider;

    use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
    use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
    use Symfony\Component\Security\Core\User\UserProviderInterface;
    use Symfony\Component\Security\Core\User\UserInterface;
    use \BaseFacebook;
    use \FacebookApiException;

    class FacebookProvider implements UserProviderInterface
    {
        /**
         * @var \Facebook
         */
        protected $facebook;
        protected $userManager;
        protected $validator;

        public function __construct(BaseFacebook $facebook, $userManager, $validator)
        {
            $this->facebook = $facebook;
            $this->userManager = $userManager;
            $this->validator = $validator;
        }

        public function supportsClass($class)
        {
            return $this->userManager->supportsClass($class);
        }

        public function findUserByFbId($fbId)
        {
            return $this->userManager->findUserBy(array('facebookId' => $fbId));
        }

        public function loadUserByUsername($username)
        {
            $user = $this->findUserByFbId($username);

            try {
                $fbdata = $this->facebook->api('/me');
            } catch (FacebookApiException $e) {
                $fbdata = null;
            }

            if (!empty($fbdata)) {
                if (empty($user)) {
                    $user = $this->userManager->createUser();
                    $user->setEnabled(true);
                    $user->setPassword('');
                }

                // TODO use http://developers.facebook.com/docs/api/realtime
                $user->setFBData($fbdata);

                if (count($this->validator->validate($user, 'Facebook'))) {
                    // TODO: the user was found obviously, but doesnt match our expectations, do something smart
                    throw new UsernameNotFoundException('The facebook user could not be stored');
                }
                $this->userManager->updateUser($user);
            }

            if (empty($user)) {
                throw new UsernameNotFoundException('The user is not authenticated on facebook');
            }

            return $user;
        }

        public function refreshUser(UserInterface $user)
        {
            if (!$this->supportsClass(get_class($user)) || !$user->getFacebookId()) {
                throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user)));
            }

            return $this->loadUserByUsername($user->getFacebookId());
        }
    }

Finally one also needs to add a getFacebookId() and setFBData() method to the User model.
The following example also adds "firstname" and "lastname" properties, using the Doctrine ORM:

    <?php

    namespace Acme\MyBundle\Entity;

    use FOS\UserBundle\Entity\User as BaseUser;
    use Doctrine\ORM\Mapping as ORM;

    class User extends BaseUser
    {
        /**
         * @var string
         *
         * @ORM\Column(name="firstname", type="string", length=255)
         */
        protected $firstname;

        /**
         * @var string
         *
         * @ORM\Column(name="lastname", type="string", length=255)
         */
        protected $lastname;

        /**
         * @var string
         *
         * @ORM\Column(name="facebookId", type="string", length=255)
         */
        protected $facebookId;

        public function serialize()
        {
            return serialize(array($this->facebookId, parent::serialize()));
        }

        public function unserialize($data)
        {
            list($this->facebookId, $parentData) = unserialize($data);
            parent::unserialize($parentData);
        }

        /**
         * @return string
         */
        public function getFirstname()
        {
            return $this->firstname;
        }

        /**
         * @param string $firstname
         */
        public function setFirstname($firstname)
        {
            $this->firstname = $firstname;
        }

        /**
         * @return string
         */
        public function getLastname()
        {
            return $this->lastname;
        }

        /**
         * @param string $lastname
         */
        public function setLastname($lastname)
        {
            $this->lastname = $lastname;
        }

        /**
         * Get the full name of the user (first + last name)
         * @return string
         */
        public function getFullName()
        {
            return $this->getFirstname() . ' ' . $this->getLastname();
        }

        /**
         * @param string $facebookId
         * @return void
         */
        public function setFacebookId($facebookId)
        {
            $this->facebookId = $facebookId;
            $this->setUsername($facebookId);
            $this->salt = '';
        }

        /**
         * @return string
         */
        public function getFacebookId()
        {
            return $this->facebookId;
        }

        /**
         * @param Array
         */
        public function setFBData($fbdata)
        {
            if (isset($fbdata['id'])) {
                $this->setFacebookId($fbdata['id']);
                $this->addRole('ROLE_FACEBOOK');
            }
            if (isset($fbdata['first_name'])) {
                $this->setFirstname($fbdata['first_name']);
            }
            if (isset($fbdata['last_name'])) {
                $this->setLastname($fbdata['last_name']);
            }
            if (isset($fbdata['email'])) {
                $this->setEmail($fbdata['email']);
            }
        }
    }


text:
#include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */

#include "dcmtk/dcmdata/dcvrae.h"

#define MAX_AE_LENGTH 16

// ********************************

DcmApplicationEntity::DcmApplicationEntity(const DcmTag &tag,
                                           const Uint32 len)
  : DcmByteString(tag, len)
{
    setMaxLength(MAX_AE_LENGTH);
    setNonSignificantChars(" \\");
}

DcmApplicationEntity::DcmApplicationEntity(const DcmApplicationEntity &old)
  : DcmByteString(old)
{
}

DcmApplicationEntity::~DcmApplicationEntity()
{
}

DcmApplicationEntity &DcmApplicationEntity::operator=(const DcmApplicationEntity &obj)
{
    DcmByteString::operator=(obj);
    return *this;
}

OFCondition DcmApplicationEntity::copyFrom(const DcmObject& rhs)
{
  if (this != &rhs)
  {
    if (rhs.ident() != ident()) return EC_IllegalCall;
    *this = OFstatic_cast(const DcmApplicationEntity &, rhs);
  }
  return EC_Normal;
}

// ********************************

DcmEVR DcmApplicationEntity::ident() const
{
    return EVR_AE;
}

OFCondition DcmApplicationEntity::checkValue(const OFString &vm,
                                             const OFBool /*oldFormat*/)
{
    OFString strVal;
    /* get "raw value" without any modifications (if possible) */
    OFCondition l_error = getStringValue(strVal);
    if (l_error.good())
        l_error = DcmApplicationEntity::checkStringValue(strVal, vm);
    return l_error;
}

// ********************************

OFCondition DcmApplicationEntity::getOFString(OFString &stringVal,
                                              const unsigned long pos,
                                              OFBool normalize)
{
    /* call inherited method */
    OFCondition l_error = DcmByteString::getOFString(stringVal, pos, normalize);
    /* normalize string if required */
    if (l_error.good() && normalize)
        normalizeString(stringVal, !MULTIPART, DELETE_LEADING, DELETE_TRAILING);
    return l_error;
}

// ********************************

OFCondition DcmApplicationEntity::checkStringValue(const OFString &value,
                                                   const OFString &vm)
{
    return DcmByteString::checkStringValue(value, vm, "ae", 13, MAX_AE_LENGTH);
}


text:
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)

describe "Numeric#singleton_method_added" do
  it "raises a TypeError when trying to #dup a Numeric" do
    lambda do
      a = NumericSpecs::Subclass.new
      a.dup
    end.should raise_error(TypeError)

    lambda do
      a = 1
      a.dup
    end.should raise_error(TypeError)

    lambda do
      a = 1.5
      a.dup
    end.should raise_error(TypeError)

    lambda do
      a = bignum_value
      a.dup
    end.should raise_error(TypeError)
  end
end


text:
import fields

from base import Model, BaseModel

__all__ = ["fields", "Model", "BaseModel"]


text:
using System;

namespace ExpressMapper.Tests.Model.ViewModels
{
    public class ContactViewModel
    {
        public Guid Id { get; set; }

        public bool IsPerson { get; set; }

        public bool IsOrganization { get; set; }

        protected bool ContactEquals(ContactViewModel other)
        {
            return Id == other.Id && IsPerson == other.IsPerson && IsOrganization == other.IsOrganization;
        }
    }
}


text:
'use strict';

var log = require('loglevel');
var helper = require('pages/blocks/helper');
var blocks = require('pages/blocks/blocks');

module.exports = function ($ctx) {
  log.debug('index.js');
  log.warn('index.js helper', helper());
  log.error('index.js blocks', blocks());

  // fix off-canvas menus
  var tocMenu = $ctx.find('.toc__menu');
  tocMenu.css('position', 'relative');

  var navMenu = $ctx.find('.nav__menu');
  navMenu.css('position', 'relative');
};


text:
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import getAlerts from '../../src/actions/getAlerts';
import nock from 'nock';
import fetch from 'isomorphic-fetch'

const middlewares = [thunk]
const mockStore = configureMockStore(middlewares)

describe('async actions for getAlerts', () => {
  afterEach(() => {
    nock.cleanAll()
  })

  it('creates GET_ALERTS when fetching Alerts has been resolved', () => {

    nock("http://api.openweathermap.org")
      .get("/data/3.0/triggers?appid=698009a4dde62e48490582289f422bd2")
      .reply(200, {})

    const expectedActions = [
      { type: "GET_ALERTS", payload: { unit : "C", object: {} } }
    ]
    const store = mockStore({ todos: [] })

    return store.dispatch(getAlerts('C')).then(() => {

      expect(store.getActions()).toEqual(expectedActions)
    })
  })
})


text:
import { AbstractRegexFilter } from './abstract-regex-filter';

export class No extends AbstractRegexFilter {

    /**
     * Get pattern.
     */
    protected getPattern(): string | RegExp {
        return /^n(o(t|pe)?|ix|ay)?$/i;
    }
}

export default No;


text:
title: Significant Figures
localeTitle: Значимые фигуры
---
## Значимые фигуры

Это заглушка. [Помогите нашему сообществу расширить его](https://github.com/freecodecamp/guides/tree/master/src/pages/mathematics/significant-figures/index.md) .

[Это руководство по быстрому стилю поможет вам принять ваш запрос на тягу](https://github.com/freecodecamp/guides/blob/master/README.md) .

#### Дополнительная информация: