Skip to content

Instantly share code, notes, and snippets.

View diramazioni's full-sized avatar

Eli Spizzichino diramazioni

  • Italy (looking for other destination)
View GitHub Profile

Svelte 5 Event Handling

Svelte 5 replaces on: directives with direct property bindings for event handlers.


@diramazioni
diramazioni / svelte5_full_context.md
Created May 10, 2025 10:16
svelte5_full_context

Svelte 5 Runes Overview


$State


Svelte 5 Runes Overview


$State


Svelte 5 Snippets


@diramazioni
diramazioni / gist:ae3792d37ed0678d1c68de08722ca287
Created May 10, 2025 09:52
svelte 5 & sveltekit 2 migration guide
## docs/svelte/07-misc/07-v5-migration-guide.md
--- title: Svelte 5 migration guide --- Version 5 comes with an overhauled syntax and reactivity system. While it may look different at first, you'll soon notice many similarities. This guide goes over the changes in detail and shows you how to upgrade. Along with it, we also provide information on _why_ we did these changes. You don't have to migrate to the new syntax right away - Svelte 5 still supports the old Svelte 4 syntax, and you can mix and match components using the new syntax with components using the old and vice versa. We expect many people to be able to upgrade with only a few lines of code changed initially. There's also a [migration script](#Migration-script) that helps you with many of these steps automatically. ## Reactivity syntax changes At the heart of Svelte 5 is the new runes API. Runes are basically compiler instructions that inform Svelte about reactivity. Syntactically, runes are functions starting with a dollar-sign. ### let → $state
@diramazioni
diramazioni / FileList.py
Created March 26, 2024 11:08
List files recursively from a json configuration passed as argument
import os
import fnmatch
import json
import argparse
def list_files_recursive(directory, include_patterns, exclude_dirs):
"""
List files recursively in the given directory,
filtering them by include patterns and excluding specified directories.
@diramazioni
diramazioni / ws_send_image.ino
Last active January 26, 2024 17:15
esp32 send image with websocket
#include "esp_camera.h"
#include <WiFi.h>
#include <ArduinoWebsockets.h>
// #include <algorithm>
// #include "soc/soc.h" //disable brownout problems
// #include "soc/rtc_cntl_reg.h" //disable brownout problems
#define CAMERA_MODEL_ESP32S3_EYE
#include "camera_pins.h"
@diramazioni
diramazioni / csv2latex.py
Last active June 22, 2023 23:48
Convert a CSV table into LaTeX
def csv2latex(file_path, sep):
with open(file_path, 'r') as file:
lines = file.readlines()
# count how many column there is
col = lines[0].count(sep) + 1
empty_line = sep*int(col-1)
start = ['\\begin{table} \n','\caption{Table captions should be placed above the tables.}\label{tab1} \n']
new = start
tabular = '\\begin{tabular}{'+'|l|'*col+'}\hline \n'
new.append(tabular)
@diramazioni
diramazioni / route.ts
Created June 11, 2023 13:58
Next.js endpoint to test strapi API requests
import { fetchAPI } from "../utils/fetch-api";
//import { NextRequest } from 'next/server';
import { NextResponse } from 'next/server';
export async function GET(request: Request) {
const query = {
filters: {
slug: {$eq:"home",},
},
populate: [
@diramazioni
diramazioni / rose2COCO.py
Created May 25, 2023 11:21
DIANNE annotation tool outputs xml annotations, this script was made to convert the dataset of the ROSE's chalange in COCO format
import os
import xml.etree.ElementTree as ET
import json
import cv2
from PIL import Image
def rose2COCO(coco_annotations, root_dir, name_ds, name_cls):
'''
root_dir = base directory of the dataset
name_ds = name of the dataset