For best results, use hub and git bash completion (included with git under contrib/completion
).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Module pattern: | |
// http://yuiblog.com/blog/2007/06/12/module-pattern | |
// | |
var APP = (function(window, document, $, undefined) { | |
// For use only inside APP. | |
var PRIVATE_CONSTANT_1 = 'foo'; | |
var PRIVATE_CONSTANT_2 = 'bar'; | |
// Expose contents of APP. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I don't have answers yet, just questions. Keep in mind that I prefer code | |
// that is easiest to maintain. | |
// Example from http://www.nczonline.net/blog/2010/10/26/wanted-dynamic-execution-contexts-in-javascript/ | |
// Consider: | |
// Let's say you start with this, but need to (in a later commit) add a few | |
// additional vars. | |
var myglobal = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
/* *** | |
** ENVIRONNEMENT SETTING | |
*/ | |
(function(global){ | |
var constructorName = "MyDOMNode"; | |
var MyDOMNodeMap = WeakMap(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var name = 'window baby'; | |
var obj = { | |
name: 'object baby', | |
// This is totally broken, because inner functions don't "inherit" the outer | |
// function's `this` value. Instead, their `this` value is the global object. | |
broken: function() { | |
function doStuff() { | |
return this.name + '!?!'; | |
} | |
return doStuff(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* jQuery initData - v0.1pre - 5/18/2011 | |
* http://benalman.com/ | |
* | |
* Copyright (c) 2011 "Cowboy" Ben Alman | |
* Dual licensed under the MIT and GPL licenses. | |
* http://benalman.com/about/license/ | |
*/ | |
(function($){ |
This perhaps deserves a blog post, but whatever.
The challenge: What if you wanted to determine what level my Bulgarian language skills were at? Using this sample document:
{
"name": {
"first": "Lloyd",
"last": "Hilaiel"
},
"favoriteColor": "yellow",
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@_1 = -> | |
# sum of multiples of 3 or 5 (not both) under 1K | |
answer = 0 | |
for n in [1...1000] | |
if n % 3 == 0 or n % 5 == 0 | |
answer += n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Annoying.js - How to be an asshole to your users | |
* | |
* DO NOT EVER, EVER USE THIS. | |
* | |
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com) | |
* Visit https://gist.github.com/767982 for more information and changelogs. | |
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog | |
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Conditionals | |
( false :) | |
console.log "if" | |
:( true ) | |
console.log "else if" | |
:() | |
console.log "else" | |