Skip to content

Instantly share code, notes, and snippets.


Steve Coffman StevenACoffman

View GitHub Profile
leophys / godoc.zsh
Last active Nov 28, 2022
Optionally colored and fuzzy findable godoc
View godoc.zsh
### colored and fuzzy go doc
if which bat > /dev/null; then
function _godoc() {
if echo $1|grep -q -E "^([a-zA-Z0-9/]+)$"; then
go doc ${@} | bat -p -l md
elif echo $1|grep -q -E "^[a-zA-Z0-9/]+\.[a-zA-Z0-9.]+$"; then
go doc ${@} | bat -p -l go
elif echo $1|grep -q -E "^([a-zA-Z0-9/._-]+)/.*\.[a-zA-Z0-9.]+$"; then
go doc ${@} | bat -p -l go
wijayaerick / slog_console_handler.go
Last active Nov 30, 2022
Example ConsoleHandler for Logger
View slog_console_handler.go
// ConsoleHandler formats slog.Logger output in console format, a bit similar with Uber's zap ConsoleEncoder
// The log format is designed to be human-readable.
// Performance can definitely be improved, however it's not in my priority as
// this should only be used in development environment.
// e.g. log output:
// 2022-11-24T11:40:20+08:00 DEBUG ./main.go:162 Debug message {"hello":"world","!BADKEY":"bad kv"}
// 2022-11-24T11:40:20+08:00 INFO ./main.go:167 Info message {"with_key_1":"with_value_1","group_1":{"with_key_2":"with_value_2","hello":"world"}}
// 2022-11-24T11:40:20+08:00 WARN ./main.go:168 Warn message {"with_key_1":"with_value_1","group_1":{"with_key_2":"with_value_2","hello":"world"}}
iNetJoJo / workload.go
Created Oct 31, 2022
cool util for starting alot of gorutines with error handling
View workload.go
package workload
import (
type Worker func() error
StevenACoffman / main.go
Created Sep 2, 2022 — forked from pteich/main.go
Example for using go's sync.errgroup together with signal detection signal.Notify to stop all running goroutines
View main.go
package main
import (
preslavrachev / do.go
Last active Aug 4, 2022
Do is an experiment in mimicking the Result type (known from languages like Rust and Haskell). The idea is to minimize the amount of error checking and let the developer focus on the happy path, without undermining the power of Go's errors. The code below requires Go 1.18+, as it makes use of generic type parameters.
View do.go
package do
type Void struct{}
type Result[T any] interface {
Unwrap() (T, error)
type defaultResult[T any] struct {
val T

From The 7 Types of Pull Requests:

After reading Rouan Wilsenach’s article on Ship / Show / Ask, I realized that when creating a pull request, I’m thinking about:

  • How can I confidently get my code out of the door?
  • Will my changes pass the automated CI checks?
  • Will my changes pass a self-review? I.e. would I approve my own PR?
  • Will my colleagues be able to give me good feedback?

So this gives us 7 types of pull-request:

No Pull Request / Ship
StevenACoffman /
Created Oct 3, 2021
Get Source code from Stack overflow
rafi /
Last active Nov 9, 2022
Keycloak and oauth2-proxy using k3d & ngrok:

K3d and Keycloak


Ensure docker, k3d and ngrok are installed.

brew update
brew install --cask docker ngrok
brew install k3d
View chart.js
function rest(dag) {
layering = d3.layeringSimplex()
decrossing = d3.decrossOpt()
coords = d3.coordQuad()