Skip to content

Instantly share code, notes, and snippets.

View patrickberkeley's full-sized avatar

Patrick Berkeley patrickberkeley

View GitHub Profile

This grouped bar chart is constructed from a CSV file storing the populations of different states by age group. The chart employs conventional margins and a number of D3 features:

@patrickberkeley
patrickberkeley / README.md
Last active December 19, 2015 18:48 — forked from mbostock/.block

A variation of the example bar chart using a slightly more D.R.Y. style. The visual encoding is represented by two functions and their composition:

  • The value accessor returns the value (or property) to encode for a given data object.
  • The scale maps this value to a visual display encoding, such as a pixel position.
  • The map function represents the composition valuescale, mapping from data to display.

Inspired by Andrew Winterman’s post, Tooling for the Lazy Programmer: DRYing up D3.

@patrickberkeley
patrickberkeley / template.rb
Created October 16, 2012 23:58 — forked from alanpeabody/railst
HackVT Rails Template
gem('rspec-rails', group: 'test')
gem('debugger', group: 'development')
gem('jquery-rails', group: 'development')
gem('backbone-on-rails', group: 'development')
gem('backbone-support', group: 'development')
gem('activeadmin')
gem('faraday')
gem('mechanize')
@patrickberkeley
patrickberkeley / assets.js.erb
Created October 12, 2012 15:21 — forked from codebrew/assets.js.erb
javascript asset helper
App.assets = {
// Returns an object containing all of asset pipeline's image paths.
//
// Sample:
//
// {
// avatars/missing_avatar.png: "/assets/avatars/missing_avatar.png"
// chosen-sprite.png: "/assets/chosen-sprite.png"
// circle_green.png: "/assets/circle_green.png"
// circle_orange.png: "/assets/circle_orange.png"
@patrickberkeley
patrickberkeley / crimea.csv
Created March 21, 2012 15:27 — forked from mbostock/.block
Stacked Bar Chart
date wounds other disease
5/1854 0 95 105
6/1854 0 40 95
7/1854 0 140 520
8/1854 20 150 800
9/1854 220 230 740
10/1854 305 310 600
11/1854 480 290 820
12/1854 295 310 1100
1/1855 230 460 1440
body {
font: 86.5% Arial, sans-serif;
}
#container {
width: 960px;
margin: 0 auto;
padding: 60px 10px 10px 40px;
@patrickberkeley
patrickberkeley / dna.rb
Created July 13, 2009 19:12
DNA search program
class Dna
# Prompt user for input.
def pick_one
puts "Enter DNA sequence. Must contain a, t, c, and g."
input = gets.chomp
process_input(input)
end
# Hash of dna sequences and values.
# If input exists in hash, return value.
# Simplified version of calvin stephens (http://github.com/Calvin4) elevator program.
class Building
# Ask the user for the top floor of the building
def get_top_floor
puts "Please enter the top floor: "
@top_floor = gets.chomp!.to_i
end
# oil painting program
# painting process to be added later
# This Ruby program is a beginners attempt at using Ruby
# to make a alla prima oil painting program
# basic materials and tools to make an alla prima painting
class Painting