Skip to content

Instantly share code, notes, and snippets.

@ruzzbot
ruzzbot / backbone-list.js
Created March 12, 2012 20:07
javascript: backbone-list
//=== LIST
Article.Views.List = Backbone.View.extend({
template: "",
initialize: function( options ){
_.bindAll(this, "render", "addAll", "addOne");
this.collection.bind( "add", this.addOne );
this.collection.bind( "reset", this.addAll );
this.totalItems = this.collection.length;
},
@ruzzbot
ruzzbot / grunt-bbb.js
Created July 31, 2012 03:04
JavaScript Gruntjs script for the backbone boilerplate [JavaScript,Configure,Settings,Backbone,BBB,Grunt,Bundle,Package,Template]
// This is the main application configuration file. It is a Grunt
// configuration file, which you can learn more about here:
// https://github.com/cowboy/grunt/blob/master/docs/configuring.md
module.exports = function(grunt) {
grunt.initConfig({
// The clean task ensures all files are removed from the dist/ directory so
// that no files linger from previous builds.
clean: ["dist/"],
@ruzzbot
ruzzbot / index-mobile.html
Created July 31, 2012 03:05
HTML Template for mobile web apps [iOS,HTML5,HTML,Mobile,Template]
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{app_title}}</title>
<!-- Mobile viewport optimization h5bp.com/ad -->
<meta name="HandheldFriendly" content="True">
@ruzzbot
ruzzbot / stylus-mixin.styl
Created July 31, 2012 03:24
Stylus Mixin Template [CSS,Stylus,Configure,Settings,Template]
//################################################################ STYLUS MIXIN
// Colors
$lavender = #9569bb
$pink = #f468f9
$white = #fff
$black = #000
$grayDark = #333
$grayMed = #666
$grayLight = #999
@ruzzbot
ruzzbot / music-file.coffee
Created August 2, 2012 16:48
A small script to find music files and store them to couchDB
fs = require 'fs'
ID3 = require 'node-id3'
findit = require 'findit'
cradle = require 'cradle'
db = new(cradle.Connection)().database('music')
allowed_files = [ 'mp3', 'aiff', 'wav', 'ogg' ]
mnt = [
'/Users/<username>/Music',
'/Users/<username>/Podcasts' ]
@ruzzbot
ruzzbot / vml-grunt.js
Created September 12, 2012 14:32
VML grunt.js buildscript (bbb)
// This is the main application configuration file. It is a Grunt
// configuration file, which you can learn more about here:
// https://github.com/cowboy/grunt/blob/master/docs/configuring.md
// http://net.tutsplus.com/tutorials/javascript-ajax/meeting-grunt-the-build-tool-for-javascript/
// If you need support for a pre-compiler or a new tool to play with, check out
// http://gruntjs.com/
module.exports = function(grunt) {
// directory paths
@ruzzbot
ruzzbot / stash
Created September 21, 2012 19:05
stash-ish : a temporary place to put code I'm unsure about adding
<script type="text/javascript">
// 2012-09-21 : RWM
(function(){
var countrysortinator = function(){
// Sort object
var sortinator = {
parse_countries : function($container){
var countries = [];
@ruzzbot
ruzzbot / dubstep.coffee
Created September 21, 2012 19:24
dubstep script
if _( others ).include( dubstep.banger )
for bassface in [1..140]
"WUB"
@ruzzbot
ruzzbot / user.coffee
Created October 10, 2012 19:13
simple-tests.jasmine.coffee
define [ "modules/user" ], (User)->
describe "User", ->
users = new User.Collection()
me = null
it "create new user", ->
users.create
"email" : "[email protected]"
@ruzzbot
ruzzbot / graph.adjacency-list.js
Created October 11, 2012 04:15
Adjacency List for Undirected Graph
define([], function(app) {
var Graph = {},
adj = {}; //Map of adjacency lists for each node
//@nodes (int[])
Graph.init = function(nodes){
//your node labels are consecutive integers starting with one.
//to make the indexing easier we will allocate an array of adjacency one element larger than necessary
adj = adj.clone();
for (var i = 0; i < nodes.length; ++i) {