This file contains 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
import React, { Children, PureComponent, PropTypes } from 'react'; | |
import { unmountComponentAtNode, unstable_renderSubtreeIntoContainer } from 'react-dom'; | |
// renders children at the end of the body | |
export default class Portal extends PureComponent { | |
static propTypes = { | |
children: PropTypes.node.isRequired | |
}; | |
componentDidMount() { |
This file contains 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
import _ from 'underscore'; | |
/** | |
* Takes an array of generators, i.e. functions that return promises, and calls them such that there are only ever | |
* 5 requests that are waiting on responses. Returns a promise that resolves to all the resulting promises only after | |
* they have all been executed | |
* | |
* @param generators array of functions that | |
* @param batchSize max number of requests to execute at a time | |
* @param throttle how often the queue is checked for more requests to process |
This file contains 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
/** | |
* Returns a promise that has a cancelled method that will cause the callbacks not to fire when it resolves or rejects | |
* @param promise to wrap | |
* @returns new promise that will only resolve or reject if cancel is not called | |
*/ | |
export default function cancellable(promise) { | |
var cancelled = false; | |
const toReturn = new Promise((resolve, reject) => { | |
promise.then(() => { |
This file contains 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
React.createClass({ | |
displayName: 'Autoresizing TextArea', | |
propTypes: { | |
height: React.PropTypes.number.isRequired, | |
onChangeHeight: React.PropTypes.func.isRequired | |
}, | |
getDefaultProps: function () { | |
return { |
This file contains 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 page = require('webpage').create(), | |
system = require('system'), | |
address, output, size; | |
if (system.args.length !== 3) { | |
console.log('Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat] [zoom]'); | |
console.log(' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"'); | |
console.log(' image (png/jpg output) examples: "1920px" entire page, window width 1920px'); | |
console.log(' "800px*600px" window, clipped to 800x600'); |
This file contains 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
commands: | |
000_dd: | |
test: test ! -e /swapfile | |
command: dd if=/dev/zero of=/swapfile bs=1M count=2048 && chmod 600 /swapfile | |
001_mkswap: | |
command: mkswap /swapfile | |
ignoreErrors: true | |
002_swapon: | |
command: swapon /swapfile | |
ignoreErrors: true |
This file contains 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
import org.jsoup.Jsoup; | |
import org.jsoup.nodes.Document; | |
import org.jsoup.nodes.Element; | |
import org.jsoup.select.Elements; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import java.util.Set; | |
import java.util.StringTokenizer; | |
import java.util.logging.Level; |
NewerOlder