text:
//Fabian Verkuijlen
//Created on: 15/04/2016

using UnityEngine;
using System.Collections.Generic;

public class BlockManager : MonoBehaviour
{
	[SerializeField] private int fieldWidth;
	[SerializeField] private int fieldHeight;
	[SerializeField] private GameObject[] farmStageTiles;
	[SerializeField] private GameObject[] forrestStageTiles;
	[SerializeField] private GameObject[] farmSpecialBlocks;
	[SerializeField] private GameObject[] forrestSpecialBlocks;
	[SerializeField] private GameObject FarmPigUp;
	[SerializeField] private GameObject forrestPigUp;
	private GameObject pigup;
	private GameObject[] specialBlocks;
	private GameObject[] currentStageTiles;
	private int stageID;
	private List<List<Block>> blocks;

	private int normalPercentage = 90;

	[SerializeField] private Transform playerPosition;
	private Vector3 nextLinePosition;

	private int nextLine;
	/// <summary>
	/// Adds the listeners on enable
	/// </summary>
	protected void OnEnable ()
	{
		EventManager.AddListener(StaticEventNames.RESTART, RestartGame);
	}
	/// <summary>
	/// removes the listeners on disable
	/// </summary>
	protected void OnDisable ()
	{
		EventManager.RemoveListener(StaticEventNames.RESTART, RestartGame);
	}
	/// <summary>
	/// Sets the tiles and generates them.
	/// </summary>
	protected void Awake()
	{
		SetOriginTiles ();
		Generation ();
	}
	/// <summary>
	/// Sets the correct tiles so that the right tiles will be selected for generation
	/// </summary>
	private void SetOriginTiles ()
	{
		currentStageTiles = farmStageTiles;
		specialBlocks = farmSpecialBlocks;
		pigup = FarmPigUp;
	}
	/// <summary>
	/// on reset it resets the tiles
	/// </summary>
	private void RestartGame ()
	{
		SetOriginTiles ();
		Reset (true);
	}

	/// <summary>
	/// Generates all the blocks into the game
	/// </summary>
	private void Generation()
	{
		blocks = new List<List<Block>>();
		for (int x = 0; x < fieldWidth; x++)
		{
			List<Block> tempList = new List<Block>();
			for (int y = 0; y < fieldHeight; y++)
			{
				int percentageCounter = Random.Range(0 , 100);
				if (percentageCounter < normalPercentage)
				{
					if (percentageCounter < 3)
					{
						//pig up
						GameObject instantiateBlock = (GameObject) Instantiate (pigup, new Vector2 (transform.position.x + x, transform.position.y - (fieldHeight - y)), Quaternion.identity);
						instantiateBlock.GetComponent<Block> ().Position = new Vector2 (x, y);
						tempList.Add (instantiateBlock.GetComponent<Block> ());
					}
					else
					{
						//normal tile
						GameObject instantiateBlock = (GameObject) Instantiate (currentStageTiles[Random.Range (0, currentStageTiles.Length)], new Vector2 (transform.position.x + x, transform.position.y - (fieldHeight - y)), Quaternion.identity);
						instantiateBlock.GetComponent<Block> ().Position = new Vector2 (x, y);
						tempList.Add (instantiateBlock.GetComponent<Block> ());
					}
				}
				else
				{
					//special tile
					GameObject instantiateBlock = (GameObject) Instantiate (specialBlocks[Random.Range (0, specialBlocks.Length)], new Vector2 (transform.position.x + x, transform.position.y - (fieldHeight - y)), Quaternion.identity);
					instantiateBlock.GetComponent<Block> ().Position = new Vector2 (x, y);
					tempList.Add (instantiateBlock.GetComponent<Block> ());
				}
			}
			blocks.Add(tempList);
		}
	}
	/// <summary>
	/// Sets and holds track of stage ID for the right type of block inspawning
	/// </summary>
	private void UpdateStageID ()
	{
		stageID++;
		if (stageID == 2)
		{
			stageID = 0;
			normalPercentage -= 7;
		}
		switch (stageID)
		{
			case 0:
				currentStageTiles = farmStageTiles;
				specialBlocks = farmSpecialBlocks;
				pigup = FarmPigUp;
			break;
			case 1:
				currentStageTiles = forrestStageTiles;
				specialBlocks = forrestSpecialBlocks;
				pigup = forrestPigUp;
			break;
		}
	}
	/// <summary>
	/// resets stage and generation
	/// </summary>
	/// <param name="restart"></param>
	public void Reset (bool restart)
	{
		if (!restart)
		{
			UpdateStageID ();
		}
		Invoke("Generation", 1f);
		RemoveBlocks();
		nextLine = 0;
		nextLinePosition.y = nextLine;
		blocks = new List<List<Block>>();
	}
	/// <summary>
	/// Removes blocks at certain position.
	/// </summary>
	private void RemoveBlocks ()
	{
		for (int x = 0; x < fieldWidth; x++)
		{
			for (int y = 0; y < fieldHeight; y++)
			{
				if (blocks != null && blocks[x][y])
				{
					Destroy(blocks[x][y].gameObject);
				}
			}
		}
	}
}


text:
/*!
 * Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=729d22883cae23ba78bf)
 * Config saved to config.json and https://gist.github.com/729d22883cae23ba78bf
 */
/*!
 * Bootstrap v3.3.6 (http://getbootstrap.com)
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 */
.btn-default,
.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger {
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
}
.btn-default:active,
.btn-primary:active,
.btn-success:active,
.btn-info:active,
.btn-warning:active,
.btn-danger:active,
.btn-default.active,
.btn-primary.active,
.btn-success.active,
.btn-info.active,
.btn-warning.active,
.btn-danger.active {
  -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}
.btn-default.disabled,
.btn-primary.disabled,
.btn-success.disabled,
.btn-info.disabled,
.btn-warning.disabled,
.btn-danger.disabled,
.btn-default[disabled],
.btn-primary[disabled],
.btn-success[disabled],
.btn-info[disabled],
.btn-warning[disabled],
.btn-danger[disabled],
fieldset[disabled] .btn-default,
fieldset[disabled] .btn-primary,
fieldset[disabled] .btn-success,
fieldset[disabled] .btn-info,
fieldset[disabled] .btn-warning,
fieldset[disabled] .btn-danger {
  -webkit-box-shadow: none;
  box-shadow: none;
}
.btn-default .badge,
.btn-primary .badge,
.btn-success .badge,
.btn-info .badge,
.btn-warning .badge,
.btn-danger .badge {
  text-shadow: none;
}
.btn:active,
.btn.active {
  background-image: none;
}
.btn-default {
  background-image: -webkit-linear-gradient(top, #eb6c5f 0%, #e43a29 100%);
  background-image: -o-linear-gradient(top, #eb6c5f 0%, #e43a29 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#eb6c5f), to(#e43a29));
  background-image: linear-gradient(to bottom, #eb6c5f 0%, #e43a29 100%);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffeb6c5f', endColorstr='#ffe43a29', GradientType=0);
  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
  background-repeat: repeat-x;
  border-color: #e33220;
  text-shadow: 0 1px 0 #fff;
  border-color: #ccc;
}
.btn-default:hover,
.btn-default:focus {
  background-color: #e43a29;
  background-position: 0 -15px;
}
.btn-default:active,
.btn-default.active {
  background-color: #e43a29;
  border-color: #e33220;
}
.btn-default.disabled,
.btn-default[disabled],
fieldset[disabled] .btn-default,
.btn-default.disabled:hover,
.btn-default[disabled]:hover,
fieldset[disabled] .btn-default:hover,
.btn-default.disabled:focus,
.btn-default[disabled]:focus,
fieldset[disabled] .btn-default:focus,
.btn-default.disabled.focus,
.btn-default[disabled].focus,
fieldset[disabled] .btn-default.focus,
.btn-default.disabled:active,
.btn-default[disabled]:active,
fieldset[disabled] .btn-default:active,
.btn-default.disabled.active,
.btn-default[disabled].active,
fieldset[disabled] .btn-default.active {
  background-color: #e43a29;
  background-image: none;
}
.btn-primary {
  background-image: -webkit-linear-gradient(top, #e75142 0%, #d12b1a 100%);
  background-image: -o-linear-gradient(top, #e75142 0%, #d12b1a 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#e75142), to(#d12b1a));
  background-image: linear-gradient(to bottom, #e75142 0%, #d12b1a 100%);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe75142', endColorstr='#ffd12b1a', GradientType=0);
  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
  background-repeat: repeat-x;
  border-color: #c82919;
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: #d12b1a;
  background-position: 0 -15px;
}
.btn-primary:active,
.btn-primary.active {
  background-color: #d12b1a;
  border-color: #c82919;
}
.btn-primary.disabled,
.btn-primary[disabled],
fieldset[disabled] .btn-primary,
.btn-primary.disabled:hover,
.btn-primary[disabled]:hover,
fieldset[disabled] .btn-primary:hover,
.btn-primary.disabled:focus,
.btn-primary[disabled]:focus,
fieldset[disabled] .btn-primary:focus,
.btn-primary.disabled.focus,
.btn-primary[disabled].focus,
fieldset[disabled] .btn-primary.focus,
.btn-primary.disabled:active,
.btn-primary[disabled]:active,
fieldset[disabled] .btn-primary:active,
.btn-primary.disabled.active,
.btn-primary[disabled].active,
fieldset[disabled] .btn-primary.active {
  background-color: #d12b1a;
  background-image: none;
}
.btn-success {
  background-image: -webkit-linear-gradient(top, #2c3e50 0%, #161f29 100%);
  background-image: -o-linear-gradient(top, #2c3e50 0%, #161f29 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#2c3e50), to(#161f29));
  background-image: linear-gradient(to bottom, #2c3e50 0%, #161f29 100%);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff2c3e50', endColorstr='#ff161f29', GradientType=0);
  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
  background-repeat: repeat-x;
  border-color: #131a22;
}
.btn-success:hover,
.btn-success:focus {
  background-color: #161f29;
  background-position: 0 -15px;
}
.btn-success:active,
.btn-success.active {
  background-color: #161f29;
  border-color: #131a22;
}
.btn-success.disabled,
.btn-success[disabled],
fieldset[disabled] .btn-success,
.btn-success.disabled:hover,
.btn-success[disabled]:hover,
fieldset[disabled] .btn-success:hover,
.btn-success.disabled:focus,
.btn-success[disabled]:focus,
fieldset[disabled] .btn-success:focus,
.btn-success.disabled.focus,
.btn-success[disabled].focus,
fieldset[disabled] .btn-success.focus,
.btn-success.disabled:active,
.btn-success[disabled]:active,
fieldset[disabled] .btn-success:active,
.btn-success.disabled.active,
.btn-success[disabled].active,
fieldset[disabled] .btn-success.active {
  background-color: #161f29;
  background-image: none;
}
.btn-info {
  background-image: -webkit-linear-gradient(top, #a6a6a6 0%, #878787 100%);
  background-image: -o-linear-gradient(top, #a6a6a6 0%, #878787 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#a6a6a6), to(#878787));
  background-image: linear-gradient(to bottom, #a6a6a6 0%, #878787 100%);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffa6a6a6', endColorstr='#ff878787', GradientType=0);
  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
  background-repeat: repeat-x;
  border-color: #828282;
}
.btn-info:hover,
.btn-info:focus {
  background-color: #878787;
  background-position: 0 -15px;
}
.btn-info:active,
.btn-info.active {
  background-color: #878787;
  border-color: #828282;
}
.btn-info.disabled,
.btn-info[disabled],
fieldset[disabled] .btn-info,
.btn-info.disabled:hover,
.btn-info[disabled]:hover,
fieldset[disabled] .btn-info:hover,
.btn-info.disabled:focus,
.btn-info[disabled]:focus,
fieldset[disabled] .btn-info:focus,
.btn-info.disabled.focus,
.btn-info[disabled].focus,
fieldset[disabled] .btn-info.focus,
.btn-info.disabled:active,
.btn-info[disabled]:active,
fieldset[disabled] .btn-info:active,
.btn-info.disabled.active,
.btn-info[disabled].active,
fieldset[disabled] .btn-info.active {
  background-color: #878787;
  background-image: none;
}
.btn-warning {
  background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
  background-image: -o-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#eb9316));
  background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);
  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
  background-repeat: repeat-x;
  border-color: #e38d13;
}
.btn-warning:hover,
.btn-warning:focus {
  background-color: #eb9316;
  background-position: 0 -15px;
}
.btn-warning:active,
.btn-warning.active {
  background-color: #eb9316;
  border-color: #e38d13;
}
.btn-warning.disabled,
.btn-warning[disabled],
fieldset[disabled] .btn-warning,
.btn-warning.disabled:hover,
.btn-warning[disabled]:hover,
fieldset[disabled] .btn-warning:hover,
.btn-warning.disabled:focus,
.btn-warning[disabled]:focus,
fieldset[disabled] .btn-warning:focus,
.btn-warning.disabled.focus,
.btn-warning[disabled].focus,
fieldset[disabled] .btn-warning.focus,
.btn-warning.disabled:active,
.btn-warning[disabled]:active,
fieldset[disabled] .btn-warning:active,
.btn-warning.disabled.active,
.btn-warning[disabled].active,
fieldset[disabled] .btn-warning.active {
  background-color: #eb9316;
  background-image: none;
}
.btn-danger {
  background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
  background-image: -o-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c12e2a));
  background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);
  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
  background-repeat: repeat-x;
  border-color: #b92c28;
}
.btn-danger:hover,
.btn-danger:focus {
  background-color: #c12e2a;
  background-position: 0 -15px;
}
.btn-danger:active,
.btn-danger.active {
  background-color: #c12e2a;
  border-color: #b92c28;
}
.btn-danger.disabled,
.btn-danger[disabled],
fieldset[disabled] .btn-danger,
.btn-danger.disabled:hover,
.btn-danger[disabled]:hover,
fieldset[disabled] .btn-danger:hover,
.btn-danger.disabled:focus,
.btn-danger[disabled]:focus,
fieldset[disabled] .btn-danger:focus,
.btn-danger.disabled.focus,
.btn-danger[disabled].focus,
fieldset[disabled] .btn-danger.focus,
.btn-danger.disabled:active,
.btn-danger[disabled]:active,
fieldset[disabled] .btn-danger:active,
.btn-danger.disabled.active,
.btn-danger[disabled].active,
fieldset[disabled] .btn-danger.active {
  background-color: #c12e2a;
  background-image: none;
}
.thumbnail,
.img-thumbnail {
  -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
  background-image: -webkit-linear-gradient(top, #bfc5c9 0%, #b1b8bd 100%);
  background-image: -o-linear-gradient(top, #bfc5c9 0%, #b1b8bd 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#bfc5c9), to(#b1b8bd));
  background-image: linear-gradient(to bottom, #bfc5c9 0%, #b1b8bd 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffbfc5c9', endColorstr='#ffb1b8bd', GradientType=0);
  background-color: #b1b8bd;
}
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
  background-image: -webkit-linear-gradient(top, #e75142 0%, #e43c2b 100%);
  background-image: -o-linear-gradient(top, #e75142 0%, #e43c2b 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#e75142), to(#e43c2b));
  background-image: linear-gradient(to bottom, #e75142 0%, #e43c2b 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe75142', endColorstr='#ffe43c2b', GradientType=0);
  background-color: #e43c2b;
}
.navbar-default {
  background-image: -webkit-linear-gradient(top, #ffffff 0%, #e6e8ea 100%);
  background-image: -o-linear-gradient(top, #ffffff 0%, #e6e8ea 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#e6e8ea));
  background-image: linear-gradient(to bottom, #ffffff 0%, #e6e8ea 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e8ea', GradientType=0);
  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
  border-radius: 4px;
  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075);
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .active > a {
  background-image: -webkit-linear-gradient(top, #c6cbcf 0%, #ced2d6 100%);
  background-image: -o-linear-gradient(top, #c6cbcf 0%, #ced2d6 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#c6cbcf), to(#ced2d6));
  background-image: linear-gradient(to bottom, #c6cbcf 0%, #ced2d6 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc6cbcf', endColorstr='#ffced2d6', GradientType=0);
  -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.075);
  box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.075);
}
.navbar-brand,
.navbar-nav > li > a {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}
.navbar-inverse {
  background-image: -webkit-linear-gradient(top, #3e5771 0%, #2c3e50 100%);
  background-image: -o-linear-gradient(top, #3e5771 0%, #2c3e50 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#3e5771), to(#2c3e50));
  background-image: linear-gradient(to bottom, #3e5771 0%, #2c3e50 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3e5771', endColorstr='#ff2c3e50', GradientType=0);
  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
  border-radius: 4px;
}
.navbar-inverse .navbar-nav > .open > a,
.navbar-inverse .navbar-nav > .active > a {
  background-image: -webkit-linear-gradient(top, #1a242f 0%, #1e2b37 100%);
  background-image: -o-linear-gradient(top, #1a242f 0%, #1e2b37 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#1a242f), to(#1e2b37));
  background-image: linear-gradient(to bottom, #1a242f 0%, #1e2b37 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff1a242f', endColorstr='#ff1e2b37', GradientType=0);
  -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25);
}
.navbar-inverse .navbar-brand,
.navbar-inverse .navbar-nav > li > a {
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.navbar-static-top,
.navbar-fixed-top,
.navbar-fixed-bottom {
  border-radius: 0;
}
@media (max-width: 767px) {
  .navbar .navbar-nav .open .dropdown-menu > .active > a,
  .navbar .navbar-nav .open .dropdown-menu > .active > a:hover,
  .navbar .navbar-nav .open .dropdown-menu > .active > a:focus {
    color: #fff;
    background-image: -webkit-linear-gradient(top, #e75142 0%, #e43c2b 100%);
    background-image: -o-linear-gradient(top, #e75142 0%, #e43c2b 100%);
    background-image: -webkit-gradient(linear, left top, left bottom, from(#e75142), to(#e43c2b));
    background-image: linear-gradient(to bottom, #e75142 0%, #e43c2b 100%);
    background-repeat: repeat-x;
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe75142', endColorstr='#ffe43c2b', GradientType=0);
  }
}
.alert {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.alert-success {
  background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
  background-image: -o-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#c8e5bc));
  background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);
  border-color: #b2dba1;
}
.alert-info {
  background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
  background-image: -o-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#b9def0));
  background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);
  border-color: #9acfea;
}
.alert-warning {
  background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
  background-image: -o-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#f8efc0));
  background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);
  border-color: #f5e79e;
}
.alert-danger {
  background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
  background-image: -o-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#e7c3c3));
  background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);
  border-color: #dca7a7;
}
.progress {
  background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
  background-image: -o-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#f5f5f5));
  background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);
}
.progress-bar {
  background-image: -webkit-linear-gradient(top, #e75142 0%, #db2d1b 100%);
  background-image: -o-linear-gradient(top, #e75142 0%, #db2d1b 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#e75142), to(#db2d1b));
  background-image: linear-gradient(to bottom, #e75142 0%, #db2d1b 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe75142', endColorstr='#ffdb2d1b', GradientType=0);
}
.progress-bar-success {
  background-image: -webkit-linear-gradient(top, #2c3e50 0%, #1a242f 100%);
  background-image: -o-linear-gradient(top, #2c3e50 0%, #1a242f 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#2c3e50), to(#1a242f));
  background-image: linear-gradient(to bottom, #2c3e50 0%, #1a242f 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff2c3e50', endColorstr='#ff1a242f', GradientType=0);
}
.progress-bar-info {
  background-image: -webkit-linear-gradient(top, #a6a6a6 0%, #8d8d8d 100%);
  background-image: -o-linear-gradient(top, #a6a6a6 0%, #8d8d8d 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#a6a6a6), to(#8d8d8d));
  background-image: linear-gradient(to bottom, #a6a6a6 0%, #8d8d8d 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffa6a6a6', endColorstr='#ff8d8d8d', GradientType=0);
}
.progress-bar-warning {
  background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
  background-image: -o-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#ec971f));
  background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
}
.progress-bar-danger {
  background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%);
  background-image: -o-linear-gradient(top, #d9534f 0%, #c9302c 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c9302c));
  background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
}
.progress-bar-striped {
  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
  background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
.list-group {
  border-radius: 4px;
  -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
}
.list-group-item.active,
.list-group-item.active:hover,
.list-group-item.active:focus {
  text-shadow: 0 -1px 0 #db2d1b;
  background-image: -webkit-linear-gradient(top, #e75142 0%, #e33220 100%);
  background-image: -o-linear-gradient(top, #e75142 0%, #e33220 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#e75142), to(#e33220));
  background-image: linear-gradient(to bottom, #e75142 0%, #e33220 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe75142', endColorstr='#ffe33220', GradientType=0);
  border-color: #e33220;
}
.list-group-item.active .badge,
.list-group-item.active:hover .badge,
.list-group-item.active:focus .badge {
  text-shadow: none;
}
.panel {
  -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.panel-default > .panel-heading {
  background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
  background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
  background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
}
.panel-primary > .panel-heading {
  background-image: -webkit-linear-gradient(top, #e75142 0%, #e43c2b 100%);
  background-image: -o-linear-gradient(top, #e75142 0%, #e43c2b 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#e75142), to(#e43c2b));
  background-image: linear-gradient(to bottom, #e75142 0%, #e43c2b 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe75142', endColorstr='#ffe43c2b', GradientType=0);
}
.panel-success > .panel-heading {
  background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
  background-image: -o-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#d0e9c6));
  background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);
}
.panel-info > .panel-heading {
  background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
  background-image: -o-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#c4e3f3));
  background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
}
.panel-warning > .panel-heading {
  background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
  background-image: -o-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#faf2cc));
  background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);
}
.panel-danger > .panel-heading {
  background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
  background-image: -o-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#ebcccc));
  background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);
}
.well {
  background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
  background-image: -o-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
  background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#f5f5f5));
  background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
  border-color: #dcdcdc;
  -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);
}

redpajama_set_name: RedPajamaGithub


text:
package com.intellij.openapi.wm;

import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.AnAction;

import javax.swing.*;

/**
 * @author Konstantin Bulenkov
 */
public interface WelcomeScreen extends Disposable {
  JComponent getWelcomePanel();

  void setupFrame(JFrame frame);

  void removeRecentProjectItem(AnAction anActiona);
}


text:
package io.quarkus.deployment.steps;

import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.AbstractMap;
import java.util.Enumeration;
import java.util.Map;
import java.util.Scanner;

import org.jboss.logging.Logger;

import io.quarkus.banner.BannerConfig;
import io.quarkus.builder.Version;
import io.quarkus.deployment.IsTest;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.ConsoleFormatterBannerBuildItem;
import io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem;
import io.quarkus.deployment.util.FileUtil;
import io.quarkus.runtime.BannerRecorder;
import io.quarkus.runtime.util.ClassPathUtils;

public class BannerProcessor {

    private static final Logger logger = Logger.getLogger(BannerProcessor.class);

    @BuildStep(onlyIfNot = { IsTest.class })
    @Record(ExecutionTime.RUNTIME_INIT)
    public ConsoleFormatterBannerBuildItem recordBanner(BannerRecorder recorder, BannerConfig config) {
        String bannerText = readBannerFile(config);
        return new ConsoleFormatterBannerBuildItem(recorder.provideBannerSupplier(bannerText));
    }

    @BuildStep
    HotDeploymentWatchedFileBuildItem watchBannerChanges(BannerConfig config) {
        return new HotDeploymentWatchedFileBuildItem(config.path);
    }

    private String readBannerFile(BannerConfig config) {
        try {
            Map.Entry<URL, Boolean> entry = getBanner(config);
            URL bannerResourceURL = entry.getKey();
            if (bannerResourceURL == null) {
                logger.warn("Could not locate banner file");
                return "";
            }
            return ClassPathUtils.readStream(bannerResourceURL, is -> {
                try {
                    byte[] content = FileUtil.readFileContents(is);
                    String bannerTitle = new String(content, StandardCharsets.UTF_8);

                    int width = 0;
                    try (Scanner scanner = new Scanner(bannerTitle)) {
                        while (scanner.hasNextLine()) {
                            width = Math.max(width, scanner.nextLine().length());
                        }
                    }

                    String tagline = "\n";
                    Boolean isDefaultBanner = entry.getValue();
                    if (!isDefaultBanner) {
                        tagline = String.format("\n%" + width + "s\n", "Powered by Quarkus " + Version.getVersion());
                    }

                    return bannerTitle + tagline;
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            });
        } catch (IOException e) {
            logger.warn("Unable to read banner file");
            return "";
        }
    }

    /**
     * @return an entry containing the text of the banner as the key and whether the default banner is being used as the
     *         value. The default banner is used as a last report
     */
    private Map.Entry<URL, Boolean> getBanner(BannerConfig config) throws IOException {
        Enumeration<URL> resources = Thread.currentThread().getContextClassLoader().getResources(config.path);
        URL defaultBanner = null;
        URL firstNonDefaultBanner = null;
        while (resources.hasMoreElements() && firstNonDefaultBanner == null) {
            URL url = resources.nextElement();
            if (defaultBanner == null && isQuarkusCoreBanner(url)) {
                defaultBanner = url;
            } else {
                firstNonDefaultBanner = url;
            }
        }
        if (firstNonDefaultBanner == null) {
            return new AbstractMap.SimpleEntry<>(defaultBanner, true);
        } else {
            return new AbstractMap.SimpleEntry<>(firstNonDefaultBanner, false);
        }
    }

    protected boolean isQuarkusCoreBanner(URL url) {
        if (!"jar".equals(url.getProtocol())) {
            return false;
        }

        String thisClassName = this.getClass().getName();

        try {
            return ClassPathUtils.processAsPath(url, p -> {
                // We determine whether the banner is the default by checking to see if the jar that contains it also
                // contains this class. This way although somewhat complicated guarantees that any rename of artifacts
                // won't affect the check
                Path resolved = p.resolve("/" + thisClassName.replace('.', '/') + ".class");
                return Files.exists(resolved);
            });
        } catch (UncheckedIOException ex) {
            return false;
        }
    }
}


text:
module Main where

import Test.DocTest

main :: IO ()
main = doctest ["-isrc", "src/Logic/Cpu.hs"]


text:
package org.skfiy.typhon.spi.dargon;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.inject.Inject;

import org.skfiy.typhon.Typhons;
import org.skfiy.typhon.domain.Player;
import org.skfiy.typhon.packet.Packet;
import org.skfiy.typhon.packet.PacketError;
import org.skfiy.typhon.packet.SingleValue;
import org.skfiy.typhon.session.SessionUtils;
import org.skfiy.typhon.spi.ItemProvider;
import org.skfiy.typhon.spi.store.Commodity;
import org.skfiy.typhon.spi.store.MyCommodity;
import org.skfiy.typhon.spi.store.StoreProvider;
import org.skfiy.typhon.util.ComponentUtils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

public class DargonStoreProvider extends StoreProvider {

    private static final Map<String, Commodity> HYCOMMODITY_MAP = new HashMap<>();
    private static final List<Commodity> HYCOMMODITIESA = new ArrayList<>();
    private static final List<Commodity> HYCOMMODITIESB = new ArrayList<>();
    private static final List<Commodity> HYCOMMODITIESC = new ArrayList<>();
    private static final List<Commodity> HYCOMMODITIESD = new ArrayList<>();
    private static final List<Commodity> HYCOMMODITIESE = new ArrayList<>();
    private static final List<Commodity> HYCOMMODITIESF = new ArrayList<>();
    private static final List<Commodity> HYCOMMODITIES = new ArrayList<>();

    private List<Integer> refreshExpenses;
    private List<Integer> refreshTimes;

    @Inject
    protected ItemProvider itemProvider;

    @Override
    protected void doInit() {
        JSONArray array = JSON.parseArray(ComponentUtils.readDataFile("dargon_store.json"));
        for (int i = 0; i < array.size(); i++) {
            JSONObject json = array.getJSONObject(i);
            Commodity commodity = toCommodity(json);
            commodity.setItem(itemProvider.getItem(json.getString("#item.id")));
            if (commodity.getPos() == 1) {
                HYCOMMODITIESA.add(commodity);
            } else if (commodity.getPos() == 2) {
                HYCOMMODITIESB.add(commodity);
            } else if (commodity.getPos() == 3) {
                HYCOMMODITIESC.add(commodity);
            } else if (commodity.getPos() == 4) {
                HYCOMMODITIESD.add(commodity);
            } else if (commodity.getPos() == 5) {
                HYCOMMODITIESE.add(commodity);
            } else if (commodity.getPos() == 6) {
                HYCOMMODITIESF.add(commodity);
            } else {
                HYCOMMODITIES.add(commodity);
            }
            HYCOMMODITY_MAP.put(commodity.getId(), commodity);
        }
        // 打乱顺序
        Collections.shuffle(HYCOMMODITIESA);
        Collections.shuffle(HYCOMMODITIESB);
        Collections.shuffle(HYCOMMODITIESC);
        Collections.shuffle(HYCOMMODITIESD);
        Collections.shuffle(HYCOMMODITIESE);
        Collections.shuffle(HYCOMMODITIESF);
        Collections.shuffle(HYCOMMODITIES);

        array = JSON.parseArray(ComponentUtils.readDataFile("dargon_store_refresh_time.json"));
        List<Integer> tempRefreshTimes = new ArrayList<>();
        Collections.addAll(tempRefreshTimes, array.toArray(new Integer[] {}));
        refreshTimes = Collections.unmodifiableList(tempRefreshTimes);

        array = JSON.parseArray(ComponentUtils.readDataFile("dargon_store_refresh.json"));
        refreshExpenses = Arrays.asList(array.toArray(new Integer[] {}));
    }

    @Override
    protected void doDestroy() {}

    @Override
    protected void doReload() {}

    @Override
    public List<Integer> getRefreshTimes() {
        return refreshTimes;
    }

    @Override
    public void refreshCommodity(Player player) {
        int level = player.getRole().getLevel();
        List<MyCommodity> myCommodities = new ArrayList<>();
        randomCommodity(HYCOMMODITIESA, myCommodities, level);
        randomCommodity(HYCOMMODITIESB, myCommodities, level);
        randomCommodity(HYCOMMODITIESC, myCommodities, level);
        randomCommodity(HYCOMMODITIESD, myCommodities, level);
        randomCommodity(HYCOMMODITIESE, myCommodities, level);
        randomCommodity(HYCOMMODITIESF, myCommodities, level);
        int index = index() - myCommodities.size();
        for (int i = 0; i < index; i++) {
            randomCommodity(HYCOMMODITIES, myCommodities, level);
        }

        player.getNormal().setDargonCommodities(myCommodities);
    }

    @Override
    public void refreshCommodity(SingleValue packet) {
        Player player = SessionUtils.getPlayer();
        int count = player.getNormal().getRefreshDargonStore();
        int i = count;

        if (count >= refreshExpenses.size()) {
            i = refreshExpenses.size() - 1;
        }

        int cost = refreshExpenses.get(i);
        SessionUtils.decrementDargonMoney(cost);
        player.getNormal().setRefreshDargonStore(count + 1);
        refreshCommodity(player);
        player.getSession().write(Packet.createResult(packet));
    }

    @Override
    public void buyCommodities(SingleValue packet) {
        Player player = SessionUtils.getPlayer();
        String cid = (String) packet.getVal();
        Commodity commodity = HYCOMMODITY_MAP.get(cid);

        if (buyCommodities0(player.getNormal().getDargonCommodities(), commodity)) {
            player.getSession().write(Packet.createResult(packet));
        } else {
            PacketError error = PacketError.createResult(packet, PacketError.Condition.conflict);
            error.setText("Without the id" + cid + " on the table  OR the id count is more<Store> ");
            player.getSession().write(error);
        }
    }

    public int index() {
        return Typhons.getInteger("typhon.spi.dargon.store");
    }
}


text:
module Jsdoc
  class Function < ActiveRecord::Base
    belongs_to :symbol
    has_many :params, :dependent => :destroy
    has_many :returns, :dependent => :destroy
    has_many :requires, :dependent => :destroy
    has_many :throws, :dependent => :destroy
    has_many :sees, :as => 'see_for', :dependent => :destroy
    has_many :examples, :as => 'example_for', :dependent => :destroy

    has_many :borrowed_to_join, :class_name => 'Jsdoc::BorrowedFunction', :dependent => :destroy
    has_many :borrowed_to, :through => :borrowed_to_join, :dependent => :destroy

    scope :private, where(:is_private => true)
    scope :public, where(:is_private => false)
    scope :method_types, where(:function_type => 'method')
    scope :event_types, where(:function_type => 'event')

    scope :for_symbol, lambda { |s| includes(:borrowed_to).where('symbol_id = :symbol_id OR (jsdoc_borrowed_functions.borrowed_to_id = :symbol_id)', :symbol_id => s.id) }
  end
end


text:
static void *vtable_ISteamAppList001[] = {
    SteamAPI_ISteamAppList_GetNumInstalledApps,
    SteamAPI_ISteamAppList_GetInstalledApps,
    SteamAPI_ISteamAppList_GetAppName,
    SteamAPI_ISteamAppList_GetAppInstallDir,
    SteamAPI_ISteamAppList_GetAppBuildId,
};

VtableEntry vtable_ISteamAppList[] = {
    {1, vtable_ISteamAppList001, sizeof(vtable_ISteamAppList001), 0},
    {0, NULL, 0, 0},
};


text:
package br.com.objectos.way.xls;

import static br.com.objectos.way.core.Preconditions.checkArgument;

import java.util.Iterator;

import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;

/**
 * @author marcio.endo@objectos.com.br (Marcio Endo)
 */
public class WorksheetReader {

  private final Iterator<Row> rowIterator;

  WorksheetReader(Sheet sheet) {
    rowIterator = sheet.iterator();
  }

  public WorksheetReader skipFirstRows(int rows) {
    checkArgument(rows > 0, "Please inform a number > 0");
    for (int i = 0; i < rows; i++) {
      checkArgument(rowIterator.hasNext(), "Cannot skip. Not enough rows.");
      rowIterator.next();
    }
    return this;
  }

  public Iterator<RowReader> iterator() {
    return new Iterator<RowReader>() {
      @Override
      public boolean hasNext() {
        return rowIterator.hasNext();
      }

      @Override
      public RowReader next() {
        Row row = rowIterator.next();
        return new RowReader(row);
      }

      @Override
      public void remove() {
        rowIterator.remove();
      }
    };
  }

}


text:
package org.commonjava.indy.action;

import org.commonjava.indy.IndyException;

import java.text.MessageFormat;
import java.util.Objects;

public class IndyLifecycleException
        extends IndyException
{
    private static final long serialVersionUID = 1L;

    private Object[] params;

    private String formattedMessage;

    public IndyLifecycleException( final String message, final Throwable cause, final Object... params )
    {
        super( message, cause );
        this.params = params;
    }

    public IndyLifecycleException( final String message, final Object... params )
    {
        super( message );
        this.params = params;
    }

    @Override
    public synchronized String getMessage()
    {
        if ( formattedMessage == null )
        {
            final String format = super.getMessage()
                                       .replaceAll( "\\{\\}", "%s" );
            if ( params == null || params.length < 1 )
            {
                formattedMessage = format;
            }
            else
            {
                final String original = formattedMessage;
                try
                {
                    formattedMessage = String.format( format, params );
                }
                catch ( final Error | Exception e )
                {
                    // do nothing
                }

                if ( formattedMessage == null || Objects.equals( original, formattedMessage ) )
                {
                    try
                    {
                        formattedMessage = MessageFormat.format( format, params );
                    }
                    catch ( final Error | RuntimeException e )
                    {
                        formattedMessage = format;
                        throw e;
                    }
                    catch ( final Exception e )
                    {
                        formattedMessage = format;
                    }
                }
            }
        }

        return formattedMessage;
    }

    private Object writeReplace()
    {
        final Object[] newParams = new Object[params.length];
        int i = 0;
        for ( final Object object : params )
        {
            newParams[i] = String.valueOf( object );
            i++;
        }

        this.params = newParams;
        return this;
    }

}


text:
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/); this project adheres to [Semantic Versioning](http://semver.org/).

-----------------------
## [1.1.0] - unleleased

### Added
- Added `Promise` helper class with promise-specific helpers.
- Added `ThenSequence` extensions.
- Added unhandled exception event for `Done` promise extensions.
- Added `LoadSceneAsync` extension method for `AssetBundle`.
- Added `AsyncUtility.LoadSceneAsync` helper.
- Added `npm` support.

## Fixed
- Fixed build issue for Unity 2018.3.

-----------------------
## [1.0.2] - 2019.05.19

### Fixed
- Fixed `AsyncUtility.FrameUpdate` not scheduling the callback.

-----------------------
## [1.0.1] - 2019.04.09

NOTE: NuGet-only release instead of not published v1.0.0.

### Changed
- Deprecated all `Task`-related extension methods. They are considered out of the library scope.

-----------------------
## [1.0.0] - 2019.02.23

### Added
- Added more comments throughout the code.
- Added Unity 2018.3 support (esp. support all target .NET frameworks in a single Asset Store package).
- Added `await` support to `YieldInstruction` Unity class.
- Added coroutine helpers (`AsyncUtility.FromCoroutine`).
- Added helpers for loading assets from an `AssetBundle`.
- Added `AsyncUtility.FrameTime` await helper.

### Changed
- Added `DebuggerHidden` attribute to some properties/methods to make stack traces a bit more friendly.
- Renamed `AsyncContinuationContext` to `AsyncCallbackOptions`.
- Renamed web request helper methods (added `Async` postfix to their names).
- Moved Unity extension methods to `UnityFx.Async.Extensions` namespace (previously they were in namespace `UnityFx.Async`).

### Fixed
- Fixed web requests `null` result in cases when downloaded file failed to open.
- Fixed `AsyncUtility.AddCompletionCallback` exception when adding new callbacks from another callback.
- Fixed `AsyncUpdateSource` implementation to allow adding listeners from a callback.
- Fixed `AsyncCompletionSource.SetProgress` implementation to allow setting progress when the operation is not started.

### Removed
- Removed many specialized `IAsyncOperationCallbacks` methods to make the interface as minimalistic as possible (new extension methods are added to compensate).
- Removed `(Try)SetExceptions` methods/extensions and `FromExceptions` helpers.
- Removed extension methods of the `Animation` class.
- Removed `WaitAsync` extension methods of the `Animator` class.
- Dropped `MovieTexture` support.

-----------------------
## [0.9.8] - 2018.11.09

### Added
- `AsyncResult` is now Task-like type and can be used as `async` method result value (requires C# 7.2).
- Added new `AsyncResult.FromAction` overloads.
- Added new `SynchronizationContext` extension methods (`PostAsync`, `InvokeAsync` etc).
- Added extension methods for `Socket`, `WebRequest`, `Stream` BCL classes.

### Changed
- Moved BCL extension methods to namespace `UnityFx.Async.Extensions` (previously they were in namespace `UnityFx.Async`).

### Fixed
- Fixed `AsyncResult` completion callbacks to be called event if `OnCompleted` throws.
- Fixed exception not been set for `AsyncResult.FaultedOperation` and `AsyncResult.CanceledOperation`.
- Disabled `MovieTexture` helpers for iOS/Android (as it is not supported on mobiles).

### Removed
- Removed `AsyncResultQueue`.
- Removed `AsyncLazy`.

-----------------------
## [0.9.7] - 2018.09.27

### Added
- Added convenience overloads for `SetException`-like methods accepting as error message string.
- Added allocation optimizations for single-threaded applications (particularly for Unity3d). See `AsyncResult.DefaultSynchronizationContext` for more info.
- Added new overloads for `ConfigureAwait` extensions accepting continuation options instead of boolean flag.
- Added `SynchronizationContext` extension methods for `Send`/`Post` accepting `Action` as the delegate.
- Added `AsyncResult.Yield` static method (workd exactly as `Task.Yield`).
- Added `AsyncUtility.AddFrameCallback` helper for scheduling delegates for `MonoBehaviour` update loop.
- Signed the assembly with a strong name.
- Added performance benchmarks.
- Added sandbox Unity project.

### Changed
- Moved several of `IAsyncOperationEvents` methods to the interface extensions.
- Simplified `AsyncLazy` interface.

### Fixed
- Fixed error handling in `AsyncOperationResult`.

### Removed
- Removed Asset Store samples.
- Dropped Unity 5.0 support (the minimum version supported is now 5.4).
- Dropped `WWW` support for Unity 2018.3+ (it has been deprecated in Unity).

-----------------------
## [0.9.6] - 2018.08.31

### Added
- Added `Play`/`Wait` extension methods for `Animation` and `Animator`.
- Added `AsyncResult.IsStarted` helper property.

### Changed
- Changed `AsyncResult` constructors argument order to avoid ambiguity in some cases.
- Moved the package content to Plugins folder and remove assembly definition file.
- Moved web request related helpers from `AsyncUtility` to `AsyncWww` class.
- Changed `AsyncUtility.SendToMainThread`, `AsyncUtility.PostToMainThread` and `AsyncUtility.InvokeOnMainThread` implementation to use `ConcurrentQueue` for net46+ to avoid unnesesary locks.
- Changed interface of `AsyncResultQueue`.

### Removed
- Removed `IAsyncOperationEvents.TryAddCompletionCallback` and `IAsyncOperationEvents.TryAddProgressCallback` methods. These methods are not needed in 99% of cases and may lead to logic errors in multi-threaded environment.

-----------------------
## [0.9.5] - 2018.07.31

### Added
- Added `IAsyncOperation.Id` property for easy operation identification.
- Added `AsyncUtility.GetText` and `AsyncUtility.GetBytes` helpers.
- Added `ToTask` extensions for `AsyncOperation`/`UnityWebRequest`/`WWW`.
- `AsyncResult` now implements `AsyncContinuation` to enable easy operation chaining.

### Fixed
- Fixed compile warnings for Unity 2018.2.

### Removed
- Removed `ToAsyncXxx` extension methods for `WWW` and `UnityWebRequest`.
- Removed `MovieTexture` related methods for Unity 2018.2 (the class is deprecated now).
- Removed `IAsyncSchedulable` interface (it was just another form of `IAsyncContinuation`).

-----------------------
## [0.9.4] - 2018.07.10

### Added
- Added assembly definition file for Unity 2017.3+.
- Added `AsyncResult.FaultedOperation` helper.
- Added `AsyncUtility.IsMainThread` method.
- Added `AsyncUtility.GetAssetBundle`, `AsyncUtility.GetTexture`, `AsyncUtility.AudioClip` and `AsyncUtility.GetMovieTexture` helper methods.
- Added `AssetBundleCreateRequest` wrapper operation.
- Added `ThrowIfNonSuccess` extension for `IAsyncOperation`.
- Added `ToEnum` extension for `IAsyncResult` that converts an asynchronous operation (`Task`, `AsyncResult` etc) to enumerator.
- Added `IAsyncSchedulable` interface - an abstraction of a schedulable entity.
- Added `AsyncLazy` helper for initialization operations.

### Fixed
- Fixed compile warnings for some older Unity versions.
- Fixed error handling for Unity operation wrappers.

### Removed
- Removed `AggregateException` class for net35.

-----------------------
## [0.9.3] - 2018.06.09

### Added
- Added push-based progress reporting support.
- Added `AsyncResult.Delay(float)` overloads.
- Added `AsyncCreationOptions.SuppressCancellation` option.
- Added update sources for `LateUpdate`, `FixedUpdate` and end-of-frame updates.
- Added `SynchronizationContext` for the main thread (if not set by Unity).
- Added methods `AsyncUtility.PostToMainThread`, `AsyncUtility.SendToMainThread` as `AsyncUtility.InvokeOnMainThread`.
- Added new `FromAction` overloads.

### Changed
- Significantly reduced number of memory allocations when adding continuations.
- Changed signature of the `IAsyncContinuation.Invoke` method.
- Changed `AsyncResult.OnCancel` implementation to do nothing (previously it threw `NotSupportedException`).

### Fixed
- Fixed exception when removing listeners while in `AsyncUpdateSource.OnError` / `AsyncUpdateSource.OnCompleted` / `AsyncUpdateSource.Dispose`.
- Fixed `AsyncResult.MoveNext` to always return `true` while the operation is not completed.
- Fixed `AsyncResult` construction code not working as intended when `AsyncCreationOptions` are specified.

### Removed
- Removed `AsyncOperationCallback` delegate type.

-----------------------
## [0.9.2] - 2018.05.25

### Added
- Added pull-based progress reporting support.
- Added new methods to `IAsyncUpdateSource`.
- Added `AsyncUpdateSource` class as default `IAsyncUpdateSource` implementation.
- `IAsyncOperation<T>` now inherits `IObservable<T>`.

### Changed
- Changed `IAsyncOperation.Exception` type to `Exception`.
- Changed `IAsyncOperationEvents.Completed` type to `AsyncCompletedEventHandler`.

### Removed
- Removed `ToObservable` extension of `IAsyncOperation`.

-----------------------
## [0.9.1] - 2018.05.07

### Fixed
- Fixed Unity3d script compile errors when targeting .NET 4.x ([Issue #1](https://github.com/Arvtesh/UnityFx.Async/issues/1)).

-----------------------
## [0.9.0] - 2018.04.24

### Added
- Added `AsyncContinuationOptions`.
- Added `AsyncCreationOptions`.
- Added `Promise`-like extensions `Then`, `ThenAll`, `ThenAny`, `Rebind`, `Catch`, `Finally` and `Done`.
- Added `Unwrap` extension methods.
- Added `FromTask`/`FromObservable` helpers.
- Added `FromAction` helpers.
- Added `ToAsync` extension method for `IObservable` interface.
- Added `TryAddContinuation`/`RemoveContinuation` methods to `IAsyncOperationEvents` for non-delegate continuations.
- Added `IAsyncUpdatable` and `IAsyncUpdateSource` interfaces.
- Added `Delay`/`Retry` overload that uses `IAsyncUpdateSource`-based service for time management.
- Added cancellation support (`IAsyncCancellable` interface, `WithCancellation` extension method and many implementation changes).
- Added `Wait`/`Join` overloads with `CancellationToken` argument.

### Changed
- Changed `ContinueWith` extension signatures to match corresponding `Task` methods.
- Changed `IAsyncOperation.Exception` to always return an exception instance if completed with non-success.
- Changed `AddCompletionCallback`/`AddContinuation` to instance methods (instead of extensions).

### Fixed
- Fixed exception not initialized properly for canceled operations sometimes.

### Removed
- Removed `GetAwaiter`/`ConfigureAwait` instance methods from `AsyncResult` to avoid code duplication (extension methods should be used).
- Removed all `AsyncCompletionSource` methods having `completedSynchronously` argument.

-----------------------
## [0.8.2] - 2018-03-28

### Added
- New `AsyncResult` constructors added.
- New overloads for `AsyncResult.FromResult`, `AsyncResult.FromCanceled` and `AsyncResult.FromException` methods added.

### Changed
- Made optimizations to `ToTask` extensions implementation for cases when target operation is completed.
- Marked all assembly classes CLS-compilant.

### Fixed
- `ToTask` extensions now throw inner exception instead of the `AggregateException` in case of an error.
- Fixed `AsyncResult.Delay` throwing exception when infinite delay (-1) specified.

-----------------------
## [0.8.1] - 2018-03-19

### Added
- Added `AsyncResultQueue.Empty` event.
- Added `Unity`-specific tools for Asset Store.

-----------------------
## [0.8.0] - 2018-03-10

### Added
- Added `IAsyncCompletionSource.Operation` property to match `TaskCompletionSource` interface.
- Added new constructor to `AsyncResult`.
- Added `AsyncResult.Start` method to match `Task` interface.
- Added `AsyncResult.OnStarted` virtual method.
- Added `WhenAll`/`WhenAny` static helpers for `AsyncResult`.
- Added `ConfigureAwait` extensions for `IAsyncOperation`.
- Added `Task` extension methods to that convert it to an `AsyncResult` instance.
- Added `AsyncResult.Retry` methods.
- Added `Wait` overloads to match `Task` interface.

### Removed
- Removed `AsyncResult.TryCreateAsyncWaitHandle` helper.

### Changed
- Modified `AsyncResultAwaiter` implementation to throw if the operation was canceled or faulted (to match `TaskAwaiter` behaviour).
- Implemented `AsyncCompletionSource` as a sealed analog of `TaskCompletionSource`.
- Removed public completion methods from `AsyncResult` (moved them to `AsyncCompletionSource`).
- Made `SpinUntilCompleted` an extension method (was `AsyncResult` instance method).
- Changed `IAsyncOperation.Exception` type to `AggregateException` to match `Task`.
- Changed `IAsyncOperationEvents.Completed` event signature & behaviour to always execute handler (event if it was registered after the comperation has copleted).
- Removed `AsyncResult` constructors that accepted exceptions.
- Changed `AsyncResult.Result` property to throw `AggregateException` when faulted or canceled to mathch `Task` behaviour.

### Fixed
- `AsyncResultQueue` now does not remove uncompleted operations from the queue.
- `AsyncResult.Exception` now only returns non-null value when the operation is faulted.

-----------------------
## [0.7.1] - 2018-02-14

### Added
- Added possibility to store multiple exceptions in `AsyncResult`.
- Added `AggregateException` class for `net35` target.
- Added `IsEmpty` property to `AsyncResultQueue`.

### Changed
- `AsyncResult` implemenation is changed to prevent returning null operation result when the operation is completed in some cases.

-----------------------
## [0.7.0] - 2018-02-10

### Added
- Added project documentation site (`docs` folder).
- Added unit tests project.
- Added continuations support.
- Added [AppVeyor CI](https://ci.appveyor.com/project/Arvtesh/unityfx-async) support.
- Added [NuGet](https://www.nuget.org/packages/UnityFx.Async/) deployment.
- Added [GitVersion](https://gitversion.readthedocs.io/en/latest/) support.

### Changed
- Renamed `AsyncOperationStatus` values to match [TastStatus](https://msdn.microsoft.com/ru-ru/library/system.threading.tasks.taskstatus(v=vs.110).aspx).

-----------------------
## [0.3.1] - 2017-08-01

### Added
- Initial release.


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="author" content="Gregory Moyerbrailean">

    <link rel="icon" href="">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/gmoyerbrailean.css" rel="stylesheet">

    <title>Greg Moyerbrailean</title>

Greg Moyerbrailean

Greg Moyerbrailean

Software Product Manager - Illumina, Inc, San Diego, CA

Phd, Molecular Biology & Genetics - Wayne State University - Detroit, MI

Registered Yoga Teacher, 200hr - Sangha Studio - Burlington, VT

Restorative Yoga, 30hr - Trilogy Studio - La Jolla, CA

                
                
                
                
                


text:
<?xml version="1.0" encoding="UTF-8"?>
<module codename="com.sun.tools.visualvm.threaddump/0">
    <module_version install_time="1358413952538" last="true" origin="installer" specification_version="1.0">
        <file crc="3664428360" name="config/Modules/com-sun-tools-visualvm-threaddump.xml"/>
        <file crc="2748591287" name="modules/com-sun-tools-visualvm-threaddump.jar"/>
    </module_version>
</module>


text:
using System.Collections.Generic;
using GOLD;
using Prometheus.Compile;
using Prometheus.Grammar;
using Prometheus.Nodes.Types;

namespace Prometheus.Nodes
{
    /// <summary>
    /// Handles converting the upside down tree of data from
    /// the parser into a top down tree of nodes that this
    /// library can run as commands.
    /// </summary>
    public static class NodeFactory
    {
        /// <summary>
        /// These nodes has a terminal associated with them that needs to be converted into a DataType.
        /// </summary>
        private static readonly HashSet<GrammarSymbol> _terminalData = new HashSet<GrammarSymbol>
                                                                       {
                                                                           GrammarSymbol.Types
                                                                       };

        /// <summary>
        /// Initializes a new Node object from a Reduction object.
        /// </summary>
        /// <param name="pReduction">The reduction object.</param>
        /// <param name="pLocation">The location in the code.</param>
        /// <returns>The new node</returns>
        public static Node Create(Reduction pReduction, Location pLocation)
        {
            GrammarSymbol symbol = getSymbol(pReduction);

            Node node = new Node(symbol, pLocation);
            for (int i = 0; i < pReduction.Count(); i++)
            {
                Node child = pReduction[i].Data as Node;
                if (child != null)
                {
                    node.Children.Add(child);
                    continue;
                }

                Token token = pReduction[i];
                SymbolType t = token.Type();
                if (t != SymbolType.Content)
                {
                    continue;
                }

                Symbol parent = token.Parent;
                GrammarSymbol dataType = (GrammarSymbol)parent.TableIndex();

                // special case, these nodes carry the terminal on the right
                if (_terminalData.Contains(symbol))
                {
                    node.Data.Add(new TerminalType(dataType));
                    continue;
                }

                if (!DataTypeFactory.isDataType(dataType))
                {
                    continue;
                }

                string str = (string)token.Data;
                node.Data.Add(DataTypeFactory.Create(pLocation, dataType, str));
            }
            return node;
        }

        /// <summary>
        /// Gets the grammar symbol.
        /// </summary>
        /// <param name="pReduction">The node being reduced.</param>
        /// <returns>The symbol</returns>
        public static GrammarSymbol getSymbol(Reduction pReduction)
        {
            Production parent = pReduction.Parent;
            Symbol symbol = parent.Head();
            GrammarSymbol parserSymbol = (GrammarSymbol)symbol.TableIndex();
            return parserSymbol;
        }
    }
}


text:
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.

#pragma once

#include "OnlineUserCloudInterface.h"

#ifdef __IPHONE_8_0
#import <CloudKit/CloudKit.h>

@class IOSCloudStorage;

@interface IOSCloudStorage : NSObject

@property(retain) CKContainer* CloudContainer;
@property(retain) CKDatabase* SharedDatabase;
@property(retain) CKDatabase* UserDatabase;
@property(retain) id iCloudToken;

-(IOSCloudStorage*)init:(bool)registerHandler;
-(bool)readFile:(NSString*)fileName sharedDB:(bool)shared completionHandler:(void(^)(CKRecord* record, NSError* error))handler;
-(bool)writeFile:(NSString*)fileName contents:(NSData*)fileContents sharedDB:(bool)shared completionHandler:(void(^)(CKRecord* record, NSError* error))handler;
-(bool)deleteFile:(NSString*)fileName sharedDB:(bool)shared completionHandler:(void(^)(CKRecordID* record, NSError* error))handler;
-(bool)query:(bool)shared fetchHandler : (void(^)(CKRecord* record))fetch completionHandler : (void(^)(CKQueryCursor* record, NSError* error))complete;

-(void)iCloudAccountAvailabilityChanged:(NSNotification*)notification;

+(IOSCloudStorage*)cloudStorage;

@end
#endif

/**
*	FOnlineUserCloudInterfaceIOS - Implementation of user cloud storage for IOS
*/
class FOnlineUserCloudInterfaceIOS : public IOnlineUserCloud
{
protected:

	FCloudFile* GetCloudFile(const FString& FileName, bool bCreateIfMissing = false);
    FCloudFileHeader* GetCloudFileHeader(const FString& FileName, bool bCreateIfMissing = false);
	bool ClearFiles();
	bool ClearCloudFile(const FString& FileName);

public:
    FOnlineUserCloudInterfaceIOS(){ MetaDataState = EOnlineAsyncTaskState::Done; }
	virtual ~FOnlineUserCloudInterfaceIOS();

	// IOnlineUserCloud
	virtual bool GetFileContents(const FUniqueNetId& UserId, const FString& FileName, TArray<uint8>& FileContents) override;
	virtual bool ClearFiles(const FUniqueNetId& UserId) override;
	virtual bool ClearFile(const FUniqueNetId& UserId, const FString& FileName) override;
	virtual void EnumerateUserFiles(const FUniqueNetId& UserId) override;
	virtual void GetUserFileList(const FUniqueNetId& UserId, TArray<FCloudFileHeader>& UserFiles) override;
	virtual bool ReadUserFile(const FUniqueNetId& UserId, const FString& FileName) override;
	virtual bool WriteUserFile(const FUniqueNetId& UserId, const FString& FileName, TArray<uint8>& FileContents) override;
	virtual void CancelWriteUserFile(const FUniqueNetId& UserId, const FString& FileName) override;
	virtual bool DeleteUserFile(const FUniqueNetId& UserId, const FString& FileName, bool bShouldCloudDelete, bool bShouldLocallyDelete) override;
	virtual bool RequestUsageInfo(const FUniqueNetId& UserId) override;
	virtual void DumpCloudState(const FUniqueNetId& UserId) override;
	virtual void DumpCloudFileState(const FUniqueNetId& UserId, const FString& FileName) override;

private:
	/** File metadata */
	TArray<struct FCloudFileHeader> CloudMetaData;
    /** File metadata query state */
    EOnlineAsyncTaskState::Type MetaDataState;
	/** File cache */
	TArray<struct FCloudFile> CloudFileData;

    /** Critical section for thread safe operation on cloud files */
    FCriticalSection CloudDataLock;
};

typedef TSharedPtr<FOnlineUserCloudInterfaceIOS, ESPMode::ThreadSafe> FOnlineUserCloudIOSPtr;


text:
module.exports = AsLate;

// Tests use this module to inssert into an already running mesh node

function AsLate(arg, u, ments) {
  this.args = arg + u + ments;
  this.started = false;
};

AsLate.prototype.start = function($happn, callback) {
  this.started = true;
  callback();
}

AsLate.prototype.stop = function($happn, callback) {
  this.started = false;
  callback();
}

AsLate.prototype.exchangeMethod = function(opts, callback) {
  opts.args = this.args;
  opts.started = this.started;
  callback(null, opts);
}

AsLate.prototype.mware1 = function($happn, res, req, next) {
  res.send('mware1\n');
  next();
}

AsLate.prototype.mware2 = function(res, req, next) {
  res.send('mware2\n');
  next();
}

AsLate.prototype.webMethod = function($happn, res, req, next) {
  res.end('done');
}

AsLate.prototype.$happner = {
  config: {
    component: {
      startMethod: 'start',
      stopMethod: 'stop',
      web: {
        routes: {
          'long-route': ['mware1', 'mware2', 'webMethod'],
          'short-route': 'webMethod',
          'widget': 'static',
        }
      }
    }
  }
}


text:
#include <aws/alexaforbusiness/model/GetRoomRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::AlexaForBusiness::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;

GetRoomRequest::GetRoomRequest() :
    m_roomArnHasBeenSet(false)
{
}

Aws::String GetRoomRequest::SerializePayload() const
{
  JsonValue payload;

  if(m_roomArnHasBeenSet)
  {
   payload.WithString("RoomArn", m_roomArn);

  }

  return payload.View().WriteReadable();
}

Aws::Http::HeaderValueCollection GetRoomRequest::GetRequestSpecificHeaders() const
{
  Aws::Http::HeaderValueCollection headers;
  headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AlexaForBusiness.GetRoom"));
  return headers;

}


text:
"""
A module that contains the content-based recommender LDARecommender that uses
LDA.
"""
from lib.content_based import ContentBased
from overrides import overrides
from sklearn.decomposition import LatentDirichletAllocation

class LDARecommender(ContentBased):
    """
    LDA Recommender, a content based recommender that uses LDA.
    """
    def __init__(self, initializer, evaluator, hyperparameters, options,
                 verbose=False, load_matrices=True, dump_matrices=True):
        """
        Constructor of Latent Dirichilet allocation's processor.

        :param ModelInitializer initializer: A model initializer.
        :param Evaluator evaluator: An evaluator of recommender and holder of input.
        :param dict hyperparameters: A dictionary of the hyperparameters.
        :param dict options: A dictionary of the run options.
        :param boolean verbose: A flag for printing while computing.
        :param boolean load_matrices: A flag for reinitializing the matrices.
        :param boolean dump_matrices: A flag for saving the matrices.
        """
        super(LDARecommender, self).__init__(initializer, evaluator, hyperparameters, options,
                                             verbose, load_matrices, dump_matrices)

    @overrides
    def train_one_fold(self, return_report=True):
        """
        Train one fold for n_iter iterations from scratch.

        :param bool return_report: A flag to decide if we should return the evaluation report.
        """
        # Try to read from file.
        matrix_found = False
        if self._load_matrices is True:
            matrix_shape = (self.n_items, self.n_factors)
            matrix_found, matrix = self.initializer.load_matrix(self.hyperparameters, 'document_distribution_lda',
                                                                matrix_shape)
            self.document_distribution = matrix
            if self._verbose and matrix_found:
                print("Document distribution was set from file, will not train.")
        if matrix_found is False:
            if self._verbose and self._load_matrices:
                print("Document distribution file was not found, will train LDA.")
            self._train()
            if self._dump_matrices:
                self.initializer.save_matrix(self.document_distribution, 'document_distribution_lda')
        if return_report:
            return self.get_evaluation_report()

    def _train(self):
        """
        Train LDA Recommender, and store the document_distribution.
        """
        term_freq = self.abstracts_preprocessor.get_term_frequency_sparse_matrix()
        lda = LatentDirichletAllocation(n_topics=self.n_factors, max_iter=self.n_iter,
                                        learning_method='online',
                                        learning_offset=50., random_state=0,
                                        verbose=0)
        if self._verbose:
            print("Initialized LDA model..., Training LDA...")

        self.document_distribution = lda.fit_transform(term_freq)
        if self._verbose:
            print("LDA trained..")


text:
<?xml version="1.0" encoding="UTF-8"?>
<Template>
	<TemplateConfiguration>
		<_Name>Prism ViewModel</_Name>
		<Icon>md-class-file</Icon>
		<_Category>Prism</_Category>
		<LanguageName>C#</LanguageName>
		<_Description>Creates a ViewModel that derives from BindableBase for use in a Prism application</_Description>
	</TemplateConfiguration>

	<TemplateFiles>
		<File name="${Name}.${LanguageExtension}" src="PrismViewModel.cs" DefaultExtension=".cs" />
	</TemplateFiles>
</Template>


text:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("BowlingGame6")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BowlingGame6")]
[assembly: AssemblyCopyright("Copyright ©  2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

[assembly: Guid("d7fb5f8d-2cf3-42f1-ac74-93c8ada6d897")]

// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]


text:
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';

const useStyles = makeStyles((theme) => ({
  root: {
    display: 'flex',
    flexWrap: 'wrap',
    '& > *': {
      margin: theme.spacing(1),
      width: theme.spacing(16),
      height: theme.spacing(16),
    },
  },
}));

export default function SimplePaper() {
  const classes = useStyles();

  return (
    <div className={classes.root}>
      <Paper elevation={0} />
      <Paper />
      <Paper elevation={3} />
    </div>
  );
}


text:
package com.jsoniter.output;

import com.jsoniter.spi.ClassInfo;
import com.jsoniter.spi.JsoniterSpi;

import java.lang.reflect.Type;

class CodegenImplMap {
    public static CodegenResult genMap(String cacheKey, ClassInfo classInfo) {
        boolean noIndention = JsoniterSpi.getCurrentConfig().indentionStep() == 0;
        Type[] typeArgs = classInfo.typeArgs;
        boolean isCollectionValueNullable = true;
        if (cacheKey.endsWith("__value_not_nullable")) {
            isCollectionValueNullable = false;
        }
        Type keyType = Object.class;
        Type valueType = Object.class;
        if (typeArgs.length == 2) {
            keyType = typeArgs[0];
            valueType = typeArgs[1];
        }
        CodegenResult ctx = new CodegenResult();
        ctx.append("public static void encode_(java.lang.Object obj, com.jsoniter.output.JsonStream stream) throws java.io.IOException {");
        ctx.append("if (obj == null) { stream.writeNull(); return; }");
        ctx.append("java.util.Map map = (java.util.Map)obj;");
        ctx.append("java.util.Iterator iter = map.entrySet().iterator();");
        if (noIndention) {
            ctx.append("if(!iter.hasNext()) { return; }");
        } else {
            ctx.append("if(!iter.hasNext()) { stream.write((byte)'{', (byte)'}'); return; }");
        }
        ctx.append("java.util.Map.Entry entry = (java.util.Map.Entry)iter.next();");
        if (noIndention) {
            ctx.buffer('{');
        } else {
            ctx.append("stream.writeObjectStart(); stream.writeIndention();");
        }
        genWriteMapKey(ctx, keyType, noIndention);
        if (isCollectionValueNullable) {
            ctx.append("if (entry.getValue() == null) { stream.writeNull(); } else {");
            CodegenImplNative.genWriteOp(ctx, "entry.getValue()", valueType, true);
            ctx.append("}");
        } else {
            CodegenImplNative.genWriteOp(ctx, "entry.getValue()", valueType, false);
        }
        ctx.append("while(iter.hasNext()) {");
        ctx.append("entry = (java.util.Map.Entry)iter.next();");
        if (noIndention) {
            ctx.append("stream.write(',');");
        } else {
            ctx.append("stream.writeMore();");
        }
        genWriteMapKey(ctx, keyType, noIndention);
        if (isCollectionValueNullable) {
            ctx.append("if (entry.getValue() == null) { stream.writeNull(); } else {");
            CodegenImplNative.genWriteOp(ctx, "entry.getValue()", valueType, true);
            ctx.append("}");
        } else {
            CodegenImplNative.genWriteOp(ctx, "entry.getValue()", valueType, false);
        }
        ctx.append("}");
        if (noIndention) {
            ctx.buffer('}');
        } else {
            ctx.append("stream.writeObjectEnd();");
        }
        ctx.append("}");
        return ctx;
    }

    private static void genWriteMapKey(CodegenResult ctx, Type keyType, boolean noIndention) {
        if (keyType == Object.class) {
            ctx.append("stream.writeObjectField(entry.getKey());");
            return;
        }
        if (keyType == String.class) {
            ctx.append("stream.writeVal((java.lang.String)entry.getKey());");
        } else if (CodegenImplNative.NATIVE_ENCODERS.containsKey(keyType)) {
            ctx.append("stream.write('\"');");
            ctx.append(String.format("stream.writeVal((%s)entry.getKey());", CodegenImplNative.getTypeName(keyType)));
            ctx.append("stream.write('\"');");
        } else {
            String mapCacheKey = JsoniterSpi.getMapKeyEncoderCacheKey(keyType);
            ctx.append(String.format("com.jsoniter.output.CodegenAccess.writeMapKey(\"%s\", entry.getKey(), stream);", mapCacheKey));
        }
        if (noIndention) {
            ctx.append("stream.write(':');");
        } else {
            ctx.append("stream.write((byte)':', (byte)' ');");
        }
    }
}


text:
<?php
function formate_card($post) {
	return preg_replace('/[^-_a-zA-Z0-9 \'' .'àáâãäçèéêëìíîï' .'ñòóôõöùúûüýÿ' .'ÀÁÂÃÄÇÈÉÊËÌÍÎÏ' .'ÑÒÓÔÕÖÙÚÛÜÝ]/ui','', $post);
}

if(isset($_POST['scoreboard_reset'])) {
	$prefs->scores = [];
	$prefs->save();
	exit_redirect();
}

if(isset($_POST['scoreboard_effacer'])) {
	$card = formate_card($_POST['scoreboard_nom']);
	if($card && isset($prefs->scores[$card])) {
		unset($prefs->scores[$card]);
		$prefs->save();
	}
	exit_redirect();
}

if(isset($_POST['scoreboard_index'])) {
	$prefs->set("scoreboard_index",intval($_POST['scoreboard_index'],0));
	$prefs->save();
	exit_redirect();
}

if(isset($_POST['scoreboard_switch'])) {
	$prefs->set("scoreboard_on",$_POST['scoreboard_switch']?true:false);
	$prefs->save();
	exit_redirect();
}

if(isset($_POST["scoreboard_updown"])) {
	$value = intval($_POST["scoreboard_changer"]);
	$delta = intval($_POST["scoreboard_updown"]) * intval($_POST["scoreboard_modif"]);
	if($delta != 0) {
		$card = formate_card($_POST['scoreboard_nom']);
		if($card && isset($prefs->scores[$card])) {
			$prefs->scores[$card]['score'] = $value+$delta;
			$prefs->scores[$card]['stamp'] = time();
			$prefs->save();
		}
	}
	exit_redirect();
}

if(isset($_POST['scoreboard_add'])) {
	$value = intval($_POST["scoreboard_changer"]);
	$delta = intval($_POST["scoreboard_add"]);
	if($delta != 0) {
		$card = formate_card($_POST['scoreboard_nom']);
		if($card && isset($prefs->scores[$card])) {
			$prefs->scores[$card]['score'] = $value+$delta;
			$prefs->scores[$card]['stamp'] = time();
			$prefs->save();
		}
	}
	exit_redirect();
}

if(isset($_POST["scoreboard_modif"]) && $_POST["scoreboard_modif"]!="") {
	$card = formate_card($_POST['scoreboard_nom']);
	$value = intval($_POST["scoreboard_changer"]);
	if($card && isset($prefs->scores[$card])) {
		$prefs->scores[$card]['score'] = $value;
		$prefs->scores[$card]['stamp'] = time();
		$prefs->save();
	}
	exit_redirect();
}

if(isset($_POST['scoreboard_new_nom']) && $_POST['scoreboard_new_nom']!="") {
	$nom = formate_card($_POST['scoreboard_new_nom']);
	if($_POST["scoreboard_new_score"] == "") $value = 1;
	else $value = intval($_POST["scoreboard_new_score"]);
	if($nom && !isset($prefs->scores[$nom])) {
		$prefs->scores[$nom] = array(
			'nom' => $nom,
			'score' => $value,
			't0' => time(),
			'stamp' => time(), // dernier gain
		);
		$prefs->save();
	}
	exit_redirect();
}

function disp_scoreboard($thisurl) {
	global $prefs,$Nscreens;
	$scores = $prefs->sortedScores();
	?>

Scores

	<form action="<?=$thisurl?>" name="scoreboard_indexing" method="POST">
		<?php $zindex = intval($prefs->get('scoreboard_index',0)); ?>
		<select class="scoreboard_index" name="scoreboard_index" title="Position par rapport aux écrans">
			<option value="0">Derrière</option><?php
			for($screen=1; $screen<$Nscreens; $screen++) {
				$selected = $screen == $zindex ? "selected" : "";
				?><option value="<?=$screen?>" <?=$selected?>>Entre <?=$screen ?> et <?=$screen+1 ?></option><?
			}
			$selected = ($Nscreens == $zindex || $zindex == 100) ? "selected" : ""; ?>
			<option value="100" <?=$selected?>>Devant</option>
		</select>
	</form>
	<form action="<?=$thisurl?>" name="scoreboard_onoff" method="POST">
	<?php
	if($prefs->get("scoreboard_on",false)) {
		?><button class="btn_switch btn_switch_on" name="scoreboard_switch" value="0" title="Activé, cliquer pour masquer les scores">ON</button><?
	} else {
		?><button class="btn_switch btn_switch_off" name="scoreboard_switch" value="1" title="Désactivé, cliquer pour afficher les scores">OFF</button><?
	}
	?>
	</form>

	<?
	$i = 0;
	foreach($scores as $card) {
		$i += 1;
		if($i%2) { $parite = "pair"; } else { $parite = "impair"; }
		?>
		<div class="scoreboard_line <?=$parite?>">
		<form action="<?=$thisurl?>" name="scorecard" method="POST" autocomplete="off">
			<input type="submit" style="display:none" name="scoreboard_ok" value="ok"/>
			<input type="hidden" name="scoreboard_nom" value="<?=$card['nom']?>"/>
			<button class="btn_image down_score" name="scoreboard_updown" value="-1" title="Réduire le score du nombre indiqué"></button>
			<input class="modif_score" type="text" name="scoreboard_modif" value="1" title="Valeur pour modifier le score"/>
			<button class="btn_image up_score" name="scoreboard_updown" value="1" title="Augmenter le score du nombre indiqué"></button>
			<?php if($prefs->active_screen()!==null): ?>
			<button class="btn_image active_score score_value" name="scoreboard_add" value="0" title="Donner les points du jeu en cours"></button>
			<?php endif; ?>
			<input class="score" type="text" name="scoreboard_changer" value="<?=$card['score']?>" title="Score, entrée pour modifier"/>

			<?=$card['nom']?>
			<button class="btn_image effacer_score" name="scoreboard_effacer" value="<?=$card['nom']?>" title="Retirer le joueur"></button>
		</form>

		<?
	}
	?>

	<form action="<?=$thisurl?>" name="scoreboard" method="POST">

		Ajouter <input class="scoreboard_new_score" name="scoreboard_new_score" value="" title="Nouvelle valeur de points" placeholder="Score (1)"/><input class="scoreboard_new_nom" name="scoreboard_new_nom" value="" title="Entrer un nouveau nom et valider avec entrée" placeholder="Nom du nouveau"/><button class="btn_image scoreboard_new_btn" name="scoreboard_new_btn" value="ok" title="Ajouter le joueur"></button>

	</form>

	<?
}


text:
@class RSZNotification;

@interface RSZPresenter : NSObject

+ (void)setPresentingWindow:(UIWindow *)window;

+ (void)presentNotification:(RSZNotification *)notification;
+ (void)presentNotification:(RSZNotification *)notification autoDismissal:(BOOL)autoDismiss;
+ (void)presentNotification:(RSZNotification *)notification after:(NSTimeInterval)delay autoDismissal:(BOOL)autoDismiss;

+ (void)hideNotification:(RSZNotification *)notification;
+ (void)hideNotification:(RSZNotification *)notification completion:(void (^)(BOOL success, BOOL isPresenting))completion;

@end


text:
Provides a canonical mongodb user and authentication store as part of the passport (https://github.com/jaredhanson/passport) family. It makes use of mongoose and has taken some inspiration from devise

THIS IS NOT DONE YET. DON'T USE YET

[![Build Status](https://secure.travis-ci.org/scottyapp/passport-users-mongoose.png)](http://travis-ci.org/scottyapp/passport-users-mongoose.png)

_id
userName
displayName
description (one liner like twitter status, do you have a better term)
emails: Array of email object, with sparse index on email. (email, dateCreated, dateUpdated,isVerified,verificationToken)
notificationEmail: This is the email to send notifications to (better to have an easy to grasp field)
createdAt
updatedAt

roles: array of string
statistics:
   signInCount: 12

authentications: array of
     provider: (twitter, facebook,....)
     uid: Userid with the provider
     secret: secret used to obtain the values - needs to be stored for future use
     token: long living token returned by the provider
     bearerToken:? need to look into oauth2 with refresh...
     description
     email
     firstName
     lastName
     profileImage
     displayName: like Martin Wawrusch
     userName;  like martin_sunset
     others: Object containing additional infos

--> abuse management
--> temporary/anonymous users --> Strategy

# Install

npm install passport-users-mongoose

## Usage

### Coffeescript

### Javascript

## Advertising :)

Check out

* http://scottyapp.com

Follow us on Twitter at

* @getscottyapp
* @martin_sunset

and like us on Facebook please. Every mention is welcome and we follow back.

## Trivia

* Soundgarden. A lot of Soundgarden.

## Release Notes

### 0.0.1

* First version

## Internal Stuff

* npm run-script watch

# Publish new version

* Change version in package.json
* git tag -a v0.0.1 -m 'version 0.0.1'
* git push --tags
* npm publish

## Contributing to passport-users-mongoose

* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
* Fork the project
* Start a feature/bugfix branch
* Commit and push until you are happy with your contribution
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the package.json, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

## Copyright

Copyright (c) 2011 Martin Wawrusch. See LICENSE for
further details.


text:
DataRequireJS
=============
A require module that loads other require modules using the data-require attribute. Each module that is loaded this way also gets a reference to it's DOM-element when it's created. The goal of this library is to make it easier to organize javascript-code on a larger web-site.

Dependencies
=============
require.js

Demo
=============
The library can be tested in a browser using the file demo/index.html. This example contains a simple page that loads in some modules using the data-require attribute. The demo also contains an example of how the module handles ajax-loaded markup.

Unit-test
=============
Run: grunt jasmine


text:
{% extends "base.html" %}{% load i18n st_core blog %}

{% block title %}{% trans "Welcome" %}{% endblock %}

{% block description %}{% trans "Welcome to index page" %}{% endblock %}

{% block content %}
<script>
var disqus_config = function () {
    this.language = "{{ LANGUAGE_CODE  }}";
};
</script>
  {% get_recent_posts LANGUAGE_CODE POSTS_IN_INDEX as posts %}
  {% for post in posts %}{% include "blog/post_excerpt.html" %}{% endfor %}
{% endblock %}


text:
class ChangePlantsStatesColumns < ActiveRecord::Migration
  def up
    remove_column :plants_states, :plant_id
    remove_column :plants_states, :state_id

    add_column :plants_states, :plant_symbol, :string
    add_column :plants_states, :state_fips_code, :integer
  end

  def down
    add_column :plants_states, :plant_id, :integer
    add_column :plants_states, :state_id, :integer

    remove_column :plants_states, :plant_symbol
    remove_column :plants_states, :state_fips_code
  end
end