Skip to content

Instantly share code, notes, and snippets.

View neilmiddleton's full-sized avatar
🏠
Working from home

Neil Middleton neilmiddleton

🏠
Working from home
View GitHub Profile
TUTORIAL_KEY=`(echo -n ":" ; heroku auth:token) | base64` ; echo $TUTORIAL_KEY
curl -X GET https://api.heroku.com/apps -H "Accept: application/vnd.heroku+json; version=3" -H "Authorization: $TUTORIAL_KEY"
curl -X GET https://api.heroku.com/apps/neilmiddleton/formation -H "Accept: application/vnd.heroku+json; version=3" -H "Authorization: $TUTORIAL_KEY"
[
{
"name": "support.triage_paid",
"data_point": "views/26629566/count.json",
"type": "count",
"source": "zendesk"
},
{
"name": "support.triage_free",
"data_point": "views/26626052/count.json",
module HealthReport
module LogStreamer
def stream(url, timeout)
Timeout::timeout(20) do
EventMachine.run do
EventMachine::PeriodicTimer.new(15) { out << "\0" }
http = EventMachine::HttpRequest.new(url, keepalive: true, connection_timeout: 0, inactivity_timeout: 0).get
buffer = ""
http.stream do |chunk|
def stream(url, timeout)
http.stream do |chunk|
buffer << chunk
yield buffer
end
end
stream url, 20 do |buffer|
while line = buffer.slice!(/.+\n/)
end
EventMachine.run do
EventMachine::PeriodicTimer.new(15) { out << "\0" }
http = EventMachine::HttpRequest.new(url, keepalive: true, connection_timeout: 0, inactivity_timeout: 0).get
buffer = ""
http.stream do |chunk|
buffer << chunk
while line = buffer.slice!(/.+\n/)
puts line
end
$ h pg:index_usage -a bisley-production
<%
require 'cgi'
require 'uri'
begin
uri = URI.parse(ENV["DATABASE_URL"])
rescue URI::InvalidURIError
raise "Invalid DATABASE_URL"
end

Neil is the English Samurai at Heroku working as part of the Support Engineering team. Based in the UK working remotely Neil helps look after the 3 million + applications Heroku run on a daily basis whilst struggling to remember all their names.

@neilmiddleton
neilmiddleton / gist:5712976
Last active December 18, 2015 02:39
Unicorn config
worker_processes ENV["RAILS_ENV"] == 'production' ? 3 : 1
timeout 30
worker_processes ENV.fetch("WORKER_CONCURRENCY", 1).to_i
timeout ENV.fetch("UNICORN_TIMEOUT", 30).to_i

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discussions around concrete examples, not handy-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style