Skip to content

Instantly share code, notes, and snippets.

View benlangfeld's full-sized avatar

Ben Langfeld benlangfeld

View GitHub Profile
t = Time.now
[1,2,3].each do |n|
puts "Working on #{n}"
t_answer = false
while true
if ((Time.now - t) > 10)
puts "10 seconds elapsed"
t_answer = true
break
end
!!!
%html{:xmlns => "http://www.w3.org/1999/xhtml"}
%head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title #{@title}/
%link{:href => "css/style.css", :media => "screen", :rel => "stylesheet", :type => "text/css"}/
%link{:href => "css/contentlayout.css", :media => "screen", :rel => "stylesheet", :type => "text/css"}/
%link{:href => "css/voice.css", :media => "screen", :rel => "stylesheet", :type => "text/css"}/
%link{:href => "css/home.css", :rel => "stylesheet", :type => "text/css"}/
%script{:src => "js/application.js", :type => "text/javascript"}/
!!!
%html{:xmlns => "http://www.w3.org/1999/xhtml"}
%head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title #{@title}/
%link{:href => "css/style.css", :media => "screen", :rel => "stylesheet", :type => "text/css"}/
%link{:href => "css/contentlayout.css", :media => "screen", :rel => "stylesheet", :type => "text/css"}/
%link{:href => "css/voice.css", :media => "screen", :rel => "stylesheet", :type => "text/css"}/
%link{:href => "css/home.css", :rel => "stylesheet", :type => "text/css"}/
%script{:src => "js/application.js", :type => "text/javascript"}/
Factory.sequence :email do |n|
"user#{n}@example.com"
end
Factory.define :user do |u|
u.email { Factory.next :email }
u.password 'eeoo1100'
u.password_confirmation { |u| u.password }
u.phone_number '4158489676'
u.available true
$("#edit_topics_link").text(<%= (@video.topics.count == 0) ? 'Add descriptive topics so people can find your song!' : 'Edit Topics' %>);
Feature: Blah blah
As a random callee
In order to do somethng
I want to be able to talk to robots
Scenario: Choosing some options
Given I start a call
Then I should hear "Press 1 for the marketing department"
And I should hear "Press 2 for the art department"
class Loader
class << self
attr_accessor :default_dial_plan_file_name
def load(dial_plan_as_string)
string_io = StringIO.new dial_plan_as_string
def string_io.path
"(eval)"
end
load_dialplans string_io
from_pstn {
menu 'welcome', 'for-spanish-press-8', 'main-ivr',
:timeout => 8.seconds, :tries => 3 do |link|
link.shipment_status 1
link.ordering 2
link.representative 4
link.spanish 8
link.employee 900..999
link.on_invalid { play 'invalid' }
#!/usr/bin/env ruby
# encoding: UTF-8
#require 'rubygems'
require 'csv'
#require 'yaml'
#require 'ya2yaml' # this is to use proper UTF8
require 'twitter'
#require 'digest/md5'
ERROR agi: TypeError: can't convert Symbol into String
ERROR agi: /home/ben/.rvm/gems/ruby-1.9.2-p180/gems/adhearsion-1.0.1/lib/adhearsion/voip/asterisk/commands.rb:959:in `delete'
/home/ben/.rvm/gems/ruby-1.9.2-p180/gems/adhearsion-1.0.1/lib/adhearsion/voip/asterisk/commands.rb:959:in `play_time'
/home/ben/.rvm/gems/ruby-1.9.2-p180/gems/adhearsion-1.0.1/lib/adhearsion/voip/asterisk/commands.rb:200:in `block in play'
/home/ben/.rvm/gems/ruby-1.9.2-p180/gems/adhearsion-1.0.1/lib/adhearsion/voip/asterisk/commands.rb:199:in `each'
/home/ben/.rvm/gems/ruby-1.9.2-p180/gems/adhearsion-1.0.1/lib/adhearsion/voip/asterisk/commands.rb:199:in `play'
/home/ben/My-PBX/components/simon_game/simon_game.rb:45:in `verify_attempt'
/home/ben/My-PBX/components/simon_game/simon_game.rb:18:in `block in start'
/home/ben/My-PBX/components/simon_game/simon_game.rb:15:in `loop'
/home/ben/My-PBX/components/simon_game/simon_game.rb:15:in `start'