Skip to content

Instantly share code, notes, and snippets.

View nussjustin's full-sized avatar

Justin Nuß nussjustin

View GitHub Profile
@nussjustin
nussjustin / JIRA-Table-With-Rows-Number.js
Last active February 7, 2024 16:04
JIRA Table Extractor for Intellij (Scratches and Consoles > Extensions > Database Tools and SQL > data > extractors)
function eachWithIdx(iterable, f) { var i = iterable.iterator(); var idx = 0; while (i.hasNext()) f(i.next(), idx++); }
function mapEach(iterable, f) { var vs = []; eachWithIdx(iterable, function (i) { vs.push(f(i));}); return vs; }
function escape(str) {
str = str.replaceAll("\t|\b|\\f", "");
str = com.intellij.openapi.util.text.StringUtil.escapeXml(str);
return str;
}
var NEWLINE = "\n";
var EMPTY = "_EMPTY_";
@nussjustin
nussjustin / userscript.js
Last active August 12, 2020 05:44
Golang Release Notes CL Links - Displays links to CLs on Go release notes
// ==UserScript==
// @name Golang Release Notes CL Links
// @namespace https://github.com/nussjustin
// @version 0.1
// @description Displays links to CLs on Go release notes
// @author Justin Nuß
// @match https://golang.org/doc/go*.*
// @match https://tip.golang.org/doc/go*.*
// @grant none
// ==/UserScript==
@nussjustin
nussjustin / stackcollapse.go
Last active February 7, 2022 17:02
quick'n'dirty stackcollapse v2 (faster, cleaner, more awesome, and now with support for blackfire profile output)
package main
import (
"bufio"
"flag"
"fmt"
"io"
"log"
"os"
"strconv"
@nussjustin
nussjustin / read.go
Created April 12, 2018 11:21
encoding/xml optimizations
// Copyright 2009 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 xml
import (
"bytes"
"encoding"
"errors"
@nussjustin
nussjustin / iface_test.go
Created January 3, 2016 19:16
Allocation example
package iface_test
import "testing"
func setOneLine(p *int, v interface{}) {
*p = v.(int)
}
func setTwoLines(p *int, v interface{}) {
intv := v.(int)
PASS
BenchmarkClientStreamc1-8 30000 121497 ns/op 2015 B/op 46 allocs/op
--- Histogram (unit: µs)
Count: 30000 Min: 54 Max: 1147 Avg: 118.84
------------------------------------------------------------
[ 54, 55) 1 0.0% 0.0%
[ 55, 56) 2 0.0% 0.0%
[ 56, 57) 3 0.0% 0.0%
[ 57, 58) 6 0.0% 0.0%
[ 58, 60) 31 0.1% 0.1%