Skip to content

Instantly share code, notes, and snippets.

View overture8's full-sized avatar

Phil McClure overture8

  • Stora
  • Belfast, Northern Ireland
View GitHub Profile
> sudo apt-get install dnsmasq
> app.get '/people'
> app.response.body
# You can also inspect the request with:
> app.request
> ApplicationController.allow_forgery_protection = false
> app.host! 'mysubdomain.mydomain.local:3000'
> app.post '/sessions', :username => 'phil', :password => 'somethingsecure'
$ rails c
> app.get '/uri'
> app.post '/uri', :postdata1 => "something", :postdata2 => "nothing"
> app.put '/uri', :postdata1 => "something", :postdata2 => "nothing"
> app.delete '/uri'
<%= csrf_meta_tag %>
irb(main):004:0> b = Book.new
irb(main):004:0> b.read
=> "reading book..."
irb(main):004:0> b.go_to_page(101)
=> "Going to page 101"
class Book
def read
puts "reading book..."
end
def go_to_page(page_no)
puts "Going to page #{page_no}"
end
end
class Application < Rails::Application
config.middleware.use Rack::Codehighlighter, :coderay, :element => "pre", :pattern => /\A:::(\w+)\s*\n/
.
.
.
end