Skip to content

Instantly share code, notes, and snippets.

@marcelbeumer
Created April 3, 2012 20:08
Show Gist options
  • Save marcelbeumer/2295191 to your computer and use it in GitHub Desktop.
Save marcelbeumer/2295191 to your computer and use it in GitHub Desktop.
#js boiler for buzz
snippet buzzjs
/*jshint undef:true, forin:false, eqeqeq:true, browser:true, newcap:true */
/*global console:true, $:true */
(function (global) { // We always pass global here
var bm = global.bm,
_ = bm.util;
})(this);
# Class
snippet class
// $1 constructor
function ${1:class_name}(${2:argument}) {
${3:// body...}
}
# Subclass
snippet subclass
// $1 constructor
function ${1:class_name}(${2:argument}) {
$1.__super__.constructor.apply(this, arguments);
${4:// body...}
}
// Inherit from $3
_.inherits($1, ${3:super_class});
# Prototype
snippet proto
${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {
${4:// body...}
};
# Prototype with super
snippet protosuper
${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {
$1.__super__.$2.
apply(this, arguments);
${6:// body...}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment