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
<?php | |
/** | |
* Scan the api path, recursively including all PHP files | |
* | |
* @param string $dir | |
* @param int $depth (optional) | |
*/ | |
protected function _require_all($dir, $depth=0) { | |
if ($depth > $this->max_scan_depth) { |
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 .tpl for smarty files | |
--type-set=smarty=.tpl | |
--type-set=tpl=.tpl | |
# plain text CSV files | |
--type-set=csv=.txt,.csv,.tsv | |
# CSS/LESS | |
--type-set=css=.css,.less |
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
# 1. Install mplayer command line (via Brew, Macports, or APT) | |
# 2. Add the following aliases to ~/.profile | |
# 3. Type `source ~/.profile` | |
# 3. Type `news` or `current` to listen in your terminal | |
alias news="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/news.pls" # MPR News | |
alias current="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/the_current.pls" # The Current | |
alias classical="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/classical.pls" # Classical MPR | |
alias localcurrent="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/local.pls" # Local Current | |
alias heartland="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/radio_heartland.pls" # MPR Radio Heartland |
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
#!/usr/bin/expect | |
# set variables | |
set username [email protected] | |
set password changeme | |
set certificate_accept y | |
spawn mount -t davfs https://www.box.com/dav/ /mnt/box.net/ | |
# Look for username prompt | |
expect "username:" |
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
for w in 320 640 960; | |
do webkit2png -Fs 1 -W $w -o $w$(date +%Y%m%d-%H%M%S) "http://mediaqueri.es"; | |
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
<?php | |
// return host name from server for debugging purposes | |
header('X-App-Host: served from ' . php_uname('n')); |
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 | |
cd /path/to/project/ || exit | |
unset GIT_DIR | |
LOGFILE=deployments.log | |
echo $(date) >> $LOGFILE | |
git pull origin master >> $LOGFILE | |
git update-server-info | |
echo $(git rev-parse --short HEAD) > VERSION |
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 | |
while [ 1 ] | |
do | |
rsync -avz --partial source dest | |
if [ "$?" = "0" ] ; then | |
echo "rsync completed normally" | |
exit | |
else | |
echo "Rsync failure. Backing off and retrying..." |
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 | |
PROJECTPATH=$(git rev-parse --show-toplevel) | |
echo $(git rev-parse --short HEAD) > $PROJECTPATH/VERSION |
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
<?php | |
if(!is_404()) { | |
// Set caching headers (cache for 5 minutes) | |
header('Cache-Control: max-age=300, must-revalidate'); | |
header('Expires: '.gmdate('D, d M Y H:i:s', strtotime('+5 minutes')).' GMT'); | |
} |