Skip to content

Instantly share code, notes, and snippets.

import org.gradle.jvm.tasks.Jar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
application
id("setup.repository")
kotlin("jvm") version "1.7.21"
kotlin("plugin.serialization") version "1.7.21"
}
@Jesperpaulsen
Jesperpaulsen / update-tw-classes.mjs
Last active February 28, 2022 10:47
A script that can be used to update all tailwind classes of a project. This is useful when the projects tailwind config have been missconfigured. By the use of regex it will update all directions of for instance margin (mx-, my-, ml-, mt-, mb-, mr-, ml-). At the moment the script is configured to update margins, but can easily be used to update …
/**
* This script will replace all occurrences of a given class across the .tsx files in the src folder.
* Run it from the root folder of the project: `node update-tw-classes.mjs`
*
* !!!!!!
* Commit or stash all changes before running this script.
* Backup the folder before running this script. If an error occures while running the script, you will have to discard all changes and restore the backup or from git.
* !!!!!!
* */
import * as readline from 'readline'
@Jesperpaulsen
Jesperpaulsen / Debouncer.ts
Last active April 13, 2022 15:12
Using setTimeout instead of setInterval
class Debouncer {
delay: number
private timeout?: ReturnType<typeof setTimeout>
private nextCallbackTime = Date.now()
private callback?: () => void | Promise<void>
constructor(delay: number) {
this.delay = delay
}
@Jesperpaulsen
Jesperpaulsen / CountdownDuration.ts
Last active March 1, 2022 07:09
Webworker Next
export default interface CountdownDuration {
value: number
unit: string
}