Skip to content

Instantly share code, notes, and snippets.

View seanknox's full-sized avatar
🙋‍♂️

Sean Knox seanknox

🙋‍♂️
  • San Francisco, CA
View GitHub Profile
@seanknox
seanknox / gist:4008075
Created November 3, 2012 17:37
install t rubygem
chingon:hacktunes sean$ sudo gem install t
dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid
Password:
Fetching: addressable-2.3.2.gem (100%)
Fetching: launchy-2.1.2.gem (100%)
Fetching: fastercsv-1.5.5.gem (100%)
Fetching: geokit-1.6.5.gem (100%)
Fetching: oauth-0.4.7.gem (100%)
Fetching: oj-1.4.3.gem (100%)
@seanknox
seanknox / merchmart_osm.html
Created November 10, 2012 02:52
Merch Mart OSM HTML
<style type="text/css">.olControlAttribution { bottom: 3px!important; }</style><script src="http://www.openlayers.org/api/OpenLayers.js"></script><script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script><div id="map" style="width:500px;height:400px;"></div><script type="text/javascript">var map; function showMap(){ map = new OpenLayers.Map("map"); var mapnik = new OpenLayers.Layer.OSM(); map.addLayer(mapnik); map.setCenter(new OpenLayers.LonLat(-87.6365131,41.8883776).transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913")), 12); map.addLayer(new OpenLayers.Layer.Markers()); var marker = new OpenLayers.Marker(map.getCenter()); marker.events.register("mousedown", marker, function(evt) { alert("Chicago\n222 West Merchandise Mart Plaza Chicago, IL 60654"); OpenLayers.Event.stop(evt); }); map.layers[map.layers.length-1].addMarker(marker); } showMap();</script><br><a style="font:7pt Arial;text-decoration:none;cursor:default;color:black;" href="http://www.m
@seanknox
seanknox / livehere.carto.css
Created November 10, 2012 16:37
Tilemill styles
#merchmart {
marker-width:60;
marker-fill:#008000;
marker-line-color:#008000;
marker-allow-overlap:true;
}
#cta_rail_stations[BRN = 'TRUE']::glow {
@seanknox
seanknox / qgis.txt
Created November 10, 2012 18:51
QGIS stuff
Buffering with points tutorial: http://maps.cga.harvard.edu/qgis/wkshop/buffer.php
Beginning QGIS: http://www.learnosm.org/files/beginning-qgis/Beginning_QGIS_en_v1.pdf
@seanknox
seanknox / coins.rb
Created November 12, 2012 16:30 — forked from JeffCohen/coins.rb
Coin Change Machine
require 'test/unit'
class ChangeMachine
# Returns an array indicating the quantity of
# each denomination required.
# [pennies, nickels, dimes, quarters]
def issue_coins(amount)
end
end
@seanknox
seanknox / index.html
Created November 12, 2012 23:39
HTML code for HTML5 geolocation + Google Maps
<style type="text/css">
#mapContainer {
height: 500px;
width: 800px;
border:10px solid #eaeaea;
}
</style>
<script src="http://maps.google.com/maps/api/js?sensor=false">
</script>
@seanknox
seanknox / index.html
Created November 13, 2012 01:46
HTML code for HTML5 geolocation + Leaflet/OpenStreetMaps
<div style="width:800px; height:500px" id="map"></div>
<script type='text/javascript'>
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position){
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
});
@seanknox
seanknox / gist:4180951
Created December 1, 2012 07:21
How to route multipoint addresses + pub transit
We have code that takes an array of addresses and then determines routes between them using the Google Maps API, all in Javascript. It works roughly like this:
var eventArray = ["1062 W. Webster Avenue", "222 Merchandise Mart Plaza", "Midway International Airport"]
var directions = [];
while (eventArray.length > 1) { // Stop running when we have less than two addresses to route btwn
var start = eventArray[0]; // start is the first address in our array
var end = eventArray[1]; // end is the next address in the array
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]> ><! <![endif]-->
<html class='no-js' lang='en'>
<!-- <![endif] -->
<head>
<meta charset='utf-8'>
$ tree /Library/Developer/CommandLineTools
/Library/Developer/CommandLineTools
├── Library
│   ├── Developer
│   │   └── Acknowledgments.pdf
│   ├── Perl
│   │   ├── 5.12
│   │   │   └── darwin-thread-multi-2level
│   │   │   ├── SVN
│   │   │   │   ├── Base.pm