This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bicycle | |
attr_reader :gears, :wheels, :seats | |
def intialize(gears = 1) | |
@wheels = 2 | |
@seats = 1 | |
@gears = gears | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# inkscape -b '#ffffff' -e circles.png -w 3000 circles.svg | |
# gem install color-tools | |
require 'color' | |
# http://code.google.com/p/chipmunk-physics/ | |
# svn checkout http://chipmunk-physics.googlecode.com/svn/trunk/ chipmunk-physics-read-only | |
# cmake -D BUILD_RUBY_EXT=ON . | |
# make && sudo make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' rescue nil | |
require 'gosu' | |
require 'chipmunk' | |
class Array | |
# e.g. [1,2,3].each_link yields [1,2], [2,3] | |
def each_link | |
prev = first | |
self[1, size].each do |item| | |
yield prev, item |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def count_frequency(word_list) | |
counts = Hash.new(0) | |
for word in word_list | |
counts[word] += 1 | |
end | |
counts | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'http://rubygems.org' | |
gem 'carmen' | |
gem 'carrierwave' | |
gem 'decent_exposure' | |
gem 'devise' | |
gem 'fabrication' | |
gem 'ffaker' | |
gem 'fog' | |
gem 'haml-rails' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Paperclip compliant class for uploading files through URL | |
# Simplified version of http://github.com/chris/paperclip_url_support | |
require "open-uri" | |
module Paperclip | |
class UrlTempfile < Tempfile | |
attr :content_type | |
def initialize(url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Installation: | |
# 1. Save this script to /some/bin/ssh-background | |
# 2. chmod 755 /some/bin/ssh-background | |
# 3. alias ssh=/some/bin/ssh-background | |
# 4. Configure your host colors below. | |
set_color() { | |
local HEX_FG=$1 | |
local HEX_BG=$2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adapted from Zachary Johnson's Commander Clone 0.2 screen scaling example http://www.zachstronaut.com/projects/commander-clone/0.2/game.html | |
// Modified to strictly choose 1X or 2X or 4X scaling as appopriate, so we don't end up with screwed up scaling artifacts. | |
// NOTE: uses jQuery for the DOM load event | |
$(function () { | |
fullScreenify(); | |
window.addEventListener('resize', fullScreenify, false); | |
function fullScreenify() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
('123456789', 235039) | |
('12345678', 212761) | |
('11111111', 76348) | |
('dearbook', 46053) | |
('00000000', 34953) | |
('123123123', 20010) | |
('1234567890', 17794) | |
('88888888', 15033) | |
('111111111', 6995) | |
('147258369', 5966) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.27.2"></script> | |
<style type="text/css"> | |
path { | |
fill-rule: evenodd; | |
fill: #aaa; | |
fill-opacity: .7; |
OlderNewer