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
paypal_response = AdaptivePay::Callback.new(params) | |
if paypal_response.status == "COMPLETED" | |
@purchase.complete! | |
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
subject.location.should == "02108" | |
subject.location = "02108" | |
subject.location_changed?.should be_false | |
'User should not attempt to geocode location if location has not changed' FAILED | |
expected true to be false |
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
try { | |
PreparedStatement query = sqlite.prepare("REPLACE INTO homes(player_name, world, x, y, z) values(?, ?, ?, ?, ?)"); | |
query.setString(1, player.getDisplayName()); | |
query.setString(2, player.getWorld().getName()); | |
query.setDouble(3, location.getX()); | |
query.setDouble(4, location.getY()); | |
query.setDouble(5, location.getZ()); |
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
try { | |
PreparedStatement query = sqlite.prepare("SELECT * FROM homes where player_name = ?"); | |
query.setString(1, player.getDisplayName()); | |
ResultSet result = query.executeQuery(); | |
if (result.next()) { |
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 ActiveRecord | |
module AdvisoryLock | |
def obtain_advisory_lock(key, type = nil, &block) | |
raise ArgumentError, "Method expects a block" unless block_given? | |
obtain_lock(key, type) | |
begin | |
yield block |
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
def value=(value) | |
write_attribute(:value, value.gsub(/<your regexp>/, '')) | |
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
class UserPassword | |
include ActiveModel::Validations | |
include ActiveModel::Validations::Callbacks | |
include ActiveModel::Conversion | |
extend ActiveModel::Naming | |
extend ActiveModel::Translation | |
attr_accessor :email |
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
auth = Twitter::OAuth.new(TWITTER_TOKEN, TWITTER_SECRET) | |
auth.authorize_from_access(TWITTER_ACCESS_TOKEN, TWITTER_ACCESS_SECRET) | |
base = Twitter::Base.new(auth) | |
base.update("#{title} - #{url}") |
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
# TODO - add dependent option support | |
def delete_records(records) | |
case @reflection.through_reflection.options[:dependent] | |
when :destroy | |
records.each do |associate| | |
@reflection.through_reflection.klass.destroy_all(construct_join_attributes(associate)) | |
end | |
when :delete_all | |
@reflection.through_reflection.klass.delete(records.map { |record| record.id }) | |
else |
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
RSpec.configure do |config| | |
config.include Paperclip::Shoulda::Matchers | |
config.mock_with :mocha | |
config.use_transactional_fixtures = true | |
config.before(:all) do | |
geocode_payload = GeoKit::GeoLoc.new(:lat => 123.456, :lng => 123.456) | |
geocode_payload.success = true | |
GeoKit::Geocoders::MultiGeocoder.stubs(:geocode => nil) | |
end |
OlderNewer