Skip to content

Instantly share code, notes, and snippets.

View afkvido's full-sized avatar
:electron:
rush

gemsvidø afkvido

:electron:
rush
View GitHub Profile
@afkvido
afkvido / StringMatch.kt
Last active February 28, 2023 21:16
Capture one RegEx match from a String in Kotlin.
/** Captures a String from a regex */
fun String.match (regex : String) : String {
return this.match(Regex(regex))
}
/** Captures a String from a regex */
fun String.match (regex : Regex) : String {
val x : String? = regex.find(this)?.value
return if (x !== null) x else ""
}
@afkvido
afkvido / tsconfig.json
Last active February 28, 2023 21:15
TypeScript config for quickstarting prototype.
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
"incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
"tsBuildInfoFile": "./dist/.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
@afkvido
afkvido / dirname.ts
Last active February 28, 2023 21:14
EMCAscript fill for CommonJS __dirname.
import path from "path";
import { fileURLToPath } from "url";
const dirname : string = path.resolve(fileURLToPath(import.meta.url), "../..");
export default dirname;
@afkvido
afkvido / polyfill.js
Created March 1, 2023 23:17
Ensures that the webpage has all JavaScript standard library features, and loads them if it doesn't. (using core-js)
(async()=>{eval(await(await fetch("https://cdn.jsdelivr.net/npm/core-js-bundle/minified.min.js")).text())})();