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
(Resque::Failure.count-1).downto(0).each { |i| Resque::Failure.requeue(i) } | |
Resque::Failure.clear |
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
# 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] |
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
# 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 |
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 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 |
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
eventsource | |
go-eventsource | |
client/client |
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
function* fib(a, b) { | |
let c = 0 | |
yield a | |
yield b | |
while (true) { | |
c = a + b | |
a = b | |
b = c | |
yield c |
OlderNewer