Skip to content

Instantly share code, notes, and snippets.

@tommyo
tommyo / getFileInfo.js
Last active September 13, 2023 18:13
getting a simple commit log from git in javascript
import { simpleGit } from 'simple-git';
// NOTE: simple-git returns a promise, however, the error handling is not great
const git = simpleGit({
errors(err, res) {
if (err instanceof Error) {
return err;
}
if (res.exitCode === 0) {
return undefined;
@tommyo
tommyo / nested_test.go
Last active February 1, 2022 17:35
Benchmark Generics when running json.Marshal and json.Unmarshal with a nested unknown
package benchmark
import (
"encoding/json"
"testing"
)
var innerJson []byte = []byte(`{ "foo": "bar" }`)
var fullJson []byte = []byte(`{ "name": "foo", "value": { "foo": "bar" }}`)
var fin []byte