git checkout OLD_NAME
git pull
git branch -m OLD_NAME NEW_NAME
git push --delete origin OLD_NAME
git push --set-upstream origin NEW_NAME
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
#NoEnv | |
SendMode Input | |
SetWorkingDir %A_ScriptDir% | |
#SingleInstance Force | |
; These hotkeys are always active (even if the script is suspended): | |
^Left:: | |
Suspend Toggle | |
Send {Home} |
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
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
^Left::Send {Home} ; Ctrl + Left = Home | |
+^Left::Send {LShift down}{Home}{LShift up} ; Ctrl+Shift+Left = Home (select to BOL) | |
^Right::Send {End} ; Ctrl+Right = End | |
+^Right::Send {LShift down}{End}{LShift up} ; Ctrl+Shift+Right = End (select to EOL) |
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
const toBoolean = (context: any, flags: string[]) => { | |
for (const flag of flags) { | |
const propValue = context[flag]; | |
const propType = typeof propValue; | |
if ('boolean' === propType) { | |
context[flag] = propValue; | |
} |
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
const isNumericString = (digits) => { | |
if (typeof digits !== 'string') { | |
return false; | |
} | |
return digits.match(/^\d+$/); | |
}; | |
const deflatten = (flat, separator = '.') => { | |
const tree = {}; |
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
type SortingFunction<T = any> = (a: T, b: T) => number; | |
/** | |
* Accepts a key, returns an ascending sorting function for that key | |
*/ | |
const ascending = <T = any>(key: keyof T): SortingFunction<T> => { | |
return (a: any, b: any) => { | |
const aValue = a[key]; | |
const bValue = b[key]; | |
return (aValue === bValue) ? 0 : (aValue < bValue ? -1 : 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
const delay = 1000; | |
const iterations = 3; | |
const fakeRequest = () => new Promise((resolve, reject) => { | |
setTimeout(() => resolve(11), delay); | |
}); | |
// Sync | |
(async () => { | |
console.time('sync'); | |
const result = []; |
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
interface NestedObject { | |
[key: string]: NestedObject | string; | |
} | |
interface FlatObject { | |
[key: string]: string; | |
} | |
const flatten = (input: NestedObject): FlatObject => { | |
const result: FlatObject = {}; |
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
/** | |
* Coding Challenge: Intersecting rectangles | |
* | |
* Write a function calculateRectanglesIntersection that accepts two rectangles | |
* (in string format like "(0,0),(0,4),(6,4),(0,6)") and returns the value of | |
* the intersection area | |
*/ | |
const getRectangleCoordinates = (coordsInput) => { | |
let temp = coordsInput.slice(1, coordsInput.length - 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
// node ./test1.js --bool1 -2 --foo aa --bar=bb -f aaa -abc arg1 arg2 | |
const climb = require('./climb'); | |
const input = climb(process.argv, { | |
bool1: { | |
longName: 'bool1', | |
}, | |
bool2: { | |
longName: 'bool2', | |
shortName: '2', |
OlderNewer