Skip to content

Instantly share code, notes, and snippets.

View chrismetcalf's full-sized avatar

Chris Metcalf chrismetcalf

View GitHub Profile
@chrismetcalf
chrismetcalf / fire911.js
Last active August 29, 2015 13:56
simply.js Fire911 lookup
simply.title('Locating...');
navigator.geolocation.getCurrentPosition(function(pos) {
var coords = pos.coords;
simply.title('Looking up ' + coords.latitude + ', ' + coords.longitude);
var fire_url = 'http://data.seattle.gov/resource/kzjm-xkqj.json?' +
'$where=within_circle(report_location, ' + coords.latitude + ', ' + coords.longitude + ', 500)&$limit=20';
simply.body(fire_url, true);
@chrismetcalf
chrismetcalf / 0_reuse_code.js
Created June 13, 2014 16:37
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bokeh Plot</title>
<style>
/* BEGIN /usr/local/lib/python2.7/site-packages/bokeh/server/static/css/bokeh.css */
/*! jQuery UI - v1.10.0 - 2013-01-17
* http://jqueryui.com
import urllib2
# Make sure you register your own app token at http://dev.socrata.com/register
headers = {
"X-App-Token" : "YOUR_APP_TOKEN_HERE"
}
request = urllib2.Request("https://data.colorado.gov/resource/q2qp-xhnj.json?county=Denver&$limit=50", headers = headers)
response = urllib2.urlopen(request)
Compiling Do.Interface.Linux.Docky.dll...
./src/Docky.Interface/DockArea_Rendering.cs(57,26): error CS0103: The name `<ActiveIconChangeTime>k__BackingField' does not exist in the current context
./src/Docky.Interface/DockArea_Rendering.cs(57,26): error CS0103: The name `<ActiveIconChangeTime>k__BackingField' does not exist in the current context
./src/Docky.Interface/DockArea_Rendering.cs(59,36): error CS0103: The name `<RenderData>k__BackingField' does not exist in the current context
./src/Docky.Interface/DockArea_Rendering.cs(59,36): error CS0103: The name `<RenderData>k__BackingField' does not exist in the current context
./src/Docky.Interface/DockArea_Rendering.cs(61,22): error CS0103: The name `<PainterOverlayVisible>k__BackingField' does not exist in the current context
./src/Docky.Interface/DockArea_Rendering.cs(61,22): error CS0103: The name `<PainterOverlayVisible>k__BackingField' does not exist in the current context
./src/Docky.Interface/DockArea_DragAndDrop.cs(64,27): error CS0103: The nam
# Get sha for a git subtree
> git ls-tree branchname dir
# One-liner to see who uses the Seven Dirty Words the most in their code
# http://en.wikipedia.org/wiki/Seven_dirty_words
find . | grep -v ".git" | while read filename; do git blame $filename 2> /dev/null | \
egrep -i '(shit|piss|fuck|cunt|cocksucker|motherfucker|tits)' | \
perl -ne 'm|\w+\s+\(([\w.-_@ ]+) 200|; print "$1\n";'; done | sort | uniq -c
# One-liner to bulk-reassign Pivotal Tracker stories
curl -H "X-TrackerToken: $PIVOTAL_TOKEN" -X GET "http://www.pivotaltracker.com/services/v2/projects/$PROJECT_ID/stories?filter=owner:$OLD_OWNER" | \
egrep '^ <id type' | perl -ne 'm/>(\d+)</; print "$1\n";' | \
while read id; do curl -H "X-TrackerToken: $PIVOTAL_TOKEN" -H "Content-type: application/xml" \
-d "<story><owned_by>$NEW_OWNER</owned_by></story>" -X PUT \
"http://www.pivotaltracker.com/services/v2/projects/$PROJECT_ID/stories/$id"; done
" Chris Metcalf (chris@chrismetcalf.net)
" gvim config file
"
" Get rid of "chrome"
set guioptions=cmR
" set the X11 font to use. See 'man xlsfonts' on unix/linux
set guifont=ProFontWindows:h12.00
" Hide the mouse pointer while typing
" Tab config
set smarttab
set shiftwidth=2
set autoindent
set expandtab
" Wrap while searching for strings....
set wrapscan
" Wrap at whitespace instead of the middle of a word.