- http://www.wearebeef.co.uk | http://www.beefsource.co.uk
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
# Add this to your gem file | |
group :production do | |
gem 'dalli' | |
gem 'rack-cache', :require => 'rack/cache' | |
gem 'rack-contrib', :require => 'rack/contrib' | |
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
<Location /> | |
# Insert filter | |
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-javascript | |
# Netscape 4.x has some problems... | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
# Netscape 4.06-4.08 have some more problems | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip |
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
# Place in /config/initializers | |
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
if html_tag =~ /<(input|textarea|select|label)[^>]+style=/ | |
style_attribute = html_tag =~ /class=['"]/ | |
html_tag.insert(style_attribute + 7, "fieldWithErrors ") | |
elsif html_tag =~ /<(input|textarea|select|label)/ | |
first_whitespace = html_tag =~ /\s/ | |
html_tag[first_whitespace] = ' class="fieldWithErrors" ' | |
end | |
html_tag |
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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
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
#!/bin/bash | |
# using all types of newlines, search for a rails log header for a certain action of a certain controller | |
# copy and paste into terminal | |
pcregrep -MN ANY 'Processing FatController#action_man([^\n]*\n){10}' log/production.log |
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
# Be sure to restart your server when you modify this file. | |
my_formats = { | |
:short_ordinal => '%d %B - %H:%M', | |
:short_dot => ' %d.%m.%y', | |
:long_dot => '%H:%M - %d.%m.%y', | |
:time => '%H:%M' | |
} | |
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(my_formats) |
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
Scenario: Create an Article | |
Given I am on the new article page | |
When I fill in the article details | |
And I press "Save" | |
Then I should be on articles admin page | |
And I should see 'Article successfully created' | |
Scenario: Update a article | |
Given there are saved articles | |
And I am on the articles admin page |
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 ActiveRecord::Base | |
protected | |
def self.construct_count_options_from_args(*args) | |
name_and_options = super | |
if name_and_options[0].is_a?(String) | |
if name_and_options[0].include?(',') | |
name_and_options[0] = "DISTINCT #{quoted_table_name}.#{primary_key}" | |
elsif name_and_options[0] =~ /\.\*$/ | |
name_and_options[0] = '*' | |
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
server { | |
listen 80; | |
server_name dev.myapp.com; | |
root /var/www/staging/current/public; | |
passenger_enabled on; | |
rails_env staging; | |
} | |
server { | |
listen 80; |
NewerOlder