Things I Regret About Node.js
https://www.youtube.com/watch?v=M3BM9TB-8yA
If I'd still been working on networking at the time, that never would have happened. But I was off doing stuff for a startup called Autodesk.
| const isCharging = require('is-charging'); | |
| const bluebird = require('bluebird'); | |
| const exec = require('child_process').exec; | |
| (async () => { | |
| while (true) { | |
| let charging = await isCharging() | |
| console.log(charging) | |
| if(!charging){ |
Things I Regret About Node.js
https://www.youtube.com/watch?v=M3BM9TB-8yA
If I'd still been working on networking at the time, that never would have happened. But I was off doing stuff for a startup called Autodesk.
| package main | |
| import ( | |
| "fmt" | |
| "github.com/xitongsys/parquet-go/ParquetFile" | |
| "github.com/xitongsys/parquet-go/Plugin/JSONWriter" | |
| "log" | |
| ) | |
| func main() { |
| var BoostSpatialIndex = require('boost-geospatial-index'); | |
| var _ = require("lodash"); | |
| var bsi = new BoostSpatialIndex(); | |
| var districts = require("/Users/feikolai/Downloads/hkpolygon.json"); | |
| bsi.addBoundingBox('Hong Kong', 113.5932, 22.1022, 114.7104, 22.6188); | |
| districts.features.map(f => { |
Generally, there are two kinds of error handling among all programming langauges:
try-catch, superviser with actors. This style is usually preferrable with scripting.| package main | |
| import ( | |
| "sync" | |
| "testing" | |
| "singleflight" | |
| ) | |
| func BenchmarkSingleFlight(b *testing.B) { | |
| group := &singleflight.Group{} |
| // Copyright 2013 The Go Authors. All rights reserved. | |
| // Use of this source code is governed by a BSD-style | |
| // license that can be found in the LICENSE file. | |
| // Package singleflight provides a duplicate function call suppression | |
| // mechanism. | |
| package singleflight | |
| import "sync" |
| function foo(cb) { | |
| cb(); | |
| } | |
| console.time("anonymous function"); | |
| for (var i = 0; i < 10000000; i++) { |
| 關於月用量超過5GB的大家,如果求高數據用量,直到25-12-2016截稿前最新消息如下: | |
| 1) 4G版3台核武卡(42-150Mbps 4G)$119.1/5GB FUP/30日(原價$188) )(可MNP轉台) | |
| 2) 3G版3台核武卡(42Mbps 3G)$119.1/5GB FUP/30日(原價$188) )(可MNP轉台) | |
| 3) 中國移動 4G/3G數據及話音儲值卡 $88卡 (384kbps-7XXkbps 3G/4G) $69.3/30日(原價$90)(可MNP轉台) | |
| 4) 數碼通 $48卡*15張 =$360/30日(原價$720) | |
| 5) 數碼通限速Plan 3G測試卡(384kbps 3G)=$87.5~ 96.2/30日(原價$98) | |
| 6) 數碼通4G限速卡(1Mbps 4G,10GB FUP後512kbps)= $96.4~106.1/30日(原價$108) | |
| 7) 數碼通42.2Mbps 3G 30日儲值卡 =$198.4~$217.3/30日 | |
| 8) 數碼通100Mbps 4G半日全速及1Mbps 4G半日限速 30日儲值卡 =$151~157.9/30日 | |
| 9) 大檸樂卡4G 全速30日儲值卡(16Mbps 4G) $195/15GB FUP+無限分鐘/30日 |
| package hello | |
| import ( | |
| "testing" | |
| "sync" | |
| ) | |
| func benchmarkChannel(b *testing.B, nProducer int) { | |
| ch := make(chan int) | |
| var wg sync.WaitGroup |