Skip to content

Instantly share code, notes, and snippets.

Erik Dubbelboer erikdubbelboer

Block or report user

Report or block erikdubbelboer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ToSnakeCase.go
package main
import (
"fmt"
"regexp"
"strings"
)
var (
matchBeforeCap = regexp.MustCompile("([a-z])([A-Z])")
View test_server.go
package main
import (
"net"
"runtime"
"time"
)
func main() {
runtime.GOMAXPROCS(2)
View datetest.go
package main
import (
"bytes"
"fmt"
"net"
"github.com/valyala/fasthttp"
)
View benchmark.go
package main
import (
"fmt"
"net"
"runtime"
"sync"
"sync/atomic"
"time"
View browser.js
var browser = (function(){
var test = function(regexp) { return regexp.test(window.navigator.userAgent);}
switch(true){
case test(/edge/i): return 'edge';
case test(/opr/i) && (!!window.opr || !!window.opera): return 'opera';
case test(/chrome/i) && !!window.chrome: return 'chrome';
case test(/firefox/i) : return 'firefox';
case test(/safari/i): return 'safari';
default: return '';
}
View test.go
package main
import (
"bytes"
"fmt"
"net"
"runtime"
"sync"
"sync/atomic"
"time"
@erikdubbelboer
erikdubbelboer / uuid_vs_ai.go
Created Jul 20, 2019
UUID vs Auto Increment as Primary Key in MySQL
View uuid_vs_ai.go
/*
CREATE TABLE `test_ai` (
`id` int(11) NOT NULL,
`col1` int(11) NOT NULL,
`col2` int(11) NOT NULL,
`col3` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
ALTER TABLE `test_ai`
View speech.js
// See: https://bugs.chromium.org/p/chromium/issues/detail?id=799849
var grammar = '#JSGF V1.0; grammar commands; public <command> = left | right | jump | duck ;'
var recognition = new webkitSpeechRecognition();
var speechRecognitionList = new webkitSpeechGrammarList();
speechRecognitionList.addFromString(grammar, 1);
recognition.grammars = speechRecognitionList;
recognition.continuous = true;
recognition.lang = 'en-US';
recognition.interimResults = false;
recognition.maxAlternatives = 1;
View goroutine-pool-test.go
package main
import (
"net"
"runtime"
"sync/atomic"
"time"
"github.com/valyala/fasthttp"
"github.com/valyala/fasthttp/fasthttputil"
View test.go
package main
import (
"math/rand"
"net"
//"runtime"
"sync/atomic"
"time"
"github.com/valyala/fasthttp"
You can’t perform that action at this time.