Skip to content

Instantly share code, notes, and snippets.

View steveclarke's full-sized avatar

Steve Clarke steveclarke

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / 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:1411146
Created November 30, 2011 21:54
Git: Setting up a Remote Repository and Doing Initial Push

Setup remote repository:

ssh [email protected]
mkdir my_project.git
cd my_project.git
git init --bare

On local machine:

cd my_project