Skip to content

Instantly share code, notes, and snippets.

View fud's full-sized avatar

Brenton Bills fud

  • Paypa Plane
  • Brisbane, Australia.
  • 06:47 (UTC +10:00)
View GitHub Profile
@fud
fud / gist:cd432afe11549e051c7db9d8b184391f
Created November 3, 2017 01:30 — forked from KoryNunn/gist:5c6cb954a6d9be930d2a9b873cc34797
prototypical method binding Proxy
function bindContext(object){
return new Proxy({
get: function(target, key){
if(typeof target[key] === 'function' && !target.hasOwnProperty(key)){
return target[key].bind(target);
}
return target[key];
}
});
@fud
fud / bash.sh
Created May 11, 2017 00:25
Add a comma to lines.
cat systems.txt | uniq | sed 's/$/,/'
@fud
fud / check.sh
Created March 21, 2017 03:38
Run jshint (manually) over files to be committed.
# if you don't have a pre commit hook you can
# manually use this command.
git diff --name-only | xargs jshint
# save as an alias.
alias sc="git diff --name-only | xargs jshint"
@fud
fud / files.sh
Created March 8, 2017 00:12
Run jshint on files modified in a branch.
git diff --name-only master | xargs jshint
@fud
fud / shell.sh
Created October 31, 2016 03:55
Export automatically all the variables defined into a file
(api)~/api/code vagrant@bbills-vm » set -a ± SCRUM-8841:ce4e7d1
(api)~/api/code vagrant@bbills-vm » source /etc/finda/config.env ± SCRUM-8841:ce4e7d1
(api)~/api/code vagrant@bbills-vm » set +a
@fud
fud / shell.arguments.sh
Created September 20, 2016 05:15
Shell command line arguments.
#!/usr/bin/env bash
prog=$(basename ${0})
# Defaults
verbose=0
env="staging"
function help() {
printf "Usage: %s [-h/--help] [-e/--env <env>] <url>\n" "$prog"
@fud
fud / allocate.sh
Created September 3, 2016 08:06
More swap space for a docker machine.
for i in $(docker-machine ls | awk '{print $1}'); do
docker-machine ssh $i -- ls /swapfile || docker-machine ssh $i "fallocate -l 512M /swapfile && chmod 400 /swapfile && mkswap /swapfile" &&
docker-machine ssh $i "swapon /swapfile && echo '/swapfile none swap defaults 0 0' >> /etc/fstab" &>/dev/null;
done
@fud
fud / gist:c9c6633bf0c488b6b3e8d9f5a0aa758b
Created September 1, 2016 04:01
Open ports on a mac.
billsb@Brentons-MacBook-Pro ~/work/finda-db (fixing-up-doc)$ "/System/Library/CoreServices/Applications/Network Utility.app/Contents/Resources/stroke" 192.168.99.100 1 10000
Port Scanning host: 192.168.99.100
Open TCP Port: 22 ssh
Open TCP Port: 2376
Open TCP Port: 5432 postgresql
@fud
fud / ag.sh
Last active August 24, 2016 09:16
Using the silver searcher to search for a string ignoring a subdirectory directory in a globbed set of directories.
ag --ignore-dir node_modules setState react-udemy-*
@fud
fud / .zpreztorc
Last active August 13, 2016 03:14
Prezto themes with emacs.
#
# Prompt
#
# Set the prompt theme to load.
# Setting it to 'random' loads a random theme.
# Auto set to 'off' on dumb terminals.
if [[ $TERM =~ '^eterm' ]]; then
zstyle ':prezto:module:prompt' theme 'steeef'