Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View dstnbrkr's full-sized avatar

Dustin Barker dstnbrkr

View GitHub Profile
@dstnbrkr
dstnbrkr / prime-factors.rkt
Created March 4, 2011 21:02
racket prime factorization
(define (eratosthenes n)
(define (sift list p)
(filter (lambda (n)
(not (zero? (modulo n p))))
list))
(define (iter nums primes)
(let ((p (car nums)))
(if (> (* p p) n)
(append (reverse primes) nums)
(iter (sift (cdr nums) p) (cons p primes)))))
@dstnbrkr
dstnbrkr / node static server anywhere
Created February 12, 2011 01:47
Launch a webserver anywhere, the current working directory will be the document root
#!/usr/local/bin/node
var
sys = require('sys'),
path = require('path'),
http = require('http'),
paperboy = require('/usr/local/lib/node/paperboy'),
PORT = 8003,
WEBROOT = process.cwd();
@dstnbrkr
dstnbrkr / server.js
Created January 19, 2011 16:57
Simple server that writes raw HTTP post data to a file.
var http = require("http");
var fs = require("fs");
var path = require("path");
http.createServer(function(request, response) {
unique_filename(function(filename) {
upload_file(filename, request, response);
});
}).listen(8000);
From 092ae12aec59cc8883f6f6454f111df56260338e Mon Sep 17 00:00:00 2001
From: Dustin Barker <dustin.barker@gmail.com>
Date: Thu, 15 Oct 2009 20:49:22 -0700
Subject: [PATCH] If a mock dir exists and is a symlink, resolve it
Fixes specs that fail on Mac OS X due to symlink /var -> /private/var
---
core/dir/fixtures/common.rb | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
From 0be864d8f6eac17afb245b44020e53b932412770 Mon Sep 17 00:00:00 2001
From: Dustin Barker <dustin.barker@gmail.com>
Date: Thu, 15 Oct 2009 19:24:08 -0700
Subject: [PATCH] If a mock dir exists and is a symlink, resolve it.
Fixes specs that fail on Mac OS X due to symlink /var -> /private/var
---
core/dir/fixtures/common.rb | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)