Skip to content

Instantly share code, notes, and snippets.

View danhealy's full-sized avatar

Dan Healy danhealy

View GitHub Profile
@danhealy
danhealy / emmongo_spec_failures.txt
Created January 19, 2011 07:42
Current failing specs in em-mongo
ruby-1.9.2-p136@sandbox (git::master)@/sandbox/em-mongo/em-mongo [23:32:01] :( $ rvm gemset create emmongo
info: 'emmongo' gemset created (/Users/danhealy/.rvm/gems/ruby-1.9.2-p136@emmongo).
ruby-1.9.2-p136@sandbox (git::master)@/sandbox/em-mongo/em-mongo [23:32:11] :) $ rvm gemset use emmongo
info: Now using gemset 'emmongo'
bnruby-1.9.2-p136@emmongo (git::master)@/sandbox/em-mongo/em-mongo [23:32:16] :) $ bundle install
Fetching https://github.com/mloughran/em-spec.git
remote: Counting objects: 272, done.
remote: Compressing objects: 100% (153/153), done.
remote: Total 272 (delta 110), reused 260 (delta 103)
Receiving objects: 100% (272/272), 32.38 KiB, done.
@danhealy
danhealy / rvm_paths.txt
Created July 1, 2011 17:52
env | grep ^rvm
ruby-1.9.2-p180 @~ [10:27:37] :) $ env | grep ^rvm
rvm_gemsets_path=/Users/dan/.rvm/gemsets
rvm_scripts_path=/Users/dan/.rvm/scripts
rvm_bin_path=/Users/danbin
rvm_man_path=/Users/danshare/man
rvm_gemset_create_on_use_flag=1
rvm_user_path=/Users/dan/.rvm/user
rvm_wrappers_path=/Users/dan/.rvm/wrappers
rvm_patches_path=/Users/dan/.rvm/patches
rvm_docs_path=/Users/dan/.rvm/docs
@danhealy
danhealy / OpenFeintExtension.h
Created July 5, 2011 00:51
OpenFeint Rhodes Extension
// platform/iphone/OpenFeintExtension.h
#import "OpenFeint.h"
#import "OFAchievement.h"
#import "OFAchievementService.h"
ruby-1.9.2-p290@sandbox @/sandbox [11:58:10] :) $ ab -n 100 -c 1 http://goliath-demo.herokuapp.com/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking goliath-demo.herokuapp.com (be patient).....done
Server Software: PostRank
Server Hostname: goliath-demo.herokuapp.com
@danhealy
danhealy / Gemfile
Created December 31, 2011 23:26
Error with Goliath & BarrierAroundware
source :rubygems
gem "eventmachine", ">= 1.0.0.beta.3"
gem 'goliath', :git => 'git://github.com/postrank-labs/goliath.git'
gem 'em-synchrony', :git => 'git://github.com/igrigorik/em-synchrony.git'
@danhealy
danhealy / gist:7133303
Created October 24, 2013 08:29
Count duplicate lines in a git repo
#!/usr/bin/env ruby
class Array
def sum
inject(0.0) { |result, el| result + el }
end
def mean
sum / size
end
@danhealy
danhealy / gist:92c8b236c1c53a18c535
Last active May 22, 2018 18:20
Parallel DynamoDB Scan
batch_size = 100 # Items per request
parallel_requests = 4
total_items_to_request = 4000
iterations = (total_items_to_request / (parallel_requests * batch_size)) # => 10
parallel_requests.times do |seg|
Process.fork do
c = AWS::DynamoDB::Client.new(
:access_key_id => "...",
@danhealy
danhealy / gist:308e7d0b3906741cf50661a1f2d4a825
Last active October 6, 2016 06:11
rubymotion motion-game create sprite from image data
diff --git a/src/sprite.cpp b/src/sprite.cpp
index 450e5f4..f3320c8 100644
--- a/src/sprite.cpp
+++ b/src/sprite.cpp
@@ -54,6 +54,25 @@ sprite_new(VALUE rcv, SEL sel, VALUE name)
return rb_class_wrap_new((void *)sprite, rcv);
}
+/// @method #create_with_image(data, len)
+/// Creates a sprite from +data+ stream buffer image data and +len+ length
@danhealy
danhealy / genesis_public_key
Last active March 3, 2018 00:52
genesis_public_key
04714a3cc0a7adb56767f592a79c5c74b83e8ed6f4cf26831a5c5f0d07b54ac28d7fe519dd3350894abc4b29d57eb60a8b3609aac96e095ba384d556bfa7d22377;TheCrow1213
@danhealy
danhealy / average_array_remove_outliers.rb
Last active January 2, 2019 17:17
Average of an array, and removing outliers
# Initialize an array of 50 random integers. If you know ahead of time that the
# elements will be unique, use Set class instead for performance improvements
array = Array.new(50) do rand(100) end
# Ruby 2.4 and later has the Array#sum method which could also be implemented as
# a simple #inject call in earlier versions, it's also mixed in with Rails
avg = array.sum / array.length.to_f # to_f required for float precision
# Removing the min and max of the array by sorting. This particular method