Skip to content

Instantly share code, notes, and snippets.

View tim-smart's full-sized avatar

Tim tim-smart

View GitHub Profile
@tim-smart
tim-smart / usage_main.js
Created February 7, 2010 02:46
Node.js Web Workers
// The main node process
// Will output to shell:
// {
// "test": "test"
// }
// "bam"
var worker = require('./webworker'),
sys = require('sys');
// An example biggle module / plugin
// __init is called by plugin loader, with the global biggie object as first parameter.
exports.__init = function(big) {
// We can then mix in the global stuff from the biggie object
process.mixin(big.global);
// This will contain all the stuff we want to export as a plugin
var exports = {};
Get(/^\/myroute/, function(request) {
...
});
Post(/^\/myroute/, function(request) {
...
});
Head(/^\/myroute/, function(request) {
HTTP({
host: '127.0.0.1',
post: 8000,
routes: [{
match: /^\/myroute/,
callback: function(request) {}
}, {
match: {
type: 'POST',
rule: /^\/myroute/
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 = '';
// ==UserScript==
// @name Export Github Issues
// @namespace http://userscripts.org/users/tim
// @description Can export issues by state and label
// @include http://github.com/*/issues*
// ==/UserScript==
(function() {
var GITHUB_API_URL, GithubRequest, URL_EXPRESSION, formatOutput, menuCallback, repo, url, user;
URL_EXPRESSION = /^.*\/(.*?)\/(.*?)\/issues.*$/;
GITHUB_API_URL = 'http://github.com/api/v2/json';
@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];
var server = require('hookio');
server.init();
Fornode extends BaseNode: ->
# Contructor
ForNode::compile: (source) ->
source
class B extends A
constructor: ->
@where_am_i: 'at work'
sayWhereYouAre: ->
alert 'I am ' + @where_am_i