Skip to content

Instantly share code, notes, and snippets.

<?php
class Post extends AppModel {
public $validate = array(
'title' => array(
'rule' => 'notEmpty',
'message' => 'Sorry, we need this one, sucka!'
),
'body' => array(
'rule' => 'notEmpty'
)
#!/bin/bash
# Script to build a CSV from redirects stored in mysql DB
db="use rbim3;"
if sources=$(mysql -u root --skip-column-names -e "$db SELECT DISTINCT source from redirects ORDER BY source ASC;")
then
for i in $sources
do
echo ">> Fetching redirects for source '$i'"
src_redirect_sql="$db SELECT source, medium, content, destination, COUNT(destination) as visits from redirects WHERE source='$i' GROUP BY content ORDER BY visits DESC;"
*** LOCAL GEMS ***
ablerc (0.1.1)
abstract (1.0.0)
actionmailer (3.0.19, 3.0.11)
actionpack (3.0.19, 3.0.11)
activemodel (3.0.19, 3.0.11)
activerecord (3.0.19, 3.0.11)
activeresource (3.0.19, 3.0.11)
activesupport (3.0.19, 3.0.11)
@drinkspiller
drinkspiller / gist:5062272
Created March 1, 2013 03:27
my config.ru
require 'app'
disable :run
set :root, Pathname(__FILE__).dirname
run Sinatra::Application
@seo_stuff = SeoSetting.where( '(( controller = ? AND action = ? ) OR path = ? )', params[:controller], params[:action], request.path).limit(1)
if @seo_stuff.any?
@page_title = @seo_stuff.page_title #<-- undefined method `page_title'...but I can see the value in the view
@meta_keywords = @seo_stuff.meta_keywords
@meta_description = @seo_stuff.meta_description
end
@drinkspiller
drinkspiller / production.rb
Created December 11, 2012 05:06
my production.rb
MySite::Application.configure do
config.cache_classes = true
config.log_level = :error
config.action_controller.perform_caching = true
config.active_support.deprecation = :notify
HOST = 'www.mysite.com'