It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// getComponent is a function that returns a promise for a component | |
// It will not be called until the first mount | |
function asyncComponent(getComponent) { | |
return class AsyncComponent extends React.Component { | |
static Component = null; | |
state = { Component: AsyncComponent.Component }; | |
componentWillMount() { | |
if (!this.state.Component) { | |
getComponent().then(Component => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
year | how many | ordinance or law | resolution | exective order or directive | admin memo, IT policy, etc | city | county | state | |
---|---|---|---|---|---|---|---|---|---|
2006 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | |
2009 | 3 | 2 | 0 | 1 | 0 | 2 | 1 | 0 | |
2010 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | |
2011 | 4 | 2 | 1 | 0 | 1 | 1 | 2 | 1 | |
2012 | 7 | 5 | 0 | 2 | 0 | 5 | 1 | 1 | |
2013 | 16 | 7 | 0 | 5 | 4 | 8 | 3 | 5 | |
2014 | 20 | 11 | 1 | 6 | 2 | 14 | 3 | 3 | |
2015 | 8 | 1 | 1 | 3 | 3 | 8 | 0 | 0 | |
2016 | 9 | 2 | 4 | 3 | 0 | 8 | 0 | 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
❯ rollup --version | |
rollup version 0.25.3 | |
❯ time rollup -c ./rollup.js | |
rollup -c ./rollup.js 4.65s user 0.22s system 118% cpu 4.131 total | |
❯ time webpack | |
Hash: ebb00bbccd954c114d3c | |
Version: webpack 2.0.7-beta | |
Time: 3623ms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var babel = require('babel-core'); | |
var fs = require('fs'); | |
// borrowed from https://github.com/babel/babel-jest/blob/master/index.js | |
require.extensions['.jsx'] = function (module, filename) { | |
var src = fs.readFileSync(filename, 'utf8'); | |
// Allow the stage to be configured by an environment | |
// variable, but use Babel's default stage (2) if |
Creates an injector object that can be used for retrieving services as well as for dependency injection
// create an injector
var $injector = angular.injector(['ng']);
// use the injector to kick off your application
// use the type inference to auto inject arguments, or use implicit injection
$injector.invoke(function($rootScope, $compile, $document){
2015-01-29 Unofficial Relay FAQ
Compilation of questions and answers about Relay from React.js Conf.
Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.
Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Thanks to http://www.labs.saachitech.com/2012/10/23/pdf-generation-using-uiprintpagerenderer | |
// Note: including images in the HTML won't work, see here: | |
// https://github.com/nyg/HTMLWithImagesToPDF | |
import UIKit | |
// 1. Create a print formatter | |
let html = "<b>Hello <i>World!</i></b>" | |
let fmt = UIMarkupTextPrintFormatter(markupText: html) |