Skip to content

Instantly share code, notes, and snippets.

View mathieuravaux's full-sized avatar

Mathieu Ravaux mathieuravaux

  • Paris
View GitHub Profile
diff --git a/array.c b/array.c
index b1616c5..16326fc 100644
--- a/array.c
+++ b/array.c
@@ -302,7 +302,7 @@ ary_alloc(VALUE klass)
return (VALUE)ary;
}
-static VALUE
+VALUE
require 'rake/clean'
HAML = FileList['**/*.haml']
LESS = FileList['**/*.less']
COFFEE = FileList['**/*.coffee']
HTML = HAML.ext('html')
CSS = LESS.ext('css')
JS = COFFEE.ext('js')
@mathieuravaux
mathieuravaux / gist:934033
Created April 21, 2011 09:09
Streaming the contents of an em-http-request in a Rails response
def stream
@path = request[:path]
puts "1) grabbing the output"
already_called = false
self.response_body = work_around_double_call_bug { |resp, output|
return if already_called
already_called = true
puts "3) output grabbed: #{output}. Requesting Drobpox..."
dropbox_session.stream @path do |em_http_req|

install cycript

brew install https://gist.github.com/raw/890258/cycript.rb

download the cycript hack

wget https://gist.github.com/raw/890258/hack_propane.js
chmod +x hack_propane.js

inject hack into running propane process

require('soda').createSauceClient({ 'username': 'username-string', 'access-key': 'access-key-string',
'url': 'http://example.saucelabs.com/', 'max-duration': 300,
'os': 'Windows 2003', 'browser': 'firefox', 'browser-version': '3.6',
'name': 'This is an example test' }).chain.session()
.open('/')
.getTitle(function(title){
require('assert').ok(~title.indexOf('Cross browser testing with Selenium - Sauce Labs'), 'Title did not include the query');
})
.testComplete()
.end(function(err){
@mathieuravaux
mathieuravaux / npm_edit_meets_bundle_open.sh
Created March 18, 2011 01:12
Fellow Noders - Rubyists, treat your muscle memory! `edit` will correctly use `bundle open` or `npm edit` whether `Gemfile.lock` or `package.json` are in the Git root.
function edit {
if [[ "$1" == "" ]]; then echo "usage: edit NAME (NAME is a bundled gem or npm package)"; return; fi
RES=$(git rev-parse --quiet --is-inside-work-tree 2>&1)
if [[ "$?" == "0" ]]; then
GIT_DIR=$(git rev-parse --show-toplevel)
if [[ -f "$GIT_DIR/package.json" ]]; then
npm edit $1
fi
if [[ -f "$GIT_DIR/Gemfile" ]]; then
bundle open $1
# app/views/rescues/_trace.erb
<%
traces = [
["Application Trace", @exception.application_backtrace],
["Framework Trace", @exception.framework_backtrace],
["Full Trace", @exception.clean_backtrace]
]
names = traces.collect {|name, trace| name}
%>
if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then
source "$HOME/.rvm/scripts/rvm"
rvm use 1.9.2 > /dev/null
fi
namespace :deploy do
PRODUCTION_APP = 'myapp'
STAGING_APP = 'myapp-staging'
def run(*cmd)
system(*cmd)
raise "Command #{cmd.inspect} failed!" unless $?.success?
end
def confirm(message)