Skip to content

Instantly share code, notes, and snippets.

View gnat's full-sized avatar
:shipit:
ez pz lemon squeezy

Nathaniel Sabanski gnat

:shipit:
ez pz lemon squeezy
  • Vancouver, Canada
View GitHub Profile
@gnat
gnat / flash_as2_vs_as3.md
Last active March 16, 2024 08:46
Why AS3 sucks and was a terrible direction for Flash (Actionscript 2 vs Actionscript 3)

Why AS3 was a terrible direction for Flash

tl;dr

  • AS3 requires you be an expert in it.
    • No longer accessible to people without a programming focus (artists).
      • Previously possible projects become too difficult in a reasonable timeframe.
      • I teach Flash to designers [...] the threshold of entry as well as the intimidation factor became too high for design students. What they want to do is make something functional and beautiful without needing to spend weeks learning the basics. AS2 made that possible. AS3, to a huge degree, took it away.

      • I'm a designer. [...] I've spent incomprehensible amounts of time learning and re-learning ActionScript. When AS3 was released I took one look at it and threw in the towel. Since then my life has been much better.

  • > Surely as memory/processor constraints dwindle, programming should be becoming LESS verbose, not more. Write less, do more, quicker. Hide the complexities of common tasks in simple short terms, not have to write a hundred lines t
@gnat
gnat / index.html
Last active March 12, 2024 14:01
3D Card (Surreal + CSS Scope Inline)
<html>
<head>
<script src="https://gnat.github.io/css-scope-inline/script.js"></script>
<script src="https://gnat.github.io/surreal/surreal.js"></script>
</head>
<body>
<style>
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; }
body { font-family: system-ui, sans-serif; perspective: 1500px; background: linear-gradient(#666, #222); }
@gnat
gnat / Dockerfile
Last active February 20, 2024 02:56 — forked from adtac/Dockerfile
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "podman run -p 8080:8080 -it --rm \$(podman build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | tail -n1)"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@gnat
gnat / photoshop_linux.md
Last active September 17, 2023 10:25
Photoshop on Linux
  • Use Bottles flatpak.
  • Before Install
    • Menu ▶️ Runners ▶️ Get the latest GE Wine
  • Install
    • Custom ▶️ Select latest GE Wine
    • Click new bottle ▶️ Dependencies
      • atmlib
      • msxml3 msxml6
      • vcrun2008 vcrun2010 vcrun2012 vcrun2013
  • Expose directories to flatpak
@gnat
gnat / sublime_build_on_save.md
Last active September 12, 2023 08:35
Sublime Build on Save

Sublime Build on Save

Sublime in 2023 only has "Save on Build" not "Build on Save" built in.. use: https://github.com/alexnj/SublimeOnSaveBuild

Setting up a build.

  • Tools ➡️ Build System ➡️ New Build System...

run_on_save.sublime-build

{
@gnat
gnat / index.html
Last active September 9, 2023 07:28
Inline Stylus CSS demo
<html>
<head>
<title>Inline real time stylus demo</title>
<script>
function stylus_to_css(string){
var cursor=0
// Remove excess indentation (dedent).
var indent=''
while (cursor < string.length) {
@gnat
gnat / project_layout.md
Last active February 2, 2024 11:39
General Project Layout

Why?

A universal project layout that can work for websites, games, apps, and more.

Project Layout

  • [project group] - Umbrella name to contain a number of projects (ex: "widget company")
    • [project name] - (ex "website", "app", "documentation")
      • /notes - Related or "also" files that do not have a home. Documentation, images. The projects' scratch pad.
  • /public - Web server will it will point here (like /www). Often contains assets. Complete builds can go here.
@gnat
gnat / godot.md
Last active October 5, 2023 21:59
Godot 4 Quickstart

Godot 4 - Fast quickstart!

Legend

  • ♻️ Workflow
  • 🛠️ Tool
  • 📦 Asset or Library
  • ⭐ Guides
  • 🎨 Pattern
  • 🔥 Hot Tip
@gnat
gnat / postgres_portable_no_install.md
Last active May 19, 2024 20:06
Postgres Standalone

🐘 Postgres Standalone

Why?

  • Localize your database into one single folder of your choosing.
  • No sudo / root requirement.
  • Run multiple Postgres at the same time on the same machine- Full bare metal performance.
  • Postgres is a great starter before moving to "slow single machine but horizontal scale": CockroachDB, ScyllaDB, etc.

Compile

@gnat
gnat / uuid_ulid_alternative.md
Last active February 29, 2024 12:16
64 bit ordered unique id.

Better Primary Keys (id)

Why not just use sequential ID's (SERIAL or AUTO INCREMENT) ?

  • Writes at scale require partitioning (aka sharding) CockroachDB is automated partitioning.
    • Make your life easy by avoiding SERIAL and AUTO INCREMENT from the start.
  • SERIAL or AUTO INCREMENT ID's become very slow at scale.
    • A cluster has to ask "what's the next available id in the sequence?" = huge contention.
      • Unique consensus is bad enough, but unique consensus that also has to wait for the previous sequence number = really bad. Turns into a queue.
  • Time-based ID's are fast at scale.
  • No waiting in a queue. (At worst, may only need to do a unique consensus.)