StackExchange is ridiculous and won't let me reply to threads without becoming a regular member first.
Resources
These links cover everything you need to know:
# Svelte 5 Explorations | |
I have been using Svelte 5 to refactor a creative coding toolkit previously written in Svelte 4. | |
The major change in coding style is to take full advantage of reactivity in JS classes (ie. .svelte.js files), and move logic out of components into JS clasees, with the component file only handling HTML/CSS rendering of a reactive Svelte object. | |
To do this, I uses a dual .svelte.js file to each .svelte file, and various base classes to handle singleton patterns with Map. | |
In doing so, the main unknown has been what pattern to use when syncronising a component's props with the attendant JS object. |
export function CalculatePixels( str, el ) { | |
try { | |
const value = parseFloat( str ) | |
const unit = str.replace(value, '').toLowerCase() | |
const { innerWidth, innerHeight } = window | |
const run = { | |
['%']: () => (el.offsetWidth * (value/100)), | |
px: () => value, | |
vw: () => (innerWidth * (value/100)), |
# brew install folderify | |
# brew install imagemagick | |
#!/bin/bash | |
# Using pip install ffmpeg-normalize | |
for f in ${1}*.wav | |
do | |
echo $f | |
ffmpeg-normalize ${f} -of ${1}normalized/ -ext wav | |
done |
StackExchange is ridiculous and won't let me reply to threads without becoming a regular member first.
Resources
These links cover everything you need to know:
import { writable, get } from 'svelte/store' | |
const ERROR = 'error' | |
const SUCCESS = 'success' | |
const TRY = 'try' | |
function init() { | |
const { subscribe, set, update, get } = writable({ | |
log: [], |
const timestamp = e => Math.floor(Date.now() / 1000) | |
const date = timestamp => new Date( timestamp * 1000 ) |
const moveInArray = (arr, from, to) => { | |
if (to >= arr.length) { | |
var k = to - arr.length + 1 | |
while (k--) { | |
arr.push(undefined) | |
} | |
} | |
arr.splice(to, 0, arr.splice(from, 1)[0]) | |
return arr | |
} |
export default text => text.toString().toLowerCase() | |
.replaceAll(' ', '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - |