Skip to content

Instantly share code, notes, and snippets.

View tim-smart's full-sized avatar

Tim tim-smart

View GitHub Profile
var http = require('http'),
sys = require('sys'),
path = require('path'),
posix = require('posix'),
events = require('events');
var Walker = function() {
this._counter = 0;
};
Walker.prototype = {
// exports defined out here.
exports.foo = "bar"
require(
"sys", "file", "persistence/sqlite3"
)(function (sys, file, sqlite) {
sys.p(File);
// Rest of program here
});
var sys = require("sys"),
http = require("http");
var google = http.createClient(80, "www.google.com");
var request = google.request("GET", "/", {"host": "www.google.com"});
request.addListener('response', function (response) {
response.setBodyEncoding("utf8");
var body = '';
@tim-smart
tim-smart / CPBox.j
Created February 26, 2010 13:37 — forked from defunkt/CPBox.j
+ (id)boxEnclosingView:(CPView)aView
{
var box = [[self alloc] initWithFrame:CGRectMakeZero()],
enclosingView = [aView superview];
[box setFrameFromContentFrame:[aView frame]];
[enclosingView replaceSubview:aView with:box];
[box setContentView:aView];
class B extends A
constructor: ->
@where_am_i: 'at work'
sayWhereYouAre: ->
alert 'I am ' + @where_am_i
var A = function() {};
A.prototype.over = function() {};
var B = function() {
this.where_am_i = 'at work';
A.call(this);
};
var _fn = function() {};
Connection.prototype.query = function (sql, callback) {
if (!this._queries) this._queries = [];
this._queries.push([sql, callback]);
this.maybeDispatchQuery();
};
asyncFunction: (x, y, z) ~>
yield
readFirstFile: (dir, ~, error) ~>
[err, files]: fs.readdir dir, ~
return error(err) if err
[err, out]: fs.readFile files[o], ~
return error(err) if err
yield content
require.paths.unshift('lib');
require('express');
require('express/plugins');
redisclient = require('redis-node-client/lib/redis-client');
redis = redisclient.createClient();
sys = require('sys');
configure(function () {
use(Logger);
require.paths.unshift('lib');
require('express');
require('express/plugins');
redisclient = require('redis-node-client/lib/redis-client');
Parallel = require('parallel').Parallel;
redis = redisclient.createClient();
sys = require('sys');
configure(function () {
use(Logger);