Skip to content

Instantly share code, notes, and snippets.

View zeroeth's full-sized avatar
🤖
🐱 🤖 🐱 🤖

[0] zeroeth

🤖
🐱 🤖 🐱 🤖
View GitHub Profile
class Bicycle
attr_reader :gears, :wheels, :seats
def intialize(gears = 1)
@wheels = 2
@seats = 1
@gears = gears
end
end
#!/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
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
def count_frequency(word_list)
counts = Hash.new(0)
for word in word_list
counts[word] += 1
end
counts
end
source 'http://rubygems.org'
gem 'carmen'
gem 'carrierwave'
gem 'decent_exposure'
gem 'devise'
gem 'fabrication'
gem 'ffaker'
gem 'fog'
gem 'haml-rails'
# 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)
@zeroeth
zeroeth / ssh-background
Created October 4, 2011 18:47
Changes iTerm2's background color based on host configuration
#!/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
@zeroeth
zeroeth / canvas2Xscale.js
Created October 13, 2011 04:25 — forked from dariusk/canvas2Xscale.js
Artifact-free screen scaling for a canvas game, limited to 1X, 2X, 4X
// 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() {
@zeroeth
zeroeth / gist:1512565
Created December 23, 2011 00:51 — forked from ofan/gist:1508676
csdn passwords
('123456789', 235039)
('12345678', 212761)
('11111111', 76348)
('dearbook', 46053)
('00000000', 34953)
('123123123', 20010)
('1234567890', 17794)
('88888888', 15033)
('111111111', 6995)
('147258369', 5966)
@zeroeth
zeroeth / index.html
Created December 26, 2011 01:57 — forked from mbostock/.block
Arc Tween (Clock)
<!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;