Skip to content

Instantly share code, notes, and snippets.

View patrickandre's full-sized avatar

Patrick patrickandre

  • NYC
View GitHub Profile
/**
* Implement Foo Object.
* - Take a JSON object as an input parameter
* - Create a copy this JSON object as itself.
* - Chainable
*/
var foo = new Foo({
version : '1.0'
});
#!/usr/bin/env bash
# Helpful Aliases
alias ex="exit"
alias e="subl"
alias c="clear"
alias ls="ls -lh"
alias la="ls -lah"
alias pwd="pwd -LP"
config.init({
meta: {
title: 'Premier Dental Implant Practices',
name: "Christopher Webb",
homepage: 'http://conspirator.co',
twitter: 'conspirator',
banner: '/* \n' +
' * \tAuthor:\t\t{{meta.name}}\n' +
' * \tWebsite:\t{{meta.homepage}}\n' +
' * \tTwitter:\thttp://twitter.com/{{meta.twitter}}\n' +
@patrickandre
patrickandre / Grunt Here
Created October 28, 2012 16:36 — forked from conspirator/Grunt Here
The following AppleScript opens up Terminal, navigates to the path of the active Finder window, opens that directory in Sublime Text 2, and finally kicks off Grunt.js.
-- ========================================
-- Author: Christopher Webb
-- Web: http://conspirator.co
-- Twitter: http://twitter.com/conspirator
-- ========================================
set finderPath to ""
tell application "Finder"
try
@patrickandre
patrickandre / grunt.js
Created October 28, 2012 16:16 — forked from Takazudo/grunt.js
grunt.js example
var proc = require('child_process');
config.init({
lint: {
files : [ 'hoge.js', 'fuga.js' ]
},
concat: {
'all.js' : [ 'hoge.js', 'fuga.js', 'cofall.js', '_coftemp.js' ]
},
@patrickandre
patrickandre / qunit.md
Created October 12, 2012 14:40 — forked from peol/qunit.md
QUnit/SinonJS/Backbone.js

#Backbone.js Testing With QUnit & SinonJS

QUnit is a powerful JavaScript test suite written by Jörn Zaefferer and used by many large open-source projects (such as jQuery and Backbone.js) to test their code. It's both capable of testing standard JavaScript code in the browser as well as code on the server-side (where environments supported include Rhino, V8 and SpiderMonkey). This makes it a robust solution for a number of use-cases.

Quite a few Backbone.js contributors feel that QUnit is a better introductory framework for testing if you don't wish to start off with Jasmine and BDD right away. As we'll see later on in this chapter, QUnit can also be combined with third-party solutions such as SinonJS to produce an even more powerful testing solution supporting spies and mocks, which some say is preferable over Jasmine.

My personal recommendation is that it's worth comparing both frameworks and opting for the solution that you feel the most comfortable with.

window.NR = window.NR || {};
window.NR.myModule = (function () {
"use strict";
function initialize() {
// your initialization code here
}
function anotherMethod() {
// its function body here
@patrickandre
patrickandre / core.test.js
Created October 11, 2012 19:20 — forked from drewwells/core.test.js
RequireJS and QUnit sitting in a tree
//Wait for relevant code bits to load before starting any tests
define(['core.js'], function( core ) {
module("Core Tests");
test("Test core methods", function(){
expect(2);
equals( 1, 1, "A trivial test");
ok( true, "Another trivial test");
});
@patrickandre
patrickandre / ST2 Shortcuts
Created September 13, 2012 15:38 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts
h1. Sublime Text 2 - Useful Shortcuts (Mac OS X)
h2. General
| *⌘T* | go to file |
| *⌘⌃P* | go to project |
| *⌘R* | go to methods |
| *⌃G* | go to line |
| *⌘KB* | toggle side bar |
| *⌘⇧P* | command prompt |
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}