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
❯❯❯ cat Makefile | |
COFFEE=node_modules/.bin/coffee | |
# ## Usage | |
usage : | |
@echo '' | |
@echo '---------------------------' | |
@echo '' | |
@echo 'Core tasks : Description' | |
@echo '-------------------- : -----------' |
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
Creating buffer of size 515000 | |
Done creating buffer, duration: 1 ms | |
Set cache key foobydoo with object of length 515000, duration: 19 milliseconds | |
Creating buffer of size 515100 | |
Done creating buffer, duration: 1 ms | |
Set cache key foobydoo with object of length 515100, duration: 13 milliseconds | |
Creating buffer of size 515200 | |
Done creating buffer, duration: 1 ms | |
Set cache key foobydoo with object of length 515200, duration: 9 milliseconds | |
Creating buffer of size 515300 |
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 'benchmark' | |
N = 100_000 | |
[3, 5, 10].each do |array_size| | |
terms = [] | |
arr2 = [] | |
array_size.times do |n| | |
terms << {:id => n, :name => "term#{n}", :version => 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
require 'csv' | |
users_by_id = {} | |
CSV.new(DATA, headers: true).each do |row| | |
user_id = row['user_id'].to_i | |
supervisor_id = row['supervisor_id'].to_i | |
is_supervisor = row['is_supervisor'] == 't' | |
existing_user = (users_by_id[user_id] ||= { user_name: row['user_name'], user_id: user_id}) | |
existing_user[:users] ||= [] if is_supervisor | |
supervisor = users_by_id[supervisor_id] |
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
GIT | |
remote: git://github.com/seifertd/sms-fu.git | |
revision: 2fe5e992109945f30099952d07b9041e18d303df | |
specs: | |
sms_fu (1.1.3) | |
GEM | |
remote: http://rubygems.org/ | |
specs: | |
actionmailer (3.2.7) |
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
[2012-09-08 14:46:18] DEBUG Celluloid: [RECV] Event: Newchannel | |
Privilege: call,all | |
Channel: SIP/telco-0000016c | |
ChannelState: 0 | |
ChannelStateDesc: Down | |
CallerIDNum: NNNNNNNNNN | |
CallerIDName: XXXXXXXXXX XXXX | |
AccountCode: | |
Exten: 4242016871 | |
Context: medready |
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
class Cave | |
WATER = '~' | |
ROCK = '#' | |
AIR = ' ' | |
attr_reader :grid, :flow_points | |
attr_accessor :water | |
# Create a Cave from the given file. | |
def initialize(filename) | |
# Keep track of points where water can flow either down or to the right |
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
# This module implements flatten and flatten! methods. It is expected that it | |
# be included in Array or a subclass of Array (strictly speaking, it expects the | |
# class it is included in to 1) have an each method, 2) respond to 'replace' taking an Array as a | |
# single argument, 3) can be constructed using an Array as a single argument and 4) can be compared | |
# to an Array using ==). | |
module Flatten | |
# When included in a class that already defines :flatten and :flatten!, | |
# alias them away and remove them so that the module methods below take | |
# precedence. |