Skip to content

Instantly share code, notes, and snippets.

View beef's full-sized avatar

Beef beef

  • Beef
  • Bristol, UK
View GitHub Profile
---
extension: xml
layout: nil
dirty: true
filter: erb
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<% @pages.find(:all ).each do |page| -%>
<url>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Sniffer</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"></script>
<script type="text/javascript" charset="utf-8">
@beef
beef / unattended_passenger_apache.sh
Created May 19, 2009 11:54 — forked from maran/Unattended Rails (Passenger, Ruby Enterprise) Stack
Unattended Rails (Passenger, Ruby Enterprise) Stack
#!/bin/bash
# Unattended REE/Passenger installation
# Source: http://weblog.brightlight-ict.nl/2008/12/unattended-passenger-ruby-enterprise-installation-on-ubuntu-8/
# 15/03/09 Updated to use latest r.e.e. and passenger 2.1 and rewrote bits thanks to the comments left on my blog. Thanks guys
# 05/10/09 Update to use latest r.e.e. and passenger 2.2.5 (beef)
# 27/10/09 Update to use latest r.e.e. (beef)
# 23/11/09 Update to use latest passenger 2.2.7 (beef)
# 23/12/09 Using deb package rather the source
# 11/03/10 added new version of enterprise .deb
@beef
beef / default
Created May 19, 2009 14:13
Staging and Live Apache Set Up
<VirtualHost *>
<Directory /var/www/default/current/public>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from All
</Directory>
DocumentRoot /var/www/default/current/public
ServerName www.myapp.com
# m h dom mon dow command
*/30 * * * * cd /var/www/default/current; /usr/bin/rake xapian:update_index RAILS_ENV=production
0 0 * * 7 cd /var/www/default/current; /usr/bin/rake xapian:rebuild_index models='Profile Job Diary Article' RAILS_ENV=production
Geocode.all.each do |g|
begin
g.update_attributes( Geocode.geocoder.locate(g.query).attributes )
rescue
g.destroy
end
end
# base_template.rb
run "echo TODO > README"
run "rm public/index.html"
generate :controller, "home index"
route "map.root :controller => 'home'"
run "cp config/environments/production.rb config/environments/staging.rb"
run "echo '\nstaging:\n production' >> config/database.yml"
server {
listen 80;
server_name dev.myapp.com;
root /var/www/staging/current/public;
passenger_enabled on;
rails_env staging;
}
server {
listen 80;
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
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