Skip to content

Instantly share code, notes, and snippets.

View shawnbot's full-sized avatar
🎹

Shawn Allen shawnbot

🎹
View GitHub Profile
@shawnbot
shawnbot / google.js
Created March 6, 2012 01:00
Stamen tiles in popular map engines
// replace "toner" here with "terrain" or "watercolor"
var layer = "toner";
var map = new google.maps.Map(document.getElementById("element_id"), {
center: new google.maps.LatLng(37.7, -122.4),
zoom: 12,
mapTypeId: layer,
mapTypeControlOptions: {
mapTypeIds: [layer]
}
});
@ariya
ariya / license.txt
Created April 8, 2012 16:24
Malicious PHP masqueraded as WordPress license.txt
<?php
$GLOBALS['_1660021129_'] = Array(
'sprintf',
'ip2long',
'substr_count',
'sleep',
'strpos',
'preg_replace',
'stripos',
'gethostbyaddr',
@tmcw
tmcw / spy.js
Created September 10, 2012 17:20
Spy on requests through MM and call a callback with ms inflight
function spy(layer, callback) {
var inflight = {};
var rt = layer.requestManager.requestTile;
layer.requestManager.requestTile = function() {
inflight[arguments[0]] = +new Date();
rt.apply(layer.requestManager, arguments);
};
layer.requestManager.addCallback('requestcomplete', function(s, img) {
callback(+new Date() - inflight[img.id]);
delete inflight[img.id];
@max-mapper
max-mapper / index.js
Created November 27, 2012 01:28
link to lat/lon in native maps app on ios and android from webview (phonegap)
var mapLink = "http://maps.google.com/maps?z=12&t=m&q=loc:" + lat + "+" + lon
if ($.os.ios && navigator.userAgent.match(/iPhone OS 6_/)) mapLink = "Maps://?q=" + lat + "," + lon
if ($.os.android) mapLink = "geo:" + lat + "," + lon + "?z=12&q=" + lat + "," + lon
// assumes you have zepto and zepto.detect loaded
// also you should use target=_blank on your <a> tags
@tmcw
tmcw / index.html
Created November 27, 2012 21:04
d3 tag editing
<!DOCTYPE html>
<head>
<meta charset='utf-8'>
<title>d3 input table</title>
<style>
body {
font:normal 14px/20px 'Helvetica Neue', sans-serif;
}
</style>
</head>
@eliperelman
eliperelman / LICENSE.txt
Created June 17, 2011 15:37 — forked from 140bytes/LICENSE.txt
140byt.es polyfill for Array.filter
DO WHAT THE **** YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Eli Perelman http://eliperelman.com
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE **** YOU WANT TO PUBLIC LICENSE

Show me the code! Do you prefer seeing how something works instead of instructions? If so, check out this pull request to the Amortize module. Each instruction below lives as its own commit. cfpb/amortize#11

1. Add an .npmrc file.

The contents of the file should be:

save-exact=true
@mbostock
mbostock / .block
Last active September 30, 2016 00:21 — forked from mbostock/.block
Blocky Counties
license: gpl-3.0
ndjson-join 'true' <(cat oregon.json) <(shp2json -n data/shp/arc_reference/ned_1arcsec_g.shp) \
| ndjson-filter -r jsts 'function(d) { var r = new jsts.io.GeoJSONReader(), g1 = r.read(d[0].geometry), g2 = r.read(d[1].geometry); return !g1.intersection(g2).isEmpty() }.call(this, d)' \
| ndjson-map 'd[1]'
@mbostock
mbostock / .block
Last active January 24, 2017 21:27 — forked from mbostock/.block
U.S. Counties TopoJSON Mesh
license: gpl-3.0
height: 600
border: no