This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Automatically adds branch name to the end of every commit message. Handy for git/JIRA integrations. | |
# Make a copy of .git/hooks/prepare-commit-msg.sample in your repo and name the file prepare-commit-msg (remove "sample" extension) | |
# Paste the following into the file, save the file, and try it out in bash | |
NAME=$(git branch | grep '*' | sed 's/* //') | |
echo $(cat "$1") "$NAME" > "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function nextPermutation(previousPermutations: string[][]): string[] { | |
const nextPermutationsLength = previousPermutations.length; | |
let nextPermutations = []; | |
for (let i = 0; i < nextPermutationsLength; i++) { | |
// each of the previous permutations becomes our "inner" permutations (array) | |
const innerPermutations = previousPermutations[i]; | |
// calculate how many outer permutations we need based on where we are in the loop | |
const outerPermutationsLength = nextPermutationsLength - 1 - i; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Node | |
#heroGenerator.gd | |
#makes a level 1 hero with random class and name | |
var nameGenerator = load("res://nameGenerator.gd").new() | |
var humanFemaleHeads = ["human_female_01.png", "human_female_02.png", "human_female_03.png", "human_female_04.png", "human_female_05.png", "human_female_06.png", "human_female_07.png", "human_female_08.png", "human_female_09.png", "human_female_10.png", "human_female_11.png"] | |
var humanMaleHeads = ["human_male_01.png", "human_male_02.png", "human_male_03.png", "human_male_04.png", "human_male_05.png", "human_male_06.png", "human_male_07.png", "human_male_08.png", "human_male_08.png", "human_male_09.png"] | |
var elfFemaleHeads = ["elf_female_01.png"] | |
func _ready(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends KinematicBody2D | |
#Hero properties - not governed by external spreadsheet data | |
#These are set when a hero is randomly generated in heroGenerator.gd | |
var heroID = -1 | |
var heroName = "Default Name" | |
var heroClass = "NONE" | |
var level = -1 | |
var xp = -1 | |
var currentRoom = 0 #outside by default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Parsely v.0.1 | |
Developed for Guild Leader project (December 2018) | |
To use: place .json files in parsely/names, parsely/staticData, parsely/timedNodeData, etc. | |
In Terminal: | |
node parsely.js | |
Exported .gd files are placed directly in gameData folder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generateParenthesis(n: number): string[] { | |
if (n === 1) { return ["()"]; } | |
let result = new Set<string>(); | |
let previousCombos = generateParenthesis(n-1); | |
for (let i in previousCombos) { | |
let combo = previousCombos[i]; | |
// wrap all previous entries in parens and put those in the set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function earliestAcq(logs: number[][], n: number): number { | |
logs.sort((a:number[], b:number[]) => { | |
return (a[0] - b[0]); | |
}); | |
let mapOfSets = new Map(); | |
// put every friend ID into its own individual set - O(n) | |
for (let i = 0; i < n; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<div> | |
<p>This is a test document. | |
<a href="https://google.com">Google link</a> | |
<a href="/dp/B0077QSLXI?creativeASIN=B0077QSLXI&tag=eltakosp-21&cv_ct_pg=article-page&cv_ct_id=amzn1.osa.653ce0b4-6ed1-42c8-9daf-6654894dfe55.A1PA6795UKMFR9.de_DE&ascsubtag=amzn1.osa.653ce0b4-6ed1-42c8-9daf-6654894dfe55.A1PA6795UKMFR9.de_DE&linkCode=oaa&cv_ct_wn=article-page">de link</a> | |
<a href="https://amzn.to/2VWwm1f">Shortened link</a> | |
<a href="http://www.amazon.com/gp/product/B00HQ4W3OE/ref=as_li_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=B00HQ4W3OE&linkCode=as2&tag=diy07a-20&linkId=OEVMCK2DEF22CXZY">Long link</a> | |
<a href="http://www.amazon.com/gp/product/B00HQ4W3OE/ref=as_li_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=B00HQ4W3OE&linkCode=as2&tag=diy07a-20&linkId=OEVMCK2DEF22CXZY">Duplicate link</a> | |
<a href="https://www.amazon.com/gp/product/B01N1GI969/ref=as_li_ss_tl?ie=UTF8&psc=1&smid=A2UZVIGPN3KFSI&linkCode=ll1&tag=diy07a-20&linkId=9844cef6c9b125a0133b548290c9fd2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let allPosts = [ {id: 123, name: "test post 1"}, | |
{id: 456, name: "test post 2"} | |
]; | |
let allReplies = [ {id: 1, replyTo: 123, name: 'reply 1', read: false}, | |
{id: 2, replyTo: 123, name: 'reply 2', read: false}, | |
{id: 3, replyTo: 456, name: 'reply 3', read: false} | |
]; | |
// simulate a server response with 1s wait time | |
const getRepliesToPost = async (id: number) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Closure example, sort of a companion to my JS example: | |
// https://repl.it/@MandiGrant/JSClosureExample | |
// combineNames is a function that returns a function. | |
var combineNames = (firstName) { | |
return (lastName) => firstName + ' ' + lastName; | |
}; | |
/* If you call it like this, |
NewerOlder