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 slugify(string) { | |
return string.replace(/\W+/g, "-") | |
.replace(/[-]+$/, "") | |
.toLowerCase(); | |
} |
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
{ | |
"scripts": [], | |
"showConsole": true | |
} |
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
{ | |
"scripts": [], | |
"styles": [] | |
} |
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 random_item(items) { | |
return items[Math.floor(Math.random() * items.length)]; | |
} | |
const items = [254, 45, 212, 365, 2543]; | |
console.log(random_item(items)); |
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 randomColor = Math.floor(Math.random() * 16777215).toString(16); |
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
// Bitters 2.0.4 | |
// https://github.com/thoughtbot/bitters | |
// Copyright 2013-2019 thoughtbot, inc. | |
// MIT License | |
@import "variables"; | |
@import "buttons"; | |
@import "forms"; | |
@import "layout"; |
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
git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached | |
### Alias in .zshrc or .bashrc because too hard to remember | |
# alias ungit="git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached" |
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 toCurrency = (n, curr, LanguageFormat = undefined) => | |
Intl.NumberFormat(LanguageFormat, { style: 'currency', currency: curr }).format(n); | |
toCurrency(123456.789, 'EUR'); // €123,456.79 | currency: Euro | currencyLangFormat: Local | |
toCurrency(123456.789, 'USD', 'en-us'); // $123,456.79 | currency: US Dollar | currencyLangFormat: English (United States) | |
toCurrency(322342436423.2435, 'JPY'); // ¥322,342,436,423 | currency: Japanese Yen | currencyLangFormat: Local | |
toCurrency(322342436423.2435, 'JPY', 'fi'); // 322 342 436 423 ¥ | currency: Japanese Yen | currencyLangFormat: Finnish |
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 nativeType = v => | |
v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase(); | |
nativeType(new Set([1, 2, 3])); // set |
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 removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, ''); | |
removeNonASCII('äÄçÇéÉêlorem-ipsumöÖÐþúÚ'); // lorem-ipsum |
NewerOlder