Skip to content

Instantly share code, notes, and snippets.

View chrisdickinson's full-sized avatar

Chris Dickinson chrisdickinson

View GitHub Profile
@chrisdickinson
chrisdickinson / browser.html
Created July 10, 2010 20:00
interop between browser js and commonjs
<script type="text/javascript" src="namespace.js"></script>
<script type="text/javascript" src="example.module.js"></script>
<script type="text/javascript">
console.log(example.module.test_fn("hello", "world"));
</script>
@chrisdickinson
chrisdickinson / WIP_whisper.js
Created July 30, 2010 17:18 — forked from toastdriven/WIP_base.html
FULL ON DOUBLE RAINBOW
// Whisper.js
// A light-weight blog in node.js.
// Requires:
// http://github.com/ry/node_postgres.git
// http://github.com/chrisdickinson/pieshop.git
// http://github.com/chrisdickinson/postpie.git
// ..and JSDTL, but that's not publically available yet (sorry)
// Licensed under the BSD.
/*
// modifying the calling function's context
// in javascript to emulate operator overloading OR:
// ...
// now you're thinking with portals
var sys = require('sys');
var Toy = function() {
this.toyList = [];
};
from dulwich import client
import paramiko
class ParamikoWrapper(object):
def __init__(self, host, command, username, port):
self.client = paramiko.SSHClient()
self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.client.connect(host, username=username)
self.streams = self.client.exec_command(command[0])
self.write = self.streams[0].writelines
self.read = self.streams[1].readline
sys: require 'sys'
require './jsdocstring'
howdy: (lol) ->
"Well hello there, folks. I'm testing out my docString thing.
In coffeescript.
DocStrings are awesome."
lol
var Difference = function(milliseconds) {
if(milliseconds instanceof Object) {
var output = 0;
output += milliseconds.days === undefined ? 0 : 86400000;
output += milliseconds.hours === undefined ? 0 : 3600000;
output += milliseconds.minutes === undefined ? 0 : 60000;
output += milliseconds.seconds === undefined ? 0 : 1000;
output += milliseconds.milliseconds === undefined ? 0 : milliseconds;
milliseconds = output;
var forms = require('cruciform').forms;
var BlogAuthorForm = forms.form({
'email':forms.EmailField({required:false}),
'type':forms.ChoiceField({
'choices':{
0:'Email Account',
1:'Reddit Account',
2:'Gmail Account'
},
var sys = require('sys');
//
// Here's how prototypical inheritance works.
//
var Klass = function(val) {
this.value = val;
};
Javascript.forEach('Pythonista')
================================
An outline.
-----------
01. Intro
- Who this is for
- What this is
- Terms
// QuerySet inherits from EventEmitter,
// so the result of this method can be used like so:
// var result = qs.filter({'something__something':'something_else'});
// result.on('data', function(result) { console.log(result); });
// or:
// qs.filter({'something__something':'something_else'})(function(err, results) {
// !err && console.log(results);
// });