| // Have some complicated non-React widgets that manipulate DOM? | |
| // Do they manage a list of DOM elements? Here's how to wrap it | |
| // into a React component so you can "constantly rerender" it. | |
| // A dumb non-react widget that manually manage some DOM node that | |
| // represent a list of items | |
| function NonReactWidget(node) { | |
| this.node = node; | |
| } | 
| import { Component } from "React"; | |
| export var Enhance = ComposedComponent => class extends Component { | |
| constructor() { | |
| this.state = { data: null }; | |
| } | |
| componentDidMount() { | |
| this.setState({ data: 'Hello' }); | |
| } | |
| render() { | 
While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.
Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.
| # Hello, and welcome to makefile basics. | |
| # | |
| # You will learn why `make` is so great, and why, despite its "weird" syntax, | |
| # it is actually a highly expressive, efficient, and powerful way to build | |
| # programs. | |
| # | |
| # Once you're done here, go to | |
| # http://www.gnu.org/software/make/manual/make.html | |
| # to learn SOOOO much more. | 
| #!/usr/bin/env zsh | |
| autoload -U colors | |
| if [[ -z $1 ]]; then | |
| read "database_name?Databse Name: " | |
| else | |
| database_name=$1 | |
| fi | 
| .your-font-name(@weight: 3, @style: 'n') { | |
| // Value combinations - i is for italic | |
| // light: 3, n | |
| // regular: 4, n/i | |
| // medium: 5, n | |
| // bold: 7, n/i | |
| // Valid Syntax | |
| // .your-font-name(3, n) | |
| // .your-font-name(3, 'n') | 
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.