Skip to content

Instantly share code, notes, and snippets.

View ecin's full-sized avatar
🐶
Woof!

ecin ecin

🐶
Woof!
View GitHub Profile
// Hi, I'm Safari 4 and I throw a parse error at this!
p.import = function import(lib){
eval(p.ajax(lib));
}
|-------| |-------|
| 12345 | | 67890 | } web application processes
|-------| |-------|
| |
| |
\ / \
\ / \ } dtrace probes firing
|----| |----|
|rack| | ?? | } rack: rack interface to web applications
|----| |----| ??: consumer process for dtrace probes
CPU ID FUNCTION:NAME
0 18791 request_start:request-start / 4726603687031
0 18790 request_done:request-done / 4726603888782
1 18791 request_start:request-start /favicon.ico 4726627369797
1 18790 request_done:request-done /favicon.ico 4726627530357
/*
To check for requests, just use an empty middleware, and check for call()s to it. In our case, use Rack::Probe. We can later add more probes to log env data._
This way requires a patched Ruby to be used though. mri_instrumentation must have a better way._
*/
:::function-entry
/copyinstr((int) arg0) == "Rack::Probe" && copyinstr((int) arg1) == "call"/
{
printf("Class: %s \t Method: %s\t", copyinstr((int) arg0), copyinstr((int) arg1));
trace(timestamp);
/*
Probes fire when a Ruby process starts and ends garbage collection. Perhaps similar to mri_instrumentation's implementation?_
*/
pid$1::rb_gc:entry
{
printf("Garbage Collection has started!\t");
trace(timestamp);
printf("\n");
}
gem uninstall visionmedia-commander -v 3.3.0
gem install visionmedia-commander -v 3.2.9 --source http://gems.github.com
gem install visionmedia-jspec --source http://gems.github.com
cd ~/Library/Application\ Support/TextMate/Bundles/ &&
git clone git://github.com/visionmedia/jspec.tmbundle.git
:::object-free
/ pid == $1 /
{
printf("Bai bai, object. We barely knew thee.\n");
}
// Our lovely namespace.
var rack = {};
// Access to all set Probes
rack.Probes = {};
// An event will be added through this function
rack.Probes.addEvent = function( pid, timestamp, name, arguments ){
if(!isDefined(rack.Probes[name]))
new rack.Probe(name);
-module(matrix).
-export([do_this_once/0, update_cell/2, read_cell/2]).
%% index is a tuple: {user_id, article_id}
-record(cell, {index, value = 0 }).
do_this_once() ->
mnesia:create_schema([node()]),
mnesia:start(),
mnesia:create_table(cell,