Skip to content

Instantly share code, notes, and snippets.

View maletor's full-sized avatar

Ellis Berner maletor

View GitHub Profile
## layouts/home.html.erb
<% content_for :home do %>
<%= yield %>
<% end %>
<% render :file => 'layouts/application' %>
## layouts/home.html.erb
<% content_for :home do %>
<%= yield %>
<% end %>
<% render :file => 'layouts/application' %>
## layouts/home.html.erb
<% content_for :home do %>
<%= yield %>
<% end %>
<% render :file => 'layouts/application' %>
worker_processes 4
working_directory "/home/maletor/Sites/ellisberner/"
listen "/home/maletor/ellisberner/tmp/sockets/unicorn.sock", :backlog => 2048
timeout 30
pid "/home/maletor/ellisberner/tmp/pids/unicorn.pid"
upstream unicorn {
server unix:/home/maletor/Sites/ellisberner/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name ellisberner.com;
root /home/maletor/Sites/ellisberner/public;
server {
listen 80;
server_name ellisberner.com;
access_log /var/log/nginx/localhost.access.log;
root /var/www/ellisberner.com/current/public;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
set :application, "ellisberner.com"
role :app, application
role :web, application
role :db, application, :primary => true
set :user, "www-data"
set :port, 2222
set :deploy_to, "/var/www/#{application}"
set :repository, "git://github.com/maletor/ellisberner.git"
include Rakismet::Controller
rakismet_filter :only => :create
def create
@post = Post.find(params[:post_id])
@comment = @post.comments.build(params[:comment])
if @comment.spam?
flash[:error] = "This comment looks a lot like spam."
include Rakismet::Controller
rakismet_filter :only => :create
def create
@post = Post.find(params[:post_id])
@comment = @post.comments.build(params[:comment])
if @comment.spam?
flash[:error] = "This comment looks a lot like spam."
class Comment < ActiveRecord::Base
include Rakismet::Model
belongs_to :post
validates_presence_of :author, :author_email, :content
validates_format_of :author_email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
validates_format_of :author_url, :with => URI::regexp(%w(http https)), :allow_blank => true