Skip to content

Instantly share code, notes, and snippets.

View raykrueger's full-sized avatar

Ray Krueger raykrueger

  • Chicago, IL, USA
View GitHub Profile
@raykrueger
raykrueger / migration.rb
Created January 12, 2011 20:21
Example of safely using ActiveRecord models within a migration.
class DoSomeVoodooWithSomeModel < ActiveRecord::Migration
#this model will be used, not the one in app/models
#The User class is really a DoSomeVoodooWithSomeModel::User, that's the magic really
class User < ActiveRecord::Base; end
def self.up
#whatever
User.find(:first_name => "Ray")
end
diff --git a/lib/outbound_message_extensions.rb b/lib/outbound_message_extensions.rb
index fb5c759..4b5c425 100644
--- a/lib/outbound_message_extensions.rb
+++ b/lib/outbound_message_extensions.rb
@@ -7,16 +7,25 @@ class OutboundMessage
# messages to unverified mobile numbers.
#
def self.create(attributes = {}, publish_options = {})
+ instance = nil
if attributes[:account_id].nil?
diff --git a/lib/queued_message.rb b/lib/queued_message.rb
index 83213e0..95eaa10 100644
--- a/lib/queued_message.rb
+++ b/lib/queued_message.rb
@@ -6,7 +6,7 @@ require 'mq'
class QueuedMessage
include ActiveSupport::Callbacks
- define_callbacks :after_initialize
+ define_callbacks :after_initialize, :after_publish
(in /Users/rkrueger/source/twitter)
All dependencies seem to be installed.
Loaded suite /Users/rkrueger/.rvm/gems/ree-1.8.6-20090610/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
.................................................................................................................................FFF....................
Finished in 0.843266 seconds.
1) Failure:
test: Getting daily trends should be able to exclude hastags. (TrendsTest)
[/Users/rkrueger/.rvm/gems/ree-1.8.6-20090610/gems/jnunemaker-matchy-0.4.0/lib/matchy/built_in/operator_expectations.rb:30:in `fail!'
(in /Users/rkrueger/source/twitter)
All dependencies seem to be installed.
Loaded suite /Users/rkrueger/.rvm/gems/ruby-1.9.1-p378/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
..............F..................................................................................................................FFF...FFFF.E...........
Finished in 0.754764 seconds.
1) Failure:
test: base hitting the api should be able to get retweets to me. (BaseTest) [/Users/rkrueger/.rvm/gems/ruby-1.9.1-p378/gems/jnunemaker-matchy-0.4.0/lib/matchy/built_in/operator_expectations.rb:20]:
Expected "Testing counts with voice apps too:\n\"the voice told residents to dial 'nine hundred eleven' rather than '9-1-1'\" — http://j.mp/7mqe2B" to == "Testing counts with voice apps too:\n\"the voice told residents to dial 'nine hundred eleven' rather than '9-1-1'\" \xE2\x80\x94 http://j.mp/7mqe2B".
#!/usr/bin/env ruby
require 'rubygems'
require 'net/http'
require 'json'
http = Net::HTTP.new('stream.twitter.com', 80)
get = Net::HTTP::Get.new("/1/statuses/filter.json?track=awesome")
get.basic_auth ARGV[0], ARGV[1]
#release configuration
#Mon Aug 10 11:11:27 CDT 2009
project.scm.com.googlecode\:hibernate-memcached.tag=HEAD
project.scm.com.googlecode\:hibernate-memcached.connection=scm\:git\:git@github.com\:raykrueger/hibernate-memcached.git
project.scm.com.googlecode\:hibernate-memcached.url=http\://github.com/raykrueger/hibernate-memcached/
scm.tag=hibernate-memcached-1.2.1
scm.url=scm\:git\:git@github.com\:raykrueger/hibernate-memcached.git
preparationGoals=clean verify
project.scm.com.googlecode\:hibernate-memcached.developerConnection=scm\:git\:git@github.com\:raykrueger/hibernate-memcached.git
remoteTagging=true
%d{yyyy-MM-dd HH:mm:ss,SSS z} |%.13X{sessionId} |%X{user} |%-5p |%c{1}: %m%n
if (cidrBlock != null) {
............
//eclipse told me to make this function static, so i did...is that the right thing to do?
sqlLabel = dao.getLabel(id, cidrBlock.getIpAddress(), cidrString);
//Above function throws data exception, will that also be caught by the generic Exception e clause below?
if (sqlLabel != null)
{
cidrElement.setAttribute("label", sqlLabel);
logger.debug("Label found:(" + sqlLabel + ")");
}
apt-get install ruby ruby1.8 ruby1.8-dev ri1.8 rdoc1.8 irb1.8 \
ruby1.8-elisp ruby1.8-examples libdbm-ruby1.8 libgdbm-ruby1.8 \
libtcltk-ruby1.8 libopenssl-ruby1.8 libreadline-ruby1.8 sqlite3 \
libsqlite3-ruby1.8
wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
tar xzf rubygems-1.3.1.tgz
cd rubygems-1.3.1
ruby setup.rb
ln -s /usr/bin/gem1.8 /usr/bin/gem