Scattering of thoughts for my eyes (and maybe others?)
To install
eget protocolbuffers/protobuf
# dumps it out in the local directory
General Call Pattern
| package models | |
| // https://aayushacharya.com.np/blog/audit-log-gorm/ | |
| // couldn't get it to work, error inlined towards bottom | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| log "github.com/sirupsen/logrus" | |
| "gorm.io/datatypes" |
| {{define "all"}} | |
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"/> | |
| <title>Document</title> | |
| <link href="/static/output.css" rel="stylesheet"/> | |
| <meta content="width=device-width, initial-scale=1" name="viewport"> | |
| <link | |
| rel="stylesheet" |
| package main | |
| import ( | |
| "embed" | |
| "fmt" | |
| "github.com/go-chi/chi/v5" | |
| "html/template" | |
| "io/fs" | |
| "net/http" | |
| "strconv" |
Scattering of thoughts for my eyes (and maybe others?)
To install
eget protocolbuffers/protobuf
# dumps it out in the local directory
General Call Pattern
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"/> | |
| <title>Document</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| </head> | |
| <body> | |
| <div class="my-4 mx-auto max-w-2xl"> | |
| <div class="text-3xl font-bold underline"> |
It's deeply annoying that most vanilla javascript modal examples either involve some library, some css framework, or are poorly written. This is my crack at this. Unlike many, this will only load the event at startup (courtesy of surreal.js), remove the event listener once its done (to prevent pile-up), and allow for the modal content to be detached from the button.
Why isn't this easier to find?!
Might expand this to include an HTMX example at some point
| # CLI | |
| sudo apt update -y | |
| sudo apt install -y \ | |
| git curl btop \ | |
| docker.io docker-buildx \ | |
| build-essential pkg-config autoconf bison rustc cargo clang \ | |
| libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \ | |
| libvips imagemagick libmagickwand-dev mupdf mupdf-tools \ | |
| redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \ | |
| rbenv apache2-utils |
Much help from this Stackoverflow answer
# generate a self-contained static Go library
go build -ldflag "-s -w" -buildmode=c-archive my_lib.go
# check for the header files my_lib.h and my_lib.a in the directory
ls -ltah my_lib*
# then compile the c programAssumes you have raylib installed.
I found the official cgo docs to be a bit lacking. Specifically on how to get the right include and header files in the path. This alleviates it.
Paths found via pkg-config --libs --cflags raylib. Alternatively you can drop in // #cgo pkg-config: raylib and it will work.
Go appears to be smart about what it inclues and doesn't include. Therefore, if you only pull in one function it does not pull in every function and library from the include file.
Structs can be accesessed in Go via C.struct_YourStruct. See here for more information. Unions get more hairy but its also possible.
For reference when raising the Nginx Proxy and companion Let's Encrypt Setup.