
-
A Last Word variation Bols genever, green Chartreuse, Giralamo Luxardo, like #cocktails
Originally posted on Instagram at http://bit.ly/2tqrNid -
Playing hangman with Lucy is a unique challenge
Originally posted on Instagram at http://bit.ly/2Bu31SS -
ES6 module live bindings: surprise!
ES6 modules are pretty common in new JavaScript projects. They include one feature that can be pretty surprising to folks used to CommonJS modules: live bindings.
Consider the following CommonJS app you want to port to ES6:
// my-library.js let name = 'default'; function setName(n) { name = n; } module.exports = { name, setName }; // my-app.js var { name, setName } = require('./my-library'); console.log( name ); setName( 'ben' ); console.log( name );
That would print:
default default
A quick port to ES6 might look like this:
// my-library.js let name = 'default'; function setName(n) { name = n; } export { name, setName }; // my-app.js import { name, setName } from './my-library'; console.log( name ); setName( 'ben' ); console.log( name );
But this will print:
default ben
name
changed without anything inmy-app.js
touching it directly.magic! This can be useful behavior, but it can also be pretty surprising.
-
Broken Promises
Let’s start here:
Promise.resolve( 'hi' ).then( showHappy ).catch( showError )
This is a super common form you see with Promises, but is has a subtle problem. What happens if your
then
callback throws?Arg! My
catch
caught the error! Because of how promises chain, this is expected, but often surprising. If yourcatch
is written to expect a certain kind of error – maybe from a network request – it too could now fail.If you want to be sure that the rejected promise is from the original promise, you have two options: use the second parameter to
then
, or write thecatch
first.These methods have their own issues though. If the success handler really may throw, you may need to add a second
catch
to the end to handle that case.And if you put the
catch
first, if that handler returns a non-Error, then followingthen
will run:That’s rarely what you want, but can be handy for cases where you want to transform an API error into a blank result.
Next time, how this all changes with
async / await
. -
Always plan for seasonal movement
This takes seasonal movement, a common problem in woodworking, to a whole new level.
When it gets to be several degrees below freezing, the metal of the train tracks can contract to the point that it will pull up the bolts holding it in place, or even stress fracture.
Crews will soak long pieces of rope in kerosene and burn it to warm up the tracks, expanding them back into place for repairs. Once the track is warmed, it’ll be re-bolted, or welding repairs can be affected on the broken tracks.
-
A Manhattan variant, emphasizing the cherry and chocolate and butterscotch. #cocktails
Originally posted on Instagram at http://bit.ly/2R1OBhx -
Newsy Profile on Crucible & Others
Really nice profile on Crucible Tool in Kentucky and The Center for Furniture Craftsmanship in Maine.
-
Nineteen kinda day
-
Quality sunset tonight 👌
#baconhill -
We made 59. At about 2pm. Six remain.
-
Making the pretzels
-
Look who’s here
-
Oldy but a goodie, found unpacking a bookcase.
cc @powazek @haitchchamp -
Short ribs about to go in the oven
-
Luminaria #2018
-
“linzers”. I think next year we get the cutters 😁
-
Linzers to be
-
More large floofs #goldendoodle
-
F is for fish #cursive2019
-
Yasssssss
-
Four years at Automattic! Five in April. #a8c
-
Fancy new stair risers. Momma was busy today.
-
Going full millennial
-
Band, take the… stage!
-
Square is just, like, an idea, man.
-
#nofilter what.
-
Quality cocktail list at Green 19
-
Permission slip ramen
-
Burned in.
-
First.
It really is better in Ireland.
-
This is probably a good sign. #calypsodublin
-
Good morning #dublin
-
The thickest tree yet