View rasterize-letter-pdf.js
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'); |
View React Autoresize Textarea
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 { |
View queuePromises.jsx
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 |
View react-portal.jsx
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() { |
View app.jsx
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, { Component } from "react"; | |
const Entry = ({ entry: { name, game } }) => ( | |
<div> | |
<h3>{name}</h3> | |
<p>{game}</p> | |
</div> | |
); | |
const CHANNELS = [ |
View render-component-to-print-html.jsx
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, { PureComponent, PropTypes } from 'react'; | |
import { render, unmountComponentAtNode } from 'react-dom'; | |
import { Base64 } from 'js-base64'; | |
import Promise from 'bluebird'; | |
const htmlDocTemplate = ({ links, pageStyles, body, title = 'Print' }) => (` | |
<html> | |
<head> | |
<title>${title}</title> | |
${links} |
View SearchBuilder.java
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
package com.fastmodelsports.social.lambda.util.es; | |
import com.google.gson.JsonArray; | |
import com.google.gson.JsonObject; | |
public abstract class SearchBuilder { | |
public static JsonArray sortOn(final String attribute, final boolean desc) { | |
final JsonObject sort = new JsonObject(), | |
attr = new JsonObject(); |
View swapfile.config
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 |
View swagger-definitions.ts
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
interface IDataType { | |
type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; | |
readOnly?: true; | |
writeOnly?: true; | |
} | |
interface IStringType extends IDataType { | |
type: 'string'; | |
format?: 'date' | 'date-time' | 'password' | 'byte' | 'binary' | 'uuid' | 'email' | 'uri' | 'hostname' | 'ipv4' | 'ipv6'; |
View prevent-duplicate-async.test.ts
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 { expect } from 'chai'; | |
import preventDuplicateAsync from '../src/util/prevent-duplicate-async'; | |
function testPromise<T>(): { promise: Promise<T>; resolve: (T) => void; reject: (Error) => void; } { | |
let rslv, rjct; | |
const promise = new Promise<T>((resolve, reject) => { | |
rslv = resolve; | |
rjct = reject; |
OlderNewer