Skip to content

Instantly share code, notes, and snippets.

View kenmickles's full-sized avatar
🚀

Ken Mickles kenmickles

🚀
View GitHub Profile
@kenmickles
kenmickles / create_test_blog.php
Created August 24, 2011 18:20
Quick and dirty script to copy data from one Tumblr to another.
<?php
/**
* Quick and dirty script to copy data from one Tumblr to another.
* Useful for setting up a test blog for theme development.
*
* @author Ken Mickles
*/
// the blog to copy from
@kenmickles
kenmickles / .vimrc
Created August 24, 2011 18:23
My .vimrc
color murphy
syntax on
set ai
set nowrap
set nu
set ruler
set showcmd
set nohlsearch
set showmatch
set backspace=indent,eol,start
@kenmickles
kenmickles / fix_bdb.sh
Created August 30, 2011 23:29
Quick script to migrate some old BDB Subversion repositories I had sitting around to FSFS
#!/bin/bash
# Quick script to migrate some old BDB Subversion repositories I had sitting around to FSFS
# All commands come from http://www.hermann-uwe.de/blog/migrating-bdb-svn-repositories-from-one-version-to-another-and-to-fsfs
if [ "$1" == "" ]; then
echo "Please enter the full repository path"
exit
fi
@kenmickles
kenmickles / add-playlist-to-playlist.js
Created October 27, 2011 00:37
"Add Playlist to Playlist" bookmarklet for Rdio
/**
* This is a _very_ slightly modified version of Chris Pederick's "Add Album To Playlist" bookmarklet:
* <http://blog.chrispederick.com/post/6556221838/rdio-add-album-to-playlist-bookmarklet>
*
*/
(function () {
var interval_id = null;
var number = 0;
@kenmickles
kenmickles / gist:1321350
Created October 28, 2011 00:57
test twilio POSTs
curl -X POST -d "From=3031111111&Body=Test Message" http://localhost:3000/incoming
@kenmickles
kenmickles / .tmux.conf
Created January 11, 2012 17:19
My tmux config file
# act like vim
setw -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# act like GNU screen
@kenmickles
kenmickles / gist:1838952
Created February 15, 2012 20:56
Heroku email deploy hook
heroku addons:add deployhooks:email \
--recipient=ken@37i.net \
--subject="{{app}} was deployed by {{user}}" \
--body="Changes:\n\n{{git_log}}\n\n---\n{{url}}"
@kenmickles
kenmickles / gist:1895126
Created February 23, 2012 21:23
URL for adding a companion to a Southwest flight
http://www.southwest.com/account/rapidrewards/bookCompanion.html?recordLocator={CONFIRMATION_NUMBER}&ss=0
@kenmickles
kenmickles / gist:1950453
Created March 1, 2012 15:18
Slow sort MySQL records by distance
SELECT
name,
( 3959 * acos( cos( radians({$lat}) ) * cos( radians( latitude ) )
* cos( radians(longitude) - radians({$lng})) + sin(radians({$lat}))
* sin( radians(latitude)))) AS distance
FROM {$table}
HAVING distance < 1
ORDER BY distance
@kenmickles
kenmickles / gist:1950555
Created March 1, 2012 15:35
Simple PHP geocode function
function geocode($address) {
$url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode($address) . '&sensor=false';
$response = json_decode(file_get_contents($url), 1);
if ( isset($response['results'][0]) ) {
$ll = $response['results'][0]['geometry']['location'];
return array($ll['lat'], $ll['lng']);
}
return false;