Skip to content

Instantly share code, notes, and snippets.

View mahdisoultana's full-sized avatar
🙂
Web Development Is My Passion.

Mahdi mahdisoultana

🙂
Web Development Is My Passion.
View GitHub Profile
@getify
getify / 1-CalendarItem.js
Last active March 21, 2024 09:11
an illustration (non-trivial example) of many newer JS class features
// abstract class, not intended to be instantiated directly
class CalendarItem {
static #UNSET = Symbol("unset")
static #isUnset(v) {
return v === this.#UNSET;
}
static {
for (let [idx,msg] of [
"ID is already set.",
"ID is unset.",
@jacques-blom
jacques-blom / Canvas.tsx
Last active May 4, 2023 14:37
Atom Families
import {createContext, useState} from 'react'
import {Element, Rectangle} from './components/Rectangle/Rectangle'
import {PageContainer} from './PageContainer'
import {Toolbar} from './Toolbar'
type ElementsContextType = {
elements: Element[]
addElement: () => void
setElement: SetElement
}