Skip to content

Instantly share code, notes, and snippets.

View campreb's full-sized avatar

Cameron Prebble campreb

View GitHub Profile
@chrisjacob
chrisjacob / README.md
Created February 14, 2011 14:31
Setup GitHub Pages "gh-pages" branch as a subfolder within the "master" project on your local checkout - a step-by-step guide.

Intro

Setup GitHub Pages "gh-pages" branch as a subfolder within the "master" project on your local checkout.

IMPORTANT

If you plan on switching between different branches (e.g. git checkout master-experiment then revert back with git checkout master) you will loose your child folder from this tutorial (because it's in your .gitignore and is not part of your master branch).

@databyte
databyte / upgrade_postgres_9.0-9.1.sh
Created November 29, 2011 03:29
Upgrade PostgreSQL from 9.0 to 9.1
#!/bin/sh
#
# Upgrade PostgreSQL from 9.0 to 9.1
#
# by David Sommers
#
brew update postgres
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@pitakakariki
pitakakariki / polls.r
Last active August 4, 2016 09:28
Code to generate an interactive SVG graph of NZ general election polling.
###
##
## --- New Zealand General Election Polling ---
##
## Plots polling data scraped from Wikipedia.
##
## - GAM -
##
## The smoothed curves are calculated using a generalised additive model (GAM). The
## smoothing parameter is estimated using cross-validation. This means that the curves
@madrobby
madrobby / gist:3161015
Created July 22, 2012 20:43
Detect retina support. Tested on iOS, Android 2.x, Chrome for Android, Safari on MacBook Pro Retina, Firefox mobile (beta) for Android, Opera Mobile (Android)
function isRetina(){
return (('devicePixelRatio' in window && devicePixelRatio > 1) ||
('matchMedia' in window && matchMedia("(min-resolution:144dpi)").matches))
}
@mbostock
mbostock / README.md
Last active June 7, 2023 18:33
Underscore’s Equivalents in D3

Collections

each(array)

Underscore example:

_.each([1, 2, 3], function(num) { alert(num); });
@afeld
afeld / gist:5704079
Last active November 27, 2023 15:43
Using Rails+Bower on Heroku
@bnolan
bnolan / gist:6181156
Created August 8, 2013 03:17
All the beervana 2013 beers in some kind of machine readable format...
8Wired Brewing
Superconductor DIPA, 8.9%, BU 88
Hopwired IPA, 7.3%, BU 70
Tall Poppy Red, 7.0%, BU 60
iStout Imperial Stout, 10.0%, BU 75
Mighty Imperial Ale, 10.0%, BU 75
Semiconductor Session IPA, 4.4% BU 30
Adnams
Southwold Bitter, 4.1%
Broadside (Premium Bitter), 6.3%
@shawnbot
shawnbot / README.md
Last active December 11, 2018 09:09
d3 bounded zoom behavior

This gist shows how to restrict d3's zoom behavior so that users can't pan outside of a rectangular bounding box. Use your scroll wheel to zoom in and out of the field of circles, and click and drag to move when zoomed in. Note how when you zoom back out (by scrolling up) the view snaps to the original extent at zoom 1.

@mbostock
mbostock / .block
Last active May 10, 2021 17:42
Beeswarm
license: gpl-3.0
height: 200
redirect: https://observablehq.com/@d3/beeswarm