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
@jhsu
jhsu / gist:2292055
Created April 3, 2012 13:38 — forked from jrom/gist:1162348
Requeue failed resque jobs
(Resque::Failure.count-1).downto(0).each { |i| Resque::Failure.requeue(i) }
Resque::Failure.clear
@jhsu
jhsu / randomthumbs.rb
Created April 23, 2012 14:56 — forked from psobot/randomthumbs.rb
Random Image Thumbnailer
# Hacky random image thumbnailer.
# by Peter Sobot, April 21, 2012
# Based heavily on code by Michael Macias
# (https://gist.github.com/a54cd41137b678935c91)
require 'rmagick'
images = Dir.glob(ARGV[0] ? ARGV[0]
: '-default-input-paths-')
output_dir = (ARGV[1] ? ARGV[1]
@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 / 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
eventsource
go-eventsource
client/client
function* fib(a, b) {
let c = 0
yield a
yield b
while (true) {
c = a + b
a = b
b = c
yield c