Skip to content

Instantly share code, notes, and snippets.

@joannecheng
joannecheng / hotdog.R
Created October 7, 2013 02:12
Conditional Colors in R (from Visualize This)
# This is unnecessary:
# fillColors <- c()
# for (i in 1:length(hotdogs$Country)) {
# if (hotdogs$Country[i] == "United States") {
# fillColors <- c(fillColors, "#821010")
# } else {
# fillColors <- c(fillColors, "#aaaaaa")
# }
# }
@joannecheng
joannecheng / omgdata.md
Last active May 19, 2016 11:36
Data sets I like and want to play around with
### MATPLOTLIBRC FORMAT
# This is a sample matplotlib configuration file - you can find a copy
# of it on your system in
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it
# there, please note that it will be overridden in your next install.
# If you want to keep a permanent local copy that will not be
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux
# like systems) and C:\Documents and Settings\yourname\.matplotlib
# (win32 systems).
@joannecheng
joannecheng / gist:6800144
Created October 2, 2013 20:36
Google Places exporter. Pass in lat/lng increment, bounding coordinates, search_query. Queries the google places API and exports csv with closest distance to the place that matches your search query.
GOOGLE_API_KEY = os.environ.get('GOOGLE_API_KEY')
class GooglePlacesExporter:
column_headers = ['lat', 'lng', 'latnear', 'lngnear', 'dist_miles']
def __init__(self, lat_incr=-0.29, lng_incr=0.29, search_query='grocery_or_supermarket', lat_NW=49.44098806129775,lng_NW=-127.13476612499217, lat_SE=23.725012, lng_SE=-61.347656):
self.lat_incr = lat_incr
self.lng_incr = lng_incr
self.lat_curr = lat_NW
self.lng_curr = lng_NW
@joannecheng
joannecheng / _.md
Created August 30, 2013 20:29
arches
@joannecheng
joannecheng / _.md
Created August 27, 2013 02:47
Tributary inlet
@joannecheng
joannecheng / bouncing_ball.rb
Created August 27, 2013 01:04
eurucamp example
Bouncing Ball
class BouncingBall < Processing::App
def setup
size 650, 800
smooth
stroke_weight 5
@radius = 80
@joannecheng
joannecheng / rp5-install-notes.md
Last active December 21, 2015 05:18
Ruby-Processing install notes

Hello there! So you want to install Ruby-Processing and get started creating some fun programs.

You can simply type gem install ruby-processing from any installation of Ruby. Ruby-Processing requires JRuby to run, but it comes bundled with its own version of JRuby (granted, a very old version: 1.6.4). To run a sketch using an installed version of JRuby, just run your sketch with the --jruby flag. That way you can use installed gems in your sketches.

The version that lives on rubygems.org is the version of Ruby-Processing I used in my presentation. However, this version of Ruby-Processing is technically outdated: it uses Processing version 1.5.4, whereas the current version of Ruby-Processing is using Processing version 2.0.

There are a few reasons why I used an older version for my talk, and why I recommend people use the older version of Ruby-Processing:

  • It's easier to install: the current Ruby-Processing is too big for rubygems.org, so one needs to pull the repo down from github, install it on
@joannecheng
joannecheng / _.md
Created June 22, 2013 21:31
Tributary inlet
@joannecheng
joannecheng / _.md
Created June 19, 2013 02:57
Tributary inlet