const out = ref(value.value)
let timer: number
watch(value, next => {
clearTimeout(timer)
timer = window.setTimeout(
() => (out.value = next), ms)
})
return out Make Your Code Shareable
def chunks(items, size):
for i in range(0, len(items), size):
yield items[i:i + size]
for batch in chunks(rows, 100):
send(batch)let mut backoff = 100;
loop {
if let Ok(res) = fetch().await {
return Ok(res);
}
sleep(backoff).await;
backoff *= 2;
}select name, count(*) as uses
from snippet_tags
group by name
order by uses desc
limit 10;jobs := make(chan int, 8)
for i := 0; i < 4; i++ {
go func() {
for job := range jobs {
process(job)
}
}()
}const tick = ref(0)
const id = setInterval(() => {
tick.value++
}, 1000)
onBeforeUnmount(() => {
clearInterval(id)
})git fetch --prune
git branch -vv | grep ': gone]' \
| awk '{print $1}' \
| xargs -r git branch -D.clamp {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}1,248Snippets shared
305Languages and dependencies
100%Free and open to everyone
Browse by what you're building
Curated starting points for common stacks — front-end apps, APIs, tooling and runtimes.
Front-end apps
Vue, React and TypeScript snippets for interfaces people actually use.
Backends & services
Go, Rust and Python patterns for APIs that stay up.
Frameworks
Structure for routing, state and data without reinventing it.
Libraries
Small utilities that save a day of glue code.
Tooling
Build, lint and ship with less friction.
Runtimes
Where your code actually runs.