Skip to content

Instantly share code, notes, and snippets.

View srt32's full-sized avatar
πŸ’­
wahoo

Simon Taranto srt32

πŸ’­
wahoo
  • GitHub
  • WORLD
  • 01:05 (UTC -04:00)
View GitHub Profile
// in this case we inject the database as argument to another package
package httpd
import (
"net/http"
"path/to/db"
)
var db *db.Database

docs

To start godoc at log in time (so it always there on port 6060 when you need it):

  1. copy smarticus.godoc.plist to in ~/Library/LaunchAgents
  2. launchctl load ~/Library/LaunchAgents/smarticus.godoc.plist
  3. visit http://localhost:6060
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active March 24, 2025 20:20
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@harlow
harlow / golang_job_queue.md
Last active March 29, 2025 04:55
Job queues in Golang
package main
const MaxLength = 1 << 20
var (
addr = flag.String("listen", ":8000", "listen for requests")
numprocs = flag.Int("p", runtime.NumCPU(), "number of workers to start")
maxqueue = flag.Int("q", runtime.NumCPU()*2, "largest queue size")
jobs chan Job
@jamtur01
jamtur01 / ladder.md
Last active February 17, 2025 09:09
Kickstarter Engineering Ladder
anonymous
anonymous / markov_data.ipynb
Created August 20, 2016 15:26
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alex-ant
alex-ant / gzip.go
Created January 16, 2017 13:50
golang: gzip and gunzip
package main
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"log"
)
@srt32
srt32 / honeybadger_parser.rb
Last active November 8, 2022 19:56
parse the JSONL export from honeybadger.io
# usage: cat ~/Downloads/log_foo-bar-baz.jsonl | ruby honeybadger_parser.rb
require 'json'
data = ARGF.read
lines = data.split("\n")
grouped = lines.group_by do |line|
JSON.parse(line)["request"]["context"]["project_id"]
end
@swalkinshaw
swalkinshaw / tutorial.md
Last active February 26, 2025 21:15
Designing a GraphQL API