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
npm install -g strip-ansi | |
heroku logs | strip-ansi | grep 'web.\d' | awk '{ if($7 == "ms") print $6, "\t\t", $3, $4 }' | sort -nr | head -n 10 |
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 ruby | |
require 'nokogiri' | |
require 'open-uri' | |
if ARGV.length > 1 | |
puts 'redis-commands [group]' | |
exit 1 | |
end |
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
system 'touch README.md' | |
system 'mkdir scripts stylesheets templates' | |
# git | |
# http://git-scm.com/ | |
# http://git-scm.com/docs/gitignore | |
file = <<___ | |
node_modules | |
bower_components |
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
.switch input { | |
display: none; | |
} | |
.switch i { | |
display: inline-block; | |
cursor: pointer; | |
padding-right: 20px; | |
transition: all ease 0.2s; | |
border-radius: 20px; |
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
assert(typeof moment == 'function', 'moment dependency') | |
function gt (input, key) { | |
var dur = moment.duration(input, key) | |
return this.as('milliseconds') > dur.as('milliseconds') | |
} | |
function lt (input, key) { | |
var dur = moment.duration(input, key) | |
return this.as('milliseconds') < dur.as('milliseconds') |
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
require 'dotenv' | |
Dotenv.load | |
require 'benchmark' | |
require 'multi_json' | |
require 'firebase' | |
require 'patron' | |
Benchmark.bmbm do |x| |
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
require 'combine_pdf' | |
input = 'filename.pdf' | |
output = 'filename.pdf' | |
num = 10 | |
pdf = CombinePDF.new | |
CombinePDF.new(input).pages.each.with_index(1) do |page, i| | |
pdf << page unless i == num | |
end |
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
require 'set' | |
one = ARGV.shift | |
two = ARGV.shift | |
xs, ys = [ one, two ].map do |app_name| | |
text = `heroku config -a #{app_name}` | |
Set.new(text.scan(/^(\w+):/)) | |
end |
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
var PassThrough = require('stream').PassThrough | |
function createChildStream(ref) { | |
var stream = new PassThrough({ objectMode: true }) | |
ref.limitToLast(1).once('child_added', function(snap) { | |
var stopKey = snap.key() | |
ref.on('child_added', function(snap) { | |
stream.push(snap.val()) | |
if (snap.key() == stopKey) { | |
ref.off('child_added') |
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
YQL('yahoo.finance.quotes') | |
.where({ symbol: [ '^IXIC' ] }) | |
.select([ 'Symbol', 'LastTradePriceOnly', 'Change', 'PercentChange' ]) | |
.then(function (results) { | |
console.log(results) | |
}) | |
YQL('yahoo.finance.historicaldata') | |
.where('symbol', '=', 'PRFC') | |
.where({ startDate: new Date(2015, 4, 1), endDate: new Date(2015, 4, 23) }) |