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 canvas = document.getElementById("container"); | |
var ctx = canvas.getContext("2d"); | |
// The line settings | |
ctx.lineWidth = 4; | |
ctx.lineJoin = ctx.lineCap = "round"; | |
var intervalSource = Rx.Observable.interval(2 * 1000, Rx.Scheduler.requestAnimationFrame); | |
var pauser = new Rx.Subject(); |
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 profile OAuthProfile | |
MapToStruct(result, &profile) | |
fmt.Println("Extracted", profile) | |
func MapToStruct(m map[string]interface{}, val interface{}) error { | |
tmp, err := json.Marshal(m) |
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
s := func(name string) string { | |
time.Sleep(4 * time.Second) | |
fmt.Println("Do something", name) | |
return "Done" | |
} | |
results := []string{} | |
c := make(chan string) | |
go func() { c <- s("first") }() |
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 getProviderInfo = function (provider) | |
{ | |
return new Promise(function (resolve, reject) { | |
var time = ~~(Math.random() * 2000) + 2000; | |
// Make request and get the data, simulate request api, no fail in our case | |
window.setTimeout(function () { | |
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 p1 = new Promise(function (resolve) { | |
return resolve(10); | |
}); | |
var add = function (num) { | |
return new Promise(function (resolve) { |
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 requests = { docs: [ 'hello' ], boards: [ 'R404' ] }; | |
var fetchResultTransform = function (requests) | |
{ | |
var resource = []; | |
Object.keys(requests).forEach(function (colName) | |
{ | |
requests[colName].forEach(function (docName) | |
{ |
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 aws = require('aws-sdk'); | |
var util = require('util'); | |
var SQS = new aws.SQS({ | |
accessKeyId: 'xxxx', | |
secretAccessKey: 'xxx', | |
region: 'xxx', | |
sslEnabled: false, | |
paramValidation: true, | |
convertResponseTypes: true, |
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 config = require("config"); | |
var pg = require("pg"); | |
var PromiseB = require("bluebird"); | |
PromiseB.promisifyAll(pg); | |
// To prevent data loss handle bigint as string | |
// https://github.com/brianc/node-postgres/pull/353 | |
pg.defaults.parseInt8 = false; |
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
{ | |
"auto_indent": true, | |
"bold_folder_labels": false, | |
"caret_style": "wide", | |
"color_scheme": "Packages/User/Monokai (SL).tmTheme", | |
"ensure_newline_at_eof_on_save": true, | |
"file_exclude_patterns": | |
[ | |
"*.pyc", | |
"*.pyo", |
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
// Paste in browser developer tools | |
Array(100).join('.').split('.').map(function (a, index) { return (~~(Math.random()*(1<<24))).toString(16) }).forEach(function(color) { console.log("%c ", "background-color: #" + color) }); |