A little experiment in nginx rewrites. Any request for an actual directory
within site
gets served the index.html
page. The client side is responsible
for loading data.json
from the requested directory and rendering (I'm using
react). The client will also implement history management to avoid full-page
refreshes.
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
# Usage: specify video and width | |
# gifify my-video.mp4 1200 | |
function gifify { | |
img="$1" | |
width=${2-600} | |
ffmpeg -i "$img" -vf scale=$width:-1 -t 10 -r 10 "$img".gif | |
} |
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
SELECT * FROM wp_users WHERE id IN ( | |
SELECT user_id FROM wp_usermeta | |
WHERE | |
meta_key = 'wp_capabilities' AND meta_value LIKE '%administrator%'); |
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
# Put this in your .profile or source it | |
# Run a command forever | |
# every 10 "echo hello" | |
function every() { | |
timeout=$1 && shift | |
cmd=$@ | |
while true; do eval "$cmd"; sleep $timeout; done | |
} |
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
heroku logs | grep 'heroku\[router\]' | grep -v '\(js\|css\|png\|jpg\|gif\|woff\|ico\)' | grep -v '/Security/ping' | grep -v 'status=404' | grep -o 'service=\d*' | cut -f 2 -d'=' > servicetimes.csv |
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
/* id styling has widespread effects */ | |
#site a { padding-left: 10px; } | |
/* does nothing */ | |
li a { padding-left: 10px; } | |
/* also does nothing */ | |
.sidebar li:first a { padding-left: 10px; } | |
/* Another overly specific selector */ |
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
<!-- | |
blocking version | |
<script async src="//use.typekit.net/loj4asn.js"></script> | |
<script>var try{Typekit.load();}catch(e){}</script> | |
non-blocking version below uses script async and setInterval. Replace src="" with your own kit URL | |
--> | |
<script async src="//use.typekit.net/loj4asn.js"></script> |
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
github () { | |
open `git remote -v | grep github.com | head -n 1 | cut -f 2 | cut -d' ' -f 1 | sed 's/git@/http:\/\//' | sed 's/.git$//' | sed 's/github.com:/github.com\//'` | |
} |
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
github(){ | |
open `git remote -v | grep github.com | head -n 1 | cut -f 2 | cut -d' ' -f 1 | sed 's/git@/http:\/\//' | sed 's/.git$//' | sed 's/github.com:/github.com\//'` | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>async</title> | |
</head> | |
<body> | |
<div id="async-scripts">Social widgets will go here...</div> | |
<div>Page contents here...</div> |