Skip to content

Instantly share code, notes, and snippets.

View TheNicholasNick's full-sized avatar

Nicholas Nick TheNicholasNick

View GitHub Profile
#!/bin/sh
kill `ps | grep -i ruby | awk {'print $1'}`
./bin/merb
= form_for @user, :action => url(:user_settings, @user) do
%ul
%li
= text_field :first_name, :label => "First Name"
%li
= text_field :last_name, :label => "Last Name"
%p
The following is what shows up on printed quotes
%ul
- @user.user_details.all(:order => [:order.asc]).each do |ud|
def []=(key, value)
@_options_lookup[key] ||= {}
super
end
!!! Strict
%html{html_attrs}
%head
%meta{'http-equiv' => 'Content-Type', 'content' => 'text/html; charset=utf-8'}
%title OSTC
- require_css :style
= include_required_css
%body
%h1 OSTC
@TheNicholasNick
TheNicholasNick / gist:48589
Created January 18, 2009 09:56
unique properties
#!/usr/bin/env ruby
#
# A one file test to show ...
require 'rubygems'
gem('dm-core', '~> 0.9.8')
require 'dm-core'
require 'dm-validations'
# setup the logger
module Merb::Helpers::Form::Builder
class Form < Base
def label(contents, attrs = {})
if contents
if contents.is_a?(Hash)
label_attrs = contents
contents = label_attrs.delete(:title)
else
label_attrs = attrs
end
"@quote.brokerage_percent = 2.86"
#<Quote id=nil asset_cost=#<BigDecimal:2afb41396bd0,'0.7E5',9(18)> asset_age=0 term=60 product_id="CON0" product_name="Consumer Loan" gst_dollar=#<BigDecimal:2afb41396a90,'0.0',9(9)> residual_percent=#<BigDecimal:2afb41397238,'0.0',9(9)> residual_dollar=#<BigDecimal:2afb413970f8,'0.0',9(9)> brokerage_percent=#<BigDecimal:2afb413904b0,'0.2857142857 1428571428 5714285714 2857142857 1428571428 5714285714 2857142857 143E1',81(90)> brokerage_dollar=#<BigDecimal:2afb41396900,'0.2E4',9(18)> brokerage_split1_dollar=nil brokerage_split2_dollar=nil amount_financed=#<BigDecimal:2afb4138f600,'0.72E5',9(27)> is_active=true created_at=nil updated_at=nil user_id=2>
#<BigDecimal:2afb413904b0,'0.2857142857 1428571428 5714285714 2857142857 1428571428 5714285714 2857142857 143E1',81(90)>
#<DataMapper::Validate::ValidationErrors:0x2afb41397670 @errors={:brokerage_percent=>["Brokerage percent must be a number"]}>
#<Quote id=nil asset_cost=#<BigDecimal:2afb41396bd0,'0.7E5',9(18)> asset_age=0 t
@TheNicholasNick
TheNicholasNick / common.rb
Created January 12, 2009 12:26
Merb Ticket 1181
# FROM
BUNDLED_SPECS = File.join(Dir.pwd, "gems", "specifications")
# TO
BUNDLED_SPECS = File.join(File.expand_path(File.dirname(__FILE__)), "..", "gems", "specifications")
@TheNicholasNick
TheNicholasNick / gist:45907
Created January 12, 2009 06:11
Merb Ticket 1181
user@slice01 /var/www/app.com/www/private $ /var/www/app.com/www/private/merb_app/bin/merb -m /var/www/app.com/www/private/merb_app/bin/merb --help
/usr/lib64/ruby/site_ruby/1.8/rubygems.rb:636:in `report_activate_error': Could not find RubyGem merb-core (= 1.0.7.1) (Gem::LoadError)
from /usr/lib64/ruby/site_ruby/1.8/rubygems.rb:141:in `activate'
from /usr/lib64/ruby/site_ruby/1.8/rubygems.rb:49:in `gem'
from /var/www/app.com/www/private/merb_app/bin/merb:30
user@slice01 /var/www/app.com/www/private $ gem --version
1.3.1
user@slice01 /var/www/app.com/www/private $ cd merb_app/
user@slice01 /var/www/app.com/www/private/merb_app $ bin/merb --help
Usage: merb [uGdcIpPhmailLerkKX] [argument]
- # passed in a quote object
%div.quote{ :id => "quote_#{quote.id}" }
%p
%span.action
x
= "#{quote.product_name}, #{quote.asset_cost.to_currency(:au)} over #{quote.term} months"
- quote.quote_results.each do |qr|
%p
= qr.id