Create documentation for your projects. Like so:
- Up/Down - Previous/Next Gist
- Ctrl+e - Edit a selected Gist
- Ctrl+s - Save Gist
| const get = function(state, arrayPath, defaultValue) { | |
| if (arrayPath.length === 1) { | |
| return state.get(arrayPath[0], defaultValue); | |
| } else { | |
| return state.getIn(arrayPath, defaultValue); | |
| } | |
| } |
| const redux_log = []; | |
| const errorLogMiddleware = (store) => (next) => (action) => { | |
| const type = (action && action.type) || 'unknown action'; | |
| if ( type === 'LOG_ERROR' ) { | |
| const log_str = redux_log.join(' -> '); | |
| const error_str = (action && action.payload && action.payload.error) || 'Redux Error'; | |
| console.error(error_str + ': ' + log_str); | |
| } else { |
| # Description: | |
| # A simple prompt for bash that supports a default value. | |
| # ${ask} QUESTION DEFAULT | |
| # | |
| # Example: | |
| # BRANCH=$(ask "Which Branch?" "master") | |
| function ask(){ | |
| local QUESTION=$1 | |
| local DEFAULT=$2 | |
| local ANSWER |
| #!/bin/bash | |
| if [ ! -d ".git" ]; then | |
| echo "Not a git Directory" | |
| exit 1 | |
| fi | |
| git branch -d `git for-each-ref --format="%(refname:short)" refs/heads/\* | | |
| while read -r line; do |
| #!/bin/bash | |
| if [ ! -d ".git" ]; then | |
| echo "Not a git Directory" | |
| exit 1 | |
| fi | |
| function getStashesToRemove { | |
| git stash list | while read -r line; | |
| do | |
| read -p "remove branch: $line (y/N)?" answer </dev/tty; |
| templateString = _.curry( | |
| (config, string, valueObj) => _.template(string, config )(valueObj) | |
| ) | |
| templateMustache = templateString({interpolate: /{{([\s\S]+?)}}/g}); | |
| TempString = templateMustache('hello {{user}}!', { user: 'mustache' }) | |
| console.log(TempString) |
| <snippet> | |
| <content><![CDATA[ | |
| export function ${1:action_name}(${2:arguments}) { | |
| return { | |
| type: ${3:type}, | |
| payload: { | |
| ${2:arguments} | |
| } | |
| }; | |
| } |
| /** | |
| * Recursivly flatten a deeply nested array | |
| * @arr Array Array with nested values | |
| * @return Array Flattend array | |
| */ | |
| function flatten(arr) { | |
| return arr.reduce(function(result, current) { | |
| if (current instanceof Array) { | |
| return result.concat(flatten(current)); | |
| } else { |
| [ | |
| { "keys": ["ctrl+shift+r"], "command": "reveal_in_side_bar"} | |
| ] |