Skip to content

Instantly share code, notes, and snippets.

@daguar
daguar / gist:5368778
Last active September 18, 2018 03:39
An alternative approach to installing Drake on Mac OS X
# I bumped into some problems installing Drake ( https://github.com/Factual/drake ) on OSX, so here's what I did:
# 1. Follow the installation instructions here up through "Run Drake from the uberjar":
# https://github.com/Factual/drake/blob/251a22b27b5ded1fff522f39f06d3e06c77daf74/README.md
# (This is the specific README version I used.)
# 2. Move the 'drake' directory to Applications:
mv drake/ ~/Applications/
# 3. Install Drip ( https://github.com/flatland/drip ) for speedier load time.
@daguar
daguar / good_oakland_bars.geojson
Created June 5, 2014 00:47
Using IPython's embed() to interactively play with code at a specific point
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
require 'httparty'
require 'nokogiri'
require 'pry'
page = HTTParty.get("http://lafayette.granicus.com/ViewPublisher.php?view_id=3").body
parsed_page = Nokogiri::HTML(page)
all_agenda_link_elements = parsed_page.css("a").select { |link| link.children.text == "Agenda" }
first_agenda = HTTParty.get all_agenda_link_elements[1].attributes["href"].value
binding.pry
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@daguar
daguar / gist:3aa1ad3d0960f6cb8beb
Created January 26, 2016 01:21
How to set up a Waffle for team and project tasks
so what we do
is have multiple repos, some public some private
you can add private repos to a "meta-waffle” (the repo that sorta holds all others underneath it for waffle’s purposes)
and then it will show up for YOU (and others with permissions) but not for OTHERS
Waffle instructions for managing multiple repos in a single waffle: https://github.com/waffleio/waffle.io/wiki/FAQs#multirepo
so what i’d do is create a new repo (public) called something like “kansas-city-fellows” or somesuch
then that can be the “meta waffle” and you can configure it per the above link by adding additional project-specific repos
@daguar
daguar / gist:8389275
Created January 12, 2014 19:29
D3 OOPy quantizer for 1-5 range
// Quantizing data into buckets
function Quantizer(data_array) {
min = d3.min(data)
max = d3.max(data)
this.quantizeNumber = d3.scale.quantize()
.domain([min,max])
.range([1,5]) // Start with only mapping on 1-5 color scale
}
@daguar
daguar / gist:7932437
Last active December 31, 2015 04:09
Web mapping notes for CodigoCDMX
@daguar
daguar / gist:6188849
Created August 8, 2013 21:18
My git aliases. Put this in ~/.gitconfig
[alias]
amend = commit --amend -a
br = branch
co = checkout
ds = diff --staged
di = diff
fetchall = fetch -v --all
log-fancy = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(cyan)<%an>%Creset' --abbrev-commit --date=relative
log-me = !UN=$(git config user.name)&& git log --author="\"$UN\"" --pretty=format:'%h %cd %s' --date=short
log-nice = log --graph --decorate --pretty=oneline --abbrev-commit
@daguar
daguar / gist:5640767
Created May 24, 2013 01:43
Zillow neighborhood data exploration in Ruby
require 'pry'
require 'rubillow'
Rubillow.configure do |config|
config.zwsid = ENV["ZILLOW_KEY"]
end
hoods = Rubillow::Neighborhood.region_children({ :state => 'IN', :city => 'South Bend', :childtype => 'neighborhood' })
# Hash method -- not using
#hood_region_ids = Hash.new
@daguar
daguar / gist:3298859
Created August 8, 2012 21:17
Falling for Ruby: "Holy Crap!" Edition
=begin
Every day I use Ruby I see more and more why people become evangelists.
Take today: I was toying with evaluating different approaches to match two
data sources (API results and a giant local database), and I realized,
"wait! this is a job for yield!"
So I wrote a pleasant little module with a function that:
- Takes a block which attempts to match an API object to rows in the