This file contains 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
# Some helpers for Rack-Test (http://github.com/brynary/rack-test) | |
# To use the helper, include RackTestHelper in your test class, then you can access | |
# session[:session_id] or whatever. | |
# Warning : this won't work if you're using more than one cookie, since I'm fetching the first available ! | |
module RackTestHelper | |
#Returns the current session as a HASH | |
def session | |
Marshal.load(Base64.decode64(CGI.unescape(rack_mock_session.cookie_jar.to_hash.values.first))).with_indifferent_access | |
end |
This file contains 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
# Copyright (c) 2010 Tech-Angels | |
# | |
# Permission is hereby granted, free of charge, to any person | |
# obtaining a copy of this software and associated documentation | |
# files (the "Software"), to deal in the Software without | |
# restriction, including without limitation the rights to use, | |
# copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the | |
# Software is furnished to do so, subject to the following | |
# conditions: |
This file contains 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
^\w{3} [ :0-9]{11} [._[:alnum:]-]+ suhosin\[[0-9]+\]: ALERT - canary mismatch on efree() - heap overflow detected (attacker '[0-9a-f.:]{3,39}', file '/var/www/openx/www/delivery/[[:alpha:]]+\.php')$ |
This file contains 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
ENV["RAILS_ENV"] = "test" | |
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") | |
require 'test_help' | |
require 'authlogic/test_case' | |
class ActiveSupport::TestCase | |
[...] | |
end | |
module Resque |
This file contains 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 GetEventResult | |
@queue = :events | |
def self.perform(event_id, attempt=0) | |
event = Event.find(event_id) | |
Rails.logger.info "Fetching results for event ##{event.id} (#{event.name})..." | |
begin | |
results = EventImporter.new(event.datetime.to_date).get_results(event) | |
rescue OpenURI::HTTPError |
This file contains 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
$ sudo gem list hanna | |
*** LOCAL GEMS *** | |
hanna (0.1.9) | |
$ sudo gem install justinfrench-formtastic | |
Successfully installed justinfrench-formtastic-0.2.4 | |
1 gem installed | |
Installing ri documentation for justinfrench-formtastic-0.2.4... |
This file contains 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
$ cat .gemrc | |
--- | |
:verbose: true | |
:benchmark: false | |
:sources: | |
- http://gems.rubyforge.org/ | |
- http://gems.github.com | |
:update_sources: true | |
:backtrace: false | |
:bulk_threshold: 1000 |
This file contains 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
# Open in the default browser the page being "seen" by webrat, when a cucumber feature fails: | |
# Credits go to Ben Mabey (cf http://groups.google.com/group/cukes/browse_thread/thread/c5c3c73e469382d6) | |
After do |scenario| | |
if scenario.failed? && scenario.exception.is_a?(Webrat::NotFoundError) | |
save_and_open_page | |
end | |
end |
This file contains 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
# Render a timestamp suitable for javascript substitution (jquery.timeago) | |
# Sorry for copyright, I can't remember where I found this piece of code ! Do not hesitate to claim it | |
def timeago(time, options = {}) | |
options[:class] ||= "timeago" | |
content_tag(:abbr, time.to_s, options.merge(:title => time.getutc.iso8601)) if time | |
end | |
# don't forget to add this to substitute times (HAML) : | |
# :javascript |
This file contains 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
# Fix the issue with domain cookie sessions in rails 2.3. | |
# Put this in your environment file (config/environment/staging.rb for me) | |
Rails.configuration.action_controller.session[:domain] = '.mydomain.net' | |
# instead of : | |
ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(:domain => ".mydomain.net") | |
# or | |
ActionController::Base.session_options[:domain] = ".mydomain.net" |