I hereby claim:
- I am danprince on github.
- I am danprince (https://keybase.io/danprince) on keybase.
- I have a public key whose fingerprint is DF59 9A8B EF34 8008 1598 FEE1 9C42 D72F 9BAF CEB4
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Any wrapped components will be rendered into the React dev tools with their wrappers intact. This becomes pretty invasive when most of your components are using a HOC wrapper.
Here's a workaround for defining HOCs that respect stateless functional components and don't render a wrapper.
function withName(Component) {
class EnhancedComponent extends React.Component {| class Modal extends Component { | |
| constructor() { | |
| super(); | |
| this.state = { showing: true }; | |
| this.close = this.close.bind(this); | |
| } | |
| close() { | |
| this.setState({ showing: false }); | |
| } | |
| render() { |
| node_modules | |
| _app.js | |
| *.log |
| // Flattens an array of arbitrarily nested elements. | |
| // E.g. [[1,2,[3]],4] -> [1,2,3,4] | |
| // | |
| // - Doesn't work with negative array indices! | |
| // - ES6 TCO requires recursion to stay in tail-call position. | |
| function flatten(xs) {2 | |
| if(!Array.isArray(xs)) { | |
| return xs; | |
| } | |
| function curry(func) { | |
| const arity = func.length; | |
| function recurry(args=[]) { | |
| if(args.length == arity) { | |
| return func(...args); | |
| } else { | |
| return arg => recurry([...args, arg]); | |
| } | |
| } |
There's a hypothetical paradise where we write all of our documents with markdown and this is well on the way to being a reality with [readmes][1], [websites][2], [wikis][3] and [documentation][4] but in academic writing, LaTeX reigns supreme.
Alone, markdown isn't much of a competitor. It can't do references, it doesn't understand chapters, it can't generate page numbers, you have to manage tables of contents manually, there's no support for captions or automatic numbering of figures and listings. Markdown wasn't designed with these kinds of complex features in mind --- and rightly so.
Maybe I've just been spoiled by the expressive nature of markdown but I don't enjoy writing LaTeX.
There's a project called [Pandoc][9], which allows you to create convert from one document type to another. We can use pandoc to convert markdown into PDFs and HTML.
If you need to convert files from one markup format into another, pandoc is your swiss-army knife.
| (def height 10) | |
| (def width 10) | |
| (def pixel-size 10) | |
| (defn ->2D [i] | |
| [(mod i width) | |
| (.floor js/Math (/ i width))]) | |
| (def coords (map ->2D, (range (* height width)))) | |
| (def colors (repeat "#fff")) |
A continuously updating clock component that shows the time and date.