Skip to content

Instantly share code, notes, and snippets.

View steveclarke's full-sized avatar

Steve Clarke steveclarke

View GitHub Profile
@steveclarke
steveclarke / gist:1411146
Created November 30, 2011 21:54
Git: Setting up a Remote Repository and Doing Initial Push

Setup remote repository:

ssh git@example.com
mkdir my_project.git
cd my_project.git
git init --bare

On local machine:

cd my_project

@steveclarke
steveclarke / rename.sh
Created November 30, 2011 21:57
Iteratively rename files in Bash
for f in *.rhtml; do git mv $f `basename $f rhtml`html.erb; done
@steveclarke
steveclarke / gist:1411340
Created November 30, 2011 22:17
Useful shell script functions to pretty things up
pretty_echo(){
echo '--------------------------------'
echo " $*"
echo '--------------------------------'
echo ''
}
prompt(){
read -p 'Press any key to continue...'
}
@steveclarke
steveclarke / delay.js
Created December 1, 2011 01:08
jQuery Tips
// When you’re queuing up a chain of animations, you can use the delay()
// method to pause the animation for a length of time; pass that time as
// a parameter in milliseconds.
$('div').hide().delay(2000).show(); // div will stay hidden for 2 seconds before showing.
@steveclarke
steveclarke / application.rb
Created December 1, 2011 01:18
Rails Configuration Howto
moduleConfigurator
classApplication < Rails::Application
# By default, let OSX resolve the path to the binary
config.wkhtmltopdf = "wkhtmltopdf"
end
end
@steveclarke
steveclarke / errors.html.erb
Created December 1, 2011 01:19
Error messages for object
<% if @obj.errors.any? %>
<div class="error-messages">
<h2><%= pluralize(@obj.errors.count, 'error') %> are preventing this object from being created:</h2>
<ul>
<% @obj.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
@steveclarke
steveclarke / gist:1431461
Created December 4, 2011 22:14
Rails 3.1 on Cedar

heroku create [appname] --stack cedar

git push heroku master

heroku run rake db:migrate

@steveclarke
steveclarke / gist:1903225
Created February 24, 2012 19:42
namespace
var foo = {
11 sample: function() {
10 alert('sample!');
9 },
8
7 mix: function() {
6 alert('mix!');
5 }
4 };
3
@steveclarke
steveclarke / block-test.rb
Created March 28, 2012 00:59
Block Test for VotD
class Votd
attr_reader :reference, :text, :version
def initialize
@reference = "John 3:16"
@text = "For God so loved the world..."
@version = "NIV"
end
def to_html
@steveclarke
steveclarke / gist:2222984
Created March 28, 2012 02:25
Bundler 1.1
gem 'capistrano', '~> 2.11.2'
gem 'rails', github: 'rails/rails', branch: '3-2-stable', ref: '123...'
gem 'rails', path: '~/code/rails'
gem 'capybara', group: :test