Skip to content

Instantly share code, notes, and snippets.

View baphled's full-sized avatar

Yomi Colledge baphled

View GitHub Profile
# Journeys
All of our services have one common theme, they require a user to complete, or at least start, a journey.
Journeys comprise of steps, a single step can have a page, a form or another step.
A page typically has some copy, some information for the user to consider. Where by a form contains validation and
fields for a user to fill in.
In this case we can learn from past projects and take what has worked with them in the past.
module Loggable
include ActiveSupport::Callbacks
define_callbacks :before_process, :after_process
protected
# Need to consider how to access in the method params
def before_process
@logger.info "Method name before message with: #{@params}"
class DateOfBirth
include Virtus.model
attribute :year, Integer
attribute :month, Integer
attribute :year, Integer
def to_s
Date.new year, month, day
end
require 'formula'
class Fetchmail < Formula
homepage 'http://www.fetchmail.info/'
url 'http://downloads.sourceforge.net/project/fetchmail/branch_6.3/fetchmail-6.3.24.tar.xz'
sha1 '8cb2aa3a85dd307ccd1899ddbb4463e011048535'
depends_on 'xz' => :build
def install
@baphled
baphled / vim.rb
Created December 8, 2012 23:28 — forked from uasi/vim.rb
Vim formula for Homebrew (EDIT: recent versions of official Homebrew distribution includes one)
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.682'
def features; %w(tiny small normal big huge) end
@baphled
baphled / Gemfile
Created December 8, 2011 16:45
SyntaxError when runing jasmine-headless-webkit
source 'http://rubygems.org'
source 'http://gemcutter.org'
gem 'sprockets', '>= 2.0.0.beta.10', :git => 'git://github.com/sstephenson/sprockets.git'
gem 'haml-sprockets', :git => "git://github.com/dharanasoft/haml-sprockets.git"
gem 'rails', '3.1.2'
group :assets do
gem 'sass-rails', " >= 3.1.1"
@baphled
baphled / Devise stacktrace
Created October 19, 2011 17:54
Example code and stacktrace from introducing a private gem with a user class with the same namespace
.rvm/gems/ruby-1.9.2-head@quikcv/bundler/gems/devise-ea7f15917f70/lib/devise/rails/routes.rb:380:in `raise_no_devise_method_error!': Foo::User does not respond to 'devise' method. This usually means you haven't loaded your ORM file or it's being loaded too late. To fix it, be sure to require 'devise/orm/YOUR_ORM' inside 'config/initializers/devise.rb' or before your application definition in 'config/application.rb' (RuntimeError)
from /Users/baphled/.rvm/gems/ruby-1.9.2-head@quikcv/bundler/gems/devise-ea7f15917f70/lib/devise/rails/routes.rb:194:in `block in devise_for'
from /Users/baphled/.rvm/gems/ruby-1.9.2-head@quikcv/bundler/gems/devise-ea7f15917f70/lib/devise/rails/routes.rb:190:in `each'
from /Users/baphled/.rvm/gems/ruby-1.9.2-head@quikcv/bundler/gems/devise-ea7f15917f70/lib/devise/rails/routes.rb:190:in `devise_for'
from /Users/baphled/Projects/QuikCV/config/routes.rb:35:in `block in <top (required)>'
from /Users/baphled/.rvm/gems/ruby-1.9.2-head@quikcv/gems/actionpack-3.1.0/lib/action_dispatch/r
@baphled
baphled / Gemfile
Created September 12, 2011 15:44 — forked from mattheworiordan/Gemfile
Test PDF within Cucumber and Capybara
# normal Gem dependancy declarations
# ...
group :test, :cucumber do
gem 'pdf-reader'
end
@baphled
baphled / capybara_webkit_screenshot_env.rb
Created August 29, 2011 22:52 — forked from mattheworiordan/capybara_webkit_screenshot_env.rb
Cucumber and Capybara-Webkit automatic screenshots on failure
def screen_shot_and_save_page
require 'capybara/util/save_and_open_page'
path = "/#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}"
Capybara.save_page body, "#{path}.html"
page.driver.render Rails.root.join "#{Capybara.save_and_open_page_path}" "#{path}.png"
end
begin
After do |scenario|
screen_shot_and_save_page if scenario.failed?
@baphled
baphled / application.rb
Created July 23, 2011 22:38
Jasmine config to compile coffeescript and copy assets files for testing
# Needed if you are not requiring rails/all
require 'sprockets/railtie'