Skip to content

Instantly share code, notes, and snippets.

View yuretz's full-sized avatar
🧐
pondering & elaborating

yuretz

🧐
pondering & elaborating
View GitHub Profile
@jordienr
jordienr / api.ts
Created January 15, 2024 12:48
Fully typed API client with zod and fetch
import { z } from "zod";
const Post = z.object({
id: z.string(),
slug: z.string(),
content: z.string(),
title: z.string()
})
export function createAPIClient() {

This gist is a simple no-brainer description of the 3 ways (actually 2.5) the Web handle events.

<tag onclick />

The declarative inline HTML event listener is mostly an indirection of DOM Level 0 events, meaning this simply uses the equivalent of tag.onclick = listener behind the scene.

Example

click me
@ashmind
ashmind / run-cli.csproj
Last active October 13, 2021 16:24
Arbitrary scripts with dotnet run
<Project>
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<OutputType>Exe</OutputType>
<OutDir>build/bin</OutDir>
<BaseIntermediateOutputPath>build/obj</BaseIntermediateOutputPath>
</PropertyGroup>
<Target Name="PrepareProgram" BeforeTargets="BeforeBuild">
<PropertyGroup>
using System;
using System.Threading.Tasks;
namespace System.Collections.Concurrent
{
public static class ConcurrentDictionaryExtensions
{
/// <summary>
/// Provides an alternative to <see cref="ConcurrentDictionary{TKey, TValue}.GetOrAdd(TKey, Func{TKey, TValue})"/> that disposes values that implement <see cref="IDisposable"/>.
/// </summary>
@WebReflection
WebReflection / uce-vs-lit-element.md
Last active January 8, 2024 07:16
A very simple comparison table between uce and lit-element.

A very simple comparison table between these two libraries.

uce lit-element
version 1.11.9 2.4.0
license ISC (simplified MIT) BSD-3-Clause License
language JS w/ TS definition TS w/ JS transpilation
size ( brotli ) 9437b ES5 / 6811b ES2015+ 8634b ES5 / 6708b ES2015+
@WebReflection
WebReflection / dom-libraries.md
Last active February 6, 2024 15:50
A recap of my FE / DOM related libraries

My FE/DOM Libraries

a gist to recap the current status, also available as library picker!

Minimalistic Libraries

do one thing only and do it well

  • µhtml (HTML/SVG auto-keyed and manual keyed render)
  • augmentor (hooks for anything)
  • wickedElements (custom elements without custom elements ... wait, what?)
@WebReflection
WebReflection / why-i-use-web-components.md
Last active December 5, 2023 17:47
Why I use web components

Why I use web components

This is some sort of answer to recent posts regarding Web Components, where more than a few misconceptions were delivered as fact.

Let's start by defining what we are talking about.

The Web Components Umbrella

As you can read in the dedicated GitHub page, Web Components is a group of features, where each feature works already by itself, and it doesn't need other features of the group to be already usable, or useful.

@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active June 2, 2024 11:24
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@fabrizioschiavi
fabrizioschiavi / PragmataPro all the ligatures
Last active December 26, 2023 21:11
The complete ligature list of Pragmata Pro typeface
!=
!==
!=<
=|
=||
=|:
=/
=/=
=/<
!≡
@WebReflection
WebReflection / hyper-nitty-gritty.js
Last active May 30, 2023 06:09
hyperHTML, the nitty gritty
// used to retrieve template content
const templates = new WeakMap;
// used to retrieve node updates
const updates = new WeakMap;
// hyperHTML, the nitty gritty
function hyperHTML(chunks, ...interpolations) {
// if the static chunks are unknown