Skip to content

Instantly share code, notes, and snippets.

View anthonybrown's full-sized avatar
🎯
Focusing

Tony Brown anthonybrown

🎯
Focusing
View GitHub Profile
@anthonybrown
anthonybrown / Class Function
Created June 25, 2012 22:56
Custom Class library
var Class = function(parent){
var klass = function(){
this.init.apply(this, arguments);
};
// Change klass' prototype
if (parent) {
var subclass = function() { };
subclass.prototype = parent.prototype;
klass.prototype = new subclass;
};
@anthonybrown
anthonybrown / Part I
Created June 27, 2012 02:07
JavaScripts Good Parts
var add = function(a,b) {
return a + b;
}
var times = function(a,b) {
return a * b;
}
console.log( add( 6, 4 ) );
@anthonybrown
anthonybrown / CHANGES.md
Created August 7, 2012 12:02 — forked from topfunky/CHANGES.md
Express 3.0 Changes

Changes in Express 3.0 Templates

Related: PeepCode Full Stack Node.js screencast (an included code sample works with Express 3.0).

There are several syntax changes in Express 3.0. They do require modifications to your code, but they aren't too complicated.

The biggest change is that Express templates now use Django style inheritance rather than ERB/Rails style automatic layouts.

Summary

@anthonybrown
anthonybrown / Railscast2.tmTheme
Created September 26, 2012 23:11 — forked from smlombardi/Railscast2.tmTheme
Modified version of Railscast theme for Textmate/Sublime Text 2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Railscasts 2</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@anthonybrown
anthonybrown / jquery.ba-tinypubsub.js
Created September 30, 2012 20:49 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
@anthonybrown
anthonybrown / app.js
Created October 11, 2012 06:56 — forked from pixelhandler/app.js
Develop a RESTful API Using Node.js With Express and Mongoose - See: http://pixelhandler.com/blog/2012/02/09/develop-a-restful-api-using-node-js-with-express-and-mongoose/
var application_root = __dirname,
express = require("express"),
path = require("path"),
mongoose = require('mongoose');
var app = express.createServer();
// database
mongoose.connect('mongodb://localhost/ecomm_database');
@anthonybrown
anthonybrown / app.js
Created October 11, 2012 06:56 — forked from pixelhandler/app.js
Develop a RESTful API Using Node.js With Express and Mongoose - See: http://pixelhandler.com/blog/2012/02/09/develop-a-restful-api-using-node-js-with-express-and-mongoose/
var application_root = __dirname,
express = require("express"),
path = require("path"),
mongoose = require('mongoose');
var app = express.createServer();
// database
mongoose.connect('mongodb://localhost/ecomm_database');
@anthonybrown
anthonybrown / app.js
Created October 11, 2012 06:57 — forked from pixelhandler/app.js
Develop a RESTful API Using Node.js With Express and Mongoose - See: http://pixelhandler.com/blog/2012/02/09/develop-a-restful-api-using-node-js-with-express-and-mongoose/
var application_root = __dirname,
express = require("express"),
path = require("path"),
mongoose = require('mongoose');
var app = express.createServer();
// database
mongoose.connect('mongodb://localhost/ecomm_database');
@anthonybrown
anthonybrown / contact.coffee
Created October 20, 2012 09:18 — forked from maccman/contact.coffee
Spine Contacts Screencast
Spine = require('spine')
class Contact extends Spine.Model
@configure 'Contact', 'name', 'email', 'mobile', 'lat', 'lng'
@extend Spine.Model.Local
@filter: (query) ->
return @all() unless query
query = query.toLowerCase()
@anthonybrown
anthonybrown / 1-layout.html
Created October 21, 2012 09:11 — forked from mxriverlynn/1-layout.html
render backbone views with jquery templates
<html>
<head>
<script src="jquery-1.6.1.min.js"></script>
<script src="http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
<script src="underscore-min.js"></script>
<script src="backbone-min.js"></script>
<script src="example.js"></script>
<style type="text/css">
fieldset {