Skip to content

Instantly share code, notes, and snippets.

@ngtk
Last active January 24, 2016 02:49
Show Gist options
  • Select an option

  • Save ngtk/b719a5b58add5587af0a to your computer and use it in GitHub Desktop.

Select an option

Save ngtk/b719a5b58add5587af0a to your computer and use it in GitHub Desktop.
generate ruby.rack.status_code.snip
require 'rack'
File.open "ruby.rack.status_code.snip", "w" do |out|
Rack::Utils::HTTP_STATUS_CODES.each do |code, message|
symbol = message.downcase.gsub(/\s|-|'/, '_').to_sym
out.write <<-EOL
snippet #{symbol}
abbr #{code} #{message}
options word
:#{symbol}
EOL
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment