Skip to content

Instantly share code, notes, and snippets.

@tzwel
tzwel / isEmpty.js
Created February 28, 2023 08:46
last resort empty string validation
"is this string empty?"
.replace(/[             ᠎ㅤ‏‏‎‎​]/g, '')
.replace(/\r?\n|\r/g, '')
.replace(/<\/?[^>]+(?:>|$)?/g, '').trim().length === 0
@tzwel
tzwel / nakadashi.js
Last active February 2, 2023 06:48
The simplest Node.js server
const http = require('http');
let appOptions = {
'localHostUrl': 'http://localhost:'
//errorHandler
}
let routes = {}
const app = {
const numjs = (function () {
// Get a random number in range, accept generating multiple numbers optionally converted to a single Number
function range(min, max, times = 1, convert = false) {
let generatedNumber = Math.floor(Math.random() * (max - min + 1) + min)
if (times > 1) {
for (let i=1; i< times; i++) {
generatedNumber += Math.floor(Math.random() * (max - min + 1) + min).toString()
}
import os
extensionsToDelete = [".zip", ".rar"]
files = os.listdir()
for file in files:
split_tup = os.path.splitext(file)
if split_tup[1] in extensionsToDelete:
print(file)
@tzwel
tzwel / Midnight.css
Last active October 13, 2021 21:14
Discord Midnight Glass style
/*
https://github.com/tzwel
Tzwel - Midnight Glass
*/
:root {
--header-primary: #fff;
--header-secondary: #b9bbbe;
--text-normal: #fff;