Skip to content

Instantly share code, notes, and snippets.

CSS Rain Effect

Looks best with a taller window/layout.

Rain drop elements animate down the screen, stem element inside animates to disappear toward the end of the drop's fall, splat element animates after the stem disappears.

JavaScript used to randomly position drop elements across the screen, slightly randomize their animation duration and delay, and also stagger their top position. Randomizing delay makes sure the drops don't fall in one sheet, randomizing duration keeps them from falling in the same constant synchronization. Staggering top position makes it so the splats don't fall in a single line.

Splatters are unfortunately disabled by default as it is rather intensive and significantly lowers framerate on most machines (in Chrome that is--FireFox and Edge are smoother actually). You can hit the splat toggle to turn it on. The effect is achieved by putting a dotted border-top on an ellipse element, and animating it from scale(0) to scale(1). You can get a better look at it by enabli

@been-there-done-that
been-there-done-that / sse.ts
Created February 7, 2024 07:56 — forked from atinux/sse.ts
SSE endpoint example with Nuxt 3
// ~/server/api/sse.ts
export default defineEventHandler(async (event) => {
if (!process.dev) return { disabled: true }
// Enable SSE endpoint
setHeader(event, 'cache-control', 'no-cache')
setHeader(event, 'connection', 'keep-alive')
setHeader(event, 'content-type', 'text/event-stream')
setResponseStatus(event, 200)
@been-there-done-that
been-there-done-that / index.html
Created February 5, 2024 11:43
Tearable Cloth
<canvas id="c"></canvas>
<div id="info">
<div id="top">
<a id="close" href="">&times;</a>
</div>
<p>
<br>- Tear the cloth with your mouse
<br>
<br>- Right click and drag to cut
@been-there-done-that
been-there-done-that / index.html
Created November 29, 2022 07:31
Neumorphic Digital Clock
<div class="clock">
<div id="h1" class="clock__digit">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
@been-there-done-that
been-there-done-that / fastapi pretty response class
Created September 25, 2022 20:23
we can format the response for fastapi via the response_class
import json
import typing
from starlette.responses import Response
class PrettyJSONResponse(Response):
media_type = "application/json"
def render(self, content: typing.Any) -> bytes:
return json.dumps(
@been-there-done-that
been-there-done-that / README.md
Created April 26, 2020 04:49 — forked from Lazza/README.md
VPNGate Python script

vpngate.py

This script allows to use the free VPN service provided by VPNGate in an easy way. The user just needs to provide the desidered output country, and the script automatically chooses the best server.

After this step, OpenVPN is launched with the proper configuration. The VPN can be terminated by pressing Ctrl+C.

Usage

Run the script by providing the desired output country: