Skip to content

Instantly share code, notes, and snippets.

View chrisdickinson's full-sized avatar

Chris Dickinson chrisdickinson

View GitHub Profile
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);
// });
// call this when we're done.
var done = function(err, result) {
console.log(result);
};
var EXPENSIVE_OPERATION_ON = function(data, callback) {
callback(/*error, data, etc*/);
};
@chrisdickinson
chrisdickinson / smooth_sortable_animating.html
Created January 29, 2011 05:39
smoothly animate jquery sortable lists.
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
ul { float:left; margin-right:20px; }
body { color:white; font-family:Helvetica, sans-serif; text-shadow:1px 1px 1px rgba(0,0,0,0.2); }
ul { width:512px; overflow:hidden; border-radius:6px; }
### Symphony 2.0.x ###
Options +FollowSymlinks -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
### DO NOT APPLY RULES WHEN REQUESTING "favicon.ico"
RewriteCond %{REQUEST_FILENAME} favicon.ico [NC]
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="something">
<p class="hi">hi</p>
<p>there</p>
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
div { background:white; margin:0; padding:0; font-family:sans-serif; }
#beta { z-index:0; height:40px; background:#CCC; }
.target { -webkit-transition:top 0.4s ease; position:relative; z-index:1; top:-56px; height:200px; }
#close { display:none; }
var objectYouWantToBeCallable = {
'hi':3,
'there':4
};
var makeCallable = function(obj, onCall) {
// these make the proxy act *exactly* like the base obj
var baseHandler = {
set:function(rcvr, name, val) { return (obj[name] = val); },
get:function(rcvr, name) { return obj[name]; }