Skip to content

Instantly share code, notes, and snippets.

@davidatsurge
davidatsurge / debounce.rs
Last active January 16, 2023 22:59
A `debounce` for `sycamore-rs` (using crates`gloo_timers` and `pin_project`). Look at `main.rs` below for one would use it.
use std::cell::RefCell;
use futures_util::stream::{AbortHandle, Abortable};
use gloo_timers::future::TimeoutFuture;
use sycamore::{
futures::spawn_local_scoped,
reactive::{create_ref, Scope},
};
pub struct Debounced<'a, F>
@davidatsurge
davidatsurge / luasnip_config.lua
Last active September 24, 2024 23:26
luasnip+treesitter snippet that fills in prop names when creating new react component
local ls = require("luasnip")
local fmt = require("luasnip.extras.fmt").fmt
local s = ls.snippet
local i = ls.insert_node
local f = ls.function_node
local d = ls.dynamic_node
local sn = ls.snippet_node
local rep = require("luasnip.extras").rep
-- Get a list of the property names given an `interface_declaration`