Skip to content

Instantly share code, notes, and snippets.

@WebReflection
WebReflection / proxy-traps-cheat-sheet.md
Last active November 23, 2023 19:35
Proxy Traps Cheat Sheet

Proxy Traps Cheat Sheet

There are various shenanigans around the Proxy API, including issues with Array.isArray and Object.ownKeys so that this gits purpose is to describe all the undocummented caveats to help anyone dealing with all possibilities this half-doomed API offers.

The 3 + 1 Proxy Types

  • object: any non primitive value can be proxied but apply and construct traps won't work with it. If the object somehow wants to represent an array without being one, it's impossible to survive Array.isArray brand check (it will be false) and with ownKeys the target needs to have a non configurable length property or it will also fails once reached
  • array: it's like object but it survives the `

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
@dustingetz
dustingetz / electric-references.md
Last active July 27, 2023 13:39
Reference list — Electric Clojure

References — Electric Clojure

Electric Clojure implements a form of arrowized continuous time dataflow programming with extensions for network-transparent function composition.

Common terminology found in across literature and implementations:
Page
Region of memory. Usually 4096, 8192 or 16384 bytes
Page Frame
Same as a Page but when talking about physical memory. Same size as a Page.
Page Table
Per virtual address space table mapping virtual addresses to Pages.
Page Directory
Like Page Table and is often the same thing. The first level of Page Tables.
PTE - Page Table Entry
@nathanborror
nathanborror / gcloud-run.md
Last active May 31, 2022 15:50
How to setup a new Go project using Google Cloud Run and Cloud SQL.

Go Google Cloud

How to setup a new Go project using Google Cloud Run and Cloud SQL.

Setup a new project

Update gcloud and authenticate

$ gcloud components update
$ gcloud auth login
@salomvary
salomvary / backup-mysql.yml
Last active February 8, 2024 19:33
GitHub Action for mysqldump
name: backup-mysql
on:
schedule:
# Run at 7:00 UTC every day
- cron: "0 7 * * *"
jobs:
run_mysqldump:
runs-on: ubuntu-latest
steps:
- name: Dump database

The Rise of "Worse is Better"

By Richard Gabriel

I and just about every designer of Common Lisp and CLOS has had extreme exposure to the MIT/Stanford style of design. The essence of this style can be captured by the phrase "the right thing." To such a designer it is important to get all of the following characteristics right:

Simplicity-the design must be simple, both in implementation and interface. It is more important for the interface to be simple than the implementation.

  • Correctness — the design must be correct in all observable aspects. Incorrectness is simply not allowed.
  • Consistency — the design must not be inconsistent. A design is allowed to be slightly less simple and less complete to avoid inconsistency. Consistency is as important as correctness.
@ityonemo
ityonemo / test.md
Last active May 1, 2024 15:37
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)

@rsms
rsms / awset_test.go
Created November 23, 2020 17:35
Optimized AW-Set aka OR-SWOT — a state-based CRDT set
package crdt
import (
"fmt"
"os"
"sort"
"strings"
"testing"
)
@rsms
rsms / id.go
Last active October 27, 2020 19:33
Sortable efficient universally unique identifier in Go — PUBLISHED HERE: https://github.com/rsms/go-uuid
/* ISC License
Copyright (c) 2020, Rasmus Andersson <rsms.me>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF