Skip to content

Instantly share code, notes, and snippets.

/home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rails (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError)
from /home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1195:in `gem'
from /home/zeep/.rvm/gems/ruby-1.9.2-p290/bin/rails:18:in `<main>'
/home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rack (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError)
from /home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1195:in `gem'
from /home/zeep/.rvm/gems/ruby-1.9.2-p290/bin/rackup:18:in `<main>'
/usr/bin/env: ruby: No such file or directory
/home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rails (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError)
from /home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1195:in `gem'
from /home/zeep/.rvm/gems/ruby-1.9.2-p290/bin/rails:18:in `<main>'
/home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rack (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError)
from /home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1195:in `gem'
from /home/zeep/.rvm/gems/ruby-1.9.2-p290/bin/rackup:18:in `<main>'
/usr/bin/env: ruby: No such file or directory
@bjhaid
bjhaid / scary_craps.rb
Last active December 20, 2015 19:09 — forked from kaplan/scary_craps.rb
class Die
def roll
rand(1..6)
end
end
class Player
attr_writer :die1, :die2
def initialize
@dice_roll_from_first_turn = nil
Index:
1. should() #basic expectation
2. should_not() #basic negation of an expectation (RSpec does not support using !=)
3. include(item) #called on an enumerable object, this returns true or false if the object is found in the enumerable collection
4. respond_to(:message) #determines if a particular message (as a symbol) is defined for an object
5. raise_error(type, message) #checks if a particular error was raised, accepts zero, one or two parameters
@bjhaid
bjhaid / ported.rb
Last active December 23, 2015 19:39 — forked from askinss/ported.rb
require 'oci8'
f = File.open("/home/bblite/ported/portedmsisdn.txt")
conn = OCI8.new(DB_USER, DB_PASSWORD, DB_SERVER)
conn.autocommit = true
f.each_line do |msisdn|
#I think you would need to validate the MSISDN against a particular regular expression
next unless msisdn.match(/^233\d{9}/)
#replace the port with the SDP server port
`curl 127.0.0.1:8051/blackberry/smsservice?msisdn=#{msisdn.chomp}&msg=deactivate` #you need to deactivate the msisdn on Broker
@bjhaid
bjhaid / ema.rb
Last active December 23, 2015 23:19 — forked from askinss/ema.rb
require 'net/telnet'
def get_imsi(array_of_msisdns, &block)
ema = Net::Telnet::new("Host" => "#{HOST}",
"Port" => "#{PORT}",
"Timeout" => 10,
"Prompt" => /Enter command:/)
ema.cmd("LOGIN:#{USERNAME}:#{PASSWORD};")
ema.waitfor(/Enter command:/)
@bjhaid
bjhaid / sort.rb
Created November 20, 2013 04:46 — forked from aspyct/sort.rb
# Sample implementation of quicksort and mergesort in ruby
# Both algorithm sort in O(n * lg(n)) time
# Quicksort works inplace, where mergesort works in a new array
def quicksort(array, from=0, to=nil)
if to == nil
# Sort the whole array, by default
to = array.count - 1
end
def fib(n)
(0..n).inject([1,0]) { |(a,b), _| [b, a+b] }[0]
end
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')