Skip to content

Instantly share code, notes, and snippets.

View tanelsuurhans's full-sized avatar

Tanel Suurhans tanelsuurhans

  • ID.me
  • United States
View GitHub Profile
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
try {
PreparedStatement query = sqlite.prepare("SELECT * FROM homes where player_name = ?");
query.setString(1, player.getDisplayName());
ResultSet result = query.executeQuery();
if (result.next()) {
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());
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
paypal_response = AdaptivePay::Callback.new(params)
if paypal_response.status == "COMPLETED"
@purchase.complete!
end