Skip to content

Instantly share code, notes, and snippets.

View christowiz's full-sized avatar

Christopher Gwizdala christowiz

  • Pluto TV
  • New York, NY
View GitHub Profile
@sdekna
sdekna / gist:beb66027a2b75af3b97942a7f2b99363
Created August 19, 2023 08:26
Alternate Svelte Store
// REPL: https://svelte.dev/repl/2c56758fb2ca4de9bf842e3dfb61ed36
function customStore<T>(initialValue: T, mutationFunction: (value: T)=>T, validationFunction: (value: T)=>boolean) {
let currentValue = initialValue
let previousValue: T | null = null;
const subscribers = new Set<(value: T, previousValue: T | null) => void>();
const set = (value: T): void => {
@sindresorhus
sindresorhus / esm-package.md
Last active May 19, 2025 16:52
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.
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@squarism
squarism / iterm2.md
Last active May 21, 2025 16:41
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
#!/bin/bash
# We need the TAB character for SED (Mac OS X sed does not understand \t)
TAB="$(printf '\t')"
function abort {
echo "$(tput setaf 1)$1$(tput sgr0)"
exit 1
}
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 22, 2025 08:10
A badass list of frontend development resources I collected over time.
@willurd
willurd / web-servers.md
Last active May 20, 2025 11:28
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000