“blazing fast modern site generator for React”
- We really need CMSs
“blazing fast modern site generator for React”
/** | |
* A higher order component (HOC) that provides the current viewport | |
* dimensions to the wrapped component as a `viewport` prop that has | |
* the shape `{ width: 600, height: 400}`. | |
*/ | |
export const withViewport = Component => { | |
// The resize event is flooded when the browser is resized. We'll | |
// use a small timeout to throttle changing the viewport since it | |
// will trigger rerendering. | |
const WAIT_MS = 100; |
A few years ago, when the Frontend developer tooling craze hadn't yet started, techniques for building and optimizing JavaScript applications varied. Many were using shell scripts (cat
to concatenate files etc.), tools provided by the web framework (like Play Framework's templates), or some generic Java-based tools. There might have been some manual operations (especially around minifying for production builds), and most of the tooling was not JavaScript-based.
Then Frontend developers started to notice that it was really hard to reason about lots of files that each rely on some globals (making the inclusion order significant) and expose a "namespace" (global variable) for other files to use. Then came AMD (Asynchronous Module Definition), which enabled making modules that define their dependencies and that explicitly exposed their exports. AMD modules were used together with the require.js tool and the r.js optimizer. The A in AMD (asynchronous) was a clear design choi
(ns aws-parser.core | |
(:require [clojure.string :as str])) | |
(defn whitespace? [c] | |
(str/blank? (str c))) | |
;; STATES: :default :whitespace :quoted | |
(defn- handle-char [{:keys [state result]} c] | |
(cond |
/*eslint-env es6 */ | |
// Inspired by the paper "A tutorial on the universality and | |
// expressiveness of fold" by Graham Hutton (available at | |
// http://www.cs.nott.ac.uk/~gmh/fold.pdf), implementing some generic | |
// list handling functions in JavaScript in terms of `fold`. | |
// Personally I had an enlightnening moment when I realised the | |
// beautiful interplay of cons lists and foldr during the FP101x | |
// Haskell course. JavaScript's syntax doesn't make this very apparent |
/* @flow */ | |
function wait(time: number): Promise<string> { | |
return new Promise((resolve, reject) => { | |
setTimeout(resolve.bind(null, 'resolved in ' + time + 'ms'), time); | |
}); | |
} | |
document.addEventListener('DOMContentLoaded', () => { | |
console.log('start'); |
Been studying a bit of Haskell during the previous (rather hectic) weeks. Learnings this far:
I've favored dynamically typed languages for years now, but especially the good type inference takes most of the pain away. Using immutable values, recursion, and strong types seems very natural to me now.
New SASS website: http://sass-lang.com/
sass --compass --sourcemap --watch