Make sure that git binary is in your PATH environment variable.
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
package main | |
import ( | |
"net/http" | |
"log" | |
"time" | |
) | |
func main() { | |
http.HandleFunc("/", func (w http.ResponseWriter, r *http.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
function toInt64buffer(n) { | |
var hi = (n / 0x100000000) | 0; | |
var lo = n % 0x100000000; | |
var buff = new ArrayBuffer(8); | |
var view = new Uint8Array(buff); | |
for (var i = 7; i >= 0; i--) { | |
view[i] = lo & 0xff; | |
lo = i == 4 ? hi : lo >>> 8; | |
} |
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
// chrome | |
Object.keys(document) | |
.filter(function (i) { | |
return i.substring(0,2) == 'on' && (document[i] == null || typeof document[i] == 'function'); | |
}) | |
.map(function (e) { | |
return e.slice(2); | |
}) | |
.forEach(function (eventName) { | |
document.addEventListener(eventName, function (event) { |
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
reader = fn (source) { | |
// fetch data from somewhere e.g. http server and emit result | |
this.emit('some data') | |
} | |
parser = fn (data) { | |
// parse and validate data and emit result | |
this.emit(parsedData) | |
} |
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
html { | |
overflow-y: scroll; | |
} | |
body { | |
padding-top: 60px; | |
font-size: 13px; | |
} | |
section { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Node.js sample application</title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width"> | |
<link rel="stylesheet" href="/css/bootstrap.min.css"> | |
<link rel="stylesheet" href="/css/social-buttons.css"> |
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 ejs = require('ejs-locals'); | |
var app = express(); | |
app.engine('ejs', ejs); | |
app.set('views', __dirname + '/views'); | |
app.set('view engine', 'ejs'); | |
require(__dirname + '/router')(app); |
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
<% layout('../layout') -%> | |
<h2>This is the home page</h2> | |
<p><b>Message from contoller:</b> <%= message %></p> |
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
// exception.js | |
var ObjectId = require('mongojs').ObjectId | |
, id = '000000000000000000000000'; | |
for (var i = 0; i < 1000000; i++) { | |
try { | |
var _id = ObjectId(id); | |
} catch (e) { | |
// |
NewerOlder