Skip to content

Instantly share code, notes, and snippets.

View zimbatm's full-sized avatar
🦙
nixified

Jonas Chevalier zimbatm

🦙
nixified
View GitHub Profile
@zimbatm
zimbatm / defer.rb
Created October 10, 2008 17:37
Discovering my own code
module Kernel
# What is this ? I don't remember...
def [](*args, &block)
# FIXME: access control
send(*args, &block)
end
# Looks like "curry", method composition like in Ocaml
def defer(*args, &block)
DeferCall.new( block_given? ? block : method(args.shift), *args )
@zimbatm
zimbatm / gist:73074
Created March 2, 2009 23:32
Kongregate game rating bot
#!/usr/bin/env ruby
=begin notice
Hi, what's up ?
This is a prototype to rate all games on Kongregate. Since there are 704 pages with 15 pages on each, and that rating a game brings 1 point, you should easily obtain 10k points, which means a level 25 or so (if admin staff doesn't delete your profile).
NOTE: there is still a bug in the rating values
NOTE2: I didn't use this script on my profile
Dependencies: ruby and the mechanize (0.9.1) gem
@zimbatm
zimbatm / gist:115353
Created May 21, 2009 08:23
jruby ressource not found
Java Plug-in 1.5.0
Using JRE version 1.5.0_16 Java HotSpot(TM) Client VM
User home directory = /Users/zimbatm
network: Loading user-defined proxy configuration…
network: Done.
network: Loading proxy configuration from Netscape Navigator…
network: Done.
network: Loading direct proxy configuration…
network: Done.
network: Proxy Configuration: No proxy
From 5a534273b25a97f15305d3e0d562a6016c545615 Mon Sep 17 00:00:00 2001
From: Jonas Pfenniger <jonas@pfenniger.name>
Date: Sun, 24 Jan 2010 22:43:46 +0100
Subject: [PATCH] [test] More promise late binding tests
---
test/mjsunit/test-promise.js | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/test/mjsunit/test-promise.js b/test/mjsunit/test-promise.js
# Without patch:
$ ./node test.js
Error: Unhandled emitError: ["moo"]
at node.js:257:15
at IdleWatcher.callback (node.js:347:5)
at node.js:985:1
at node.js:989:1
# With patch:
$ 6g mapkey.go
$ 6l mapkey.6
$ ./6.out
throw: runtime.mapaccess1: key not in map
panic PC=0x299ff8
throw+0x3e /Users/zimbatm/Code/golang/src/pkg/runtime/runtime.c:74
throw(0x4ae9d, 0x0)
runtime.mapaccess1+0x74 /Users/zimbatm/Code/golang/src/pkg/runtime/hashmap.c:772
runtime.mapaccess1(0x2a8230, 0x0)
From f037d3f6bfeef8520a640364643e8a9d9909880d Mon Sep 17 00:00:00 2001
From: Jonas Pfenniger <jonas@pfenniger.name>
Date: Mon, 15 Feb 2010 23:46:06 +0100
Subject: [PATCH] Added promise.wait() after promise.emitXXX() tests
---
test/mjsunit/test-promise-wait.js | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/test/mjsunit/test-promise-wait.js b/test/mjsunit/test-promise-wait.js
From 419bdcfc4215da2aa4c2bb1b528360397f55c02d Mon Sep 17 00:00:00 2001
From: Jonas Pfenniger <jonas@pfenniger.name>
Date: Wed, 14 Apr 2010 21:39:07 +0200
Subject: [PATCH] Added webfs formula
---
Library/Formula/webfs.rb | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
create mode 100644 Library/Formula/webfs.rb
require 'formula'
=begin
STATUS: gettext disabled, so no nls for you
It doesn't compile agains OSX's gettext and the gettext brew doesn't publish it's libraries and includes.
Otherwise, should work fine.
zimbatm
@zimbatm
zimbatm / signal-stop.js
Created April 26, 2010 16:33
Signal unregistration test
var sys = require("sys"), b;
b = process.binding('signal_watcher');
(function () {
var w = new b.SignalWatcher(process["SIGINT"]);
w.stop();
})();
setInterval(function() { sys.puts("noop"); }, 1000);