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 joinToArrayOrGetString = (strOrArray1, strOrArray2) => { | |
const ret = [...convertToArray(strOrArray1), ...convertToArray(strOrArray2)].filter(item => typeof item === 'string'); | |
return (ret.length === 1) ? ret[0] : ret; | |
}; |
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 getKeyValueSafely = (obj, key) => ( | |
obj.hasOwnProperty(key) ? obj[key] : undefined | |
); |
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 normalizeURIComponentName = str => { | |
const stripChars = /[^a-z-\s]/gi; | |
return ( | |
str.toLowerCase().replace(stripChars, '').replace(/\s/gi, '-') || str | |
); | |
}; |
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 removeSymbolPrefix = str => /^([^a-z]*)(.*)$/gi.exec(str)[2] || str; |
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
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} /.*\.html | |
RewriteRule ^(.*)\.html$ /$1 [R=301,L] |
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
RewriteEngine On | |
RewriteCond %{TIME} <20190319010000 | |
RewriteRule ^agb\.html$ /legal/beta [R=302,L] |
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
export const isValidDate = d => d instanceof Date && !isNaN(d); |
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
export const convertUmlauts = str => { | |
const charMap = { | |
'ä': 'ae', | |
'ö': 'oe', | |
'ü': 'ue', | |
'Ä': 'Ae', | |
'Ö': 'Oe', | |
'Ü': 'Ue', | |
'ß': 'ss' | |
}; |
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
Verifying my Blockstack ID is secured with the address 1Nu8r4xtC7uBYri355emFongdcF96RBiGh https://explorer.blockstack.org/address/1Nu8r4xtC7uBYri355emFongdcF96RBiGh |
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
// prepend a character to a string for a given result string length | |
const prependCharToLength = (str: string, char: string = '0', len: number = 2): string => { | |
let r: string[] = []; | |
let s: string[] = str.split(''); | |
for (let i: number = len - 1; i >= 0; i--) { | |
r[i] = (s.length - i > 0) ? s[i] : char; | |
} | |
return r.join(''); | |
}; |