This file contains hidden or 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
cloudips-create.rb | |
6: c.flag [:i, "count"] | |
9: c.flag [:n, :name] | |
12: c.flag [:t, :'port-translators'] | |
cloudips-update.rb | |
6: c.flag [:r, "reverse-dns"] | |
12: c.flag [:n, :name] | |
15: c.flag [:t, :'port-translators'] |
This file contains hidden or 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
loop do | |
begin | |
puts "Whoa" | |
sleep(2) | |
rescue Exception => e | |
puts "wtf" | |
end | |
end |
This file contains hidden or 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
#WARNING do not load this file in environments other than test | |
module AfterCommitPatch | |
def transaction(options = {}) | |
rolled_back = false | |
return_value = nil | |
begin | |
return_value = super | |
rescue ActiveRecord::Rollback => e | |
puts e.message | |
puts e.backtrace |
This file contains hidden or 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
<!-- | |
Licensed to the Apache Software Foundation (ASF) under one or more | |
contributor license agreements. See the NOTICE file distributed with | |
this work for additional information regarding copyright ownership. | |
The ASF licenses this file to You under the Apache License, Version 2.0 | |
(the "License"); you may not use this file except in compliance with | |
the License. You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
This file contains hidden or 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
#!/usr/bin/env bash | |
apt-add-repository -y ppa:brightbox/ruby-ng | |
apt-get -y update | |
apt-get -y install build-essential | |
apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev | |
apt-get -y install ruby1.9.3 ruby-switch | |
ruby-switch --set ruby1.9.1 | |
gem install chef ruby-shadow --no-ri --no-rdoc |
This file contains hidden or 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 User < ActiveRecord::Base | |
attr_accessible :email, :first_name, :last_name, :username | |
before_validation :lol, :on => :create | |
before_validation :yay, :on => :create | |
before_validation :yay, :on => :update | |
def lol | |
puts "Running lol" | |
end |
This file contains hidden or 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 Leaky | |
def wow | |
locations = [1,2,3] | |
locs = Hash.new(0) | |
locations.each do |x| | |
number = 10 | |
p number | |
end | |
p number | |
end |
This file contains hidden or 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
#!c:\ruby\bin\rubyw.exe | |
require 'mpgapi4r.rb' #path to mpgapi4r.rb | |
p = ReqMod::Purchase.new | |
p.order_id = "prodtest2" | |
p.cust_id = "test" | |
p.amount = "0.00" | |
p.crypt_type = "7" | |
p.pan = "4514011602554956" |
This file contains hidden or 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 Object | |
def should_chain_receive(*args,&block) | |
if block_given? | |
ChainReceive.new(self,args,block) | |
else | |
ChainReceive.new(self,args) | |
end | |
end | |
end |
This file contains hidden or 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 Object | |
def should_chain_receive(*args,&block) | |
current_object = self | |
args[0..-2].each do |argument| | |
temp = Object.new() | |
current_object.should_receive(argument).and_return(temp) | |
current_object = temp | |
end | |
result = yield | |
current_object.should_receive(args.last).and_return result |