- http://stackoverflow.com/questions/804115 (
rebase
vsmerge
). - https://www.atlassian.com/git/tutorials/merging-vs-rebasing (
rebase
vsmerge
) - https://www.atlassian.com/git/tutorials/undoing-changes/ (
reset
vscheckout
vsrevert
) - http://stackoverflow.com/questions/2221658 (HEAD^ vs HEAD~) (See
git rev-parse
) - http://stackoverflow.com/questions/292357 (
pull
vsfetch
) - http://stackoverflow.com/questions/39651 (
stash
vsbranch
) - http://stackoverflow.com/questions/8358035 (
reset
vscheckout
vsrevert
)
This file contains 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
// variables | |
var number = 2, | |
count = 0; | |
// while prime count | |
while (number < 100) { | |
if (isPrime(number)) { | |
count++; | |
} | |
number++; |
This file contains 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 express = require('express'), | |
bodyParser = require('body-parser'), | |
app = express(); | |
// third party middleware | |
app.use(bodyParser.urlencoded()); | |
// custom middleware | |
app.use(function (req, res, next) { | |
console.log('this will log on every request'); |
This file contains 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 express = require('express'), | |
bodyParser = require('body-parser'), | |
app = express(); | |
// configurations | |
app.set('env', 'development'); // default: process.env.NODE_ENV | |
app.enable('trust proxy'); // for reverse proxy; disabled by default | |
app.set('jsonp callback name', 'cb'); // json with padding | |
app.set('json replacer', function (attr, val) { | |
if (attr === 'passwordHash') { |
This file contains 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
/* bling.js */ | |
window.$ = document.querySelectorAll.bind(document); | |
Node.prototype.on = window.on = function (name, fn) { | |
this.addEventListener(name, fn); | |
}; | |
NodeList.prototype.__proto__ = Array.prototype; |
This file contains 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
{ | |
"links": { | |
"next": "http://localhost:3050/movies?page=2" | |
}, | |
"request_info": { | |
"seconds": 0.002, | |
"cached": false, | |
"result_count": 4 | |
}, | |
"items": [ |
This file contains 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 express = require('express'); | |
var app = express(); | |
var Datastore = require('nedb'); | |
var db = {}; | |
var responder = require('./httpResponder'); | |
var port = process.argv[2] || 3050; | |
var root = 'http://localhost:' + port; | |
// Connect to an NeDB database |
This file contains 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 naive = function (a, b) { | |
var x = a; // 1 unit | |
var y = b; // 1 unit | |
var z = 0; // 1 unit | |
while (x > 0) { // runs twice | |
z = z + y; | |
x = x - 1; | |
return z; | |
} | |
}; |
This file contains 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
// event listener on each child node | |
$('#parent li').on('click', function(e) { | |
console.log('List item:', e.target.id, 'was clicked'); | |
}); |
This file contains 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
// eventUtility.js | |
var eventUtility = { | |
addEvent: function (el, type, fn) { | |
/* | |
el: HTML element object (DOM object) | |
type: event type to listen to | |
fn: function | |
*/ |
NewerOlder