This file contains hidden or 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/bin/env bash | |
| function ohHi(){ | |
| echo "Hi" | |
| } | |
| (return 0 2>/dev/null) && return || echo "Script is a subshell" | |
| # self invoke if not sourced |
This file contains hidden or 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
| Disable vim automatic visual mode on mouse select | |
| issue: :set mouse-=a | |
| add to ~/.vimrc: set mouse-=a |
This file contains hidden or 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
| # installs to /opt/gradle | |
| # existing versions are not overwritten/deleted | |
| # seamless upgrades/downgrades | |
| # $GRADLE_HOME points to latest *installed* (not released) | |
| gradle_version=2.9 | |
| wget -N https://services.gradle.org/distributions/gradle-${gradle_version}-all.zip | |
| sudo unzip -foq gradle-${gradle_version}-all.zip -d /opt/gradle | |
| sudo ln -sfn gradle-${gradle_version} /opt/gradle/latest | |
| sudo printf "export GRADLE_HOME=/opt/gradle/latest\nexport PATH=\$PATH:\$GRADLE_HOME/bin" > /etc/profile.d/gradle.sh | |
| . /etc/profile.d/gradle.sh |
This file contains hidden or 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
| /* Similar to recompose withProps but for object composition */ | |
| export const withProps = (extension) => (state) => { | |
| const ext = extension(state); | |
| return { | |
| ...state, | |
| ...ext, | |
| }; | |
| }; |
This file contains hidden or 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
| #!/bin/sh | |
| set -e | |
| set -o pipefail | |
| # collect arguments to forward on | |
| while [[ "$#" > 0 ]]; do case $1 in | |
| # example to save value | |
| # -v|--data-volume) shift; dataVolume=$1;; # --data-volume someval | |
| *) args[${#args[@]}]=$1;; | |
| esac; shift; done |
This file contains hidden or 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
| // usage example | |
| const ChildComponent = ({ CanvasContext }) => { | |
| const { setCanvasEl } = useContext(CanvasContext); | |
| return <canvas ref={setCanvasEl} />; | |
| } | |
| const Component = ({ CanvasContext }) => { | |
| const {canvasEl } = useContext(CanvasContext); | |
| const contexts = { CanvasContext }; | |
| // .. do something with canvasEl |
This file contains hidden or 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
| export const basic = (subscriber) => (origSource) => | |
| origSource.lift({ | |
| call(dest, source) { | |
| return source.subscribe(subscriber(dest)); | |
| } | |
| }); | |
| export const through = (cb) => | |
| basic((dest) => { | |
| return { |
This file contains hidden or 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
| import { debounce, throttle } from 'lodash'; | |
| import memoize from 'memoizee'; | |
| // Memoize to use unique args, and debounce to only get the last call | |
| // https://github.com/lodash/lodash/issues/2403#issuecomment-290760787 | |
| export const memoizeDebounce = (func, wait = 0, options = {}) => { | |
| const { leading, maxWait, trailing, ...memoizeOptions } = options; | |
| const mem = memoize( | |
| () => debounce(func, wait, { leading, maxWait, trailing }), |
This file contains hidden or 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
| { | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "name": "Spear UI", | |
| "type": "node", | |
| "request": "launch", | |
| "env": { | |
| "ELECTRON_ARGS": "[\\\"--inspect-brk\\\"]", | |
| "DEBUG": "SPEAR*,spear-ui*" |
This file contains hidden or 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
| #!/bin/sh | |
| set -e | |
| set -o pipefail | |
| while [[ "$#" > 0 ]]; do case $1 in | |
| -f|--from) shift; FROM=$1;; | |
| -t|--to) shift; TO=$1;; | |
| -d|--dest) shift; DEST=$1;; | |
| *) echo "Unknown parameter passed: $1"; exit 1;; | |
| esac; shift; done |