This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rename all js to tsx | |
find . -type f \( -iname '*.js' -or -iname '*.jsx' \) -not -wholename '*node_modules*' -exec sh -c 'mv "$1" "${1%.js*}.tsx"' _ {} \; | |
# keep js files as ts | |
find . -type f \( -iname '*.js' -or -iname '*.jsx' \) -not -wholename '*node_modules*' -exec sh -c 'mv "$1" `sed -Ee "s/\.js(x)?$/\.ts\1/g" <<< "$1"`' _ {} \; | |
# credits to https://github.com/markogresak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const clamp = (val, min = 0, max = 1) => { | |
// if provided min is somehow greater than max, exchange the values | |
if (min > max) { | |
[min, max] = [max, min]; | |
} | |
// get the maximum of two minimized values | |
return Math.max(min, Math.min(max, val)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const range = (start, end, step = 1) => { | |
let output = []; | |
if (typeof end === 'undefined') { | |
end = start; | |
start = 0; | |
} | |
for (let i = start; i < end; i += step) { | |
output.push(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Text.RegularExpressions; | |
using System.Globalization; | |
namespace BrainstationShared.Helpers { | |
public class LabelBook { | |
public Dictionary<string, LanguageBook> Book { get; set; } | |
public string SetLang { get; set; } = "en"; | |
public const string NoLabelPlaceholder = "NOT_SET"; |