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
;<!doctype html> | |
<html ng-app="myapp"> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.min.js"></script> | |
<script src="https://cdn.firebase.com/v0/firebase.js"></script> | |
<script src="https://cdn.firebase.com/libs/angularfire/0.6.0/angularfire.min.js"></script> | |
<link rel="stylesheet" type="text/css" href="https://www.firebase.com/css/example.css"> | |
</head> | |
<body ng-controller="MyController"> | |
<div id="messagesDiv"> |
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
/** 30_days_of_code | |
* Playing with promise implementations | |
* | |
* used doc here to step by step build: http://mattgreer.org/articles/promises-in-wicked-detail/ | |
*/ | |
function Promise(fn) { | |
var state = 'pending'; | |
var value; | |
var deferred = null; |
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 koa = require('koala'); | |
var app = koa(); | |
app.use(function *(){ | |
//console.log(this.req, this.path); | |
if(this.path==='/hey'){ | |
this.body = yield dogs; | |
}else{ | |
if(this.path!=='/favicon.ico'){ | |
// don't call the function...it needs to return a 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 pg = require ('pg'); | |
var pgConString = "postgres://localhost/xxxx" | |
pg.connect(pgConString, function(err, client) { | |
if(err) { | |
console.log(err); | |
} | |
client.on('notification', function(msg) { | |
console.log(msg); |
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
// for our internal time | |
saverTimer := logger.Timer() | |
var totalParseTime time.Duration | |
var totalTime time.Duration | |
for { | |
row, err := csvReader.ReadMap(false) | |
... | |
start := time.Now() |
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'; | |
/** | |
* This shows the currency formatting by locales. | |
* To add a new locale just update the locales var below. | |
* | |
* To run: | |
* `node translations/tasks/example_outputs.js` to view the output. | |
*/ |
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"; | |
console.log(process.env.TZ); | |
// process.env.TZ = "Asia/Shanghai"; | |
let moment = require('moment'); | |
const format = "YYYY-MM-DD"; | |
let d, dUTC, dTZ, dJS; | |
const hours = ["00","01","02","03","04","05","06","07","08","09","10","11","12", | |
"13","14","15","16","17","18","19","20","21","22","23","24"]; |
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
#!/usr/bin/env bash | |
# fresh-chrome | |
# | |
# Use this script on OS X to launch a new instance of Google Chrome | |
# with its own empty cache, cookies, and user configuration. | |
# | |
# The first time you run this script, it will launch a new Google | |
# Chrome instance with a permanent user-data directory, which you can | |
# customize below. Perform any initial setup you want to keep on every |
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
https://www.postgresql.org/docs/9.4/static/monitoring-stats.html | |
https://www.postgresql.org/docs/9.4/static/functions-admin.html | |
-- show blocking pids in a nice tree | |
-- query as blocked_query | |
-- 9.6++ | |
select pid, usename, | |
age(query_start, clock_timestamp()), | |
pg_blocking_pids(pid) as blocked_by, | |
query |
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
// Place your key bindings in this file to overwrite the defaults | |
[ | |
{ "key": "cmd+,", "command": "workbench.action.navigateBack" }, | |
{ "key": "cmd+.", "command": "workbench.action.navigateForward" } | |
] |