Skip to content

Instantly share code, notes, and snippets.

View jhsu's full-sized avatar
💀
compliant with future standards

Joe Hsu jhsu

💀
compliant with future standards
  • MineHub
  • New York, NY
  • X @jhsu
View GitHub Profile
commit c46b0fd17d59e1d8c0d303fb8d614dcdf6d4fe6a
Author: Joseph Hsu <[email protected]>
Date: Wed Aug 22 21:45:55 2012 -0400
move fake ActiveRecord::Relation to helper, use #kind_of instead of comparing to string
diff --git a/lib/draper/base.rb b/lib/draper/base.rb
index 1d16459..47937f0 100755
--- a/lib/draper/base.rb
+++ b/lib/draper/base.rb
@jhsu
jhsu / mpd.rb
Created September 12, 2012 13:22
require 'formula'
class Mpd < Formula
homepage 'http://mpd.wikia.com'
url 'http://sourceforge.net/projects/musicpd/files/mpd/0.17/mpd-0.17.tar.bz2'
sha1 '36201f32ca5729b62b0e6cbddb19ade20ee3f7d7'
head "git://git.musicpd.org/master/mpd.git"
option "lastfm", "Compile with experimental support for Last.fm radio"
@jhsu
jhsu / stickyhead.markdown
Created August 30, 2012 18:41
Stickyhead - MVP draft 1

StickyHead

Background

Step 1: Describe your startup idea in 2-3 sentences

StickyHead - A game where the names of famous people were written down on cards, shuffled and picked. A person is not allowed to see their own card, places the card face out on their forehead and must ask yes/no questions to try and figure out who they are.

The Problem

@jhsu
jhsu / rb_array_iterate.rb
Created August 3, 2012 04:47 — forked from ephekt/rb_array_iterate.rb
array iteration problem
def add1(arr, val, n)
# how many times are we going to increment
increment_count = n == 0 ? arr.length : n.abs
# are we going up or down the array
indices = n < 0 ? (-1..-arr.length) : (0...arr.length)
# iterate and update the array in place
indices.each do |index|
arr[index] = arr[index] + 1 if val == arr[index]
break if (increment_count -= 1) == 0
@jhsu
jhsu / .rvmrc
Created July 19, 2012 02:07 — forked from anonymous/.rvmrc
Ruby for rails MRI 1.9.2+
# via http://www.reddit.com/r/ruby/comments/wgtqj/how_i_spend_my_time_building_rails_apps/c5daer4
export RUBY_HEAP_MIN_SLOTS=800000
export RUBY_HEAP_FREE_MIN=100000
export RUBY_HEAP_SLOTS_INCREMENT=300000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=79000000
@jhsu
jhsu / testers.sh
Created July 13, 2012 15:51
Who has been writing tests
#!/usr/bin/env bash
for f in $(ack 'it ' 'test/unit/' | awk '{print $1}') ; do
file=$(echo $f | awk -F: '{print $1}')
line=$(echo $f | awk -F: '{print $2}')
command="git blame -c $file -L$line,$line"
$command | cut -f 2 | sed 's/(//g'
done | sort -bf | uniq -ic
#!/usr/bin/env bash
$EDITOR $(git status --short | awk '$1 ~ /^M$/ {print $2}')
#!/usr/bin/env bash
$EDITOR $(git status --short | awk '$1 ~ /^M$/ {print $2}')