Skip to content

Instantly share code, notes, and snippets.

View wijayaerick's full-sized avatar
🏝️
I may be slow to respond.

Erick Wijaya wijayaerick

🏝️
I may be slow to respond.
View GitHub Profile
@wijayaerick
wijayaerick / slog_console_handler.go
Last active November 25, 2023 06:40
Example ConsoleHandler for golang.org/x/exp/slog Logger
// 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"}}
@wijayaerick
wijayaerick / rambox_dark_mode.js
Created October 25, 2020 18:43
JS Script to set Rambox header color to dark mode
// Source: https://github.com/ramboxapp/community-edition/issues/1532#issue-305344812
//
// I put the script in gist so I can find it easier
// dark mode
document.querySelector('.x-tab-bar').style.backgroundColor='#20272D';
document.querySelectorAll('.x-tab').forEach(function(el){el.style.backgroundColor='#40474D';});