Skip to content

Instantly share code, notes, and snippets.

View benlangfeld's full-sized avatar

Ben Langfeld benlangfeld

View GitHub Profile
def play!(*arguments)
play *arguments || raise Adhearsion::PlaybackError, "One of the passed outputs is invalid"
end
def play(*arguments)
result = true
arguments.each do |argument|
if argument.is_a? Hash
value = argument.delete(:value)
result = play_ssml_for(value, argument)
elsif argument.is_a? RubySpeech::SSML::Speak
result = play_ssml argument
else
result = play_ssml_for(argument)
[root@smh3 ~]# /etc/init.d/dahdi start
Loading DAHDI hardware modules:
FATAL: Module dahdi not found.
wct4xxp: FATAL: Module wct4xxp not found.
[FAILED]
wcte12xp: FATAL: Module wcte12xp not found.
[FAILED]
wct1xxp: FATAL: Module wct1xxp not found.
[FAILED]
wcte11xp: FATAL: Module wcte11xp not found.
Index: res/res_agi.c
===================================================================
--- res/res_agi.c (revision 344329)
+++ res/res_agi.c (working copy)
@@ -3373,16 +3373,17 @@
agi_command *c;
const char *ami_res;
char *ami_cmd = ast_strdupa(buf);
- int command_id = ast_random();
int resultcode;
D, [2011-11-10T12:30:11.175564 #8948] DEBUG -- : [SEND]: Action: agi
ActionID: 2cb94ed1-2852-4931-be6d-d98ad668bc98
Channel: SIP/1234-00000029
Command: ANSWER
CommandID: fb147480-b732-4556-a1cb-49be4a5b359f
[RECV-ACTIONS]: #<RubyAMI::Response @headers={"ActionID"=>"2cb94ed1-2852-4931-be6d-d98ad668bc98", "Message"=>"Added AGI command to queue"}>
[RECV-EVENTS]: #<RubyAMI::Event @headers={"SubEvent"=>"Start", "Channel"=>"SIP/1234-00000029", "CommandId"=>"1351651434", "Command"=>"ANSWER"}, @name="AGIExec">
[RECV-EVENTS]: #<RubyAMI::Event @headers={"SubEvent"=>"End", "Channel"=>"SIP/1234-00000029", "CommandId"=>"1351651434", "Command"=>"ANSWER", "ResultCode"=>"200", "Result"=>"Success"}, @name="AGIExec">
[RECV-EVENTS]: #<RubyAMI::Event @headers={"SubEvent"=>"Exec", "Channel"=>"SIP/1234-00000029", "CommandID"=>"fb147480-b732-4556-a1cb-49be4a5b359f", "Result"=>"200%20result%3D0%0A"}, @name="AsyncAGI">
#!/usr/bin/bash
unset SUN_PERSONALITY
export LC_CTYPE=en_US.utf-8
export JRUBY_OPTS="--1.9"
source /etc/profile.d/rvm.sh
rvm use $RUBY
bundle install --no-deployment
SKIP_RCOV=true bundle exec rake spec
SINGLE_ROLL_MULTIPLIERS = [0, 100, 0, 0, 0, 50, 0]
def score(dice)
score = 0
(1..6).each do |number|
roll_count = dice.count { |dice| dice == number }
if roll_count >= 3
score += number == 1 ? 1000 : 100 * number
roll_count -= 3
java.lang.NullPointerException: null
com/rubyeventmachine/EmReactor.java:433:in `sendData'
com/rubyeventmachine/EmReactor.java:437:in `sendData'
/Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/eventmachine-0.12.10-java/lib/jeventmachine.rb:117:in `send_data'
/Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/eventmachine-0.12.10-java/lib/em/connection.rb:222:in `send_data'
/Users/ben/code/VoIP/adhearsion/ruby_ami/lib/ruby_ami/stream.rb:32:in `send_action'
/Users/ben/code/VoIP/adhearsion/ruby_ami/lib/ruby_ami/client.rb:63:in `_send_action'
/Users/ben/code/VoIP/adhearsion/ruby_ami/lib/ruby_ami/client.rb:14:in `initialize'
require 'nokogiri'
class MyNode < Nokogiri::XML::Node
def self.new(*args)
super
end
end
class MyNode2 < Nokogiri::XML::Node
def initialize(*args)
@benlangfeld
benlangfeld / fails.rb
Created November 2, 2011 14:21
JRuby super fail
require 'nokogiri'
class MyNode < Nokogiri::XML::Node
def self.new(name, doc)
super(name, doc)
end
end
describe MyNode do
it 'should be the same as Nokogiri' do