Skip to content

Instantly share code, notes, and snippets.

View benlangfeld's full-sized avatar

Ben Langfeld benlangfeld

View GitHub Profile
require "uri"
require "yajl/http_stream"
require "terminal-notifier"
require "celluloid"
class Stream
include Celluloid
def initialize(room, token)
@room = room
{9:07}[ruby-1.9.3]~/Desktop ben% ruby super_module.rb
C
B2
B
A
{9:51}[ruby-1.9.3]~/code/VoIP/adhearsion/testapps/general ben% be ahn -
Starting Adhearsion server at /Users/ben/code/VoIP/adhearsion/testapps/general
[2012-03-20 09:52:00] WARN Adhearsion::LinuxProcName: Error while attaching libc function prctl: Function 'prctl' not found in [libc.dylib]
[2012-03-20 09:52:00] INFO Adhearsion::Initializer: Setting RAILS_ENV to "development"
[2012-03-20 09:52:01] INFO Adhearsion::PunchblockPlugin::Initializer: Starting connection to server
[2012-03-20 09:52:01] TRACE Punchblock::Connection::XMPP: USING JID: [email protected]/blmbp.home-28910
[2012-03-20 09:52:01] TRACE Punchblock::Connection::XMPP: SENDING: (/Users/ben/code/VoIP/adhearsion/testapps/general/vendor/ruby/1.9.1/gems/blather-0.7.0/lib/blather/stream/client.rb:21:in `start') <stream:stream to='127.0.0.1' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en' >
[2012-03-20 09:52:01] TRACE Punchblock::Connection::XMPP: RECEIVING (stream) <stream:stream xmlns:db="jabber:se
@benlangfeld
benlangfeld / foo.rb
Created February 3, 2012 12:00
I am struggling a little with using $stdin.gets within a Pry session. My use case is a console method presenting a list of numbered options, and then blocking on a choice (an integer) before resuming that method. I'm seeing this: https://gist.github.com/1
require 'pry'
def foo
gets
end
pry
@benlangfeld
benlangfeld / README.md
Created December 15, 2011 18:00
Rayo complete reason changes

It is proposed that the <success/> element, indicating that a component completed successfully, be replaced by a set of more descriptively named elements, such as <initial-timeout/>, <end-of-file/>, etc. These allow the client to correlate the actual completion reason with what are potentially a large set of possible triggers from the original command. For example, setting both max-time and interrupt-on on an Output results in an ambiguous <success/> reason. In the case of Input, <success/> will be renamed <match/>.

Further, it is concerning that node ordering is still being relied upon for disambiguating children of <complete/>. Currently, the Record component may submit a complete event like this:

<presence to='[email protected]/1' from='[email protected]/fgh4590'>
  <complete xmlns='urn:xmpp:rayo:ext:1'>
    <success xmlns='urn:xmpp:rayo:record:complete:1'/>
    <recording xmlns='urn:xmpp:rayo:record:complete:1' 
         uri="file:/tmp/rayo7451601434771683422.mp3"
<!-- Partial match -->
<presence to='[email protected]/1' from='[email protected]/fgh4590'>
<match mode="speech" confidence="0.45" xmlns='urn:xmpp:rayo:input:1'>
<interpretation>1234</interpretation>
<utterance>one two three four</utterance>
</match>
</presence>
<!-- Final match -->
<presence to='[email protected]/1' from='[email protected]/fgh4590'>
{11:03}[ruby-1.9.3]~/code/VoIP/adhearsion/core@develop✗✗✗ ben% doc/cloc-1.55.pl . --exclude-dir=.git,vendor,coverage
817 text files.
816 unique files.
8599 files ignored.
http://cloc.sourceforge.net v 1.55 T=7.0 s (18.7 files/s, 2592.9 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Ruby 130 1687 793 7406
class Foo
def foo(&block)
instance_eval &block
end
def bar(&block)
yield
end
end
class Foo
end
class Bar < Foo
end
new_controller = catch :controller_jump do
throw :controller_jump, Bar
end
methods_for :dialplan do
def baz
speak 'Baz'
end
end
foo {
menu do |link|
link.bar 1
link.baz 2