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
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
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 | |
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
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
#!/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
# only open After Effects if cache hard drive is plugged in | |
function fx() { | |
if [ -d /Volumes/Vanniman\ Time\ Machine/ ] | |
then | |
open -a Adobe\ After\ Effects\ CC | |
fi | |
} |
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
alias MacBook="sudo" | |
alias THELONIUS="sudo" | |
alias Air="sudo" |
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
model.foobar = model.foo_or_bar? # business logic | |
response.content = model.to_json # serialization | |
response.headers += "Content-type: foo/bar" # protocol details | |
response.send # ok go |
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
# sinatra | |
get "/show" do | |
# render a template here | |
# maybe sneak in ActiveRecord or something | |
end | |
# waves equivalent, isolated for simplicity | |
on :get, :show => [ 'entry', :name ] do |