#Deploying a Meteor app to Digital Ocean
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
| /** | |
| * Sort array of objects based on another array | |
| */ | |
| function mapOrder (array, order, key) { | |
| array.sort( function (a, b) { | |
| var A = a[key], B = b[key]; | |
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 Page = require('puppeteer/lib/Page'); | |
| // the following 2 methods are originally from: https://github.com/GoogleChrome/puppeteer/issues/85#issuecomment-341743259, with some modification to fit puppeteerv1.0.0 | |
| async function newPageWithNewContext(browser) { | |
| const { browserContextId } = await browser._connection.send('Target.createBrowserContext'); | |
| const { targetId } = await browser._connection.send('Target.createTarget', { url: 'about:blank', browserContextId }); | |
| const target = await browser._targets.get(targetId); | |
| const client = await browser._connection.createSession(targetId); | |
| const page = await Page.create(client, target, browser._ignoreHTTPSErrors, browser._appMode, browser._screenshotTaskQueue); | |
| page.browserContextId = browserContextId; |
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
| import React from 'react'; | |
| import moment from 'moment'; | |
| let timer; | |
| class Clock extends React.Component { | |
| renderTime() { | |
| this.setState({ | |
| utcTime: moment.utc(new Date()).format("dddd, MMMM Do YYYY, h:mm:ss a").toString(), | |
| }); |
using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies