Skip to content

Instantly share code, notes, and snippets.

@CharlieCrisp
CharlieCrisp / PReact Signals Suspense Bug
Created October 7, 2025 14:16
This is a bunch of test cases that can be added to `suspense.test.tsx` in https://github.com/preactjs/signals. Two of these tests fail, indicating that when suspenses are used, signals used in components are never unwatched.
it("should clean up signals after unmount with multiple suspense boundaries", async () => {
let watchedCallCount = 0;
let unwatchedCallCount = 0;
// Create a signal with watched/unwatched callbacks to track cleanup
const trackedSignal = signal(0, {
name: "trackedSignal",
watched: function () {
watchedCallCount++;
},
@CharlieCrisp
CharlieCrisp / good_emscripten_window_resize.cpp
Created April 15, 2021 18:33
Example off how to set canvas size using emscripten + glfw
glfwSetWindowSize(
mWindow,
width * device_pixel_ratio,
height * device_pixel_ratio
);
glViewport(
0,
0,
width * device_pixel_ratio,
height * device_pixel_ratio
@CharlieCrisp
CharlieCrisp / bad_emscripten_window_resize.cpp
Last active April 15, 2021 18:30
Example off how not to set canvas size using emscripten + glfw
glfwSetWindowSize(mWindow, width, height);
glViewport(0, 0, width, height);
@CharlieCrisp
CharlieCrisp / .bash_profile
Last active March 12, 2018 20:53
bash_profile
alias gg='git log --oneline --graph'
alias gco='git checkout'
alias gs='git status'
# OPAM configuration
. /Users/charlie/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
@CharlieCrisp
CharlieCrisp / .tmux.conf
Last active March 12, 2018 20:43
Tmux configuration
unbind C-b
set -g prefix 'C-o'
bind-key 'C-o' send-prefix
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf