Skip to content

Instantly share code, notes, and snippets.

Jordan Ritter jpr5

Block or report user

Report or block jpr5

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jpr5
jpr5 / b00m.rb
Created Dec 11, 2012
Nuke HipChat 1:1 History
View b00m.rb
require 'rubygems'
require 'mechanize'
account = {
:email => "jpr5@serv.io",
:password => "balls",
}
agent = Mechanize.new
site = agent.post("https://www.hipchat.com/sign_in", account).uri.host
@jpr5
jpr5 / bug.rb
Created Oct 16, 2012
Demo and workaround for post-connection delay bug in EventMachine 1.0.0
View bug.rb
#!/usr/bin/env ruby
#
# Demo and workaround for post-connection delay bug in EventMachine 1.0.0
#
# See https://github.com/eventmachine/eventmachine/issues/374 for explanation.
require 'rubygems'
require 'eventmachine' # 1.0.0
require 'amqp' # 0.8.0 / 54f18d426
@jpr5
jpr5 / bot.rb
Created Apr 26, 2011
XMPP/Ruby Bot for HipChat
View bot.rb
#!/usr/bin/env ruby
#
# Script: HipChat bot in Ruby
# Author: Jordan Ritter <jpr5@darkridge.com>
#
unless `rvm-prompt i g`.chomp == "ree@xmpp"
exec("rvm ree@xmpp ruby #{$0}")
end
@jpr5
jpr5 / 1_script.rb
Created Feb 25, 2011
DM: lazy-loaded properties materialized in hooks (:save) reset parental reference updates for children
View 1_script.rb
#!/usr/bin/ruby
require 'rubygems'
require 'data_objects' # current master @ ed1ceefc
require 'dm-core' # current master @ 73860575
require 'dm-migrations' # current master @ ab608e81
class Order
include ::DataMapper::Resource
@jpr5
jpr5 / 1_bar.rb
Created Feb 9, 2011
bad bug in DM/DO nested transactions (FIXED in 03ae081f28a6143478e2174ccf3bd233e82cb91b)
View 1_bar.rb
#!/usr/bin/ruby
[
'addressable.git', 'extlib.git',
'do.git/data_objects', 'do.git/do_mysql',
'dm-core.git', 'dm-migrations.git', 'dm-transactions.git', 'dm-do-adapter.git', 'dm-mysql-adapter-1.0.0',
].each do |path|
$:.unshift "common/gems/#{path}/lib"
end
@jpr5
jpr5 / 1_no_workie.rb
Created Jan 17, 2011
[ruby 1.8.7] nested namespaces need physical nesting for const_missing? to work
View 1_no_workie.rb
#!/usr/bin/ruby
class Balls
BALLS = 1
end
class Balls::Dongs
def doit
puts "balls = #{BALLS}"
end
@jpr5
jpr5 / 1_example.rb
Created Jan 5, 2011
DM example of M:M through join table using two relationships.
View 1_example.rb
class DocumentSet
include ::DataMapper::Resource
property :id, Serial
# First, define the immediate (intermediate) relationship.
has n, :document_maps, :child_key => [:ds_id]
# Then make another relationship that bounces through that relationship
# (:through), arriving at model Document.
@jpr5
jpr5 / 1_notes.txt
Created Dec 17, 2010
Nested-Transactional Cukes in DataMapper
View 1_notes.txt
Depends on:
- https://github.com/datamapper/do/commit/74645c46ac9b210c5e4029853b8a23fe02defd71
- https://github.com/datamapper/dm-transactions/commit/242e60473a341a151df62ea707264f06f418b077
@jpr5
jpr5 / 1_sample_database.yml
Created Nov 22, 2010
example of how you'd specify multiple repos in a database.yml for DataMapper
View 1_sample_database.yml
development:
repositories:
default: &balls_defaults
adapter: mysql
host: localhost
database: balls
username: root
password: ""
dongs: &dongs_defaults
adapter: mysql
@jpr5
jpr5 / DefaultKeyBinding.dict
Created Oct 14, 2010
My OSX system-wide keybinding overrides (readline/emacs bindings)
View DefaultKeyBinding.dict
{
"~f" = "moveWordForward:";
"~b" = "moveWordBackward:";
"~<" = "moveToBeginningOfDocument:";
"~>" = "moveToEndOfDocument:";
"~v" = "pageUp:";
"^v" = "pageDown:";
"~d" = "deleteWordForward:";
"~^h" = "deleteWordBackward:";
"~\Uf728" = "deleteWordForward:";
You can’t perform that action at this time.