See https://medium.com/unsplash/how-we-gradually-migrated-to-typescript-at-unsplash-7a34caa24ef1
#!/bin/bash | |
# Dependencies: | |
# - hub (`brew install hub`) | |
# - climergebutton (`brew install vitorgalvao/tiny-scripts/climergebutton`) | |
set -eou pipefail | |
# TODO: | |
# - fail if no URL argument |
import { | |
end, | |
int, | |
lit, | |
Match, | |
parse, | |
Route as RouteBase, | |
zero | |
} from "fp-ts-routing"; | |
import { pipe } from "fp-ts/lib/function"; |
diff --git a/node_modules/react-dom/lib/ReactDefaultBatchingStrategy.js b/node_modules/react-dom/lib/ReactDefaultBatchingStrategy.js | |
index 5e149f0..96e34a0 100644 | |
--- a/node_modules/react-dom/lib/ReactDefaultBatchingStrategy.js | |
+++ b/node_modules/react-dom/lib/ReactDefaultBatchingStrategy.js | |
@@ -20,6 +20,8 @@ var emptyFunction = require('fbjs/lib/emptyFunction'); | |
var RESET_BATCHED_UPDATES = { | |
initialize: emptyFunction, | |
close: function () { | |
+ console.timeStamp('end React batch update'); | |
+ console.log('end React batch update'); |
// Expand all collapsed commits | |
$$('.js-timeline-progressive-disclosure-button').forEach(el => el.click()); | |
// Expand all collapsed conversations | |
$$('button') | |
.filter(el => el.innerText === 'Load more…') | |
.forEach(el => el.click()); |
declare module 'luxon' { | |
namespace luxon { | |
type DateTimeFormat = any; | |
type ZoneOptions = { | |
keepCalendarTime?: boolean; | |
}; | |
type ToFormatOptions = { | |
round: boolean; | |
}; |
I would like to demonstrate some of the benefits of scoped styles over mobile-first CSS with overrides for wider breakpoints. I'll start by explaining the two approaches, before listing the benefits.
h2 {
color: black;
font-size: 2em;
Tagged unions are a way of saying "this data is any one of these values", and the tag is a property that discriminates the values. It enables some really powerful type system features, like exhaustive checking and control flow analysis.
Tagged unions also go by the name of: tagged unions, discriminated unions, algebraic data types (ADTs), and sum types. Just to confuse matters.
In many functional languages this is a really common pattern, like Haskell, Elm, PureScript, and Scala. So much so, they have their own native syntax.
For example, in Elm we can define a tagged union representing an anonymous or named user with:
// elm
{ | |
// Enums represent types and values | |
// At the type level, this is a union of all enum members | |
// At the value level, this is an object containing enum members | |
enum TypeEnum { | |
foo, | |
bar, | |
baz, | |
} |
/* | |
In JavaScript, objects can be used to serve various purposes. | |
To maximise our usage of the type system, we should assign different types to our objects depending | |
on the desired purpose. | |
In this blog post I will clarify two common purposes for objects known as records and dictionaries | |
(aka maps), and how they can both be used with regards to the type system. |