https://twitter.com/ParkerNathans/status/1435270801905831942
*##html:style(filter:grayscale(1))
localhost##html:style(filter:grayscale(0))
... etc.
| const ready = fn => document.readyState !== 'loading' ? fn() : document.addEventListener('DOMContentLoaded', fn); | |
| // https://stackoverflow.com/questions/799981/document-ready-equivalent-without-jquery |
| #!/bin/bash | |
| # Store the user_id in a variable | |
| user_id=0 | |
| # Store the provided date in a variable | |
| input_date=$1 | |
| # Get the current date in the format yyyy-mm-dd | |
| current_date=$(date +%F) |
https://twitter.com/ParkerNathans/status/1435270801905831942
*##html:style(filter:grayscale(1))
localhost##html:style(filter:grayscale(0))
... etc.
| /** | |
| * Randomise array order | |
| * @param {Array} arr Array to randomise | |
| * @param {Object} [options] | |
| * @param {Boolean} [options.mutate] Sets if should modify given array. Defaults to false | |
| * @param {Function} [options.rand] Randomly generate an integer j: min <= j < max | |
| * @returns {Array} | |
| */ | |
| const shuffle = (arr, options) => { | |
| const len = arr.length; |
| ' !"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~' | |
| All 33 of 'em. | |
| [ 32, ' ' ] | |
| [ 33, '!' ] | |
| [ 34, '"' ] | |
| [ 35, '#' ] | |
| [ 36, '$' ] | |
| [ 37, '%' ] |
| $ stack exec -- haskenthe examples/factorial.hth | |
| failed | |
| CEUnboundVar (Name "\9580\9559") |
| // List the first n prime numbers | |
| primes = n => { | |
| const results = [] | |
| let i = 1 | |
| while (results.length < n) { | |
| ++i | |
| results.find(r => i % r === 0) || results.push(i) | |
| } | |
| return results | |
| } |
| function beersong(count) { | |
| let startCount = count; | |
| let song = ""; | |
| const countBottles = (c, cap) => { | |
| if (c === -1) return countBottles(startCount); | |
| if (c === 0) return (cap ? 'N' : 'n') + 'o more bottles'; | |
| if (c === 1) return '1 bottle' | |
| return `${c} bottles`; | |
| } |
| .selected-flag:before { | |
| content: ; | |
| content: ''; | |
| background-color: #94949454; | |
| width: 48px; | |
| height: 48px; | |
| position: absolute; | |
| left: 4px; | |
| top: 0; | |
| border-radius: 50%; |
| <Component | |
| aria-selected={highlight ? true : undefined} | |
| /> | |
| <Component | |
| {...(highlight ? { "aria-selected": true } : {})} | |
| /> | |
| /* These are not the same ;_; */ |