Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require 'cgi'
require 'rubygems'
require 'hpricot'
require 'open-uri'
class SXSWPodcast
attr_reader :title, :description, :date, :link
#!/usr/bin/env ruby
require 'osx/cocoa'
include OSX
OSX.require_framework 'ScriptingBridge'
itunes = SBApplication.applicationWithBundleIdentifier( 'com.apple.itunes' )
itunes_window = itunes.windows.first
require 'rubygems'
require 'active_record'
class Salutations
attr_accessor :greeting, :farewell
def initialize(greeting, farewell)
@greeting = greeting
@farewell = farewell
end
def bang
raise
ensure
return
end
bang
puts "you wouldn't expect to get here"
# http://dnssd.rubyforge.org/dnssd/
# http://xmpp.org/extensions/xep-0174.html
# http://home.gna.org/xmpp4r/
require 'rubygems'
require 'dnssd'
require 'xmpp4r'
# An example of how to send messages to iChat with the bonjour chat protocol
# using ruby.
require 'thread'
require 'rubygems'
require 'net/irc'
# undo weirdness in the net/irc library, so that we get NoMethodError when we
# call a method that doesn't exist
class Net::IRC::Client
remove_method :method_missing if defined? method_missing
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>untitled</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
require "securerandom"
class RollingCounter
# :call-seq: RollingCounter.new(redis_client, max_window_seconds) -> counter
#
# Create a new counter instance, that will store/retrieve counts with
# +redis_client+ and return counts within the last +max_window_seconds+
# seconds.
#
@matsadler
matsadler / em-statsd-ruby.rb
Created May 29, 2012 16:14
EventMachine connectivity for the statsd-ruby client
require "eventmachine"
require "statsd" # statsd-ruby gem
module EventMachine
class Statsd < ::Statsd
class ConnectionWrapper
def initialize(em_connection)
@em_connection = em_connection
end
@matsadler
matsadler / Gemfile
Created June 18, 2012 16:34
ActiveRecord slowdown with Threads
source :rubygems
gem "activerecord", "3.1.4"
platforms :mri do
gem "mysql2"
end
platforms :jruby do
gem "activerecord-jdbcmysql-adapter"