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
// # Ghost Configuration | |
// Setup your Ghost install for deployment to Zeit Now.sh. | |
// This is a stripped down version of the default `config-example.js` | |
// file with only a single ("production") environment for simplicity. | |
// Full documentation can be found at http://support.ghost.org/config/ | |
var path = require('path'); |
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
/home/nowuser $ env | |
SHLVL=7 | |
HOME=/home/nowuser | |
NOW=1 | |
TEMP=/tmp | |
TERM=xterm-256color | |
PATH=/home/nowuser/src/node_modules/.bin:/home/nowuser/bin://usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/node_modules/@zeit/ace/build/node_modules/.bin | |
DEPLOYMENT_ID=<redacted> | |
AUTH_TOKEN=<redacted> | |
PWD=/home/nowuser |
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 sh | |
# | |
# Usage: | |
# USERNAME=abcd12345 PASSWORD=ghij67890 HOST=n8.io TARGET=alias.zeit.co ./updater.sh | |
URL="https://domains.google.com/nic/update" | |
HOST_IP=$(dig @8.8.8.8 +short A "$HOST" | sort | tail -1) | |
TARGET_IP=$(dig @8.8.8.8 +short A "$TARGET" | sort | tail -1) |
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 { format } from 'url'; | |
import { STATUS_CODES } from 'http'; | |
import uppercamelcase from 'uppercamelcase'; | |
class HTTPError extends Error { | |
constructor(code, message, extras) { | |
super(message || STATUS_CODES[code]); | |
if (arguments.length >= 3 && extras) { | |
Object.assign(this, extras); | |
} |
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
// These theoretical API requests are deferred promises; | |
// Not executed until `.then()` is invoked. | |
let a = new Request('/foo'); | |
let b = new Request('/bar'); | |
let c = new Request('/baz'); | |
// If invoked directly, then issue 3 direct HTTP requests: | |
Promise.all([ a, b, b ]).then((results) => { | |
// GET /foo | |
// GET /bar |
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
'use strict'; | |
const Lazy = require('./lazy-promise'); | |
class TimerPromise extends Lazy(Promise) { | |
constructor() { | |
const start = new Date(); | |
super((resolve, reject) => resolve(new Date() - start)); | |
} | |
} |
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
# Edit the clipboard in your $EDITOR | |
# Add this to your `.bashrc` file | |
function pbedit () { | |
local tmpfile=`mktemp` | |
pbpaste > $tmpfile | |
$EDITOR $tmpfile | |
pbcopy < $tmpfile | |
rm -f $tmpmfile | |
} | |
export -f pbedit |
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
curl https://nodejs.org/dist/v4.2.4/node-v4.2.4-linux-x64.tar.gz | tar xzvf - --exclude CHANGELOG.md --exclude LICENSE --exclude README.md --strip-components 1 -C /usr/local/ |
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
function *MatchIterator (string, regexp, match) { | |
if (match) yield match; | |
match = regexp.exec(string); | |
while (match != null) { | |
yield match; | |
match = regexp.exec(string); | |
} | |
}; | |
module.exports = MatchIterator; |
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
'use strict'; | |
function *LineIterator (str) { | |
let pos = 0; | |
let delimiter = '\n'; | |
while (true) { | |
let index = str.indexOf(delimiter, pos); | |
if (index === -1) break; | |
yield str.substring(pos, index); | |
pos = index + delimiter.length; |