Magic words:
psql -U postgres
If run with -E
flag, it will describe the underlaying queries of the \
commands (cool for learning!).
Most \d
commands support additional param of __schema__.name__
and accept wildcards like *.*
git ls-files | xargs wc -l |
// The classic AJAX call - dispatch before the request, and after it comes back | |
function myThunkActionCreator(someValue) { | |
return (dispatch, getState) => { | |
dispatch({type : "REQUEST_STARTED"}); | |
myAjaxLib.post("/someEndpoint", {data : someValue}) | |
.then(response => dispatch({type : "REQUEST_SUCCEEDED", payload : response}) | |
.catch(error => dispatch({type : "REQUEST_FAILED", error : error}); | |
}; | |
} |
{ | |
// http://eslint.org/docs/rules/ | |
"ecmaFeatures": { | |
"binaryLiterals": false, // enable binary literals | |
"blockBindings": false, // enable let and const (aka block bindings) | |
"defaultParams": false, // enable default function parameters | |
"forOf": false, // enable for-of loops | |
"generators": false, // enable generators | |
"objectLiteralComputedProperties": false, // enable computed object literal property names |
Speed Up Mission Control Animations in MacOS Sierra: | |
defaults write com.apple.dock expose-animation-duration -float 0.1 | |
// and restart Dock with "killall Dock" | |
// Go back to default speed: | |
defaults delete com.apple.dock expose-animation-duration; killall Dock | |
Set Key Repeat: | |
defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms) | |
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms) | |
// login/logoff is neded |
/* Calculate Distance between two latitute & longitude points */ | |
function GPScalculateDistance(lat1, lng1, lat2, lng2) | |
{ | |
//radians | |
lat1 = (lat1 * 2.0 * Math.PI) / 60.0 / 360.0; | |
lng1 = (lng1 * 2.0 * Math.PI) / 60.0 / 360.0; | |
lat2 = (lat2 * 2.0 * Math.PI) / 60.0 / 360.0; | |
lng2 = (lng2 * 2.0 * Math.PI) / 60.0 / 360.0; |
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}' |
var degrees2meters = function(lon,lat) { | |
var x = lon * 20037508.34 / 180; | |
var y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180); | |
y = y * 20037508.34 / 180; | |
return [x, y] | |
} | |
lon= -77.035974 | |
lat = 38.898717 |
tail -n +2 "$FILE" > "$FILE.tmp" && mv "$FILE.tmp" "$FILE" |
find . -print0 | while IFS= read -r -d '' file | |
do | |
echo "$file" | |
done |