Skip to content

Instantly share code, notes, and snippets.

@isaacs
isaacs / comma-first-var.js
Created April 6, 2010 19:24
A better coding convention for lists and object literals in JavaScript
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",
var HTTPParser = process.binding('http_parser').HTTPParser;
var net = require('net');
var path = require('path');
var sys = require('sys');
var Worker = require('webworker/webworker').Worker;
var VHOSTS = ['foo.bar.com', 'baz.bizzle.com'];
var WORKERS = {};
VHOSTS.forEach(function(vh) {
@jupiterjs
jupiterjs / Can you do.js
Created December 7, 2010 23:10
Can your framework do this?
//- CONTROLLER -
$.Controller("Tabs",{
"li click" : function(){
}
})
// will automatically create a jQuery plugin like:
@jupiterjs
jupiterjs / tie.js
Created December 8, 2010 09:14
Demonstrating some of tie's functionality.
/*
Tie lets you cross-bind form elements and controllers with models.
This means that by changing a model attribute, you it will
automatically update controllers or form elements.
This also means that if a 'change' event happens on the
element, it will automatically update the model attribute.
Lets see an example:
*/
@cowboy
cowboy / pubsub-demo.js
Created December 16, 2010 20:04 — forked from rmurphey/pubsub-demo.js
Two approaches: "Traditional" vs Pub/Sub (via rmurphey)
// Note that this uses my Pub/Sub implementation, which is slightly different than
// phiggins' in that jQuery custom events are used, and as such the first event handler
// argument passed is the event object.
//
// jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery
// https://gist.github.com/661855
// The "traditional" way.
anonymous
anonymous / gist:980546
Created May 19, 2011 11:13
<?php
namespace Doctrine\ORM\Tools\Console\Command;
use Symfony\Component\Console\Input\InputArgument,
Symfony\Component\Console\Input\InputOption,
Symfony\Component\Console;
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
@jupiterjs
jupiterjs / JavaScriptMVC.md
Created May 24, 2011 16:58 — forked from moschel/JavaScriptMVC.md
JavaScriptMVC Overview

The following is a VERY rough draft of an article I am working on for Alex MacCaw's @maccman's Book. It is very rough, but even now a worthwhile read. Suggestions / comments are very welcome! Please help me :-)

Introduction

JavaScriptMVC (JMVC) is an open-source jQuery-based JavaScript framework. It is nearly a comprehensive (holistic) front-end development framework, packaging utilities for testing, dependency management, documentation, and a host of useful jQuery plugins.

Yet every part of JavaScriptMVC can be used without every other part, making the library lightweight. Its Class, Model, View, and Controller combined are only 7k minified and compressed, yet even they can be used independently. JavaScriptMVC's independence lets you start small and scale to meet the challenges of the most complex applications on the web.

This chapter covers only JavaScriptMVC's $.Class, $.Model, $.View, and $.Controller. The following describes each component:

@justinbmeyer
justinbmeyer / bbuicanjs.md
Created June 22, 2012 16:47
BackboneUI done with CanJS

Button

<button><%= coffee.attr('roaster') %></button>

Checkbox

<input type='checkbox'
@rodw
rodw / pid-file-daemon.sh
Created August 14, 2012 01:53
Bash script that uses a PID file to add daemon-like start/stop/status behavior to an arbitrary program.
#!/bin/bash
# Uses a PID file to add daemon-like behavior to an arbitrary program.
################################################################################
usage() {
echo "Usage: `basename $0` PROGRAM {start|stop|restart|force-stop|force-restart|status} [PIDFILE|PID]" >&2
echo "Where: PROGRAM is an executable file." >&2
echo " PIDFILE is the file that contains (or will contain) the PID." >&2
echo " PID is a process id to use in place of a PIDFILE." >&2
}
@justinbmeyer
justinbmeyer / observeOverPub-Sub.md
Created August 17, 2012 15:49
Observes over Pub-Sub

Here's how to build an app with something like CanJS and AMD-like modules (using steal). For this example app, consider a tree-like nested grid where you can select locations and get more information. The app might look something like:

IL
Chicago