Skip to content

Instantly share code, notes, and snippets.

View stephenheard's full-sized avatar

Stephen Heard stephenheard

View GitHub Profile
@stephenheard
stephenheard / gist:0c48aa2ba1ee01699d16
Last active August 29, 2015 14:04
Garmin Connect Course GPX Download Bookmarklet
javascript:(function(){ if (window.location.host == "connect.garmin.com") { var pathArray = window.location.pathname.split( '/' ); if ( pathArray[1] == "course" ) { open('http://connect.garmin.com/proxy/course-service-1.0/gpx/course/' + pathArray[2]); } } }());
@stephenheard
stephenheard / rails on ec2
Last active August 29, 2015 14:01
Commands to setup Ruby on Rails on Amazon EC2 with Amazon Linux
sudo yum update
sudo yum groupinstall "Development Tools"
sudo yum install git pcre pcre-devel gcc make zlib zlib-devel openssl openssl-devel sqlite-devel
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
mkdir -p ~/.rbenv/plugins
cd ~/.rbenv/plugins
@stephenheard
stephenheard / history_example_with_jquery.js
Last active December 12, 2019 17:29
Quick History.js Example (with jQuery)
// have jQuery and history.js already loaded
//
// this works with hyperlinks and back/forward buttons
// and anywhere you use History.pushState
$(function() {
// run after page is loaded
ajaxifyLinks();
@stephenheard
stephenheard / CSV.php
Last active December 27, 2015 17:58
Very simple CSV parser object in PHP. Pass it a CSV string, perhaps from a file_get_contents($path)Requires that the first row be the column names, and that the delimiter is a comma.
<?php
class CSV implements IteratorAggregate {
// this is where we will store the rows
protected $rows = array();
function __construct($csv)
{