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
var getTimeLeft = function(){ | |
var now = moment(); | |
var deadline = now.clone().hour(12).minute(0),second(0); | |
if(now.isAfter(deadline) { | |
// disable RSVP button here | |
return ‘Closed’; | |
}else { | |
// enable RSVP button here | |
// returns “in x hours”, “in x minutes”, “in a few seconds” | |
return deadline.from(now); |
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
/**************************************************************** | |
* Setting root-level styles * | |
* See: https://www.mapbox.com/mapbox-gl-js/style-spec/#root * | |
* JSBIN: https://jsbin.com/qazosufoge/1/edit?js,console,output * | |
****************************************************************/ | |
mapboxgl.accessToken = 'pk.eyJ1IjoiaGVsbG8tY2EiLCJhIjoiY2lyaTdmdjNwMDF5eWc2bnJzM29rajAycyJ9.V-d5lBQ8iQ_n-vpvJ_RSIA'; | |
var statesSource = { | |
'type': 'geojson', |
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
var betterInterval = function(execute, delay, reverse) { | |
execute.stop = false; | |
execute.stopped = false; | |
if(reverse){ execute(); } | |
(function subroutine() { | |
setTimeout(function() { | |
if(!execute.stop){ | |
execute(); | |
subroutine(); | |
}else{ execute.stopped = true; } |
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
#!/bin/bash | |
red=$'\e[1;31m' | |
grn=$'\e[1;32m' | |
yel=$'\e[1;33m' | |
blu=$'\e[1;34m' | |
mag=$'\e[1;35m' | |
cyn=$'\e[1;36m' | |
end=$'\e[0m' |
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
set nocompatible " be iMproved | |
au FocusGained,BufEnter * :silent! ! | |
au FocusLost,WinLeave * :silent! w | |
" so $HOME/.vim/plugin/vundle.vim | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Auto load changes to vimrc to vim | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
augroup myvimrc |
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
var sum = 0; | |
var add5Async = () => { | |
return setTimeoutAsync(1000) | |
.then(add5.bind(null, sum)) // pure function, bind global variable as input | |
.then(setSum); // side-effect at the end | |
}; | |
asyncReduce([ add5Async, add5Async, add5Async ]) | |
.then(() => { console.log('sum:', sum); }) |
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
#!/bin/sh | |
for staged_file in $(git diff --cached --name-only) | |
do | |
if [[ "$staged_file" == *\.js$* ]] && [ -f "$staged_file" ]; then | |
./node_modules/jscs/bin/jscs "$staged_file" | |
if [[ "$?" != "0" ]]; then | |
exit 1 | |
fi | |
fi |
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
# remap prefix from 'C-b' to 'C-a' | |
unbind C-b | |
set-option -g prefix C-a | |
bind-key C-a send-prefix | |
# split panes using | and - | |
bind | split-window -h | |
bind - split-window -v | |
unbind '"' | |
unbind % |
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
#Add to ~/.gitconfig | |
[alias] | |
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short |
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
#!/bin/bash | |
vercomp () { | |
if [[ $1 == $2 ]] | |
then | |
return 0 | |
fi | |
local IFS=. | |
local i ver1=($1) ver2=($2) | |
# fill empty fields in ver1 with zeros | |
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)) |
NewerOlder