malloc()
and free()
; they're then on their ownx
and either 1) passes x
to another function; or 2) does some operation on x
and assigns the result to another variable, x
will no longer be able to be referenced for the remainder of the function body. This will sound plain to anyone who's fought with Rust's borrow checker before (though, linear functions have the additional constraint that "borrowed" values must be used)..toISOString()
returns a timestamp in UTC for both Date
and moment
.Date()
or moment()
. This acts as a view-only transformation layer.catch()
itself throws)Result<>
leads the natural strategy of validate, then continue. The latter, IMO, is significantly easier/general/more sane.Result<>
grants the natural ergonomics of return codes, with a higher level of definition than exceptions.Result<>
fits that model more cleanly.A seductive assumption underlies the euphoria around the Singapore model: that models of development can be scientific and universal. Those who are afflicted with this euphoria search eagerly for examples of universality. But there is far more to the Singaporean story than mere technocracy. Political strategy and a keen understanding of domestic and international power were central to the success of Lee’s PAP. This allowed him to create the institutional foundations for Singapore’s famous technocratic model. Likewise, there is far more to the rise of China than an imported Singaporean model—a story frequently told by stringing together study-mission statistics and a couple of Deng anecdotes.That story ignores, for example, China’s decentralized system of de facto fiscal federalism and fierce xian level competition—which have no Singaporean equivalent—because it is inconvenient for their thesis. They sweep aside the fact that the father of Singapore himself and a legion of elite Singapore civil servants could not scale the model under optimal conditions. Some are so oblivious of Singaporean history that they do not even realize they are advocating for a developmental model that contradicts their own ideological views. This analytical trap ends up not understanding Singapore, or China, or arguably the Western development path itself.Ironically, Lee Kuan Yew himself had no patience for other people’s models. In his words, “I am not following any prescription given to me by any theoretician on democracy or whatever. I work from first principles: what will get me there?” If there is a lesson from Singapore’s development it is this: forget grand ideologies and others’ models. There is no replacement for experimentation, independent thought, and ruthless pragmatism.
brew
to install stuff, as well as on manual tasks like entering licenses for various desktop apps. Overall I'm super happy with where my setup is at the moment.<input>
s are not supposed to accept children. Seems reasonable, except :before
pseudoelements etc. are also treated as children. Only Firefox follows the spec and correctly renders nothing. This is relevant if you want to checkbox-powered sliders — pseudoelements will work in all browsers except Firefox.onclick()
and dispatch focus event on clicked element (unless it’s a button). Because event dispatches are async, React rerenders can happen between each of these. Combined with the previous Firefox quirk, let’s say you have some component where button focus is relevant (my case was an input-with-button where the button is disabled unless either the input or button are focused), it will break on Firefox… on Apple OSes. (For some reason, Safari works fine — it probably resolves events in a slightly different order)..vimrc
is loaded on program start, config files in ftplugin/
are ran on demand when Vim detects that a file with the given filetype (ft
) is opened. Similarly, files in after/ftplugin
or after/plugin
are loaded after the files in ftplugin/
and plugin/
resolve. The purpose of this is to allow tacking small modifications onto existing plugins.after/ftplugin/ruby.vim
:--incremental
and --noEmit
are not compatible, so we emit to a temporary directory. This makes initial build a little bit slower (about 20% for me) but makes all subsequent typechecks about 2-3x faster.active
and an event activate
, AASM generates the following methods:active?
- is state active
.activate!
- sends activate
event; will error if current state cannot transition with this event.may_activate?
- returns true
if activate!
would succeed. I wish I knew about this one ages ago. I didn't find it because I normally use <TAB>
in pry to explore available methods.This is probably one of the most highly efficient engineering teams I've worked with in my career.I think we're operating at... maybe 50% of our possible efficiency.We can get higher without working longer hours and just working better as a team, I think.
grid-gap
is such a great abstraction and results in incredibly standardized layouts. And it's incredibly easy to add responsiveness if needed -- just tweak the column count based on the page size!foldl
vs. foldr
illustratedgit commit
...=~
with :t (=~)
in GHCi, we get:RegexContext
and Regex
. Without diving deeper into the implementation of these types, we know that either RegexContext
or Regex
is the source of this magic polymorphism. Specifically, this is implemented using pattern matching: several instances are declared, with different return values based on the type of target
, which is the last type parameter of RegexContext
. In regular usage, if the expected type of target
is clear from context, no type annotation is needed: the type system just "does the right thing."RegexContetxt
might be implemented as a class with instance methods like .asBool()
, .asTuple()
, etc. However, the consumer is still responsible for calling the correct method, whereas here the return type logic lives entirely at the type level! There is no runtime cost at all. This results in a beautifully elegant developer experience.[Maybe t]
.Data.List.NonEmpty
or a related type.