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 { Writable } from 'stream' | |
/** | |
* Create a Buffer from a stream (warning: loads all chunks into memory) | |
* Usage: myStream.pipe(new BufferStream(buffer => {}, err => {})) | |
*/ | |
export default class BufferStream extends Writable { | |
data = [] |
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
let musicalNotes = [ | |
// name + octave: frequency (Hz) | |
"C0": 16.35, | |
"C#0": 17.32, | |
"D0": 18.35, | |
"D#0": 19.45, | |
"E0": 20.60, | |
"F0": 21.83, | |
"F#0": 23.12, | |
"G0": 24.50, |
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 UIKit | |
class BlurredBackgroundView: UIView { | |
let imageView: UIImageView | |
let blurView: UIVisualEffectView | |
override init(frame: CGRect) { | |
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark) | |
blurView = UIVisualEffectView(effect: blurEffect) | |
imageView = UIImageView(image: UIImage(name: "someBackgroundImage.jpg")) |
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
open -a Google\ Chrome --args --disable-web-security --user-data-dir |
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
auth_basic "Restricted"; | |
auth_basic_user_file /home/dokku/$APP/nginx.conf.d/.htpasswd; |
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
/* | |
* EXAMPLE USAGE | |
* This component is text that will bounce on mount and | |
* every time `this.props.someProperty` changes. | |
* Too bad react native doesn't support decorators yet :/ | |
*/ | |
import React, { | |
Component, | |
StyleSheet, |
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
const fs = require('fs') | |
const path = require('path') | |
const mkpath = require('mkpath') | |
module.exports = function writeFilePromise(fileName, contents) { | |
return new Promise((resolve, reject) => { | |
mkpath(path.dirname(fileName), err => { | |
if (err) reject(err) | |
else { | |
fs.writeFile(fileName, contents, err => { |
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
const fs = require('fs') | |
module.exports = function readFilePromise(path, encoding) { | |
return new Promise((resolve, reject) => { | |
try { | |
var filename = require.resolve(path) | |
fs.readFile(filename, encoding || 'utf8', (err, file) => { | |
if (err) reject(err) | |
else resolve(file) | |
}) |
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
// @flow | |
/* eslint-env browser */ | |
import * as React from 'react' | |
import { createPortal } from 'react-dom' | |
type Props = { | |
children: React.Node, | |
} | |
export default class Portal extends React.Component<Props> { |