Skip to content

Instantly share code, notes, and snippets.

@moudy
moudy / globals.js
Created April 1, 2011 19:31
handy code for monitoring global vars, should go at the end
if (true /* MONITOR_GLOBALS */) {
(function(){
var globals = {};
var startGlobals = [];
for (var j in window) {
globals[j] = true;
startGlobals.push(j);
}
if (true /* PRINT_INITIAL_GLOBALS */)
console.log("Initial globals: "+startGlobals.sort().join(', '));
@moudy
moudy / sass with style
Created January 27, 2011 16:09
run sass with style option
sass --style compact --watch master.scss:style.css
@moudy
moudy / vertical_div_align.html
Created January 27, 2011 15:39
aligns a div vertically on a page
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html,body{
height:100%;
margin:0;
padding:0;}
#offset{
width:100%;
@moudy
moudy / Revealing_Module_Pattern.js
Created January 21, 2011 19:01
A design pattern to help structure and namespace your Javascript code.
// single global namespace
var Resturaunt = (function (window, document, $, undefined) {
// private variables
var name = 'Building on Bond',
location = (function () {
// nested private variables
var address = { street: '112 Bond St',
city: 'Brooklyn',
state: 'NY',