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
#!/usr/bin/env bash | |
set -e | |
# ----------------------------------------------------------------------------- | |
# Open a bastion host connection | |
# ----------------------------------------------------------------------------- | |
usage="$0 [region] [ssh args]" | |
# this variable could be "DC" (data center) instead. | |
REGION=$1 | |
shift |
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
fs.readFile path, (error, buffer) -> | |
unless error? | |
doSomethingWithContents buffer.toString() | |
else | |
handleError error |
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
try | |
buffer = yield readFile path | |
doSomethingWithContents buffer.toString() | |
catch error | |
handleError error |
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
github = resource "https://api.github.com/", | |
repo: (resource) -> | |
resource "repos/{owner}/{repo}/", | |
issues: (resource) -> | |
resource "issues", | |
create: | |
method: "post" | |
headers: | |
accept: "application/vnd.github.v3.raw+json" | |
expect: 201 |
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
try | |
{response, data} = yield github | |
.repo owner: "pandastrike", repo: "shred" | |
.list() | |
for issue in (JSON.parse yield data) | |
console.log issue | |
catch error | |
console.error error |
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
do (data="") -> | |
response.on "data", (chunk) -> data += chunk | |
response.on "end" -> | |
try | |
for issue in (JSON.parse data) | |
console.log issue | |
catch error | |
console.error error |
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
context.test "Using a full URL for a nested resource", (context) -> | |
{data} = yield github | |
.repo | |
.issues("https://api.github.com/repos/pandastrike/shred/issues") | |
.list() | |
assert.equal type(yield data), "array" |
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
parallel = require "when/parallel" | |
resource = require "shred" | |
module.exports = (urls...) -> parallel (resource(url) for urls in url) |
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
curl https://raw.githubusercontent.com/creationix/nvm/v0.17.3/install.sh | bash | |
source ~/.nvm/nvm.sh |
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
nvm install 0.11 | |
nvm use 0.11 |