Title / Description
Code #!/usr/bin/env ruby require 'ramaze' class MainController < Ramaze::Controller def index super "Hello World!" end end require 'camping' Camping.goes :Hello module Hello::Controllers class Index < R '/' def get render :hello end end end module Hello::Views def hello p "Hello World!" end end require './hello' run Rack::Adapter::Camping.new(Hello) require 'activerecord' require 'uri' db = URI.parse(ENV['DATABASE_URL'] || 'postgres://localhost/mydb') ActiveRecord::Base.establish_connection( :adapter => db.scheme == 'postgres' ? 'postgresql' : db.scheme, :host => db.host, :port => db.port, :username => db.user, :password => db.password, :database => db.path[1..-1], :encoding => 'utf8' ) class SessionsController < ApplicationController def create ENV['sfdc_token'] = request.env['omniauth.auth']['credentials']['token'] ENV['sfdc_instance_url'] = request.env['omniauth.auth']['instance_url'] #render :text => request.env['omniauth.auth'].inspect render :text => Accounts.get_first_hundred.inspect end end foo = 124 bar = :symbol baz = "string" hoge = Hoge.new do |test| @fuga = test end foo = 0.14 proc do |a, b| end lambda { :hi } [].inject(&hoge) [1, 2, 3] %W!foo bar baz!
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code