text:
<!DOCTYPE html>

<input type='hidden' class='sheet-tabstoggle' name='attr_sheetTab'  value='character'/>

	<button type="action" class=sheet-stub-tab>CharacterJournal</button>

		<button type="action" class=sheet-selected-tab name="act_character">Character</button>
		<button type="action" class=sheet-unselected-tab name="act_journal">Journal</button>

					Name
					<input type=text style='width: 22em;' name="attr_cname"/>

						 Age <input type=text style='width: 3em;'name="attr_age"/>

					 Title/Rank <input type=text style='width: 7em;' name="attr_title"/>

					 Race <input type=text style='width: 8em;'name="attr_race"/>

					 Gender <input type=text style='width: 5em;' name="attr_gender"/>

							ST
							<input class=sheet-tiny-input type=text name="attr_ST_max" value="8"/>

						+
						<input class=sheet-small-input type=number title="Temporary adjustment to Strength, not counting Wounds or Fatigue." name="attr_ST_adj" value="0"/>
						=

						<button class=sheet-dice-button type="action" title="3d6 Strength Check" name="act_st_check3">3</button>
						<button class=sheet-dice-button type="action" title="4d6 Strength Check" name="act_st_check4">4</button>

							DX
							<input class=sheet-tiny-input type=text name="attr_DX_max" value="8"/>

						+
						<input class=sheet-small-input type=number title="Temporary adjustment to Dexterity." name="attr_DX_adj" value="0"/>
						=

						<button class=sheet-dice-button type="action" title="3d6 Dexterity Check" name="act_dx_check3">3</button>
						<button class=sheet-dice-button type="action" title="4d6 Strength Check" name="act_dx_check4">4</button>

							IQ
							<input class=sheet-tiny-input type=text name="attr_IQ_max" value="8"/>

						+
						<input class=sheet-small-input type=number title="Temporary adjustment to IQ." name="attr_IQ_adj" value="0"/>
						=

						<button class=sheet-dice-button type="action" title="3d6 IQ Check" name="act_iq_check3">3</button>
						<button class=sheet-dice-button type="action" title="4d6 IQ Check" name="act_iq_check4">4</button>

							MA
							<input class=sheet-tiny-input type=text name="attr_MA_max" value="10"/>

						+
						<input class=sheet-small-input type=number title="Temporary adjustment to Movement Allowance, excluding caused by weight." name="attr_MA_adj" value="0"/>
						=

							Carry

							Mana
							<input class=sheet-tiny-input type=text name="attr_mana_max" value="0"/>

						-
						<input class=sheet-small-input title="How much Mana spent." type=number name="attr_mana_adj" value="0"/>
						=

						Saves

						<button class=sheet-dice-button type="action" title="2d6 Save" name="act_save2">2</button>
						<button class=sheet-dice-button type="action" title="2d6 Save" name="act_save3">3</button >
						<button class=sheet-dice-button type="action" title="2d6 Save" name="act_save4">4</button>
						<button class=sheet-dice-button type="action" title="5d6 Save" name="act_save5">5</button>
						<button class=sheet-dice-button type="action" title="6d6 Save" name="act_save6">6</button>
						<button class=sheet-dice-button type="action" title="7d6 Save" name="act_save7">7</button>
						<button class=sheet-dice-button type="action" title="8d6 Save" name="act_save8">8</button>

					<button class=sheet-dice-button type="action" title="Add yourself to Turn Order, select your Token first." name="act_turnorder">Turn Order</button>

						<button class=sheet-dice-button type="action" title="Roll team Initiative." name="act_initiative">Initiative</button>
						<input class=sheet-onechar-input type=text title="Bonus to Initiative, as for Tactics or Strategist." name="attr_initiative_adj"/>

						Health

						<button class=sheet-dice-button type="action" title="3d6 Health Check" name="act_health_check3">3</button>
						<button class=sheet-dice-button type="action" title="4d6 Health Check" name="act_health_check4">4</button>

						Wounds
						<input type=number class=sheet-small-input name="attr_Hits" value="0"/>

					<button class=sheet-dice-button type="action" title="Reaction to attacker initiating Hand to Hand Combat." style='width: 4.6rem' name="act_hthreaction">HTH</button>

						Fatigue
						<input type=number class=sheet-small-input name="attr_Fatigue" value="0"/>

						<button class=sheet-dice-button type="action" title="Shield Rush Save vs weaker (unwounded strength) rusher." style='width: 4.6rem' name="act_shieldrushweaker">SRW</button>
						<button class=sheet-dice-button type="action" title="Shield Rush Save vs equal or stronger (unwounded strength) rusher." style='width: 4.6rem' name="act_shieldrushstronger">SRS</button>

						Minus to Hit

						MtH Flank

						Hits Blocked

						HB Flank

					Talent

						Available IQ

				<fieldset class=repeating_talents>

						<input type=text name=attr_talentname class=sheet-flex placeholder="Talent Name">

						<button class="sheet-describe-button" title="Describe the talent." type="action" name="act_describe"/>
						<button class="sheet-expand-button" title="Expand and edit more fields." type="action" name="act_expand"/>

					<input type="checkbox" name="attr_options-flag" hidden class="sheet-toggle">

								IQ Spent:
								<input type=text class=sheet-tiny-input name="attr_talentcost">

								XP Spent:
								<input type=text class=sheet-small-input name="attr_expspent">

							IQ Required:
							<input type=text class=sheet-tiny-input name=attr_talentiq>

						Description:
						<textarea class=sheet-text-area spellcheck="false" name="attr_description"></textarea>

				</fieldset>

				Attack

					<button class=sheet-attack-button title="Vs. Invisible or in total darkness/blind" type="action" name="act_attack-6">-6</button>
					<button class=sheet-attack-button type="action" name="act_attack-5">-5</button>
					<button class=sheet-attack-button title="Missile/Thrown against Prone behind cover or only head and shoulders visible, or vs. Flying" type="action" name="act_attack-4">-4</button>
					<button class=sheet-attack-button title="Health at 3 or less" type="action" name="act_attack-3">-3</button>
					<button class=sheet-attack-button title="Missile at 5+6 MH, Severely Wounded (-5 or more) last turn, standing on a body, vertical cover, melee from > half yard below" type="action" name="act_attack-2">-2</button>
					<button class=sheet-attack-button title="Missile at 3+4 MH, Thrown per hex, Molotail per MH, or Projectile per 10 vertical feet" type="action" name="act_attack-1">-1</button>
					<button class=sheet-attack-button type="action" name="act_attack0">0</button>
					<button class=sheet-attack-button title="Missile per attackable extra hex of a multi hex creature" type="action" name="act_attack1">+1</button>
					<button class=sheet-attack-button title="Melee/Thrown against Flank, or pole set against charger, Melee from > half yard above" type="action" name="act_attack2">+2</button>
					<button class=sheet-attack-button type="action" name="act_attack3">+3</button>
					<button class=sheet-attack-button title="Melee/Thrown against Rear, Prone, or in HTH" type="action" name="act_attack4">+4</button>
					<button class=sheet-attack-button type="action" name="act_attack5">+5</button>
					<button class=sheet-attack-button type="action" name="act_attack6">+6</button>

				<button class=sheet-attack-button title="Automatic attack/cast success, use for HTH Reaction=6, bound victims, etc." type="action" name="act_attacka">A</button>
				<input type=checkbox name=attr_defending class=sheet-caption-checkbox hidden>
				<button class=sheet-caption-button title="Roll 4d6, use vs. Defending/Dodging or Unskilled Attack, deselects after each attack" type="action" name="act_attack4d">4d</button>
				<input type=checkbox name=attr_defending2 class=sheet-caption-checkbox hidden>
				<button class=sheet-caption-button title="Roll 5d6, use vs. Weapon Mastery Defending/Dodging, deselects after each attack" type="action" name="act_attack5d">5d</button>

				Weapon
				<button class=sheet-select-button style='visibility:hidden' type="action"/>
				Weapon
				Damage
				To Hit
				Notes
				Count
				Lbs

					NC
					<button type="action" class=sheet-checkbox-button name="act_none" style='visibility:hidden;'>

				<button class=sheet-describe-button style='visibility:hidden' type="action"/>
				<button class=sheet-expand-button style='visibility:hidden' type="action"/>

			<fieldset class=repeating_weapons>

					<input type="checkbox" class="sheet-select-radio" name="attr_selection-flag" hidden>
					<button type="action" class=sheet-select-button title="Select this Weapon for Attack!" name="act_select"/>
					<input type=text name=attr_weaponname style='width: 13rem;' placeholder="Weapon Name">
					<input type=text name=attr_weapondamage style='width: 6rem;'>
					<input type=text name=attr_tohit style='width: 4rem;'>
					<input type=text name=attr_weaponnotes class=sheet-flex>
					<input type=number name=attr_count value="1" style='width: 5rem;'>
					<input type=text name=attr_weight style='width: 4rem;'>
					<input type="checkbox" name="attr_notcarried" class=sheet-checkbox-checkbox hidden>
					<button type="action" class=sheet-checkbox-button name="act_check_notcarried" />

					<button class=sheet-describe-button title="Describe the weapon." type="action" name="act_describe"/>
					<button class=sheet-expand-button title="Expand and edit more fields in the selected weapon." type="action" name="act_expand"/>

				<input type="checkbox" name="attr_options-flag" class="sheet-toggle" hidden>

					Attack Flavor Text:
					<input type=text name="attr_attackflavor" style='display: block; width:100%' placeholder="swings his mighty war axe.">
					Success Flavor Text:
					<input type=text name="attr_successflavor" style='display: block; width:100%' placeholder="The axe hits with a sickening crunch!">
					Failure Flavor Text:
					<input type=text name="attr_failureflavor" style='display: block; width:100%' placeholder="The axe swooshes air!">
					Description:
					<textarea class=sheet-text-area spellcheck="false" name="attr_description"></textarea>

			</fieldset>

				Spell
				<button class=sheet-select-button style='visibility:hidden' type="action"/>
				Spell
				Damage
				To Hit
				ST Cost
				Duration
				Notes

				<button class=sheet-describe-button style='visibility:hidden' type="action"/>
				<button class=sheet-expand-button style='visibility:hidden' type="action"/>

			<fieldset class=repeating_spells>

					<input type="checkbox" class="sheet-select-radio" name="attr_selection-flag" hidden>
					<button title="Select this Spell for casting." class=sheet-select-button type="action" name="act_select"/>
					<input type=text name=attr_spellname style='width: 13rem;' placeholder="Spell Name">
					<input type=text name=attr_spelldamage style='width: 6rem;'>
					<input type=text name=attr_tohit style='width: 4rem;'>
					<input type=text name=attr_stcost style='width: 7rem;'>
					<input type=text name=attr_duration style='width: 7rem;'>
					<input type=text name=attr_spellnotes class=sheet-flex>

					<button class=sheet-describe-button title="Describe the spell." type="action" name="act_describe"/>
					<button class=sheet-expand-button title="Expand and edit more fields." type="action" name="act_expand"/>

				<input type="checkbox" name="attr_options-flag" hidden class="sheet-toggle">

							IQ Spent:
							<input type=text class=sheet-tiny-input name="attr_spellcost">

							XP Spent:
							<input type=text class=sheet-small-input name="attr_expspent">

						IQ Required:
						<input type=text class=sheet-tiny-input name=attr_iqrequired>

						Success Flavor Text:
						<input type=text name="attr_successflavor" style='display: block; width:100%' placeholder="A giant wolf appears.">

						Failure Flavor Text:
						<input type=text name="attr_failureflavor" style='display: block; width:100%' placeholder="A whisker falls to the ground.">

Description:

					<textarea class=sheet-text-area spellcheck="false" name="attr_description"></textarea>

			</fieldset>

				Armor/Shield
				Hits Blocked
				Minus to Hit
				DX Penalty
				Notes
				Lbs

					NF
					<button type="action" class=sheet-checkbox-button name="act_none" style='visibility:hidden;'>

					NC
					<button type="action" class=sheet-checkbox-button name="act_none" style='visibility:hidden;'>

				<button class=sheet-describe-button style='visibility:hidden' type="action"/>
				<button class=sheet-expand-button style='visibility:hidden' type="action"/>

			<fieldset class=repeating_armor>

					<input type=text name=attr_defensename value="" style='width: 13rem;' placeholder="Armor/Shield Type">
					<input type=text name=attr_hitsblocked value="0" style='width: 5rem;'>
					<input type=text name=attr_minustohit value="0" style='width: 5rem;'>
					<input type=text name=attr_dexpenalty value="0" style='width: 5rem;'>
					<input type=text name=attr_defensenotes class=sheet-flex>
					<input type=text name=attr_weight value="" style='width: 4rem;'>
					<input type="checkbox" name="attr_nonflanking" class=sheet-checkbox-checkbox hidden>
					<button type="action" class=sheet-checkbox-button name="act_check_nonflanking" />
					<input type="checkbox" name="attr_notcarried" class=sheet-checkbox-checkbox hidden>
					<button type="action" class=sheet-checkbox-button name="act_check_notcarried" />

					<button class=sheet-describe-button title="Describe the Armor/Shield." type="action" name="act_describe"/>
					<button class=sheet-expand-button title="Expand and edit more fields." type="action" name="act_expand"/>

				<input type="checkbox" name="attr_options-flag" hidden class="sheet-toggle">

Description:

					<textarea class=sheet-text-area spellcheck="false" name="attr_description"></textarea>

			</fieldset>

				Equipment
				Count
				Notes
				Lbs

					NC
					<button type="action" class=sheet-checkbox-button name="act_none" style='visibility:hidden;'>

				<button class=sheet-describe-button style='visibility:hidden' type="action"/>
				<button class=sheet-expand-button style='visibility:hidden' type="action"/>

			<fieldset class=repeating_equipment>

					<input type=text name=attr_name style='width: 13rem;' placeholder="Equipment Name">
					<input type=number name=attr_count value="1" style='width: 8rem;'>
					<input type=text name=attr_notes class=sheet-flex>
					<input type=text name=attr_weight value="" style='width: 4rem;'>
					<input type="checkbox" name="attr_notcarried" class=sheet-checkbox-checkbox hidden>
					<button type="action" class=sheet-checkbox-button name="act_check_notcarried" />

					<button class=sheet-describe-button title="Describe the Equipment." type="action" name="act_describe"/>
					<button class=sheet-expand-button title="Expand and edit more fields." type="action" name="act_expand"/>

				<input type="checkbox" name="attr_options-flag" hidden class="sheet-toggle">

Description:

					<textarea class=sheet-text-area spellcheck="false" name="attr_description"></textarea>

			</fieldset>

	<button type="action" class=sheet-stub-tab>CharacterJournal</button>

		<button type="action" class=sheet-unselected-tab name="act_character">Character</button>
		<button type="action" class=sheet-selected-tab name="act_journal">Journal</button>

			Experience Points

						Total XP
						<input type=number style='width: 6em;' name="attr_experiencetotal" value="0"/>

					&nbsp
					Available XP
					&nbsp
					Spent XP

						Attribute Point Total

					&nbsp

						Next Attribute Point Cost  XP

				Attribute Acquired
				XP Spent
				Notes

			<fieldset class=repeating_exphistory>

					<input type=text name=attr_expability style='width: 12rem;' placeholder='<Attribute name>'>
					<input type=text name=attr_expspent style='width: 8rem;'>
					<input type=text name=attr_expnotes class=sheet-flex>

			</fieldset>

			Notes
			<textarea class=sheet-text-area spellcheck="false" name="attr_inventory" title="Notes"></textarea>

			Other Spells and Talents
			<textarea class=sheet-text-area spellcheck="false" name="attr_spells" title="Spells"></textarea>

<rolltemplate class="sheet-rolltemplate-stat-check">

{{character_name}} makes {{stat_a}}
			{{stat_name}}
			check.

			{{computed::roll1}}
			= {{roll1}} vs {{stat}}

		{{#rollGreater() computed::success 0}}
			{{#rollTotal() computed::success 3}}

Critical Success!

			{{/rollTotal() computed::success 3}}
			{{#rollTotal() computed::success 2}}

Automatic Success!

			{{/rollTotal() computed::success 2}}
			{{#rollTotal() computed::success 1}}

Success!

			{{/rollTotal() computed::success 1}}
		{{/rollGreater() computed::success 0}}

		{{#rollLess() computed::success 0}}
			{{#rollTotal() computed::success -3}}

Critical Failure!

			{{/rollTotal() computed::success -3}}
			{{#rollTotal() computed::success -2}}

Automatic Failure!

			{{/rollTotal() computed::success -2}}
			{{#rollTotal() computed::success -1}}

Failure!

			{{/rollTotal() computed::success -1}}
		{{/rollLess() computed::success 0}}

</rolltemplate>

<rolltemplate class="sheet-rolltemplate-attack">

			{{#attackflavor}}
				{{character_name}} {{attackflavor}}
			{{/attackflavor}}
			{{^attackflavor}}
				{{#weaponname}}
					{{character_name}} attacks with {{pronoun}} {{weaponname}}!
				{{/weaponname}}
				{{^weaponname}}
					{{character_name}} Attacks!
				{{/weaponname}}
			{{/attackflavor}}

		{{#defending}}

Opponent is defending/dodging

		{{/defending}}
		{{^roll1}}

Automatic Hit

		{{/roll1}}

		{{#roll1}}

					{{computed::roll1}}
					= {{roll1}} vs
					{{#simpletohit}}
						{{tohit}}
					{{/simpletohit}}

				{{^simpletohit}}

						{{dx}}
						{{#weaponadj}}
						 + {{weaponadj}}
						{{/weaponadj}}
						{{#tohitadj}}
						 + {{tohitadj}}
						{{/tohitadj}}
						 = {{tohit}}

				{{/simpletohit}}

		{{/roll1}}

		{{#rollGreater() computed::success 0}}
			{{#successflavor}}

{{successflavor}}

			{{/successflavor}}
			{{^successflavor}}

Hit!

			{{/successflavor}}
			{{#rollTotal() computed::success 4}}
				{{#damage}}

Damage: {{damage}} &times 3 = {{computed::damage}}

				{{/damage}}

Critical: Triple Damage!

			{{/rollTotal() computed::success 4}}
			{{#rollTotal() computed::success 3}}
				{{#damage}}

Damage: {{damage}} &times 2 = {{computed::damage}}

				{{/damage}}

Critical: Double Damage!

			{{/rollTotal() computed::success 3}}
			{{#rollLess() computed::success 3}}
				{{#damage}}

Damage: {{damage}}

				{{/damage}}
				{{#rollTotal() computed::success 2}}

Automatic hit.

				{{/rollTotal() computed::success 2}}
			{{/rollLess() computed::success 3}}
		{{/rollGreater() computed::success 0}}

		{{#rollLess() computed::success 0}}
			{{#failureflavor}}

{{failureflavor}}

			{{/failureflavor}}
			{{^failureflavor}}

Miss!

			{{/failureflavor}}
			{{#rollTotal() computed::success -4}}

Critical: Weapon breaks or 1d6 damage!

			{{/rollTotal() computed::success -4}}
			{{#rollTotal() computed::success -3}}

Critical: Drops weapon or 1d6 damage!

			{{/rollTotal() computed::success -3}}
			{{#rollTotal() computed::success -2}}

Automatic miss.

			{{/rollTotal() computed::success -2}}
		{{/rollLess() computed::success 0}}

</rolltemplate>

<rolltemplate class="sheet-rolltemplate-cast-spell">

{{character_name}} casts {{spellname}}.

		{{#defending}}

Opponent is defending/dodging

		{{/defending}}
		{{^roll1}}

Automatic Success

		{{/roll1}}

		{{#roll1}}

					{{computed::roll1}}
					= {{roll1}} vs
					{{#simpletohit}}
						{{tohit}}
					{{/simpletohit}}

				{{^simpletohit}}

						{{dx}}
						{{#spelladj}}
						 + {{spelladj}}
						{{/spelladj}}
						{{#tohitadj}}
						 + {{tohitadj}}
						{{/tohitadj}}
						 = {{tohit}}

				{{/simpletohit}}

		{{/roll1}}

		{{#rollGreater() computed::success 0}}
			{{#successflavor}}

{{successflavor}}

			{{/successflavor}}
			{{^successflavor}}

Success!

			{{/successflavor}}
			{{#rollTotal() computed::success 4}}
				{{#damage}}

Damage: {{damage}} &times 3 = {{computed::damage}}

				{{/damage}}

Critical: Triple Damage or Effect!

			{{/rollTotal() computed::success 4}}
			{{#rollTotal() computed::success 3}}
				{{#damage}}

Damage: {{damage}} &times 2 = {{computed::damage}}

				{{/damage}}

Critical: Double Damage or Effect!

			{{/rollTotal() computed::success 3}}
			{{#rollLess() computed::success 3}}
				{{#damage}}

Damage: {{damage}}

				{{/damage}}
				{{#rollTotal() computed::success 2}}

Automatic success.

				{{/rollTotal() computed::success 2}}
			{{/rollLess() computed::success 3}}
		{{/rollGreater() computed::success 0}}

		{{#rollLess() computed::success 0}}
			{{#failureflavor}}

{{failureflavor}}

			{{/failureflavor}}
			{{^failureflavor}}

Failure!

			{{/failureflavor}}
			{{#rollTotal() computed::success -4}}

Critical: Staff breaks!

			{{/rollTotal() computed::success -4}}
			{{#rollTotal() computed::success -3}}

Critical: Lose ST, drop staff!

			{{/rollTotal() computed::success -3}}
			{{#rollTotal() computed::success -2}}

Automatic fail.

			{{/rollTotal() computed::success -2}}
		{{/rollLess() computed::success 0}}

</rolltemplate>

<rolltemplate class="sheet-rolltemplate-initiative">

			{{character_name}} takes initiative!

				{{#initiativeadj}}
					{{computed::roll1}} + {{initiativeadj}} = {{roll1}}
				{{/initiativeadj}}
				{{^initiativeadj}}
					{{computed::roll1}} = {{roll1}}
				{{/initiativeadj}}

</rolltemplate>

<rolltemplate class="sheet-rolltemplate-turnorder">

			{{character_name}}'s Turn Order

			Dexterity: {{turnorder}}

</rolltemplate>

<rolltemplate class="sheet-rolltemplate-shield-rush">

{{character_name}} makes a Shield Rush save.

		{{#weaker}}

Rusher is weaker

		{{/weaker}}
		{{^weaker}}

Rusher is equal or stronger

		{{/weaker}}

			{{computed::roll1}}
			= {{roll1}} vs {{stat}}

		{{#rollGreater() computed::success 0}}

Remains standing!

		{{/rollGreater() computed::success 0}}

		{{#rollLess() computed::success 0}}

Falls prone!

			{{#rollTotal() computed::success -2}}

Automatic Failure.

			{{/rollTotal() computed::success -2}}
		{{/rollLess() computed::success 0}}

</rolltemplate>

<rolltemplate class="sheet-rolltemplate-hth-reaction">

{{character_name}} reacts to Hand to Hand Combat.

			{{computed::roll1}}

		{{#rollBetween() roll1 1 2}}

Drops weapon and shield unless main-gouche or dagger.

Must fight bare handed this turn.

Drops prone with attacker.

		{{/rollBetween() roll1 1 2}}
		{{#rollBetween() roll1 3 4}}

Drops weapon and shield unless main-gouche or dagger.

Readies dagger and can use it this turn.

Drops prone with attacker.

		{{/rollBetween() roll1 3 4}}
		{{#rollTotal() roll1 5}}

Keeps weapon and shield!

Attacker backs up to adjacent hex in the direction they came from.

No Hand to Hand combat.

		{{/rollTotal() roll1 5}}
		{{#rollTotal() roll1 6}}

Keeps weapon and shield!

Automatically hits the attacker RIGHT NOW.

Attacker backs up to adjacent hex in the direction they came from.

No Hand to Hand combat.

					Note:

						If attacked from behind or has no weapon and no unarmed-combat skill, re-roll this.

		{{/rollTotal() roll1 6}}

</rolltemplate>

<rolltemplate class="sheet-rolltemplate-description">

			{{item_name}}

		{{#stat0}}

{{name0}}: {{stat0}}

		{{/stat0}}
		{{#stat1}}

{{name1}}: {{stat1}}

		{{/stat1}}
		{{#stat2}}

{{name2}}: {{stat2}}

		{{/stat2}}
		{{#stat3}}

{{name3}}: {{stat3}}

		{{/stat3}}
		{{#stat4}}

{{name4}}: {{stat4}}

		{{/stat4}}
		{{#stat5}}

{{name5}}: {{stat5}}

		{{/stat5}}

{{description}}

</rolltemplate>


text:
import dmeanstdevpn = require( './index' );

// TESTS //

// The function returns a Float64Array...
{
	const x = new Float64Array( 10 );
	const out = new Float64Array( 2 );

	dmeanstdevpn( x.length, 1, x, 1, out, 1 ); // $ExpectType Float64Array
}

// The compiler throws an error if the function is provided a first argument which is not a number...
{
	const x = new Float64Array( 10 );
	const out = new Float64Array( 2 );

	dmeanstdevpn( '10', 1, x, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( true, 1, x, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( false, 1, x, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( null, 1, x, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( undefined, 1, x, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( [], 1, x, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( {}, 1, x, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( ( x: number ): number => x, 1, x, 1, out, 1 ); // $ExpectError
}

// The compiler throws an error if the function is provided a second argument which is not a number...
{
	const x = new Float64Array( 10 );
	const out = new Float64Array( 2 );

	dmeanstdevpn( x.length, '10', x, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, true, x, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, false, x, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, null, x, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, undefined, x, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, [], x, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, {}, x, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, ( x: number ): number => x, x, 1, out, 1 ); // $ExpectError
}

// The compiler throws an error if the function is provided a third argument which is not a Float64Array...
{
	const x = new Float64Array( 10 );
	const out = new Float64Array( 2 );

	dmeanstdevpn( x.length, 1, 10, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, '10', 1, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, true, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, false, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, null, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, undefined, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, [ '1' ], 1, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, {}, 1, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, ( x: number ): number => x, 1, out, 1 ); // $ExpectError
}

// The compiler throws an error if the function is provided a fourth argument which is not a number...
{
	const x = new Float64Array( 10 );
	const out = new Float64Array( 2 );

	dmeanstdevpn( x.length, 1, x, '10', out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, true, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, false, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, null, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, undefined, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, [], out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, {}, out, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, ( x: number ): number => x, out, 1 ); // $ExpectError
}

// The compiler throws an error if the function is provided a fifth argument which is not a Float64Array...
{
	const x = new Float64Array( 10 );

	dmeanstdevpn( x.length, 1, x, 1, 10, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, '10', 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, true, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, false, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, null, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, undefined, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, [ '1' ], 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, {}, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, ( x: number ): number => x, 1 ); // $ExpectError
}

// The compiler throws an error if the function is provided a sixth argument which is not a number...
{
	const x = new Float64Array( 10 );
	const out = new Float64Array( 2 );

	dmeanstdevpn( x.length, 1, x, 1, out, '10' ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, out, true ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, out, false ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, out, null ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, out, undefined ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, out, [] ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, out, {} ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, out, ( x: number ): number => x ); // $ExpectError
}

// The compiler throws an error if the function is provided an unsupported number of arguments...
{
	const x = new Float64Array( 10 );
	const out = new Float64Array( 2 );

	dmeanstdevpn(); // $ExpectError
	dmeanstdevpn( x.length ); // $ExpectError
	dmeanstdevpn( x.length, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1 ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, out ); // $ExpectError
	dmeanstdevpn( x.length, 1, x, 1, out, 1, 10 ); // $ExpectError
}

// Attached to main export is an `ndarray` method which returns a Float64Array...
{
	const x = new Float64Array( 10 );
	const out = new Float64Array( 2 );

	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, 1, 0 ); // $ExpectType Float64Array
}

// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number...
{
	const x = new Float64Array( 10 );
	const out = new Float64Array( 2 );

	dmeanstdevpn.ndarray( '10', 1, x, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( true, 1, x, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( false, 1, x, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( null, 1, x, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( undefined, 1, x, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( [], 1, x, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( {}, 1, x, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( ( x: number ): number => x, 1, x, 1, 0, out, 1, 0 ); // $ExpectError
}

// The compiler throws an error if the `ndarray` method is provided a second argument which is not a number...
{
	const x = new Float64Array( 10 );
	const out = new Float64Array( 2 );

	dmeanstdevpn.ndarray( x.length, '10', x, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, true, x, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, false, x, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, null, x, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, undefined, x, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, [], x, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, {}, x, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, ( x: number ): number => x, x, 1, 0, out, 1, 0 ); // $ExpectError
}

// The compiler throws an error if the `ndarray` method is provided a third argument which is not a Float64Array...
{
	const x = new Float64Array( 10 );
	const out = new Float64Array( 2 );

	dmeanstdevpn.ndarray( x.length, 1, 10, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, '10', 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, true, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, false, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, null, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, undefined, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, [ '1' ], 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, {}, 1, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError
}

// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number...
{
	const x = new Float64Array( 10 );
	const out = new Float64Array( 2 );

	dmeanstdevpn.ndarray( x.length, 1, x, '10', 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, true, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, false, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, null, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, undefined, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, [], 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, {}, 0, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError
}

// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number...
{
	const x = new Float64Array( 10 );
	const out = new Float64Array( 2 );

	dmeanstdevpn.ndarray( x.length, 1, x, 1, '10', out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, true, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, false, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, null, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, undefined, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, [], out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, {}, out, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError
}

// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a Float64Array...
{
	const x = new Float64Array( 10 );

	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, 10, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, '10', 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, true, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, false, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, null, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, undefined, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, [ '1' ], 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, {}, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError
}

// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number...
{
	const x = new Float64Array( 10 );
	const out = new Float64Array( 2 );

	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, '10', 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, true, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, false, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, null, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, undefined, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, [], 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, {}, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError
}

// The compiler throws an error if the `ndarray` method is provided an eighth argument which is not a number...
{
	const x = new Float64Array( 10 );
	const out = new Float64Array( 2 );

	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, 1, '10' ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, 1, true ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, 1, false ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, 1, null ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, 1, undefined ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, 1, [] ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, 1, {} ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError
}

// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments...
{
	const x = new Float64Array( 10 );
	const out = new Float64Array( 2 );

	dmeanstdevpn.ndarray(); // $ExpectError
	dmeanstdevpn.ndarray( x.length ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, 1 ); // $ExpectError
	dmeanstdevpn.ndarray( x.length, 1, x, 1, 0, out, 1, 0, 10 ); // $ExpectError
}

redpajama_set_name: RedPajamaGithub


text:
<?php
/**
 * Created by PhpStorm.
 * User: burak
 * Date: 2/8/2017
 * Time: 10:38 AM
 */

namespace AppBundle\Controller\Web;
use AppBundle\AppBundle;
use AppBundle\Entity\Author;
use AppBundle\Entity\Book;
use AppBundle\Entity\Tags;
use AppBundle\JsonModer;
use FOS\RestBundle\Controller\FOSRestController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Console\Logger\ConsoleLogger;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Encoder\XmlEncoder;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\Serializer;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\Serializer\Encoder\JsonEncode;
use FOS\RestBundle\Routing\ClassResourceInterface;

class CategoryController extends Controller
{

    //Tum kategorileri getirmek icin ;
    /**
     * @Route("/category/all" , name="category_all")
     * @Method("GET")
     */
    public function categoryGetAllAction()
    {
        $encoders = array(new JsonEncoder());
        $normalizers = array(new ObjectNormalizer());
        $serializer = new Serializer($normalizers, $encoders);
        $categorys =  $this->getDoctrine()
            ->getRepository('AppBundle:Category')
            ->findAll();

        return new JsonResponse(JsonModer::ArrayMod($categorys));
    }

    //kategori yaratmak icin;
    /**
     * @Route("/category/create" , name="category_create")
     * @Method ({"POST" , "GET"})
     */
    public function categoryCreateAction(){
        die("kategori yarat");
    }

    //id'si girilmis olan kategoriyi getirir
    /**
     * @Route("/category/id/{category_id}" , name="category-id")
     * @Method("GET")
     */
    public function categoryGetIdAction(){
        die("id girilen kategoriyi getirir");
    }

    //Id'si girilen kategoriyi siler
    /**
     * @Route("/category/delete/{category_id}" , name="category_id")
     * @Method ({"DELETE" , "GET"})
     */
    public function categoryDelAction(){
        die("id girilen kategoriyi siler");
    }

    //Id'ile cagrilan kategori uzerinde duzenleme yapilir

    /**
     * @Route("/category/edit/{category_id}" , name="category_edit")
     * @Method({"GET" , "PUT"})
     */
    public function categoryPutAction(){
        die("kategori edit");
    }
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.Web.UI.WebControls
{
    using System;

    using DotNetNuke.Framework;
    using DotNetNuke.Framework.JavaScriptLibraries;
    using DotNetNuke.Services.Localization;
    using Telerik.Web.UI;

    [Obsolete("Telerik support will be removed in DNN Platform 10.0.0.  You will need to find an alternative solution")]
    public class DnnGrid : RadGrid
    {
        public int ScreenRowNumber { get; set; }

        public int RowHeight { get; set; }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            this.EnableEmbeddedBaseStylesheet = false;
            Utilities.ApplySkin(this);
            JavaScript.RequestRegistration(CommonJs.DnnPlugins);
            if (string.IsNullOrEmpty(this.ClientSettings.ClientEvents.OnGridCreated))
            {
                this.ClientSettings.ClientEvents.OnGridCreated = "$.dnnGridCreated";
            }

            this.PreRender += new EventHandler(this.DnnGrid_PreRender);

            this.MasterTableView.NoMasterRecordsText = Localization.GetString("NoRecords", Localization.SharedResourceFile);
        }

        private void DnnGrid_PreRender(object sender, EventArgs e)
        {
            var items = this.MasterTableView.Items;
            if (this.ScreenRowNumber == 0)
            {
                this.ScreenRowNumber = 15;
            }

            if (items.Count > this.ScreenRowNumber)
            {
                // need scroll
                this.ClientSettings.Scrolling.AllowScroll = true;
                this.ClientSettings.Scrolling.UseStaticHeaders = true;

                if (this.RowHeight == 0)
                {
                    this.RowHeight = 25;
                }

                this.ClientSettings.Scrolling.ScrollHeight = this.RowHeight * this.ScreenRowNumber;
            }
            else
            {
                this.ClientSettings.Scrolling.AllowScroll = false;
            }
        }
    }
}


text:
@interface ViewController ()<UIScrollViewDelegate>
@property(nonatomic, strong)NSArray *imageArray;
@property(nonatomic, assign)NSInteger tager;

@end
UIScrollView *_myscrollview;
UIPageControl *_pageControl;
@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    UIScrollView *carouseView = [[UIScrollView alloc]initWithFrame:self.view.frame];
    carouseView.delegate = self;
    carouseView.bounces = NO;
    carouseView.contentSize = CGSizeMake(carouseView.frame.size.width * 3, 0);
    CGRect frame = carouseView.frame;
    NSMutableArray *muArr = [@[] mutableCopy];
    for (int i = 0; i < 6; i++) {
        NSString *imageName = [NSString stringWithFormat:@"image%d.jpg", i];
        UIImage *image = [UIImage imageNamed:imageName];
        [muArr addObject:image];
    }
    self.imageArray = (NSArray *)muArr;
    for (int i = 0; i < 3; i++) {
        frame.origin.x = i * frame.size.width;
        UIImageView *imageV = [[UIImageView alloc]initWithFrame:frame];
        if (i == 0) {
            imageV.image = self.imageArray[self.imageArray.count - 1];
        }else{
            imageV.image = self.imageArray[i - 1];
        }
        [carouseView addSubview:imageV];
    }
    carouseView.contentOffset = CGPointMake(carouseView.frame.size.width, 0);
    self.tager = 0;
    _myscrollview = carouseView;
    carouseView.pagingEnabled = YES;
    carouseView.showsHorizontalScrollIndicator = NO;
    [self.view addSubview:carouseView];
    UIPageControl *pageV = [[UIPageControl alloc]initWithFrame:CGRectMake(100, self.view.frame.size.height - 100, self.view.frame.size.width - 200, 44)];
    [self.view addSubview:pageV];
    pageV.numberOfPages = self.imageArray.count;
    _pageControl = pageV;
    [pageV addTarget:self action:@selector(pagechaged :) forControlEvents:UIControlEventValueChanged];
    pageV.currentPageIndicatorTintColor = [UIColor redColor];
    pageV.pageIndicatorTintColor = [UIColor blackColor];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
    NSInteger page = scrollView.contentOffset.x / scrollView.frame.size.width;
    if (page == 1) {
        return;
    }
    if (page == 0) {
        self.tager -= 1;
    }else{
        self.tager += 1;
    }

    if (self.tager < 0) {
        self.tager = self.imageArray.count - 1;
            }else if(self.tager == self.imageArray.count){
        self.tager = 0;
    }
    [self setcarouseViewSubviews];

}
- (void)pagechaged :(UIPageControl *)pageC{
    self.tager = pageC.currentPage;
    [self setcarouseViewSubviews];
}
- (void)setcarouseViewSubviews{
    UIImageView *imageV0 = _myscrollview.subviews[0];
    UIImageView *imageV1 = _myscrollview.subviews[1];
    UIImageView *imageV2 = _myscrollview.subviews[2];
    if (self.tager == 0) {
        imageV1.image = self.imageArray[0];
        _myscrollview.contentOffset = CGPointMake(_myscrollview.frame.size.width, 0);
        imageV0.image = self.imageArray.lastObject;
        imageV2.image = self.imageArray[1];
    }else if (self.tager == self.imageArray.count - 1){
        imageV1.image = self.imageArray[self.tager];
        _myscrollview.contentOffset = CGPointMake(_myscrollview.frame.size.width, 0);
        imageV0.image = self.imageArray[self.tager - 1];
        imageV2.image = self.imageArray[0];
    }else{
        imageV1.image = self.imageArray[self.tager];
        _myscrollview.contentOffset = CGPointMake(_myscrollview.frame.size.width, 0);
        imageV0.image = self.imageArray[self.tager - 1];
        imageV2.image = self.imageArray[self.tager + 1];
    }
    _pageControl.currentPage = self.tager;
}
@end


text:
PTH="$(pwd)"
VERSION="$(python "$PTH/../src/version.py")"
DATETIME=$(date '+%a, %d %b %Y %H:%M:%S %z')

echo "Building fpp version $VERSION at $DATETIME"
mkdir -p "$PTH/usr/bin" &&
  mkdir -p "$PTH/usr/share/pathpicker/src/"

sed s#__version__#"$VERSION"# < "$PTH/DEBIAN/control" > "$PTH/DEBIAN/control.modif"
mv "$PTH/DEBIAN/control.modif" "$PTH/DEBIAN/control"

echo "===================="
echo "Control file is:"
echo "===================="
cat "$PTH/DEBIAN/control"
echo "===================="

cp -R "$PTH/../src" "$PTH/usr/share/pathpicker" &&
  cp "$PTH/../fpp" "$PTH/usr/share/pathpicker/fpp" &&
  cd "$PTH/usr/bin/"

echo "Creating symlink..."
ln -f -s ../share/pathpicker/fpp fpp
sed s#__version__#"$VERSION"# < "$PTH/usr/share/doc/pathpicker/changelog" > "$PTH/usr/share/doc/pathpicker/changelog.modif"
sed s#__date_timestamp__#"$DATETIME"# < "$PTH/usr/share/doc/pathpicker/changelog.modif" > "$PTH/usr/share/doc/pathpicker/changelog"

echo "===================="
echo "Changelog is:"
echo "===================="
cat  "$PTH/usr/share/doc/pathpicker/changelog"
echo "===================="

echo "Gziping..."
gzip -9 "$PTH/usr/share/doc/pathpicker/changelog" &&
  rm "$PTH/usr/share/doc/pathpicker/changelog.modif"

echo "Setting permissions..."
cd "$PTH"
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

echo "Building package..."
rm "$PTH/package.sh"
chmod 755 usr/share/pathpicker/fpp
fakeroot -- sh -c "chown -R root:root * && dpkg --build ./ ../fpp_${VERSION}_noarch.deb ;"
echo "Restoring template files..."
cd -
git checkout HEAD -- "$PTH/DEBIAN/control" "$PTH/usr/share/doc/pathpicker/changelog" "$PTH/package.sh"
chmod 777 "$PTH/package.sh"

echo 'Done! Check out fpp.deb'


text:
const pkg = require('../package.json');

/**
 * Given a JSON string, convert it to its base64 representation.
 *
 * @param {object} json Json data
 * @returns {string}
 */
const jsonToBase64 = (json) => {
  const bytes = Buffer.from(JSON.stringify(json));

  return bytes.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
};

/**
 * Return an object with information about the current client.
 *
 * @function    generateClientInfo
 * @returns {object}   Object containing client information.
 */
const generateClientInfo = () => ({
  name: 'node-auth0',
  version: pkg.version,
  env: {
    node: process.version.replace('v', ''),
  },
});

const containsUnsafeChars = (s) => {
  const safeChars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$-_.+!*'(),%";
  return !!s.split('').find((c) => !safeChars.includes(c));
};

const maybeDecode = (url) => {
  if (containsUnsafeChars(url)) {
    return encodeURIComponent(url);
  }
  return url;
};

const sanitizeArguments = function (optionsCandidate, cbCandidate) {
  if (optionsCandidate instanceof Function) {
    return {
      cb: optionsCandidate,
      options: undefined,
    };
  }
  return {
    cb: cbCandidate,
    options: optionsCandidate,
  };
};

module.exports = {
  jsonToBase64,
  generateClientInfo,
  containsUnsafeChars,
  maybeDecode,
  sanitizeArguments,
};


text:
jtagconfig --setparam 1 JtagClock 6MHz;
quartus_pgm -c 1 flash.cdf


text:
<?php
// +---------------------------------------------------------------------------
// | Mini Framework
// +---------------------------------------------------------------------------
// | Copyright (c) 2015-2021 http://www.sunbloger.com
// +---------------------------------------------------------------------------
// | Licensed under the Apache License, Version 2.0 (the "License");
// | you may not use this file except in compliance with the License.
// | You may obtain a copy of the License at
// |
// | http://www.apache.org/licenses/LICENSE-2.0
// |
// | Unless required by applicable law or agreed to in writing, software
// | distributed under the License is distributed on an "AS IS" BASIS,
// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// | See the License for the specific language governing permissions and
// | limitations under the License.
// +---------------------------------------------------------------------------
// | Source: https://github.com/jasonweicn/miniframework
// +---------------------------------------------------------------------------
// | Author: Jason Wei <jasonwei06@hotmail.com>
// +---------------------------------------------------------------------------
// | Website: http://www.sunbloger.com/miniframework
// +---------------------------------------------------------------------------
namespace Mini\Helpers;

use Mini\Base\{Session, Request};

class Safe
{
    /**
     * 获取当前存储于Server端的CSRF-Token
     *
     * @return string
     */
    public static function getCsrfToken()
    {
        $request = Request::getInstance();
        $token = Session::get($request->getCsrfParamName());

        if (! $token) {
            $token = $request->createCsrfToken();
        }

        return $token;
    }
}


text:
"""
External content
################

Copyright (c) 2021 Nordic Semiconductor ASA
SPDX-License-Identifier: Apache-2.0

Introduction
============

This extension allows to import sources from directories out of the Sphinx
source directory. They are copied to the source directory before starting the
build. Note that the copy is *smart*, that is, only updated files are actually
copied. Therefore, incremental builds detect changes correctly and behave as
expected.

Paths for external content included via e.g. figure, literalinclude, etc.
are adjusted as needed.

Configuration options
=====================

- ``external_content_contents``: A list of external contents. Each entry is
  a tuple with two fields: the external base directory and a file glob pattern.
- ``external_content_directives``: A list of directives that should be analyzed
  and their paths adjusted if necessary. Defaults to ``DEFAULT_DIRECTIVES``.
- ``external_content_keep``: A list of file globs (relative to the destination
  directory) that should be kept even if they do not exist in the source
  directory. This option can be useful for auto-generated files in the
  destination directory.
"""

import filecmp
import os
from pathlib import Path
import re
import shutil
import tempfile
from typing import Dict, Any, List, Optional

from sphinx.application import Sphinx

__version__ = "0.1.0"

DEFAULT_DIRECTIVES = ("figure", "image", "include", "literalinclude")
"""Default directives for included content."""

def adjust_includes(
    fname: Path,
    basepath: Path,
    directives: List[str],
    encoding: str,
    dstpath: Optional[Path] = None,
) -> None:
    """Adjust included content paths.

    Args:
        fname: File to be processed.
        basepath: Base path to be used to resolve content location.
        directives: Directives to be parsed and adjusted.
        encoding: Sources encoding.
        dstpath: Destination path for fname if its path is not the actual destination.
    """

    if fname.suffix != ".rst":
        return

    dstpath = dstpath or fname.parent

    def _adjust(m):
        directive, fpath = m.groups()

        # ignore absolute paths
        if fpath.startswith("/"):
            fpath_adj = fpath
        else:
            fpath_adj = Path(os.path.relpath(basepath / fpath, dstpath)).as_posix()

        return f".. {directive}:: {fpath_adj}"

    with open(fname, "r+", encoding=encoding) as f:
        content = f.read()
        content_adj, modified = re.subn(
            r"\.\. (" + "|".join(directives) + r")::\s*([^`\n]+)", _adjust, content
        )
        if modified:
            f.seek(0)
            f.write(content_adj)
            f.truncate()

def sync_contents(app: Sphinx) -> None:
    """Synchronize external contents.

    Args:
        app: Sphinx application instance.
    """

    srcdir = Path(app.srcdir).resolve()
    to_copy = []
    to_delete = set(f for f in srcdir.glob("**/*") if not f.is_dir())
    to_keep = set(
        f
        for k in app.config.external_content_keep
        for f in srcdir.glob(k)
        if not f.is_dir()
    )

    for content in app.config.external_content_contents:
        prefix_src, glob = content
        for src in prefix_src.glob(glob):
            if src.is_dir():
                to_copy.extend(
                    [(f, prefix_src) for f in src.glob("**/*") if not f.is_dir()]
                )
            else:
                to_copy.append((src, prefix_src))

    for entry in to_copy:
        src, prefix_src = entry
        dst = (srcdir / src.relative_to(prefix_src)).resolve()

        if dst in to_delete:
            to_delete.remove(dst)

        if not dst.parent.exists():
            dst.parent.mkdir(parents=True)

        # just copy if it does not exist
        if not dst.exists():
            shutil.copy(src, dst)
            adjust_includes(
                dst,
                src.parent,
                app.config.external_content_directives,
                app.config.source_encoding,
            )
        # if origin file is modified only copy if different
        elif src.stat().st_mtime > dst.stat().st_mtime:
            with tempfile.TemporaryDirectory() as td:
                # adjust origin includes before comparing
                src_adjusted = Path(td) / src.name
                shutil.copy(src, src_adjusted)
                adjust_includes(
                    src_adjusted,
                    src.parent,
                    app.config.external_content_directives,
                    app.config.source_encoding,
                    dstpath=dst.parent,
                )

                if not filecmp.cmp(src_adjusted, dst):
                    dst.unlink()
                    shutil.move(os.fspath(src_adjusted), os.fspath(dst))

    # remove any previously copied file not present in the origin folder,
    # excepting those marked to be kept.
    for file in to_delete - to_keep:
        file.unlink()

def setup(app: Sphinx) -> Dict[str, Any]:
    app.add_config_value("external_content_contents", [], "env")
    app.add_config_value("external_content_directives", DEFAULT_DIRECTIVES, "env")
    app.add_config_value("external_content_keep", [], "")

    app.connect("builder-inited", sync_contents)

    return {
        "version": __version__,
        "parallel_read_safe": True,
        "parallel_write_safe": True,
    }


text:
require 'bundler'
Bundler.require
require 'asana'

id, secret = ENV['ASANA_CLIENT_ID'], ENV['ASANA_CLIENT_SECRET']
unless id && secret
  abort "Run this program with the env vars ASANA_CLIENT_ID and ASANA_CLIENT_SECRET.\n"  \
    "Refer to https://asana.com/developers/documentation/getting-started/authentication "\
    "to get your credentials." \
    "The redirect URI for your application should be \"urn:ietf:wg:oauth:2.0:oob\"."
end

access_token = Asana::Authentication::OAuth2.offline_flow(client_id: id,
                                                          client_secret: secret)
client = Asana::Client.new do |c|
  c.authentication :oauth2, access_token
end

puts "My Workspaces:"
client.workspaces.find_all.each do |workspace|
  puts "\t* #{workspace.name} - tags:"
  client.tags.find_by_workspace(workspace: workspace.id).each do |tag|
    puts "\t\t- #{tag.name}"
  end
end


text:
package com.bupt.jdbcUtil;

import com.jolbox.bonecp.BoneCP;
import com.jolbox.bonecp.BoneCPConfig;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * Created by leeyoung on 15/8/30.
 */
public class JdbcUtils {
    static BoneCP connectionPool;
    static {
        try {
            // load the database driver (make sure this is in your classpath!)
            Class.forName("com.mysql.jdbc.Driver");
        } catch (Exception e) {
            e.printStackTrace();
        }

        // setup the connection pool
        BoneCPConfig config = new BoneCPConfig();
        config.setJdbcUrl("jdbc:mysql://localhost:3306/TOP10");
        config.setUsername("****");
        config.setPassword("****");
        config.setMinConnectionsPerPartition(5);
        config.setMaxConnectionsPerPartition(10);
        config.setPartitionCount(1);
        try {
            connectionPool = new BoneCP(config); // setup the connection pool
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
    public static Connection getConnection() throws SQLException {
        return connectionPool.getConnection();
    }

    public static void release(Connection conn, Statement st, ResultSet rs) {

        if (rs != null) {
            try {
                rs.close();   //throw new
            } catch (Exception e) {
                e.printStackTrace();
            }
            rs = null;
        }
        if (st != null) {
            try {
                st.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
            st = null;
        }
        if (conn != null) {
            try {
                conn.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}


text:
<?php
/**
 * @file
 * Contains \Drupal\Console\Core\Command\ListCommand.
 */
namespace Drupal\Console\Core\Command;

use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
use Drupal\Console\Core\Helper\DescriptorHelper;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * Class ListCommand
 *
 * @package Drupal\Console\Core\Command
 */
class ListCommand extends Command
{
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this
            ->setName('list')
            ->setDefinition($this->createDefinition())
            ->setDescription($this->trans('commands.list.description'))
            ->setHelp($this->trans('commands.list.help'));
    }

    /**
     * {@inheritdoc}
     */
    public function getNativeDefinition()
    {
        return $this->createDefinition();
    }

    /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        if ($input->getOption('xml')) {
            $this->getIo()->info(
                'The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead',
                E_USER_DEPRECATED
            );
            $input->setOption('format', 'xml');
        }
        $commandName = $input->getFirstArgument()?$input->getFirstArgument():'help';
        $helper = new DescriptorHelper();
        $helper->describe(
            $this->getIo(),
            $this->getApplication(),
            [
                'format' => $input->getOption('format'),
                'raw_text' => $input->getOption('raw'),
                'namespace' => $input->getArgument('namespace'),
                'translator' => $this->getApplication()->getTranslator(),
                'command' => $this->getApplication()->find($commandName)
            ]
        );

        $this->getIo()->newLine();
    }

    /**
     * {@inheritdoc}
     */
    private function createDefinition()
    {
        return new InputDefinition(
            [
                new InputArgument('namespace', InputArgument::OPTIONAL, $this->trans('commands.list.arguments.namespace')),
                new InputOption('xml', null, InputOption::VALUE_NONE, $this->trans('commands.list.options.xml')),
                new InputOption('raw', null, InputOption::VALUE_NONE, $this->trans('commands.list.options.raw')),
                new InputOption('format', null, InputOption::VALUE_REQUIRED, $this->trans('commands.list.options.format'), 'txt'),
            ]
        );
    }
}


text:
namespace boost {
namespace mpl {
namespace aux {

// forward declaration
template<
      nttp_long N
    , typename First
    , typename Last
    , typename State
    , typename BackwardOp
    , typename ForwardOp
    >
struct fold_backward_impl;

template< nttp_long N >
struct fold_backward_chunk;

template<>
struct fold_backward_chunk<0>
{
    template<
          typename First
        , typename Last
        , typename State
        , typename BackwardOp
        , typename ForwardOp
        >
    struct result_
    {
        typedef First iter0;
        typedef State fwd_state0;
        typedef fwd_state0 bkwd_state0;
        typedef bkwd_state0 state;
        typedef iter0 iterator;
    };

    // ETI workaround
    template<> struct result_<int, int, int, int, int>
    {
        typedef int state;
        typedef int iterator;
    };

};

template<>
struct fold_backward_chunk<1>
{
    template<
          typename First
        , typename Last
        , typename State
        , typename BackwardOp
        , typename ForwardOp
        >
    struct result_
    {
        typedef First iter0;
        typedef State fwd_state0;
        typedef typename apply2<ForwardOp, fwd_state0, typename iter0::type>::type fwd_state1;
        typedef typename iter0::next iter1;

        typedef fwd_state1 bkwd_state1;
        typedef typename apply2<BackwardOp, bkwd_state1, typename iter0::type>::type bkwd_state0;
        typedef bkwd_state0 state;
        typedef iter1 iterator;
    };

    // ETI workaround
    template<> struct result_<int, int, int, int, int>
    {
        typedef int state;
        typedef int iterator;
    };

};

template<>
struct fold_backward_chunk<2>
{
    template<
          typename First
        , typename Last
        , typename State
        , typename BackwardOp
        , typename ForwardOp
        >
    struct result_
    {
        typedef First iter0;
        typedef State fwd_state0;
        typedef typename apply2<ForwardOp, fwd_state0, typename iter0::type>::type fwd_state1;
        typedef typename iter0::next iter1;
        typedef typename apply2<ForwardOp, fwd_state1, typename iter1::type>::type fwd_state2;
        typedef typename iter1::next iter2;

        typedef fwd_state2 bkwd_state2;
        typedef typename apply2<BackwardOp, bkwd_state2, typename iter1::type>::type bkwd_state1;
        typedef typename apply2<BackwardOp, bkwd_state1, typename iter0::type>::type bkwd_state0;

        typedef bkwd_state0 state;
        typedef iter2 iterator;
    };

    // ETI workaround
    template<> struct result_<int, int, int, int, int>
    {
        typedef int state;
        typedef int iterator;
    };

};

template<>
struct fold_backward_chunk<3>
{
    template<
          typename First
        , typename Last
        , typename State
        , typename BackwardOp
        , typename ForwardOp
        >
    struct result_
    {
        typedef First iter0;
        typedef State fwd_state0;
        typedef typename apply2<ForwardOp, fwd_state0, typename iter0::type>::type fwd_state1;
        typedef typename iter0::next iter1;
        typedef typename apply2<ForwardOp, fwd_state1, typename iter1::type>::type fwd_state2;
        typedef typename iter1::next iter2;
        typedef typename apply2<ForwardOp, fwd_state2, typename iter2::type>::type fwd_state3;
        typedef typename iter2::next iter3;

        typedef fwd_state3 bkwd_state3;
        typedef typename apply2<BackwardOp, bkwd_state3, typename iter2::type>::type bkwd_state2;
        typedef typename apply2<BackwardOp, bkwd_state2, typename iter1::type>::type bkwd_state1;
        typedef typename apply2<BackwardOp, bkwd_state1, typename iter0::type>::type bkwd_state0;

        typedef bkwd_state0 state;
        typedef iter3 iterator;
    };

    // ETI workaround
    template<> struct result_<int, int, int, int, int>
    {
        typedef int state;
        typedef int iterator;
    };

};

template<>
struct fold_backward_chunk<4>
{
    template<
          typename First
        , typename Last
        , typename State
        , typename BackwardOp
        , typename ForwardOp
        >
    struct result_
    {
        typedef First iter0;
        typedef State fwd_state0;
        typedef typename apply2<ForwardOp, fwd_state0, typename iter0::type>::type fwd_state1;
        typedef typename iter0::next iter1;
        typedef typename apply2<ForwardOp, fwd_state1, typename iter1::type>::type fwd_state2;
        typedef typename iter1::next iter2;
        typedef typename apply2<ForwardOp, fwd_state2, typename iter2::type>::type fwd_state3;
        typedef typename iter2::next iter3;
        typedef typename apply2<ForwardOp, fwd_state3, typename iter3::type>::type fwd_state4;
        typedef typename iter3::next iter4;

        typedef fwd_state4 bkwd_state4;
        typedef typename apply2<BackwardOp, bkwd_state4, typename iter3::type>::type bkwd_state3;
        typedef typename apply2<BackwardOp, bkwd_state3, typename iter2::type>::type bkwd_state2;
        typedef typename apply2<BackwardOp, bkwd_state2, typename iter1::type>::type bkwd_state1;
        typedef typename apply2<BackwardOp, bkwd_state1, typename iter0::type>::type bkwd_state0;

        typedef bkwd_state0 state;
        typedef iter4 iterator;
    };

    // ETI workaround
    template<> struct result_<int, int, int, int, int>
    {
        typedef int state;
        typedef int iterator;
    };

};

template< nttp_long N >
struct fold_backward_chunk
{
    template<
          typename First
        , typename Last
        , typename State
        , typename BackwardOp
        , typename ForwardOp
        >
    struct result_
    {
        typedef First iter0;
        typedef State fwd_state0;
        typedef typename apply2<ForwardOp, fwd_state0, typename iter0::type>::type fwd_state1;
        typedef typename iter0::next iter1;
        typedef typename apply2<ForwardOp, fwd_state1, typename iter1::type>::type fwd_state2;
        typedef typename iter1::next iter2;
        typedef typename apply2<ForwardOp, fwd_state2, typename iter2::type>::type fwd_state3;
        typedef typename iter2::next iter3;
        typedef typename apply2<ForwardOp, fwd_state3, typename iter3::type>::type fwd_state4;
        typedef typename iter3::next iter4;

        typedef fold_backward_impl<
              ( (N - 4) < 0 ? 0 : N - 4 )
            , iter4
            , Last
            , fwd_state4
            , BackwardOp
            , ForwardOp
            > nested_chunk;

        typedef typename nested_chunk::state bkwd_state4;
        typedef typename apply2<BackwardOp, bkwd_state4, typename iter3::type>::type bkwd_state3;
        typedef typename apply2<BackwardOp, bkwd_state3, typename iter2::type>::type bkwd_state2;
        typedef typename apply2<BackwardOp, bkwd_state2, typename iter1::type>::type bkwd_state1;
        typedef typename apply2<BackwardOp, bkwd_state1, typename iter0::type>::type bkwd_state0;

        typedef bkwd_state0 state;
        typedef typename nested_chunk::iterator iterator;
    };
};

template<
      typename First
    , typename Last
    , typename State
    , typename BackwardOp
    , typename ForwardOp
    >
struct fold_backward_step;

template<
      typename Last
    , typename State
    >
struct fold_backward_null_step
{
    typedef Last iterator;
    typedef State state;
};

template<>
struct fold_backward_chunk< -1 >
{
    template<
          typename First
        , typename Last
        , typename State
        , typename BackwardOp
        , typename ForwardOp
        >
    struct result_
    {
        typedef typename if_<
              typename is_same< First,Last >::type
            , fold_backward_null_step< Last,State >
            , fold_backward_step< First,Last,State,BackwardOp,ForwardOp >
            >::type res_;

        typedef typename res_::state state;
        typedef typename res_::iterator iterator;
    };

    // ETI workaround
    template<> struct result_<int, int, int, int, int>
    {
        typedef int state;
        typedef int iterator;
    };

};

template<
      typename First
    , typename Last
    , typename State
    , typename BackwardOp
    , typename ForwardOp
    >
struct fold_backward_step
{
    typedef fold_backward_chunk< -1 >::template result_<
          typename First::next
        , Last
        , typename apply2<ForwardOp, State, typename First::type>::type
        , BackwardOp
        , ForwardOp
        > nested_step;

    typedef typename apply2<BackwardOp, typename nested_step::state, typename First::type>::type state;
    typedef typename nested_step::iterator iterator;
};

template<
      nttp_long N
    , typename First
    , typename Last
    , typename State
    , typename BackwardOp
    , typename ForwardOp
    >
struct fold_backward_impl
    : fold_backward_chunk<N>
        ::template result_< First,Last,State,BackwardOp,ForwardOp >
{
};

} // namespace aux
} // namespace mpl
} // namespace boost


text:
#pragma once

#include <memory>
#include <thrift/protocol/TProtocol.h>

namespace dsn {

/// dsn::blob is a special thrift type that's not generated by thrift compiler,
/// but defined by the rDSN framework. Unlike thrift `string`, dsn::blob is
/// implemented by ref-counted buffer.
class blob
{
public:
    constexpr blob() = default;

    blob(std::shared_ptr<char> buffer, unsigned int length)
        : _holder(std::move(buffer)), _buffer(_holder.get()), _data(_holder.get()), _length(length)
    {
    }

    blob(std::shared_ptr<char> buffer, int offset, unsigned int length)
        : _holder(std::move(buffer)),
          _buffer(_holder.get()),
          _data(_holder.get() + offset),
          _length(length)
    {
    }

    /// NOTE: Use dsn::string_view whenever possible.
    /// blob is designed for shared buffer, never use it as constant view.
    /// Maybe we could deprecate this function in the future.
    blob(const char *buffer, int offset, unsigned int length)
        : _buffer(buffer), _data(buffer + offset), _length(length)
    {
    }

    /// Create shared buffer from allocated raw bytes.
    /// NOTE: this operation is not efficient since it involves a memory copy.
    static blob create_from_bytes(const char *s, size_t len)
    {
        std::shared_ptr<char> s_arr(new char[len], std::default_delete<char[]>());
        memcpy(s_arr.get(), s, len);
        return blob(std::move(s_arr), 0, static_cast<unsigned int>(len));
    }

    /// Create shared buffer without copying data.
    static blob create_from_bytes(std::string &&bytes)
    {
        auto s = new std::string(std::move(bytes));
        std::shared_ptr<char> buf(const_cast<char *>(s->data()), [s](char *) { delete s; });
        return blob(std::move(buf), 0, static_cast<unsigned int>(s->length()));
    }

    void assign(const std::shared_ptr<char> &buffer, int offset, unsigned int length)
    {
        _holder = buffer;
        _buffer = _holder.get();
        _data = _holder.get() + offset;
        _length = length;
    }

    void assign(std::shared_ptr<char> &&buffer, int offset, unsigned int length)
    {
        _holder = std::move(buffer);
        _buffer = (_holder.get());
        _data = (_holder.get() + offset);
        _length = length;
    }

    /// Deprecated. Use dsn::string_view whenever possible.
    void assign(const char *buffer, int offset, unsigned int length)
    {
        _holder = nullptr;
        _buffer = buffer;
        _data = buffer + offset;
        _length = length;
    }

    const char *data() const noexcept { return _data; }

    unsigned int length() const noexcept { return _length; }

    std::shared_ptr<char> buffer() const { return _holder; }

    const char *buffer_ptr() const { return _holder.get(); }

    // offset can be negative for buffer dereference
    blob range(int offset) const
    {
        // offset cannot exceed the current length value
        assert(offset <= static_cast<int>(_length));

        blob temp = *this;
        temp._data += offset;
        temp._length -= offset;
        return temp;
    }

    blob range(int offset, unsigned int len) const
    {
        // offset cannot exceed the current length value
        assert(offset <= static_cast<int>(_length));

        blob temp = *this;
        temp._data += offset;
        temp._length -= offset;

        // buffer length must exceed the required length
        assert(temp._length >= len);
        temp._length = len;
        return temp;
    }

    bool operator==(const blob &r) const
    {
        // not implemented
        assert(false);
        return false;
    }

    std::string to_string() const
    {
        if (_length == 0)
            return {};
        return std::string(_data, _length);
    }

    // for serialization in thrift format
    uint32_t read(::apache::thrift::protocol::TProtocol *iprot);
    uint32_t write(::apache::thrift::protocol::TProtocol *oprot) const;

private:
    friend class binary_writer;
    std::shared_ptr<char> _holder;
    const char *_buffer{nullptr};
    const char *_data{nullptr};
    unsigned int _length{0}; // data length
};

} // namespace dsn


text:
#ifndef CRIMILD_CORE_SCENEGRAPH_CSG_NODE_
#define CRIMILD_CORE_SCENEGRAPH_CSG_NODE_

#include "SceneGraph/Node.hpp"

namespace crimild {

    class CSGNode : public Node {
        CRIMILD_IMPLEMENT_RTTI( crimild::CSGNode )

    public:
        enum class Operator {
            UNION,
            INTERSECTION,
            DIFFERENCE,
        };

    public:
        CSGNode( void ) = default;
        explicit CSGNode( Operator op ) noexcept;
        CSGNode( Operator op, SharedPointer< Node > const &left, SharedPointer< Node > const &right ) noexcept;
        virtual ~CSGNode( void ) = default;

        inline Operator getOperator( void ) const noexcept { return m_operator; }

        inline Node *getLeft( void ) noexcept { return get_ptr( m_left ); }
        void setLeft( SharedPointer< Node > const &right ) noexcept;

        inline Node *getRight( void ) noexcept { return get_ptr( m_right ); }
        void setRight( SharedPointer< Node > const &right ) noexcept;

    private:
        Operator m_operator;
        SharedPointer< Node > m_left;
        SharedPointer< Node > m_right;

    public:
        virtual void accept( NodeVisitor &visitor ) override;

        /**
            \name Coding
         */
        //@{
    public:
        virtual void encode( coding::Encoder &encoder ) override;
        virtual void decode( coding::Decoder &decoder ) override;

        //@}
    };

}
#endif


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>TechBlog Part2</title>
  <meta name="description" content="">
  <meta name="author" content="">

  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.css">
  <link href="../styles/main.css" rel="stylesheet" type="text/css">

  <link rel="icon" type="image/png" href="images/favicon.png">

Home

Blog

Projects

Archive

About

Contact

TechBlog Part 2

week 2

What is grid based design?

                Grid based design is where in graphic design the webpage is broken into a grid type structure made up of vertical and horizontal lines which are used to help structure content. The grid makes a framework on which you can easily organise elements.

Whats all the hype about responsive webpages?

                Responsive web pages are pages that respond to the size of the device you are using and change their width or re-size depending on the size of the browser being used.

What is Semantic structure?

                Semantic structure is where we use semantic html to reinforce the meaning of the information on the page rahter than just define the look of the page. They are elements with a meaning - for example an image tag, whereas a div tag tells us nothing about it's content.

Any other points you found interesting and want to reflect on?

                I like the thought that any problem we have has been solved before! Yay!

      © of Newbies 2016
Terms of Use


text:
function postDialog(options) {
    FB.ui({
       method: 'feed',
       name: options.title,
       message: '',
       picture: options.picture,
       link: options.nerdtrackLink,
       caption: '   ',
       description: options.quote,
       actions: [
           {
               name: 'Nerdcast',
               link: options.nerdcastLink
           },
       ]
    });
}


text:
//
//  ViewController.m
//  AutoLayout简单使用-01
//
//  Created by wxy on 15/12/18.
//  Copyright © 2015年 wxy. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    UIButton *topLeftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [topLeftBtn setTitle:@"topLeftBtn" forState:UIControlStateNormal];
    [topLeftBtn setTitleColor:[UIColor  blackColor] forState:UIControlStateNormal];
    [topLeftBtn setBackgroundColor:[UIColor greenColor]];
    [topLeftBtn setTranslatesAutoresizingMaskIntoConstraints:NO];
    [self.view addSubview:topLeftBtn];

    UIButton *topRightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [topRightBtn setTitle:@"topRightBtn" forState:UIControlStateNormal];
    [topRightBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [topRightBtn setBackgroundColor:[UIColor redColor]];
    [topRightBtn setTranslatesAutoresizingMaskIntoConstraints:NO];
    [self.view addSubview:topRightBtn];

    UIButton *bottomBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [bottomBtn setTitle:@"bottomBtn" forState:UIControlStateNormal];
    [bottomBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [bottomBtn setBackgroundColor:[UIColor blueColor]];
    [bottomBtn setTranslatesAutoresizingMaskIntoConstraints:NO];
    [self.view addSubview:bottomBtn];

    NSLayoutConstraint *topLeftBtnLeadingConstraint = [NSLayoutConstraint constraintWithItem:topLeftBtn attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeading multiplier:1.0 constant:10];
    [self.view addConstraint:topLeftBtnLeadingConstraint];

    NSLayoutConstraint *topLeftBtnTopConstraint = [NSLayoutConstraint constraintWithItem:topLeftBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:10];
    [self.view addConstraint:topLeftBtnTopConstraint];

    NSLayoutConstraint *topLeftBtnBottomConstraint = [NSLayoutConstraint constraintWithItem:topLeftBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:bottomBtn attribute:NSLayoutAttributeTop multiplier:1.0 constant:-10];
    [self.view addConstraint:topLeftBtnBottomConstraint];

    NSLayoutConstraint *topRightBtntTopConstraint = [NSLayoutConstraint constraintWithItem:topRightBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:topLeftBtn attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
    [self.view addConstraint:topRightBtntTopConstraint];

    NSLayoutConstraint *topRightBtnLeadingConstraint = [NSLayoutConstraint constraintWithItem:topRightBtn attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:topLeftBtn attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:10];
    [self.view addConstraint:topRightBtnLeadingConstraint];

    NSLayoutConstraint *topRightBtnTrailingConstraint = [NSLayoutConstraint constraintWithItem:topRightBtn attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:-10];
    [self.view addConstraint:topRightBtnTrailingConstraint];

    NSLayoutConstraint *leftAndRightEqualWidthConstraint = [NSLayoutConstraint constraintWithItem:topRightBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:topLeftBtn attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
    [self.view addConstraint:leftAndRightEqualWidthConstraint];

    NSLayoutConstraint *leftAndRightEqualHeightConstraint = [NSLayoutConstraint constraintWithItem:topRightBtn attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:topLeftBtn attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0];
    [self.view addConstraint:leftAndRightEqualHeightConstraint];

    NSLayoutConstraint *bottomBtnLeadingConstraint = [NSLayoutConstraint constraintWithItem:bottomBtn attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:topLeftBtn attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0];
    [self.view addConstraint:bottomBtnLeadingConstraint];

    NSLayoutConstraint *bottomBtnTrailingConstraint = [NSLayoutConstraint constraintWithItem:bottomBtn attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:topRightBtn attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0];
    [self.view addConstraint:bottomBtnTrailingConstraint];

    NSLayoutConstraint *bottomBtnTopConstraint = [NSLayoutConstraint constraintWithItem:bottomBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:topLeftBtn attribute:NSLayoutAttributeBottom multiplier:1.0 constant:10];
    [self.view addConstraint:bottomBtnTopConstraint];

    NSLayoutConstraint *bottomBtnBottomConstraint = [NSLayoutConstraint constraintWithItem:bottomBtn attribute:NSLayoutAttributeBottomMargin relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-20];
    [self.view  addConstraint:bottomBtnBottomConstraint];

    NSLayoutConstraint *bottomBtnEqualHeightConstraint = [NSLayoutConstraint constraintWithItem:bottomBtn attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:topLeftBtn attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0];
    [self.view addConstraint:bottomBtnEqualHeightConstraint];

    /*

     竖屏时:设三个Button的高度是x未知数,三个Button高度一样,10+x+10+x+10=568 --->x=269,三个按钮高度都是269像素。BottomBtn的宽度是10+y+10=320--->y=300,BottomBtn的宽就是300像素。现在主是计算TopLeftBtn  TopRightBtn的宽了,TopLeftBtn与TopRightBtn的宽相等,那么10+z+10+z+10=320-->z=145,他们的宽就是145像素了,现在一切就好说了

     TopLeftBtn的frame 就是(10,10,145,269)   TopRightBtn的frame为(10+145+10,10,145,269)

     BottomBtn的frame就是(10,10+269+10,145,269)

     横屏一样,只不过是宽度换过来了,其他的一样。

     如果是4s或者6  6plus只不过是屏幕尺寸不一样而已都按上面的公式计算,得出的frame也不一样,所以说只要你的约束加得好,就会控制控件的位置,实现多屏配适配

     */

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end


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

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

[assembly: AssemblyTitle("FeatureBee.Acceptance")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("AutosScout24")]
[assembly: AssemblyCopyright("Copyright © AutosScout24 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// The following GUID is for the ID of the typelib if this project is exposed to COM

[assembly: Guid("b83090eb-4696-43c9-b432-b042c78ab36a")]


text:
package com.pcalouche.spat.security.provider;

import com.pcalouche.spat.entity.User;
import com.pcalouche.spat.repository.UserRepository;
import com.pcalouche.spat.security.authentication.JwtAuthenticationToken;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import java.util.Optional;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.verify;

@ExtendWith(SpringExtension.class)
public class LoginAuthenticationProviderTest {
    private LoginAuthenticationProvider loginAuthenticationProvider;
    @MockBean
    private UserRepository userRepository;

    @BeforeEach
    public void before() {
        Mockito.reset(userRepository);

        User activeUser = User.builder()
                .username("activeUser")
                .password("$2a$10$VSkAHLuuGgU.Oo/5TpiKieHSdW2Whz83PfPJoFvvrh.pQbT2YsNSi")
                .build();

        given(userRepository.findByUsername(activeUser.getUsername())).willReturn(Optional.of(activeUser));

        given(userRepository.findByUsername("bogusUser")).willReturn(Optional.empty());

        loginAuthenticationProvider = new LoginAuthenticationProvider(userRepository);
    }

    @Test
    public void testAuthenticate() {
        UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken("activeUser", "password");
        Authentication authentication = loginAuthenticationProvider.authenticate(authenticationToken);

        assertThat(authentication.getName())
                .isEqualTo("activeUser");
        assertThat(authentication.getCredentials())
                .isNull();
        assertThat(authentication.getAuthorities())
                .isEmpty();

        verify(userRepository, Mockito.times(1)).findByUsername("activeUser");
    }

    @Test
    public void testAuthenticateThrowsBadCredentialsForNullUser() {
        UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken("bogusUser", "password");

        assertThatThrownBy(() -> loginAuthenticationProvider.authenticate(authenticationToken))
                .isInstanceOf(BadCredentialsException.class)
                .hasMessage("Bad credentials for username: bogusUser");

        verify(userRepository, Mockito.times(1)).findByUsername("bogusUser");
    }

    @Test
    public void testAuthenticateThrowsBadCredentialsForBadPassword() {
        UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken("activeUser", "badPassword");

        assertThatThrownBy(() -> loginAuthenticationProvider.authenticate(authenticationToken))
                .isInstanceOf(BadCredentialsException.class)
                .hasMessage("Bad credentials for username: activeUser");

        verify(userRepository, Mockito.times(1)).findByUsername("activeUser");
    }

    @Test
    public void testSupportValidAuthenticationClass() {
        assertThat(loginAuthenticationProvider.supports(UsernamePasswordAuthenticationToken.class))
                .isTrue();
    }

    @Test
    public void testSupportInvalidAuthenticationClass() {
        assertThat(loginAuthenticationProvider.supports(JwtAuthenticationToken.class))
                .isFalse();
    }
}


text:
ideashout
=========

Web app to share ideas annonymously and get immediate feedback.

=========

This is a work in progress and basically just a way for me to learn som JS stuff.


text:
/* global XMLHttpRequest, __returnResults */

'use strict';

const Gather = require('./gather');

// *WARNING* do not use fetch.. due to it requiring window focus to fire.
// Request the current page by issuing a XMLHttpRequest request to ''
// and storing the status code on the window.
// This runs in the context of the page, so we don't cover it with unit tests.
/* istanbul ignore next */
const requestPage = function() {
  const oReq = new XMLHttpRequest();
  oReq.onload = oReq.onerror = e => {
    // __returnResults is injected by driver.evaluateAsync
    __returnResults(e.currentTarget.status);
  };
  oReq.open('GET', '');
  oReq.send();
};

class Offline extends Gather {

  static goOffline(driver) {
    return driver.sendCommand('Network.emulateNetworkConditions', {
      offline: true,
      // values of 0 remove any active throttling. crbug.com/456324#c9
      latency: 0,
      downloadThroughput: 0,
      uploadThroughput: 0
    });
  }

  static goOnline(driver) {
    return driver.sendCommand('Network.emulateNetworkConditions', {
      offline: false,
      latency: 0,
      downloadThroughput: 0,
      uploadThroughput: 0
    });
  }

  afterPass(options) {
    const driver = options.driver;

    // TODO eventually we will want to walk all network
    // requests that the page initially made and retry them.
    return Offline
        .goOffline(driver)
        .then(_ => driver.evaluateAsync(`(${requestPage.toString()}())`))
        .then(offlineResponseCode => {
          this.artifact = offlineResponseCode;
        })
        .then(_ => Offline.goOnline(driver))
        .catch(_ => {
          this.artifact = {
            offlineResponseCode: -1
          };
        });
  }
}

module.exports = Offline;


text:
'use strict';

var keyMirror = require('keymirror');

module.exports = keyMirror({
  DEBUG_DIRECTION: null
});


text:
node-smsfeedback
================

SMSFeedback message sender


text:
A stack is a **last-in first-out**(LIFO) linear data structure,ie. the items are accessed from the stack
in the reversed order in which they are inserted. Elements can be added/removed from the stack only at the top.
Generally, the following two operations are performed on stacks -
* Push() -  Adds an item in the stack (if the stack is not full)
* Pop()  -  Removes an item from the top of the stack
Additionally, a method can be used to check whether the stack is full/ is empty to avoid errors.

####Implementation:
There are two ways to implement a stack:
* Using an array
* Using a linked list

For an array based stack, create an array depending on the type of variables to be stored.
Next, create a variable _top_ that refers to the top element in the stack and a variable _capacity_ that refers to the array size.
The _top_ changes from _-1_ to _capacity - 1_. We say that a stack is empty when top = -1, and the stack is full when top = capacity-1.

####Use-cases -
* Reversal of a word
* Balancing parantheses
* Hanoi Tower problem
* Maze/Backtracking

##QUEUES
The queue is a _first-in first-out_ (FIFO) data structure. It is easy to visualize a queue as a line at the supermarket.
When you go to the supermarket, customers join to the rear (end) of the line and customers come off of the line (i.e., are serviced) from the front of the line.
Generally, the following two operations are performed on queues -
* Dequeue() - Removes and returns the object at the beginning of the Queue.
* Enqueue()	- Adds an object to the end of the Queue.
Additional utility methods/variables for checking status can be used.

####Implementation:
Queues can easily be implemented using lists/arrays. For implementing a queue, we need to keep track of two indices, _front_ and _rear_. We enqueue an item at the rear and dequeue an item from front.
If we simply increment front and rear indices, then there may be problems, the front may reach end of the array.
The solution to this problem is to increase front and rear in circular manner, by incrementing the counters modulo the size of the array.

####Use-cases -
* Arithmetic Expression Evaluation
* Searching algorithms


text:
using System;
using System.Collections.Generic;
using IniDotNet.Converters;

namespace IniDotNet
{
    public static class IniConvert
    {
        public static T DeserializeObject<T>(string iniFileContents)
        {
            var deserializer = new IniDeserializer();

            if (typeof(T).IsAssignableFrom(typeof(IDictionary<string, IDictionary<string, string>>)))
            {
                return (T) deserializer.Deserialize(iniFileContents);
            }

            return deserializer.Deserialize<T>(iniFileContents);
        }

        public static T DeserializeObject<T>(string iniFileContents, string iniSection)
        {
            var deserializer = new IniDeserializer();

            if (typeof(T).IsAssignableFrom(typeof(IDictionary<string, string>)))
            {
                return (T)deserializer.DeserializeSection(iniFileContents, iniSection);
            }

            return deserializer.DeserializeSection<T>(iniFileContents, iniSection);
        }
    }
}