- racksh - console for Rack apps, like
rails c
ormerb -i
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def empty?(s) | |
return s.size == 0 | |
end | |
class B | |
def ==(s) | |
"not boolean" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.application.config.database_configuration | |
Rails.application.load_generators | |
Rails.application.load_seed | |
Rails.application.paths['db/migrate'].to_a | |
Rails.application.railties.all | |
Rails::Engine.find(ENGINE_PATH) | |
Rails.env | |
Rails.env.development? | |
Rails::Generators::SessionMigrationGenerator.start [ ENV['MIGRATION'] || 'add_sessions_table' ] | |
Rails.root |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :gemcutter | |
source 'http://gems.github.com' | |
gem 'rails', '3.2.7' | |
gem 'rake', '0.9.2.2' | |
gem 'foreman' | |
gem 'sidekiq', '= 2.4.0' | |
gem 'sinatra', require: false | |
# Database and data related [Putting pg to the end because of a weird bug with Lion, pg and openssl] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/support/carrierwave.rb | |
class TestStorage < CarrierWave::Storage::File | |
def store!(file) | |
end | |
def retrieve!(identifier) | |
identifier | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
def gas(name = "", acct = "") | |
url = "http://sevgaz.com.ua/index.php?option=com_content&view=article&id=52" | |
data = `curl -F "afam=#{name}" -F "peracc=#{acct}" "#{url}" 2>/dev/null` | |
data.scan(%r{Адрес.*?<tr><td>(.*?)</td>\s*<td>\s*<strong>(.*?)</strong>}).flatten | |
end | |
def water(name = "", acct = "") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FirstController < ApplicationController | |
def edit | |
prepare_model_for_form | |
end | |
def update | |
current_user.attributes = params[:user] | |
current_user.validates_email! | |
if current_user.save |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe SomeController do | |
context "if user is not logged in" do | |
specify "GET 'show' should redirect to login page" do | |
get :show | |
response.should redirect_to login_path | |
end | |
specify "PUT 'update' should redirect to login page" do | |
put :update | |
response.should redirect_to login_path |