Skip to content

Instantly share code, notes, and snippets.

View neilmiddleton's full-sized avatar
🏠
Working from home

Neil Middleton neilmiddleton

🏠
Working from home
View GitHub Profile
@neilmiddleton
neilmiddleton / Zippy
Created February 1, 2011 17:08
Zippy Application Template
# HTML 5 Boiler Plate
apply 'https://gist.github.com/806066.txt'
run "rm public/javascripts/jquery.js"
run "rm -rf public/build"
run "rm -rf public/demo"
run "rm -rf public/test"
# JQuery
apply 'https://gist.github.com/806025.txt'
@neilmiddleton
neilmiddleton / HTML5BoilerPlateTemplate
Created February 1, 2011 16:08
HTML5 Boiler Plate Template
# Rails 3 simple template
# USE ONLY ON EMPTY APPS - USAGE:rails new app_name -m rails3-templates/base.rb
# Remove Default
run 'mv public/index.html public/test-rails3.html'
# Install JQuery
inside "public/javascripts" do
FileUtils.rm_rf %w(controls.js dragdrop.js effects.js prototype.js rails.js)
run "wget https://github.com/rails/jquery-ujs/raw/master/src/rails.js --no-check-certificate"
# Delete old prototype drivers
# Do this first so that you don't delete the new jQuery rails one below
inside('public/javascripts') do
FileUtils.rm_rf %w(controls.js dragdrop.js effects.js prototype.js rails.js)
end
# Download latest jQuery.min
get "http://code.jquery.com/jquery-latest.min.js", "public/javascripts/jquery.js"
# Download latest jQuery drivers
@neilmiddleton
neilmiddleton / gist:703612
Created November 17, 2010 16:38
SQL Find and Replace
SET NOCOUNT ON
DECLARE @stringToFind VARCHAR(100)
DECLARE @stringToReplace VARCHAR(100)
DECLARE @schema sysname
DECLARE @table sysname
DECLARE @count INT
DECLARE @sqlCommand VARCHAR(8000)
DECLARE @where VARCHAR(8000)
DECLARE @columnName sysname
@neilmiddleton
neilmiddleton / deployments.rake
Created October 15, 2010 16:18
Integrates CodebaseHQ deployment notifications into Heroku-san
desc 'After_deploy callback'
task :before_deploy => :environment do |t, args|
username = `git config codebase.username`.chomp.strip
api_key = `git config codebase.apikey`.chomp.strip
if username == '' || api_key == ''
puts " * Codebase is not configured on your computer. Bundle the codebase gem and run 'codebase setup' to auto configure it."
puts " * Deployments will not be tracked."
next
require 'test_helper'
require 'admin/comments_controller'
class Admin::CommentsController; def rescue_iction(e) raise e end; end
class CommentControllerTest < ActionController::TestCase
should "get index" do
Factory(:comment)
Factory(:comment)
~ ➔ rvm --trace install ree
--trace install ree
rvm 0.1.38 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/]
+ [[ -z '' ]]
+ [[ ! -z ree ]]
+ rvm_action=use
+ [[ ! -z '' ]]
+ [[ ! -z '' ]]
SELECT * FROM sometable WHERE textfield LIKE '%value%';
SELECT * FROM sometable WHERE textfield ILIKE '%value%';
<%= some_string.html_safe %>