Skip to content

Instantly share code, notes, and snippets.

View flowchartsman's full-sized avatar
🏠
Working from home

Andy Walker flowchartsman

🏠
Working from home
View GitHub Profile
package main
import (
"net/http"
"github.com/gorilla/mux"
)
// example of a basic handler
func fooHandler(w http.ResponseWriter, r *http.Request) {
v, ok := inter.(MyType)
if !ok {
return errors.New ("nope")
}
// becomes
switch v := inter.(type) {
case MyType:
// do MyType stuff with v
@flowchartsman
flowchartsman / start.md
Last active July 19, 2022 13:51
Zero To Go

Intro

This is an experiment in self-teaching Go, starting from complete unfamiliarity with the language. The goal is to provide a step-by-step educational resource that you can follow at your own pace, where each phase effectively builds on that which came before it with as little unnecessary overlap as possible. It's very much a "living document" or work in progress, and will likely be under constant revision as I revisit advice, update sources, tweak ordering and learn more about how these resources interact to create a well-rounded knowledge of the language. Please feel free to issue feedback and make any suggestions you feel are pertinent.

Reading

  1. Go through the tour at https://tour.golang.org/list
  2. Promptly abandon all of those plans you have to use channels everywhere
  3. Read the language spec once over: https://golang.org/ref/spec
  4. https://dave.cheney.net/2017/04/26/understand-go-pointers-in-less-than-800-words-or-your-money-back
  5. Read Effective Go: https://golang.org/doc/effective_go.htm
blueprint:
name: Frigate Notification (0.10.0) w/ ignoretime
description: |
## Frigate Mobile App Notification
This blueprint will send a notification to your device when a Frigate event for the selected camera is fired. The notification will initially include the thumbnail of the detection, but include an actionable notification allowing you to view the clip and snapshot.
With this blueprint, you may send the notification to multiple devices by leaving "Device" blank and instead use a [notification group][1].
### Software Version Requirements
@flowchartsman
flowchartsman / json_test.go
Created November 2, 2022 20:08 — forked from LOZORD/json_test.go
An example of using a native JSON-friendly Go struct as a type and input in a CEL program.
package test
import (
"bytes"
"encoding/json"
"testing"
"github.com/golang/protobuf/jsonpb"
structpb "github.com/golang/protobuf/ptypes/struct"
"github.com/google/cel-go/cel"
@flowchartsman
flowchartsman / .github_dependabot.yml
Created March 16, 2023 22:02
Golang testing and github workflow w/ coverage, dependencies and badges
version: 2
updates:
- package-ecosystem: github-actions
directory: /
labels:
- dependencies
- actions
- Skip Changelog
schedule:
interval: weekly
@flowchartsman
flowchartsman / main.go
Last active June 15, 2023 01:21
bubbletea multiprogress widget supporting new widgets, failure, reset, all controlled externally
package main
import (
"fmt"
"math/rand"
"os"
"strconv"
"time"
tea "github.com/charmbracelet/bubbletea"