Important
This is an unofficial Korean translation of The Grug Brained Developer by Carson Gross.
| type UnixTime struct{ time.Time } | |
| func (t *UnixTime) UnmarshalJSON(b []byte) error { | |
| if string(b) == "null" { | |
| t.Time = time.Time{} | |
| return nil | |
| } | |
| var value any | |
| if err := json.Unmarshal(b, &value); err != nil { | |
| return err |
Important
This is an unofficial Korean translation of The Grug Brained Developer by Carson Gross.
| // BufferedIterator returns an iterator over data pages. | |
| // | |
| // This implementation uses a goroutine and a buffered channel | |
| // to pre-fetch the next page of data while the current page | |
| // is being processed, optimizing for slow network calls. | |
| // | |
| // This version starts the producer goroutine *lazily* (only when | |
| // iteration begins) to prevent resource leaks if the | |
| // iterator is created but never used. | |
| func BufferedIterator(ctx context.Context, releaseID int) iter.Seq2[*Data, error] { |
| #!/usr/bin/env bash | |
| fx ./data/podcasts.json '{...x, podcasts: sortBy(x => x.title)(x.podcasts)}' save |
| type UnixTime struct{ time.Time } | |
| func (t *UnixTime) UnmarshalJSON(b []byte) error { | |
| if string(b) == "null" { | |
| t.Time = time.Time{} | |
| return nil | |
| } | |
| var timestamp float64 | |
| if err := json.Unmarshal(b, ×tamp); err != nil { | |
| return err |
| package main | |
| import ( | |
| "bytes" | |
| "context" | |
| "encoding/json" | |
| "errors" | |
| "fmt" | |
| "log/slog" | |
| "sync" |
| package fred | |
| import ( | |
| "context" | |
| "database/sql" | |
| "errors" | |
| "log/slog" | |
| "time" | |
| ) |
| package main | |
| import "golang.org/x/text/unicode/norm" | |
| type levenshteinDistancer struct { | |
| deletionCost int | |
| insertionCost int | |
| substitutionCost int | |
| } |
| package main | |
| import ( | |
| "context" | |
| "encoding/json" | |
| "fmt" | |
| "io" | |
| "log/slog" | |
| "os/exec" | |
| "strings" |
| { | |
| "description": "Press Escape to switch to English (sends Escape multiple times)", | |
| "manipulators": [ | |
| { | |
| "conditions": [ | |
| { | |
| "input_sources": [{ "language": "^en$" }], | |
| "type": "input_source_unless" | |
| } | |
| ], |