Skip to content

Instantly share code, notes, and snippets.

View theetrain's full-sized avatar

Enrico Sacchetti theetrain

View GitHub Profile
@theetrain
theetrain / timezone-library-research.md
Last active June 17, 2026 16:37
Preparing for timezone policy changes

Why

British Columbia will make daylight savings time permanent, and we need to ensure our systems respect those changes so that dates and times appear correctly in those user's locale.

Article: https://vancouversun.com/news/bc-daylight-time-permanent

Preliminary research

I was curious to know how various operating systems and platforms handle updates to timezone data:

@theetrain
theetrain / Design_System_Principles.md
Last active January 16, 2026 14:20
Design System Principles

Have an accessibility-first mindset

Users of the web live with a spectrum of abilities. We need to be abundantly cautious to not create barriers to information access such as in these cases:

  • Truncating essential information that either requires more interactions to view, or leaves the user stranded.
  • Using colour alone to convey information that is not interpretable by colour blind individuals.
  • Providing feedback after an interaction is made, but not focusing on that feedback; which is invisible to users with a screen reader or screen magnifier.
  • Providing keyboard shortcuts for elements that have built-in standard shortcuts without informing the user, potentially breaking their workflow or breaking their assistive technology.

More information, data, guides, and resources: Accessibility.

@theetrain
theetrain / accessibility.md
Last active October 17, 2025 22:59
Accessibility pledge
@theetrain
theetrain / package.json
Created December 20, 2024 15:42
Example Svelte UI library package.json
{
"name": "@internal/ui-svelte",
"version": "0.0.0-semantically-released",
"description": "Component library for the common Svelte components",
"license": "SEE LICENSE IN LICENSE",
"repository": {
"type": "git",
"url": "git+https://github.com/redacted/ui-svelte.git"
},
"files": [
<!--
"Reacting to checkboxes" by Enrico
https://github.com/theetrain
Synchronizes checkbox state between two different views
of checkboxes.
-->
<script>
import Container from './Container.svelte'
@theetrain
theetrain / auto-import-css.md
Created June 21, 2024 02:42
Automatically import library CSS with Svelte components

Cool Vite thing I learned today; @import in .css files will be inlined at build time.

/* main.css */
@import url('variables.css');
@import url('normalize.css');

This becomes a single CSS file in the production build; and if you happen to add it to a shared library (npm package), you can have it auto-import global styles along with Svelte components.

@theetrain
theetrain / +page.server.js
Last active August 12, 2024 12:55
MaybeStream
import { maybeStream } from '$lib/utils'
/** @type {import('./$types').PageServerLoad} */
export async function load({ isDataRequest }) {
const combinationResponse = maybeStream(pretendAPI(), { isDataRequest })
const otherCombinationResponse = maybeStream(pretendAPI(), { isDataRequest })
let [combination, other] = await Promise.all([
combinationResponse,
otherCombinationResponse
@theetrain
theetrain / +page.server.ts
Created September 12, 2023 02:01
PocketBase JavaScript SDK back-end connection (SvelteKit example)
import { connect } from '$lib/server/pbclient'
import { redirect, type Actions } from '@sveltejs/kit'
export const actions = {
create: async ({ request, cookies }) => {
const data = await request.formData()
const post = [...data.entries()]
const pb = await connect()
@theetrain
theetrain / .eslintrc.json
Created August 28, 2023 14:23
Svelte ESLint config
{
"root": true,
"extends": ["prettier", "standard"],
"plugins": ["@typescript-eslint"],
"parser": "@typescript-eslint/parser",
"rules": {
"arrow-parens": ["error", "as-needed"],
"operator-linebreak": ["error", "before"],
"no-trailing-spaces": [
"error",
@theetrain
theetrain / ui-chooser.mmd
Last active May 28, 2023 16:00
Choosing a UI library (Svelte Edition)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.