Keys | Action | Description |
---|---|---|
Cmd-Shift-A | Search action by name | search for any command/menu items |
Alt-F1 | Select target | Open current file in project tree, finder, etc |
Keys | Action | Description |
---|---|---|
Cmd-O | Class search | classes, traits, objects |
// install @types/react-redux and other nonsense | |
import * as React from 'react' | |
import { connect } from 'react-redux' | |
import { YourActualAppState } from './wherever-it-is.ts' | |
export function mapStateToProps({ | |
whatever | |
}: YourActualAppState) { | |
return { |
/** | |
* Read the text contents of a File or Blob using the FileReader interface. | |
* This is an async interface so it makes sense to handle it with Rx. | |
* @param {blob} File | Blob | |
* @return Observable<string> | |
*/ | |
const readFile = (blob) => Observable.create(obs => { | |
if (!(blob instanceof Blob)) { | |
obs.error(new Error('`blob` must be an instance of File or Blob.')); | |
return; |
function *flatten<T>(iterable: Iterable<T>, depth: number = Infinity): Iterable<T> { | |
if (depth === 0) { return iterable; } | |
for (let item of iterable) { | |
if (typeof item[Symbol.iterator] === 'function') { | |
yield *flatten(item, depth - 1); | |
} else { | |
yield item; | |
} | |
} |
function ensure(moduleId, fn, done){ | |
if(__webpack_modules__[moduleId]) { //eslint-disable-line no-undef | |
return done(undefined, __webpack_require__(moduleId)) //eslint-disable-line no-undef | |
} | |
fn().then(Module => done(undefined, Module), done) | |
} | |
// usage | |
ensure(require.resolveWeak('./x.js'), |
100+ different js counter apps... |
fstash() { | |
local out q k sha | |
while out=$( | |
git stash list --pretty="%C(yellow)%h %>(14)%Cgreen%cr %C(blue)%gs" | | |
fzf --ansi --no-sort --query="$q" --print-query \ | |
--expect=ctrl-d,ctrl-b); | |
do | |
IFS=$'\n'; set -f | |
lines=($(<<< "$out")) | |
unset IFS; set +f |
gstash() { | |
local out k reflog | |
out=( | |
$(git stash list --pretty='%C(yellow)%gd %>(14)%Cgreen%cr %C(blue)%gs' | | |
fzf --ansi --no-sort --header='enter:show, ctrl-d:diff, ctrl-o:pop, ctrl-y:apply, ctrl-x:drop' \ | |
--preview='git stash show --color=always -p $(cut -d" " -f1 <<< {}) | head -'$LINES \ | |
--preview-window=down:50% --reverse \ | |
--bind='enter:execute(git stash show --color=always -p $(cut -d" " -f1 <<< {}) | less -r > /dev/tty)' \ | |
--bind='ctrl-d:execute(git diff --color=always $(cut -d" " -f1 <<< {}) | less -r > /dev/tty)' \ | |
--expect=ctrl-o,ctrl-y,ctrl-x)) |
/*! | |
* Copyright 2015 Google Inc. All rights reserved. | |
* | |
* 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 |
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |