Bored? Try a new thing.
Collected from Wikipedia's list of hobbies, on 2017-05-09.
shuf -n 1 hobbies.txt
const SECOND = 1000; // ms | |
const MINUTE = 60 * SECOND; | |
const HOUR = 60 * MINUTE; | |
const DAY = 24 * HOUR; | |
const WEEK = 7 * DAY; | |
const MONTH = 4 * WEEK; | |
export function formatRelativeTimestamp(date: Date): string { | |
const agoMs = Date.now() - date.getTime(); |
1 | |
12 | |
123 | |
1234 | |
12345 | |
123456 | |
1234567 | |
12345678 | |
123456789 | |
1234567890 |
▸ node ~/Desktop/testbed.js | |
Completed test 1 in 26950ms | |
Completed test 2 in 14ms |
{ Error: ENOENT: no such file or directory, open '/Users/dylan/Library/Caches/heroku/error.log' | |
errno: -2, | |
code: 'ENOENT', | |
syscall: 'open', | |
path: '/Users/dylan/Library/Caches/heroku/error.log' }Error: /Users/dylan/Library/Caches/heroku/update.lock is locked with a reader active: 96678 | |
at waitForReaders (/Users/dylan/.local/share/heroku/client/node_modules/rwlockfile/lib/rwlockfile.js:149:29)Error: Unexpected argument --autoupdate | |
at Parse.parse (/Users/dylan/.local/share/heroku/client/node_modules/cli-engine-command/lib/parser.js:89:73) | |
at PluginsUpdate.init (/Users/dylan/.local/share/heroku/client/node_modules/cli-engine-command/lib/command.js:83:48) | |
at Function.run (/Users/dylan/.local/share/heroku/client/node_modules/cli-engine-command/lib/command.js:53:17) | |
at Update.run (/Users/dylan/.local/share/heroku/client/node_modules/cli-engine/lib/commands/update.js:68:28) |
heroku-cli: Updating CLI... already on latest version: 6.10.9-b8f5c7d | |
heroku-cli: Updating plugins... done | |
▸ 'ENOENT': ENOENT: no such file or directory, open | |
▸ '/Users/dylan/Library/Caches/heroku/error.log' | |
heroku-cli: Updating CLI... | |
heroku-cli: Updating CLI from 6.10.9-b8f5c7d to 6.11.10-532d137... done | |
heroku-cli: Updating CLI... already on latest version: 6.11.10-532d137 | |
heroku-cli: Updating plugins... done | |
heroku-cli: Updating CLI... | |
heroku-cli: Updating CLI from 6.11.10-532d137 to 6.11.15-28b84f4... Waiting for all commands to finish |
-- context: we have a table `animals` with a column `animal_type` | |
-- this column has an enum value of ('human', 'cat', 'dog') - a.k.a. `possible_animal_types` | |
-- we want to remove the 'dog' possibility from the enum type | |
-- this is a simplified case too; my actual code is much longer as i'm using this type in a few tables | |
-- is there a better/easier way?? | |
alter table animals | |
alter column animal_type type text, | |
alter column animal_type set default 'human'; |
Bored? Try a new thing.
Collected from Wikipedia's list of hobbies, on 2017-05-09.
shuf -n 1 hobbies.txt
$ ITER=1000000 node out.js | |
Ran with .bind in 1691 | |
Ran with arrow function in 75 | |
$ ITER=10000000 node out.js | |
Ran with .bind in 16719 | |
Ran with arrow function in 734 |
### Initial situation: branch `develop` has one commit ("Initial Commit") | |
$ git checkout -b first develop | |
$ echo 'First content' > README.md | |
$ git add . | |
$ git commit -m 'First content' |
coffee> ({ a: 1, b: 2, c: 3}).should.have.properties({ a: 1, b: 2 }) | |
(success) | |
coffee> ({ a: 1, b: 2, c: 3}).should.have.properties({ a: 1, b: 3 }) | |
AssertionError: expected { a: 1, b: 2, c: 3 } to have property b of 3 (got 2) | |
coffee> ({ a: 1, b: 2, c: 3}).should.have.containEql({ a: 1, b: 2 }) | |
(success) | |
coffee> ({ a: 1, b: 2, c: 3}).should.have.containEql({ a: 1, b: 3 }) |