Skip to content

Instantly share code, notes, and snippets.

@pixeltrix
pixeltrix / .htaccess
Created June 1, 2011 21:27
Default WordPress .htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
@pixeltrix
pixeltrix / Capfile
Created November 24, 2010 16:23
Single file deployment config for a Jekyll based website
load 'deploy'
set :stages, [:staging, :production]
set :default_stage, :staging
require 'capistrano/ext/multistage'
task :staging do
set :stage, :staging
set :user, '<ssh-user-staging>'
@pixeltrix
pixeltrix / gist:667517
Created November 8, 2010 09:22
Automated spam cleanup email
From: "Lighthouse" <[email protected]>
To: "[email protected]" <[email protected]>
Reply-To: [email protected]
Date: Mon, 08 Nov 2010 03:54:20 -0500
Subject: [Ruby on Rails #5599] Use Array.wrap instead of Array()
// Add your reply above here
==================================================
Jeff Kreeftmeijer updated this ticket at November 8th, 2010 @ 08:54 AM
@pixeltrix
pixeltrix / routes.rb
Created October 29, 2010 13:21
Examples of advanced Rails 3.0 routes
Rails.application.routes.draw do
get '/(:locale)/products/(:category)/(page/:page).:extension',
:to => 'products#index',
:as => :products,
:constraints => {
:locale => /[a-z]{2}/,
:category => /.+?/,
:page => /\d+/
},
From 45980ca687c7e858eaf5f70d1869645aca2ac755 Mon Sep 17 00:00:00 2001
From: Andrew White <[email protected]>
Date: Tue, 31 Aug 2010 17:02:49 +0100
Subject: [PATCH] Move implicit nested call before options handling so that nested constraints work
---
actionpack/lib/action_dispatch/routing/mapper.rb | 16 +++++++---------
actionpack/test/dispatch/routing_test.rb | 18 ++++++++++++++++++
2 files changed, 25 insertions(+), 9 deletions(-)
From ac01dfb12e217928ac5f2b53e093b202d842af4f Mon Sep 17 00:00:00 2001
From: Andrew White <[email protected]>
Date: Sat, 28 Aug 2010 00:28:46 +0100
Subject: [PATCH] Read the route name directly from the route instead of looking it up in the named routes hash
---
railties/lib/rails/tasks/routes.rake | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/railties/lib/rails/tasks/routes.rake b/railties/lib/rails/tasks/routes.rake
From d00ce654a1442dcea7bf9585647d1b7015cc9cbe Mon Sep 17 00:00:00 2001
From: Andrew White <[email protected]>
Date: Tue, 24 Aug 2010 22:16:34 +0100
Subject: [PATCH] Use nested scope for routes defined at the :resources scope level
---
actionpack/lib/action_dispatch/routing/mapper.rb | 11 ++++++-----
actionpack/test/dispatch/routing_test.rb | 7 +++++++
2 files changed, 13 insertions(+), 5 deletions(-)
# Manage cross engine/plugin dependencies by deferring resolution
# until all plugins have been loaded and then including them after
# the main class definition has been loaded.
# lib/mercium.rb
module Mercium
mattr_reader :extensions
@@extensions = {}
def self.register_extension(klass, extension)
From 210b89938aea9bd514379f2a509049f173c1a56f Mon Sep 17 00:00:00 2001
From: Andrew White <[email protected]>
Date: Tue, 6 Jul 2010 22:20:06 +0100
Subject: [PATCH] When a dynamic :controller segment is present in the path add a
Regexp constraint that allow matching on multiple path segments.
Using a namespace block isn't compatible with dynamic routes so we
raise an ArgumentError if we detect a :module present in the scope.
[#5052 state:resolved]
From 8b47af9fc6f29b552caff5484a33f7325b061d9e Mon Sep 17 00:00:00 2001
From: Andrew White <[email protected]>
Date: Tue, 6 Jul 2010 19:06:02 +0100
Subject: [PATCH] Refactor handling of :only and :except options. The rules are:
1. Don't inherit when specified as an option on a resource
2. Don't push into scope when specified as an option on a resource
2. Resources pull in :only or :except options from scope
3. Either :only or :except in nested scope overwrites parent scope