Skip to content

Instantly share code, notes, and snippets.

@eric
eric / application_manifest.rb
Created June 26, 2010 00:05
fact-specific configuration for moonshine.yml
# Provide a :rails_env fact
Facter.add(:rails_env) do
setcode do
ENV["RAILS_ENV"] || 'production'
end
end
# Your application manifest
class ApplicationManifest < Moonshine::Manifest
# Let us use non-symbol keys in the moonshine.yml
module BundlerSupport
def bundler_dependencies(options = {})
root = options.delete(:root)
# WARNING: This is highly Bundler 0.9 -specific
YAML::load_file(File.join(root, 'Gemfile.lock'))['specs'].each do |spec|
gem_name = spec.keys.first
dependent_recipe = "#{gem_name.gsub(/-/, '_')}_gem_dependencies".to_sym
if method_defined?(dependent_recipe)
7/29/10 11:38:44 PM [0x0-0x8c08c].com.topfunky.PeepOpen[2672] Unknown option: `-l'
7/29/10 11:38:44 PM [0x0-0x8c08c].com.topfunky.PeepOpen[2672] Usage: tcsh [ -bcdefilmnqstvVxX ] [ argument ... ].
7/29/10 11:41:54 PM [0x0-0x8c08c].com.topfunky.PeepOpen[2672] Unknown option: `-l'
7/29/10 11:41:54 PM [0x0-0x8c08c].com.topfunky.PeepOpen[2672] Usage: tcsh [ -bcdefilmnqstvVxX ] [ argument ... ].
default {
execute 'SendDTMF', '1111', '100'
}
$ rackup -p 8880 static.ru
#!/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 */')
@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.
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: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],