This file contains hidden or 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
enum CharacterClassifications { | |
None = 0, | |
Digit = 1, | |
Upper = 2, | |
Lower = 4, | |
Space = 8, | |
Control = 16, | |
SymbolOrPunctuation = Upper | Lower, | |
AlphaOrDigit = Digit | Upper | Lower | Space | |
} |
This file contains hidden or 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 UnicodeMap = new Map<string, [number, number]>([ | |
["Basic Latin", [32, 127]], | |
["Latin-1 Supplement", [160, 255]], | |
["Latin Extended-A", [256, 383]], | |
["Latin Extended-B", [384, 591]], | |
["IPA Extensions", [592, 687]], | |
["Spacing Modifier Letters", [688, 767]], | |
["Combining Diacritical Marks", [768, 879]], | |
["Greek and Coptic", [880, 1023]], | |
["Cyrillic", [1024, 1279]], |
This file contains hidden or 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
function inheritTimeFrom(source, target) { | |
var sourceDateTime = new Date(source) | |
var targetDateTime = new Date(target) | |
targetDateTime.setHours(sourceDateTime.getHours()) | |
targetDateTime.setMinutes(sourceDateTime.getMinutes()) | |
targetDateTime.setSeconds(sourceDateTime.getSeconds()) | |
targetDateTime.setSeconds(sourceDateTime.getMilliseconds()) | |
return targetDateTime | |
} |
This file contains hidden or 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
export interface IFile { | |
name: string | |
size?: number | |
type?: string | |
lastModified?: number | |
data?: string|ArrayBuffer | |
} | |
export enum ReadFileReturnTypes { | |
Text = "text", |
This file contains hidden or 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 slug = s => s | |
.toString() // ensure string | |
.normalize("NFD") // convert to unicode normalization form using (N)normalization (F)form canonical (D)decomposition | |
// aka. remove accent and leave base | |
.replace(/[\u0300-\u036f]/g, "") // remove range combining grave accent to combining lating small letter x | |
.toLowerCase() // lower chars | |
.trim() // trim whitespace | |
.replace(/\s+/g, '-') // replace space(s) with dash | |
.replace(/[^\w-]+/g, "") // remove things not a-z A-Z 0-9 or - | |
.replace(/--+/g, '-') // replace double dash with single dash |
This file contains hidden or 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
:root { | |
font-size:24px; | |
--backgroundColor: rgba(255, 255, 255); | |
--squareColor: rgba(100, 100, 100, .5); | |
--squareSize: 2em; | |
} | |
@media (prefers-color-scheme: dark) { | |
:root { | |
--backgroundColor: rgb(0, 0, 0); |
This file contains hidden or 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
/// <summary> | |
/// Executes a list of functions, in parallel managed by a semaphore. | |
/// </summary> | |
/// <typeparam name="T"></typeparam> | |
/// <param name="values">The values to act on.</param> | |
/// <param name="maxDegreeOfParallelism">Maximum degree of parallelism when executing functions.</param> | |
/// <param name="fn">Function to call using value.</param> | |
/// <returns></returns> | |
public static async Task ManagedForEachAsync<T>(this IEnumerable<T> values, int maxDegreeOfParallelism, Func<T, Task> fn) | |
{ |
This file contains hidden or 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
# Nuget packaging thing | |
# | |
# Use this guy to pack and push .nupkg from your .csproj | |
# | |
# Note: nuget.exe pack will assume a .nuspec file already exist | |
# if not then create one yourself: nuget.exe spec. | |
# This is not done automatically, as you probably wan't to | |
# customize this your self, before running this. | |
# | |
# This will check if the assembly version on given project |
This file contains hidden or 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
var isTrue = function (value) { | |
if ('string' === typeof (value)) value = value.toLowerCase().trim(); | |
return ['true', '1', 'on', 'yes', 1].indexOf(value) > -1; | |
}; |
This file contains hidden or 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
// Input range sass thing. Result of reading this: | |
// http://brennaobrien.com/blog/2014/05/style-input-type-range-in-every-browser.html | |
// 07112018: removed focus outline i firefox | |
$range-track-width: 100%; | |
$range-track-height: 12px; | |
$range-track-background: #ccc; | |
$range-track-background-focus: #ccc; | |
$range-track-border: none; | |
$range-track-border-radius: 3px; |