Skip to content

Instantly share code, notes, and snippets.

View cherring's full-sized avatar
💭
Why do we even need this?

Chris Herring cherring

💭
Why do we even need this?
View GitHub Profile
@cherring
cherring / d.rb
Created September 13, 2011 05:37
Using libdevil to thumbnail and watermark
# Gem: http://rubygems.org/gems/devil
# Library: http://openil.sourceforge.net/
# Images for use with this: http://dl.dropbox.com/u/363740/images.zip
# To install on snow leopard with homebrew:
# 1. brew install devil
# 2. gem install devil
# 3. ???
# 4. Profit!
@cherring
cherring / helper.js
Created June 7, 2011 00:14 — forked from jobwat/helper.js
Resize text font-size to fit in parent element width
Helpers.updateResizeInput = function(el, text){
if(el.localName == "input" || el[0].localName == "input"){ // inputs are a pain
el.parent().prepend('<span id="test" />');
var theSpan = $('span#test', el.parent());
theSpan.value = text;
Helpers.updateResizeInput(theSpan, text);
el.css('font-size', theSpan.css('font-size'));
el.css('margin-top', theSpan.css('margin-top'));
el[0].value = text;
theSpan.remove();
require 'steak'
require 'capybara'
require 'capybara/dsl'
require 'rack/test'
RSpec.configure do |config|
def app
Capybara.app
end
config.include Capybara
# Postgres backup script
# mynameisrufus
#
# Cron tab examples:
#
# daily keeping the last 5 days (run at 1:00AM, 2 minutes after the hour)
#
# 02 1 * * * postgres /script/db_backup.sh daily /var/backups/db $DATABASE_OWNER 5 >> /var/backups/db/backup.log 2>&1
#
#
.input
= f.text_area :body
= f.hidden_field :commented_by, :value => current_user.email
Feature: Generate a new Synapse app
lorem ipsum else
Scenario: Generate a new synapse app
Given I have no synapse app "my/new/app" # Test that there are no files/dirs for the app
When I generate a synapse app "my/new/app" # Trigger the app build
Then I should have the generated files for "my/new/app" # Test that all the files are there, Use an after hook to get rid of them after
grey='\e[0;90m'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$grey%}("
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$grey%}) %{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$grey%})"
function pat_prompt {
(( spare_width = ${COLUMNS} ))
prompt=" "
# Factory girl, relaxed.
#
# Factory.define :user do |f|
# f.login 'johndoe%d' # Sequence.
# f.email '%{login}@example.com' # Interpolate.
# f.password f.password_confirmation('foobar') # Chain.
# end
#
# Factory.define :post do |f|
# f.user { Factory :user } # Blocks, if you must.
# Edit this Gemfile to bundle your application's dependencies.
## Bundle edge rails:
gem "rails", :git => "git://github.com/rails/rails.git"
## Bundle the gems you use:
# gem "bj"
# gem "hpricot", "0.6"
# gem "sqlite3-ruby", :require_as => "sqlite3"
# gem "aws-s3", :require_as => "aws/s3"
This example shows how to setup an environment running Rails 3 beta under 1.9.1 with a 'rails3' gem set.
∴ rvm update --head
# ((Open a new shell))
# If you do not already have the ruby interpreter installed, install it:
∴ rvm install 1.9.1
# Use the ruby + gem set
∴ rvm 1.9.1%rails3