Skip to content

Instantly share code, notes, and snippets.

View benlangfeld's full-sized avatar

Ben Langfeld benlangfeld

View GitHub Profile
diff --git a/lib/blather/client/client.rb b/lib/blather/client/client.rb
index 6c7fe4e..9e8350b 100644
--- a/lib/blather/client/client.rb
+++ b/lib/blather/client/client.rb
@@ -184,11 +184,7 @@ module Blather
# @private
def receive_data(stanza)
- if handler_queue
- handler_queue << stanza
def music_on_hold
output = play! "/path/to/music.wav", :repeat_times => 0
hid = call.on_joined do
output.stop! if output.executing?
end
begin
yield.tap do
output.stop! if output.executing?
require 'formula'
class Iksemel < Formula
homepage 'http://code.google.com/p/iksemel/'
url 'https://iksemel.googlecode.com/files/iksemel-1.4.tar.gz'
version '1.4'
depends_on 'gnutls'
def install
require "uri"
require "yajl/http_stream"
require "terminal-notifier"
require "celluloid"
class Stream
include Celluloid
def initialize(room, token)
@room = room
@benlangfeld
benlangfeld / fizzbuzz.rb
Created September 3, 2011 09:01 — forked from 3en/fizzbuzz.rb
FizzBuzz
# http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html
# Write a program that prints the numbers from 1 to 100.
# But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz".
# For numbers which are multiples of both three and five print "FizzBuzz".
(1..100).each do |i|
res = if i % 3 == 0 && i % 5 == 0
"FizzBuzz"
$LOAD_PATH.unshift(File.dirname(__FILE__))
%w(cgi socket routing/helpers routing/config routing/romeo routing/inbound routing/token).each { |lib| require lib }
module Foo
def self.test
puts "test"
end
end
Foo.test
!!!
%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"}/
$("#edit_topics_link").text(<%= (@video.topics.count == 0) ? 'Add descriptive topics so people can find your song!' : 'Edit Topics' %>);
def self.get_breaking_news(min)
doc = Hpricot.XML open("http://bensbargains.net/rss.xml/")
cutoff_time = Time.now - 60 * min
(doc/"item").map do |item|
profit_margin = (temp_deal.cost_retail.nil? || temp_deal.cost.nil?) ? nil : temp_deal.cost_retail - temp_deal.cost
Deal.new :name => (item/"title").inner_html, :description => (item/"description").inner_text + (item/"link").inner_html, :guid => (item/"guid").inner_html, :cost => get_price(temp_deal.name), :cost_retail => get_price_retail(temp_deal.description), :profit_margin => profit_margin, :source => "bensbargains"
end
end