Skip to content

Instantly share code, notes, and snippets.

@eric
eric / gist:718455
Created November 28, 2010 00:59 — forked from catlike/gist:718450
require 'rubygems'
require 'sinatra'
require 'lib/sms'
require 'thread'
SECONDS_PER_MESSAGE = 1.0
queue = Queue.new
consumer = Thread.new do
@eric
eric / boo.irc
Created November 22, 2010 23:38
# boo.irc
# written by prym
alias ooooMDOP {
if ([$3]) { QUOTE MODE $C -oooo $0 $1 $2 $3 ;}{
if ([$2]) { QUOTE MODE $C -booo *!*@* $0 $1 $2 ;}{
if ([$1]) { QUOTE MODE $C -boo *!*@* $0 $1 ;}{
if ([$0]) { QUOTE MODE $C -bo *!*@* $0 ;}
}
}
require 'closure-compiler'
task :copy do
IO.popen('pbcopy', 'w') do |io|
io << Closure::Compiler.new.compile(IO.popen("coffee -p *.coffee"))
end
end
window.printSource = (object, depth) ->
depth ?= 1
indent = new Array(depth + 1).join(' ')
entries = []
for all key, value of object
entries.push "\"#{key}\": #{value}"
if object.__proto__?
for all key, value of object.__proto__
entries.push "\"#{key}\": #{value}"
@eric
eric / gist:701636
Created November 16, 2010 09:49
ReaderJSController.originalArticleFinder()
/* ReaderJSController.originalArticleFinder(): */
{
"contentDocument": [object HTMLDocument],
"didSearchForArticleNode": true,
"article": [object Object],
"didSearchForPrependedArticleNode": true,
"prependedArticle": null,
"_cachedScrollY": 0,
"_cachedScrollX": 0,
"_elementsWithCachedBoundingRects": [object HTMLDivElement],
def connection
@connection ||= Faraday::Connection.new(:url => @uri.to_s) do |conn|
conn.use Faraday::Request::ActiveSupportJson
conn.adapter Faraday.default_adapter
conn.use Tinder::FaradayResponse::RaiseOnAuthenticationFailure
conn.use Faraday::Response::ActiveSupportJson
conn.use Tinder::FaradayResponse::WithIndifferentAccess
conn.headers['Content-Type'] = 'application/json'
conn.proxy ENV['HTTP_PROXY']
@eric
eric / gist:625913
Created October 14, 2010 09:03 — forked from rtomayko/gist:625807
This time bay-beee I'll beeeeeeEEEEEEEEEeeeee - BullehhhhhhhhhhhhhhhT PROOOF.
This time may-beee I'll beeeeeeeeeee... Bulleeeeeht proof.
#!/usr/bin/env ruby
require 'johnson'
require 'open-uri'
require 'yajl'
# Grab the source to the Javascript JSON implementation
json_js = open('http://www.json.org/json2.js').read
# Strip that silly alert at the top of the file
json_js.gsub!(/^(alert.*)$/, '/* \1 */')
#!/usr/bin/env ruby
require 'johnson'
require 'open-uri'
require 'yajl'
# Grab the source to the Javascript JSON implementation
json_js = open('http://www.json.org/json2.js').read
# Strip that silly alert at the top of the file
json_js.gsub!(/^(alert.*)$/, '/* \1 */')
$ rackup -p 8880 static.ru