Skip to content

Instantly share code, notes, and snippets.

View raykrueger's full-sized avatar

Ray Krueger raykrueger

  • Chicago, IL, USA
View GitHub Profile
(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".
(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!'
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
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?
@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
@raykrueger
raykrueger / passgen
Created May 5, 2011 15:59
Generating secure repeatable passwords with OpenSSL
#!/bin/bash
# see http://www.openssl.org/docs/apps/passwd.html
DOMAIN=$1
PEPPER=55e730a3
SALT=`echo ${PEPPER}${DOMAIN} | shasum | cut -c 1-8`
openssl passwd -1 -salt $SALT | cut -d '$' -f 4
if (!!navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
function(position) {
var lat = position.coords.latitude;
var lng = position.coords.longitude;
$.get('/locate?lat=' + lat + '&lng=' + lng, function(data){
$('#locations').html(data);
});
},
function(e) {
{ "_id" : ObjectId("4e15e72a4d56412e7f00bd17"),
"address" : "4647 Buttermilk Hollow Rd, West Mifflin, PA 15122-1101",
"loc" : [ 40.361421, -79.907644 ],
"owner_key" : "c79b0170896e012e7f2b00264a18267e",
"created_at" : ISODate("2011-07-07T17:04:42Z"),
"title" : "redbox at Foodland",
"updated_at" : ISODate("2011-07-13T17:54:04Z"),
"reference_id" : "31382"
}
@raykrueger
raykrueger / geolocation.js
Created October 5, 2011 15:01
Geolocation example
$(document).ready(function() {
if (!!navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
function(position) {
var lat = position.coords.latitude
var lng = position.coords.longitude
$.get('/locate' + '?lat=' + lat + '&lng=' + lng, function(data){
$('#locations').html(data);
$('.stripey li:even').addClass('alt');
});
require 'logger'
require 'openssl'
class UcellGateway
#dunno what this is, but it's yours :)
include MessageFilter
def initialize
@logger = Logger.new