Your web-browser is very outdated, and as such, this website may not display properly. Please consider upgrading to a modern, faster and more secure browser. Click here to do so.

Daniel Pritchett

Consulting product developer with Rails Dog in Memphis, TN.
Jun 18 '14

Two vim tips I hope to actually remember this time

Read from an external command into the current buffer

:read prints the results of an external command into the current buffer.

Example

:read ! cat /etc/passwd will copy the /etc/passwd file into the current buffer.

Pasting yanked text into the command input

Yank a word (e.g. yw to yank the word under the cursor) Enter the vim command line via : Ctrl-R, " to paste from the default register.

Note to self - read up on vim registers again!

May 15 '14
Apr 1 '14
Mar 6 '14
"The problem is that the F-35 costs a gazillion dollars, and (partly because it costs a gazillion dollars) the program is too politically wired-in to cancel. So they have to cut other planes to make room for it, and the only way to do that is to claim the F-35 can do the missions those other planes currently do. Which it can’t, of course, but since admitting that would require keeping the other planes, which would require canceling the F-35, which can’t happen, everybody has sort of agreed to pretend it can."

https://news.ycombinator.com/item?id=7354910

Organizational politics in a nutshell.

Feb 27 '14

Lightweight Spree testing and deployment with Wercker and Heroku

Continuous deployment to Heroku has been a huge help on my last two projects. You might find it useful too!

Nov 19 '13

How I felt when the e-commerce framework I’ve been building on all year accepted my pull request.

Nov 4 '13
Oct 12 '13
Aug 2 '13
Jul 9 '13

Endless HTTParty retries in Ruby with a simple block

See also: A Ruby HOWTO: Writing A Method That Uses Code Blocks

# Simple wrapper to allow retries for HTTP requests - prolongs daemon life.
def with_http_retries(&block)
  begin
    yield
  rescue Errno::ECONNREFUSED, SocketError, Net::ReadTimeout
    DaemonKit.logger.error "Cannot reach [#{@service_url}]. Retrying in #{@retry_seconds} seconds."
    sleep @retry_seconds
    retry
  end
end

# DRYing up the connection params
@request_params = [@service_url,
      { headers: { "Authorization" => "Token token=#{api_key}" }, timeout: 5 }]

loop do
  response = with_http_retries { HTTParty.get *@request_params }

  puts JSON.parse(response.body)

  sleep @delay_seconds
end