Skip to content

Instantly share code, notes, and snippets.

View greut's full-sized avatar
:shipit:
setting up that new work laptop

Yoan Blanc greut

:shipit:
setting up that new work laptop
View GitHub Profile
diff --git a/bin/roundup b/bin/roundup
index 5605e36..d131a79 100755
--- a/bin/roundup
+++ b/bin/roundup
@@ -5,13 +5,13 @@ load("core.js");
require("lib/roundabout");
require("lib/jack/lobster");
-Roundabout.GET("/", function() {
+Roundabout.application.GET("/", function() {
@greut
greut / rot13.js
Created January 31, 2009 13:25
playing with middlewares: wsgi, rack and jack.
#!/usr/bin/env java org.mozilla.javascript.tools.shell.Main
load("core.js");
require("lib/jack");
require("lib/jack/handler/jetty");
function app(env) {
return [200,
{"Content-Type": "text/plain"},
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from wsgiref.simple_server import make_server
from restish import app, http, resource
PORT = 8080
def unicode_found(request):
return http.found(u"http://en.wikipedia.org/wiki/£")
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<title>removeChild?</title>
<h1>Mauriz is back</h1>
<p>
But something is wrong here?
</p>
<ul>
<li>a</li>
#!/usr/bin/env python
# playing with column_property to keep counters up to date
__author__ = "Yoan Blanc"
from sqlalchemy import (create_engine, MetaData,
Table, Column, Table, Integer, ForeignKey,
select, func)
from sqlalchemy.ext.declarative import declarative_base
#!/usr/bin/env python
__author__ = "Yoan Blanc <yoan at dosimple dot ch>"
# Declarative syntax
class Declarative(type):
def __init__(cls, name, bases, dict):
super(Declarative, cls).__init__(name, bases, dict)
cls._matchers = {}
// jQuery makes me lazy :-)
$(document).ready(function($) {
var toReplace = "/trans.gif";
$('img[src$=png]').each(function() {
$(this).css({
width: $(this).width() + 'px',
height: $(this).height() + 'px',
filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + $(this).attr('src') + "', sizingMethod='scale')"
}).attr('src', toReplace);
});
function extend(source, obj) {
for(var key in obj) {
if((obj[key].constructor === Array || typeof obj[key] !== "object") && obj.hasOwnProperty(key)) {
source[key] = obj[key];
} else {
source[key] = extend(source[key]||{}, obj[key]);
}
}
return source
}
$ svn propget svn:externals -R | ruby -pe 'if $_.length() > 2; v = $_[0,$_.length-1].split(" ", 3); v[2] = v[2].gsub("/old_directory/", "/new_directory/"); $_ = "propset svn:externals \"#{v[2]}\" #{v[0]}"; end;' | xargs svn
$ js -v
JavaScript-C 1.8.0 pre-release 1 2007-10-03
$ js speed.js
1 childs: 0
10 childs: 1
100 childs: 3
1000 childs: 40
10000 childs: 217
100000 childs: 5692