Skip to content

Instantly share code, notes, and snippets.

View flimzy's full-sized avatar

Jonathan Hall flimzy

View GitHub Profile
#!/bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28
This file has been truncated, but you can view the full file.
"use strict";
(function() {
Error.stackTraceLimit = Infinity;
var $global, $module;
if (typeof window !== "undefined") { /* web page */
$global = window;
} else if (typeof self !== "undefined") { /* web worker */
$global = self;
Chromium Version 55.0.2883.75 built on Debian stretch/sid, running on Debian stretch/sid (64-bit):
len: 1
go 10000 110000 ns/op 0.01 MB/s
webcrypto 1000 1595000 ns/op 0.00 MB/s
len: 1000
go 1000 1270000 ns/op 0.79 MB/s
webcrypto 1000 1629000 ns/op 0.61 MB/s
1.
Request{
Name: "Tickets for Admin",
Method: "GET",
URL: Server.URL + "/v1/inboxes/9991/tickets/Active.json",
StatusCode: http.StatusOK,
TestContentType: "application/json",
TestCharset: "utf-8",
TestBodyJSON: func(i interface{}) error {
package main
import (
"encoding/json"
"fmt"
)
type Customer struct {
ID int `json:"id"`
FirstName string `json:"firstName"`
diff --git a/conn.go b/conn.go
index 1af4474..ba9f6fc 100644
--- a/conn.go
+++ b/conn.go
@@ -8,7 +8,6 @@ import (
"bytes"
"fmt"
"io"
- "net"
"net/url"
@flimzy
flimzy / main.go
Last active April 12, 2017 18:49
package main
import (
"bytes"
"fmt"
"net/http"
"strings"
"sync"
"sync/atomic"
)
@flimzy
flimzy / gist:714c7c8a3f5541c1b4595421929b3020
Created July 8, 2017 11:38
GopherJS transpilation of func (l *Logger) Output in the standard library 'log' package
Logger.ptr.prototype.Output = function(calldepth, s) {
var $ptr, _r, _tuple, _tuple$1, calldepth, err, file, l, line, now, ok, s, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $ptr = $f.$ptr; _r = $f._r; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; calldepth = $f.calldepth; err = $f.err; file = $f.file; l = $f.l; line = $f.line; now = $f.now; ok = $f.ok; s = $f.s; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
l = this;
now = $clone(time.Now(), time.Time);
file = "";
line = 0;
l.mu.Lock();
$deferred.push([$methodVal(l.mu, "Unlock"), []]);
if (!(((l.flag & 24) === 0))) {
keyHoldLoop = function() {
var _entry, _entry$1, _i, _key, _keys, _r, _ref, delta, k, next, now, x, x$1, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _entry$1 = $f._entry$1; _i = $f._i; _key = $f._key; _keys = $f._keys; _r = $f._r; _ref = $f._ref; delta = $f.delta; k = $f.k; next = $f.next; now = $f.now; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
next = new time.Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType.nil);
delta = new time.Duration(0, 0);
now = $clone(time.Now(), time.Time);
/* while (true) { */ case 1:
_r = fmt.Println(new sliceType([new $String("Keyhold loop")])); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r;
time.Time.
func (h *handler) GetData(ctx context.Context, request Payload) (*Data, error) {
go func(ctx context.Context) {
<-ctx.Done()
if ctx.Err() == context.Canceled {
log.Info(ctx.Err())
}
}(ctx)
data := fetchData(request)