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
public class IntArray { | |
final int DEFAULT_SIZE = 10; | |
int[] _int_array; | |
public IntArray() { | |
_int_array = new int[DEFAULT_SIZE]; | |
} | |
public IntArray(int size) { |
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
<-> @test_herml_htmlizer:emit_tuple() | |
{ok, admin} -> | |
#admin | |
.name | |
Admin | |
{error, none} -> | |
#error | |
You are not an admin. | |
{ok, _} -> | |
#other |
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
# Publishes a set of pages, allows eventmachine/amqp to send them | |
# then restarts the process with another set of pages. | |
modulus = calc_modulus(number_of_pages) | |
number_of_pages.paged_collect(modulus).each_value do |pages| | |
AMQP.start do | |
pages.each do |page| | |
lclients = Legacy::Client.all(:limit => 100, :offset => page*100) | |
topic = MQ.new.topic('conversion') | |
lclients.map do |lclient| |
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 | |
# Core | |
require 'date' | |
# Gems | |
require 'rubygems' | |
require 'mq' | |
# Helper |
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' | |
require 'mq' | |
require 'benchmark' | |
class Integer | |
def paged_collect(mod) | |
acc = Hash.new | |
self.times do |num| | |
index = num % mod | |
acc[index] = Array.new unless acc[index] |