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
public render() | |
const todos = @.props.model.todos | |
let shownTodos = todos.filter (todo) -> | |
switch @.state.nowShowing | |
case ACTIVE_TODOS: | |
-< !todo.completed | |
case COMPLETED_TODOS: | |
-< todo.completed | |
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
tsc --watch | xargs -L1 -I{} terminal-notifier -message '{}' |
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 MIN_HEIGHT = 4 | |
const MAX_HEIGHT = 8 | |
const HEIGHT_DELTA = MAX_HEIGHT - MIN_HEIGHT | |
interface Path { | |
startIndex: number | |
startHeight: number | |
endIndex: number | |
endHeight: 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
/** | |
* Suppose there was an Object.map function similar to Array.map | |
* There is some discussion about this on es-discuss but no one has filed a formal proposal yet (someone should!) | |
* @param {Object} object | |
* @param {function} callback | |
*/ | |
Object.map = function(object, callback) { | |
if (!object) { | |
throw new TypeError(`object is null or not defined`); | |
} |
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
{ | |
"name": "Attach", | |
"type": "chrome", | |
"request": "attach", | |
"port": 9222, | |
"url": "https://mixpanel.com/*", | |
"webRoot": "${workspaceRoot}", | |
"diagnosticLogging": false, | |
"sourceMapPathOverrides": { | |
"webpack:///./~/*": "${workspaceRoot}/node_modules/*", |
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
#!/usr/local/bin/bash | |
USAGE=$'Usage: sync.sh <user@host> <dest_dir> e.g ./sync.sh user@host \'~/dest_dir\'' | |
SSH_HOST=${1:?$USAGE} | |
DEST_DIR=${2:-"~/`basename $PWD`"} | |
sync_files() { | |
declare -A file_hash_map | |
while IFS= read -r file; do | |
file=${file#"$PWD/"} # get relative path |
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
[ | |
{"key": "shift+cmd+k", "command": "workbench.action.tasks.terminate" }, | |
{"key": "cmd+r", "command": "workbench.action.debug.restart", "when": "inDebugMode" }, | |
{"key": "alt+s", "command": "workbench.action.gotoSymbol" }, | |
{"key": "cmd+[", "command": "workbench.action.navigateBack" }, | |
{"key": "cmd+]", "command": "workbench.action.navigateForward" }, | |
{"key": "alt+[", "command": "editor.action.outdentLines", "when": "editorTextFocus && !editorReadonly"}, | |
{"key": "alt+]", "command": "editor.action.indentLines","when": "editorTextFocus && !editorReadonly"}, | |
{"key": "ctrl+]", "command": "editor.action.dirtydiff.next", "when": "editorTextFocus"}, | |
{"key": "ctrl+[", "command": "editor.action.dirtydiff.previous", "when": "editorTextFocus"}, |
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
def inspect_module(module_name): | |
module = importlib.import_module(module_name) | |
print('inspect: ' + module_name) | |
for name in dir(module): | |
if name[:2] != '__': # Ignore internals | |
print(' %s: %s' % (name, getattr(module, 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
printDiff(expected, encoded_actual, referencePath(relativeFileName), actualFileName); | |
/** | |
* Prints a nice diff that is useful for debugging baseline failures | |
* It doesn't print the most optimum diff but does it in O(n) time and gives a `good enough` diff for humans | |
* It also emits a `cp tests/baselines/local/<file> tests/baselines/reference/<file>` | |
* Which makes experience of updating basefiles case by case much more bearable | |
*/ | |
export function printDiff(expectedText: string, actualText: string, expectedFileName: string, actualFileName: string) { | |
type LineNumMap = { [line: string]: 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
/* | |
Write a method that returns a string representing the state of a pagination nav bar | |
# rule 1: the number of pages returned should not exceed the value of the "numVisiblePages" parameter | |
# rule 2: always show the first page | |
# rule 3: always show the last page | |
# rule 4: put ellipses where appropriate | |
# rule 5: place [] around the selected page and, if possible, center it | |
currentPage = 5 |