Skip to content

Instantly share code, notes, and snippets.

View JTRNS's full-sized avatar
💤

JT JTRNS

💤
  • The Netherlands
  • 09:37 (UTC +02:00)
View GitHub Profile
@JTRNS
JTRNS / EventEmitter.ts
Created July 18, 2023 20:24
EventEmitter
/**
* A generic class that allows for the creation of events and listeners.
*
* @template T - An object type that defines the events and their data types.
*/
export default class EventEmitter<T> {
private events: { [K in keyof T]: Array<(data: T[K]) => void> } = {} as unknown as { [K in keyof T]: Array<(data: T[K]) => void> };
/**
* Adds a listener to an event.
@JTRNS
JTRNS / input-area.css
Created June 30, 2023 15:36
InputArea Component
div[data-autogrow]:has(textarea) {
display: grid;
}
div[data-autogrow]:has(textarea)::after {
content: attr(data-autogrow) ' ';
white-space: pre-wrap;
visibility: hidden;
}
@JTRNS
JTRNS / first-names.txt
Created February 11, 2023 09:06
A list of 200 common first names
James
Mary
Robert
Patricia
John
Jennifer
Michael
Linda
David
Elizabeth
@JTRNS
JTRNS / jobs.js
Created February 11, 2023 07:48
An array of occupations
const jobs = [
'Genetic Counselor',
'Mathematician',
'University Professor',
'Occupational Therapist',
'Statistician',
'Medical Services Manager',
'Data Scientist',
'Information Security Analyst',
'Operations Research Analyst',
@JTRNS
JTRNS / tailwind-colours.css
Created November 6, 2022 09:56
Tailwind colours as CSS custom properties
:root {
--slate-50: #f8fafc;
--slate-100: #f1f5f9;
--slate-200: #e2e8f0;
--slate-300: #cbd5e1;
--slate-400: #94a3b8;
--slate-500: #64748b;
--slate-600: #475569;
--slate-700: #334155;
--slate-800: #1e293b;
@JTRNS
JTRNS / rsa-keygen.ts
Created September 3, 2022 08:43
Generate and export RSA-OAEP encryption keys from the browser.
function encodeMessage(message: string) {
const enc = new TextEncoder();
return enc.encode(message);
}
function decodeMessage(buffer: ArrayBuffer) {
const dec = new TextDecoder();
return dec.decode(buffer);
}
@JTRNS
JTRNS / SmartJoin.py
Created April 7, 2022 08:52
Create vertex groups for each mesh before joining objects in Blender
bl_info = {
"name": "Smart Join",
"author": "Jeroen Trines",
"version": (1, 0),
"blender": (3, 1, 0),
"location": "View3D > Object > Smart Join",
"description": "Create vertex groups for each mesh before joining objects in Blender",
"warning": "",
"doc_url": "",
"category": "Object",
@JTRNS
JTRNS / blingbling.js
Created September 25, 2021 11:15
A more shiny variation of the popular bling dot js
/* blingbling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
HTMLElement.prototype.$ = function (selector) {
return this.querySelector(selector);
}
HTMLElement.prototype.$$ = function (selector) {
@JTRNS
JTRNS / clean_win10_startmenu.ps1
Created June 14, 2021 06:49
Copy all links from start menu subdirectories into start menu programs directory
# Windows uses some of the .lnk files in the start menu to launch system utilities. So copy,
# but do not move / remove links like Powershell.
# system and user start menu directories
$SystemStartMenuDir = "$env:ProgramData\Microsoft\Windows\Start Menu\Programs"
$UserStartMenuDir = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs"
# copy links (.lnk files) from system start menu directory to user start menu directory
Get-ChildItem -Path $SystemStartMenuDir -File -Include "*.lnk" -Recurse | Copy-Item -Destination $UserStartMenuDir
@JTRNS
JTRNS / adjectives.txt
Last active March 18, 2021 18:27
A wordlist consisting of 5069 English adjectives.
# list has not been checked manually for duplicates and spelling mistakes.
a
aback
abaft
abandoned
abashed
abdominal
aberrant
abhorrent
abiding