Skip to content

Instantly share code, notes, and snippets.

View icylace's full-sized avatar
🎯
Focusing

Ron Martinez icylace

🎯
Focusing
View GitHub Profile
@lobre
lobre / README.md
Created November 13, 2025 10:38
Relationship Between State and URLs

The idea here was to zoom in on a very specific question: how does application state relate to the URL? Not the whole universe of state in an app, just the part where the URL has a role in carrying, pointing to, or ignoring state entirely.

When the server handles a request, it combines state from different sources: the URL, cookies, headers, and whatever state it keeps internally on its side. On the client, there can also be local UI state, but that never leaves the client unless explicitly sent. So the table is really about the URL’s role among those sources, not about state everywhere.

After thinking through the possibilities, it turns out there are only three patterns for how URLs can participate:

  • The URL contains some of the state directly
    (for example filters, pagination, search parameters)
  • The URL contains a token that points to state stored elsewhere on the server
    (often called “deep linking” in Datastar conversations)
@derekr
derekr / sse_survival_guide.md
Last active November 12, 2025 22:44
SSE FAQ

This is just a stub doc for collecting any SSE related tips/tricks/considerations others in the Datastar community want to share. While it will likely serve as a helpful resource itself, the content will be used to author a more user friendly doc or artifact to reference when learning and leveraging SSE.

SSE FAQ

Are there any SSE gotchas?

There are some known gotchas for SSE documented here:

@lobre
lobre / zig_type_system.md
Last active December 3, 2025 12:41
Zig type system illustrated using ascii diagrams

Zig Type System

Zig aims to be a simple language. It is not easy to define what simple exactly means, but zig is also a low-level programming language that aims for c-compatibility. To reach this goal, it needs good semantics in its type system so that developers have a complete toolbox to manipulate data.

So types in zig are composable, but this can become rapidly overwhelming. See those examples. Are you able to understand them at a glance, as soon as you read them?

*const ?u8
?*const u8
*const [2]u8
@mattmc3
mattmc3 / optparsing_demo.zsh
Last active December 2, 2025 17:37
Zsh option parsing example
# Manual opt parsing example
#
# Features:
# - supports short and long flags (ie: -v|--verbose)
# - supports short and long key/value options (ie: -f <file> | --filename <file>)
# - supports short and long key/value options with equals assignment (ie: -f=<file> | --filename=<file>)
# - does NOT support short option chaining (ie: -vh)
# - everything after -- is positional even if it looks like an option (ie: -f)
# - once we hit an arg that isn't an option flag, everything after that is considered positional
function optparsing_demo() {
@zaceno
zaceno / hats-examples.md
Last active March 10, 2025 15:46
Typescript + Hyperapp examples

Hello World

import {h, text, app} from "hyperapp"

app({
  view: () => h('main', {}, text('text')),
  // cast to Node only if you're sure it exists
  node: document.getElementById('app') as Node,
})
@sindresorhus
sindresorhus / esm-package.md
Last active December 10, 2025 13:22
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@ityonemo
ityonemo / test.md
Last active December 8, 2025 03:51
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

@roalcantara
roalcantara / XDG.cheat-sheet.md
Last active December 12, 2025 01:21
XDG cheat sheet

XDG - Base Directory Specification (extended)

Directories

Base

The intended use-case for BaseDirectories is to query the paths of user-invisible standard directories that have been defined according to the conventions of the operating system the library is running on.