Skip to content

Instantly share code, notes, and snippets.

Working from home

Jonathan Creamer jcreamer898

Working from home
View GitHub Profile
jcreamer898 / gist:1591029
Created Jan 10, 2012
Javascript Standards and Patterns
View gist:1591029

From Javascript Web Applications by Alex MacCaw,

"The secret to making large JavaScript applications is not to make large JavaScript applications. Instead, you should decouple your application into a series of fairly independent components. The mistake developers often make is creating applications with a lot of interdepenency, with huge linear JavaScript files generating a slew of HTML tags. These sorts of applications are difficult to maintain and extend, so they should be avoided at all costs. Paying a bit of attention to an applications structure when you start building it can make a big difference to the end result. Ignore any preconceived notions you have about JavaScript and treat it like the object-oriented language that it is. Use classes, ineritance, objects, and patterns in the same way you would if you were building an application in another language such as Python or Ruby. Architecture is critical to server-side applications, so why shouldn't the same apply to client-side apps."

Our applic

jcreamer898 / gist:1870646
Created Feb 20, 2012
Setting up docco for Windows 7
View gist:1870646
View jquery.slugify.js
;(function ($, window, document, undefined) {
// Define the jQuery plugin name and some default options
var pluginName = 'slugify',
defaults = {
on: "blur",
prefix: ''
// The actual plugin constructor
function Slugify(element, options) {
jcreamer898 / gist:2041033
Created Mar 15, 2012
NashDotNet Lab on MVC3
View gist:2041033


  • An architectural pattern invented in the late 70's early 80's.
  • Promotes separation of concerns and eases unit testing
  • MVC is great for web apps because of HTTP
    • HTTP requests
    • Retrieve data
    • Return views
  • It is stateless, just like HTTP
    • No postbacks and view state
jcreamer898 / gist:2413975
Created Apr 18, 2012
Addy Osmani's Recommended JavaScript Style Guides & Beautifiers
View gist:2413975

For developers interested in improving the code style consistency of the JavaScript they write, I'm happy to recommend the following style guides:

  1. Idiomatic.js (highly recommended, very comprehensive and includes contributions by +Rick Waldron , +Mathias Bynens and more)

  2. jQuery Core Style Guide (used by jQuery core, QUnit and many other projects)

  3. Google JavaScript Style Guide - with some further comments

  4. Dojo Style Guide (another very comprehensive alternative)

jcreamer898 / gist:2560294
Created Apr 30, 2012
Generics for Geriatrics
View gist:2560294
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
class Program
static void Main(string[] args)
View gist:2930452
activesupport (3.2.6)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.2.8)
chunky_png (1.2.5)
coffee-script (2.2.0)
View item.html
<li class="selected">
<div class="item-desc">
<h2>Basic Party Pack</h2>
<p><span>$32 </span>for 2 guests</p>
<p class="per">$15.79 per guest</p>
<a title="View Details" href="#/abc1" class="selected">View Details</a>
<div class="add">
<label for="qty">Qty: <input type="text" id="qty_q0" class="qty"></label>
jcreamer898 / package.json
Created Jun 28, 2012
package.json file for CDNJs
View package.json
"name": "jquery-mockjax",
"filename": "jquery.mockjax.js",
"version": "1.5.0pre",
"description": "Mockjax. The jQuery Mockjax Plugin provides a simple and extremely flexible interface for mocking or simulating ajax requests and responses.",
"url": "",
"keywords": [ "ajax", "mock", "unit" ],
"author": "Jonathan Sharp (",
"bugs": {
"web": ""
jcreamer898 /
Created Jul 13, 2012
Using reduce to build a string out of an array