Skip to content

Instantly share code, notes, and snippets.

'use strict';
//data type
class Option { }
Option.None = class { toString() { return "None" } };
Option.Some = class { constructor(value) { this.some = value } toString() { return `Some:${this.some}` } };
//computation builder
let maybe = function (genFunc) {
let gen = new genFunc();
defmodule PongServer do
use GenServer
def handle_call(:ping, _from, state) do
:timer.sleep(1000)
{:reply, { :ok, "pong #{state}" }, state}
end
end
defmodule MyModule do
def doSomething(num) do
if num != 1 do
{:ok, num + 1}
else
{:error, "some reason"}
end
end
end
var RESPONSIVE_BREAKPOINT_WIDTH = 770;
var mileStone, home, master, productListing, productListDropdown;
var isResponsive = false;
var pagePos = 0;
var storeLocator;
var featuredPhotoArr = [];
var isMobile = checkMobile();
if (!Object.keys) {
Object.keys = (function() {

Java

  • Reflection
  • Change modifier to protected and put tests into same place

Go

/github.com/example/mypackage.go
 /mypackage_internal_test.go 
package com.company;

public class Main {

    public static void main(String[] args) {
	    SoftwareEngineer a = new SoftwareEngineer();
        ((Employee)a).foo();
    }
}
package hello
import (
"testing"
"sync"
)
func benchmarkChannel(b *testing.B, nProducer int) {
ch := make(chan int)
var wg sync.WaitGroup
關於月用量超過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日
function foo(cb) {
cb();
}
console.time("anonymous function");
for (var i = 0; i < 10000000; i++) {
@dg3feiko
dg3feiko / singleflight.go
Created August 12, 2017 05:23
SingleFlight Benchmark
// 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"