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
| /** | |
| * A decent observer class. | |
| */ | |
| export type PayloadFn = (payload?: any) => void | Promise<void>; | |
| export interface Subscription { | |
| name: string; | |
| fn: PayloadFn; | |
| } |
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
| docker run --rm -P -v ~/Desktop/test/prod0-shard-0-1538600622-5bb55f5aff7a255af95eba75/:/data/db mongo:3.4 |
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
| #!/usr/bin/env node | |
| const fs = require("fs"); | |
| const path = require("path"); | |
| const express = require("express"); | |
| const jsdom = require("jsdom"); | |
| const isBot = require("isbot"); | |
| const { Script } = require("vm"); | |
| const app = express(); |
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
| #!/bin/sh | |
| NODE_ENV=test mocha --recursive ./**/*_test.js |
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
| f=$(date +%Y-%m-%d-%H-%M-%S) | |
| dest=$(realpath $(pwd)/..) | |
| # Archive newly deployed files in the releases directory. | |
| cp -R $dest/.tmp/ $dest/releases/$n | |
| # Update the symlink to point to the latest release (atomic). | |
| ln -sfn $dest/releases/$n $dest/live-app | |
| # Clean up. |
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
| const zoomScale = [ // [ radius, min points ] | |
| [0, 10], | |
| [0.9, 10], // 1 | |
| [0.7, 10], // 2 | |
| [0.6, 10], // 3 | |
| [0.5, 10], // 4 | |
| [0.4, 9], // 5 | |
| [0.3, 8], // 6 | |
| [0.13, 3], // 7 | |
| [0.09, 3], // 8 |
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
| const dummyData = [ | |
| { | |
| name: 'Hot Pot', | |
| images: [ | |
| 'http://lorempixel.com/400/400/food/1/' | |
| ] | |
| }, | |
| { | |
| name: 'Hot Pot 2', | |
| images: [ |
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
| { | |
| "nouns": [ | |
| "Proclamation", | |
| "Getting", | |
| "ready", | |
| "trip", | |
| "Will", | |
| "American", | |
| "I", | |
| "President", |
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
| // An example of the configured Pagination component. | |
| // I've injected the total in the connection on the server side. | |
| <Pagination | |
| bsSize="small" | |
| items={Math.ceil(total / PAGE_COUNT)} | |
| activePage={currentPage} | |
| onSelect={this.onPageChange('mangosCurrentPage', 'mango', edges)} | |
| /> |
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
| #!/usr/bin/env node | |
| /** | |
| * Process the client side application using babelify and browserify. | |
| */ | |
| if (!process.env.CLIENT_PATH || !process.env.SERVER_PATH) { | |
| throw 'CLIENT_PATH and SERVER_PATH is required.' | |
| } |