Skip to content

Instantly share code, notes, and snippets.

require 'capistrano/recipes/deploy/strategy/base'
require 'fileutils'
require 'tempfile' # Dir.tmpdir
require 'net/ssh'
require 'net/sftp'
require 'find'
module Capistrano
module Deploy
@randyjhunt
randyjhunt / gist:87674
Created March 30, 2009 07:29
Get variable from URL
<?php // get the value of "variable" from the URL
$val = $_GET['variable'];
?>
<?php
if ( $val == "yeah" ) {
echo "the variable is YEAH!";
} ?>
<!-- add the following code to your functions.php file -->
<?php
add_filter( 'sidebars_widgets', 'disable_all_widgets' );
function disable_all_widgets( $sidebars_widgets ) {
if ( is_home() )
$sidebars_widgets = array( false );
return $sidebars_widgets;
}
# you can trap for nil entries in validations and validations are simple
# you can always test it with .blank?
# you can always convert nil values to empty strings by simply
# adding .to_s
# i.e.
test = User.new
test.name
=> nil
test.name.to_s
=> ""
# run psql as the postgres user
psql -U postgres
create role USERNAME with createdb login;
\q
# run psql as the newly created user
psql -U USERNAME postgres
create database DBNAME;
\q
mkdir /usr/local/src
cd /usr/local/src
wget url-for-latest-postgres-package
tar xzf postgres...tgz
cd postgres...
./configure --with-bonjour --with-openssl
./make
./make install
randy-j-hunts-macbook-air-2:design-ignites-change randyjhunt$ rake gems:install
(in /Users/randyjhunt/code/rails/design-ignites-change)
gem install mislav-will_paginate --version "~> 2.2.3" --source http://gems.github.com
WARNING: Installing to ~/.gem since /Library/Ruby/Gems/1.8 and
/usr/bin aren't both writable.
WARNING: You don't have /Users/randyjhunt/.gem/ruby/1.8/bin in your PATH,
gem executables will not run.
Successfully installed mislav-will_paginate-2.2.3
1 - In textmate, open the bundle editor> Edit Languages
2 - pick Rails: HTML(rails) from the left hand thing
3 - Then change
fileTypes = ( 'rhtml' );
to
fileTypes = ( 'rhtml', 'html.erb' );
@randyjhunt
randyjhunt / gist:43326
Created January 5, 2009 08:09
Apache permanent redirect
# configure RedirectPermanent in Apache vhost
# step 1: new virtual hosts for each domain
# step 2: RedirectPermanent in each new vhost file
RedirectPermanent / http://mysite.org
# put the RedirectPermanent inside a vhost for each mysite.com and mysite.net
# RedirectPermanent is part of mod_alias
# this was done so multiple domain extensions would all change to the same extension
# common Rake commands
# run migrations
rake db:migrate
# copy the database
rake db:test:clone_structure
# display all application routes
rake routes