Skip to content

Instantly share code, notes, and snippets.

View mathieuravaux's full-sized avatar

Mathieu Ravaux mathieuravaux

  • Paris
View GitHub Profile
@ku
ku / snssupportbot.rb
Created June 8, 2011 17:57
rubycocoa skypebot sample
#!/usr/bin/ruby
require 'rubygems'
require 'osx/cocoa'
require 'nokogiri'
require 'open-uri'
require 'nkf'
require 'pp'
OSX.require_framework 'Skype'
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')
@mrflip
mrflip / RUNME-demo_of_async_fibers.log
Created April 25, 2011 20:57
A fully-commented demo showing execution flow in the fibers+eventmachine => linear asynchronous code pattern
>> load './RUNME-demo_of_async_fibers.rb'
/Users/flip/ics/backend/son_of_a_batch/RUNME-demo_of_async_fibers.rb:4: warning: already initialized constant FIBER_IDXS
814e5e90 0 f_0 beg main top level
814e5e90 1 f_0 beg em setup this block sets up the eventmachine execution, but no execution-order shenanigans yet
814e5e90 2 f_0 beg fiber stp the end-the-reactor block won't be called for 1.5s, so we get here immediately.
814e5e90 3 f_0 end fiber stp nothing from inside the Fiber.new{} block has run yet.
814e5e90 4 f_0 end fiber stp kick off the fiber...
80d829a0 5 f_1 beg fiber when my_fiber.resume is called, this runs. Now in a new fiber
80d829a0 6 f_1 beg get_result get_result is called from within fiber_1
80d829a0 7 f_1 setup callback set up some code to run 1.5s from now
@derekcollison
derekcollison / Cloud Foundry Production Updates
Created April 16, 2011 17:11
How to update your application in Cloud Foundry without dropping user requests..
# vmc update is great for test and development, however it stops your old app and stages and starts the new one,
# resulting in dropped requests.
# If you want to update an application without dropping user requests, see below.
# NOTE: This change assumes your application can share services, etc with the new version.
# Assume my app is named foo
vmc push foo-v2 --url foov2.cloudfoundry.com
@DavidYKay
DavidYKay / gist:912765
Created April 10, 2011 21:52
"Can Code Be Like Literature" - Jeremy Ashkenas
Jeremy
Absolutely brilliant
both technically
and oratorically
He wrote CoffeeScript
1st place 5k
21 min, 3 seconds
<7min mile
Big picture
@eric1234
eric1234 / 0_instructions.txt
Created April 9, 2011 01:12
Using Sprockets 2 in Rails 3.0.x with CoffeeScript & SASS
UPDATE: Please see some of the forks for an updated version of this guide. I
myself have moved onto the Rails 3.1 betas to get the asset pipeline. But if
you want to stay on stable there are other folks who are keeping this guide
relevant despite the changes constantly occurring on Sprockets 2. The comments
on this gist will lead you to the right forks. :)
Some brief instructions on how to use Sprocket 2 in Rails to get CoffeeScript
powered JS and SASS powered CSS with YUI compression all via the magic of rack.
This stuff will be native in Rails 3.1 and the layout of the files on the
@tmm1
tmm1 / 0-INSTALL.md
Created March 28, 2011 10:33
use cycript to load js enhancers into the propane transcript window

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

@marcuswestin
marcuswestin / Selenium-SauceLabs-NodeJS.js
Created March 21, 2011 21:29
Get started using Selenium with SauceLabs and NodeJS
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