Skip to content

Instantly share code, notes, and snippets.

var http = require('http');
var url = require('url');
var Router = function(){
this.routes = {};
return this;
};
Router.prototype.addRoute = function(route){
this.routes[route.name] = route;
<?php
set_time_limit (0);
$address = '127.0.0.1';
$port = intval($argv[1]); // php server.php 3000
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
try {
alias airport=/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
if [ `airport -I|grep -c FXG` -eq "1" ]; then
export http_proxy="proxy.cegep-fxg.qc.ca:80"
fi
@becojo
becojo / fez2.pde
Created June 16, 2013 16:21
Interactive Fez 2 Logo
PVector[] stars;
int startsCount = 700;
float z = 0;
void setup()
{
int i;
size(800, 450, P3D);
noFill();
@becojo
becojo / index.html
Created November 4, 2013 02:03
Dogescript canvas experiment
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Such canvas</title>
<style type="text/css">
canvas {
position: absolute;
top: 50%;
left: 50%;
PImage img;
String filename = "chisas.jpg";
void setup() {
img = loadImage(filename);
size(img.width, img.height);
noLoop();
}
int square = 20;
int dw, dh, hw, hh, hs;
void setup() {
size(500, 500);
dw = width / square / 2;
dh = height / square / 2;
hw = width / 2;
hh = height / 2;
@becojo
becojo / gist:8124062
Created December 25, 2013 15:07
Insertion sort
(defn insert [coll, n]
(let [parts (split-with (partial > n) coll)]
(concat (first parts) [n] (last parts))))
(defn insertion-sort [coll]
(reduce (fn [sorted item]
(insert sorted item)) nil coll))
import de.looksgood.ani.*;
import de.looksgood.ani.easing.*;
// defines the number of sides of the polygon
int sides = 6;
// the radius of the polygon
int radius = 180;
// the inner angle of the polygon