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
module Mustache | |
class << self | |
import com.github.mustachejava.DefaultMustacheFactory | |
import com.github.mustachejava.jruby.JRubyObjectHandler | |
def template_dir | |
Rails.root.join('app', 'templates') | |
end | |
def factory |
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 'faker' | |
require 'factory_girl' | |
require 'test/factories' | |
require 'message' | |
Message.collection.drop | |
Message.create_indexes | |
Contact.collection.drop | |
Contact.create_indexes |
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
start_time = Time.utc(2011, 07, 04, 12, 18) | |
mps = MessagePart.where(:timestamp.gt => start_time).collect do |mp| | |
account_msisdn = Subscriber.find(mp.subscriber_id).account.msisdn | |
attributes = mp.attributes.slice("content", "total_parts", "message_id", "part", "contact_msisdn", "sent") | |
%{ | |
MessagePart.create!(#{attributes.inspect}.merge( | |
:subscriber_id => Account.find_by_msisdn(#{account_msisdn.inspect}).subscriber.id, | |
:timestamp => Time.parse(#{mp.timestamp.to_s.inspect}) | |
)) |
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
if [[ -a Gemfile ]]; then | |
bundle exec rake $* | |
else | |
command rake $* | |
fi |
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 Event < Node | |
end |
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
module Mongo | |
module Instrumentation | |
def self.instrument(clazz, *methods) | |
clazz.module_eval do | |
methods.each do |m| | |
class_eval %{def #{m}_with_instrumentation(*args, &block) | |
ActiveSupport::Notifications.instrumenter.instrument "mongo.mongo", :name => "#{m}" do | |
#{m}_without_instrumentation(*args, &block) | |
end | |
end |
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
module Mongoid | |
class LogSubscriber < ActiveSupport::LogSubscriber | |
def self.runtime=(value) | |
Thread.current["mongoid_mongo_runtime"] = value | |
end | |
def self.runtime | |
Thread.current["mongoid_mongo_runtime"] ||= 0 | |
end |
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
context "when logged in" do | |
setup do | |
@account = Factory(:provisioned_account) | |
sign_in @account | |
end | |
context "GET index" do | |
setup do | |
@messages = 5.times.map { message(:subscriber => @account.subscriber, :favourite => true) } | |
end |
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
module UserHelper | |
attr_accessor :current_user | |
class Credentials < Struct.new(:email, :password) | |
def self.parse(arg) | |
return arg if arg.is_a?(Credentials) | |
new(arg) | |
end | |
def initialize(credentials) |
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
Hi Sean, | |
It's been more than 7 years since I last looked for a Java job. I'm not interested any positions you have now, and won't be at any time in the future. I've moved on. | |
When I get these emails from you, it's a painful reminder of the life I once led; a life I am trying to forget. Please please please remove me from your mailing list. |
NewerOlder