Skip to content

Instantly share code, notes, and snippets.

View tammersaleh's full-sized avatar
🚀
Orbiting?

Tammer Saleh tammersaleh

🚀
Orbiting?
View GitHub Profile
$ rake db:drop:all
(in /Users/tsaleh/code/tsaleh/lettercase)
Couldn't drop lettercase_test : #<Mysql::Error: Unknown database 'lettercase_test'>
$ rake db:create:all
(in /Users/tsaleh/code/tsaleh/lettercase)
lettercase_test already exists
*sponsor.txt* For Vim version 7.2. Last change: 2008 Jun 21
VIM REFERENCE MANUAL by Bram Moolenaar
SPONSOR VIM DEVELOPMENT *sponsor*
Fixing bugs and adding new features takes a lot of time and effort. To show
class RoutingErrorRaiser
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
raise ActionController::RoutingError, "No route matches #{env['PATH_INFO'].inspect}" if headers['X-Cascade'] == 'pass'
[status, headers, body]
end
def default_middleware_stack
ActionDispatch::MiddlewareStack.new.tap do |middleware|
middleware.use('::ActionDispatch::Static', lambda { paths.public.to_a.first }, :if => lambda { serve_static_assets })
middleware.use('::Rack::Lock', :if => lambda { !allow_concurrency })
middleware.use('::Rack::Runtime')
middleware.use('::Rails::Rack::Logger')
# middleware.use('::ActionDispatch::ShowExceptions', lambda { consider_all_requests_local }, :if => lambda { action_dispatch.show_exceptions })
middleware.use("::ActionDispatch::RemoteIp", lambda { action_dispatch.ip_spoofing_check }, lambda { action_dispatch.trusted_proxies })
context "with something else" do
setup { @model.something_else = true }
subject { @model }
should_validate_presence_of :something
end
ruby-1.8.7-p249 > "a" =~ / /
=> nil
ruby-1.8.7-p249 > " " =~ / /
=> 0
cars = Car.scoped
rich_ppls_cars = cars.order('cars.price DESC').limit(10)
# ..vs...
cars = Car
rich_ppls_cars = cars.order('cars.price DESC').limit(10)
# ie: Why the call to #scoped?
test: as a logged in user given an email end point on GET to /email_end_points/ should render a form to create a new email end point. (EmailEndPointsControllerTest)
[webrat (0.5.3) lib/webrat/core/matchers/have_selector.rb:63:in `assert_have_selector'
test/shoulda_macros/should_render_form.rb:8:in `__bind_1263853521_607713'
shoulda (2.10.2) lib/shoulda/context.rb:351:in `call'
shoulda (2.10.2) lib/shoulda/context.rb:351:in `test: as a logged in user given an email end point on GET to /email_end_points/ should render a form to create a new email end point. ']:
expected following output to contain a <form[action$='/email_end_points'][method='post']/> tag:
...
<form action="/email_end_points" class="formtastic email_end_point" id="new_email_end_point" method="post">
class ClientsController < InheritedResources::Base
actions :index, :create, :update, :destroy
belongs_to :user
def create
create! do |success, failure|
success.html { redirect_to collection_url }
failure.html { collection; render :action => :index }
end
end
jQuery.extend({
isReady: false,
readyList: [],
// Handle when the DOM is ready
ready: function() {
// Make sure that the DOM is not already loaded
if ( !jQuery.isReady ) {
// Remember that the DOM is ready
jQuery.isReady = true;