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
/** | |
* Generated from Current currency & funds code list by SNV. | |
* @see https://www.currency-iso.org/en/home/tables/table-a1.html | |
*/ | |
type CurrencyCode = | |
| "AFN" | |
| "EUR" | |
| "ALL" | |
| "DZD" |
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 fs = require('fs') | |
const createArray = ({ length }) => Array.from({ length }, (_, i) => i + 1); // [1, 2, 3, ...] | |
const createLargeArray = (length = 100) => ( | |
Array.from(Array(length)).map(() => Math.random() * 10) | |
) | |
const string = `module.exports = [${[...createLargeArray(), 122]}]` | |
fs.writeFile('largeArray.js', string, (error => { |
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 const HEX_RANGE = /#?([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})/ | |
export const RGB_RANGE = /rgba?\(\b([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\b,\s?\b([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\b,\s?\b([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\b,?\s?([01]|0\.\d*)?\)/ | |
export const HSL_RANGE = /hsla?\((\b[0-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-5][0-9]|360\b),\s?(\b[0-9]|[1-8][0-9]|9[0-9]|100\b)%,\s?(\b[0-9]|[1-8][0-9]|9[0-9]|100\b)%,?\s?([01]|0\.\d*)?\)/ | |
export const isHEX = color => color && color.match(HEX_RANGE) // ["#ff66ff", "ff", "66", "ff"] | null | |
export const isRGB = color => color && color.match(RGB_RANGE) // ["rgba(255, 10, 110, 0.75)", "255", "10", "110", "0.75"] | null | |
export const isHSL = color => color && color.match(HSL_RANGE) // ["hsla(160,10%,10%)", "160", "10", "10", "0.75"] | null | |
/** | |
* Converts a RGBa or HSLa into HEX |
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 compose = (...fns) => // 1. the spread operator torns function arguments into an array fns | |
(arg) => // 2. a function is then returned that expects one argument arg | |
fns.reduce( // 3. Reducing the fins with arg as the initial value | |
(composed, f) => f(composed), // 4. Each function is called with the result of the previous functions | |
arg // 3.arg is the initial value | |
) |
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
// main.js | |
if (!('serviceWorker' in navigator)) { | |
console.log('sw not supported'); | |
return; | |
} | |
navigator.serviceWorker.register('/path/to/service-worker.js') // returns a Promise | |
.then(function(registration) { | |
console.log('SW registered! Scope is: ', registration.scope); | |
}); |
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
# Use an official Ubuntu Xenial as a parent image | |
FROM ubuntu:16.04 | |
# Install Node.js 8 and npm 5 | |
RUN apt-get update | |
RUN apt-get -qq update | |
RUN apt-get install -y build-essential | |
RUN apt-get install -y curl | |
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash | |
RUN apt-get install -y nodejs |
- Surprise! https://glitch.com/edit/#!/good-fall
- Hourly rate calculator https://glitch.com/edit/#!/south-balance
- Live Search https://glitch.com/edit/#!/tide-hoe
NewerOlder