This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pp' | |
# add color with wirble. See http://pablotron.org/software/wirble/ | |
begin | |
require 'wirble' | |
Wirble.init | |
Wirble.colorize | |
rescue LoadError => err | |
warn "Couldn't load Wirble: #{err}" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# bash completion support for core Git. | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]> | |
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# The contained completion routines provide support for completing: | |
# | |
# *) local and remote branch names |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# bash completion support for core Git. | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]> | |
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# The contained completion routines provide support for completing: | |
# | |
# *) local and remote branch names |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# price | |
# quantity | |
class LineItem < ActiveRecord::Base | |
belongs_to :product | |
belongs_to :order | |
def calculate_cost | |
price * quantity * discount_multiplier | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> require 'vlad' | |
=> true | |
>> Vlad.load({ :app => :mongrel, | |
?> :config => 'config/deploy.rb', | |
?> :core => :core, | |
?> :scm => :git, | |
?> :web => :nginx }) | |
MissingSourceFile: no such file to load -- vlad/mongrel | |
from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def paypal_ipn | |
notify = Paypal::Notification.new(request.raw_post) | |
donations = Donation.find_all_from_paypal(notify.params) | |
user = donations.first.user | |
purchase = Purchase.new(:donations => donations, :user => user) | |
purchase.paypal_transaction_id = notify.transaction_id | |
if notify.acknowledge | |
if notify.complete? and purchase.total_amount == BigDecimal.new(notify.amount.to_s) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
⚜:~/Code $ sudo gem install assert_efficient_sql | |
Building native extensions. This could take a while... | |
ERROR: Error installing assert_efficient_sql: | |
ERROR: Failed to build gem native extension. | |
/usr/local/bin/ruby extconf.rb | |
==================== ERROR ===================== | |
Please set RUBY_SOURCE_DIR to the source path of ruby 1.8.6 (2008-08-11)! | |
================================================ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 $(document).ready(function() { | |
4 $('.blue').click(function() { | |
5 console.log('in function for click on blue class'); | |
6 return false; | |
7 }); | |
8 }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 describe "double tier" do | |
22 it "returns an nested unordered list" do | |
23 html = Nokogiri::HTML helper.build_new_menu(@menu_double_tier) | |
24 html.search('ul').size.should == 2 | |
25 html.search('ul#navmenu-h').size.should == 1 | |
26 html.search('ul#navmenu-h').xpath('./li').size.should == 2 | |
27 html.search('ul#navmenu-h').xpath('./li').first.xpath('./a').text.should == 'Pages' | |
28 html.search('ul#navmenu-h li ul li').size.should == 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> u = User.first | |
=> #<AdminUser id: 2, email: "[email protected]", created_at: "2009-07-27 14:19:01", updated_at: "2009-07-29 21:17:36", crypted_password: "07d8e607d131e85a6b2090030b8198c278552878e10cef07a83...", password_salt: "y6xAKXoi5I8MMhn0A5KB", persistence_token: "c9a0865f8e5b6f135d21452deeeb4019ec9483cabb3f54bdac3...", single_access_token: "EHt4OIeX6_bCCHb96u0v", perishable_token: "8GYDF4gM7drerirRuNOz", login_count: 4, failed_login_count: 0, last_request_at: "2009-07-29 21:17:36", current_login_at: "2009-07-29 21:17:27", last_login_at: "2009-07-28 15:54:27", current_login_ip: "127.0.0.1", last_login_ip: "127.0.0.1", time_zone: "Eastern Time (US & Canada)", first_name: "Jacqui", last_name: "Maher", type: "AdminUser"> | |
>> u.type = "User" | |
=> "User" | |
>> u.save | |
=> true | |
>> u | |
=> #<AdminUser id: 2, email: "[email protected]", created_at: "2009-07-27 14:19:01", updated_at: "2009-07-30 19:41:05", crypted_password: "07d8e607d131e85a6b2090030b8198c278552878e10cef07a83...", password_salt: "y6xAKXoi5I8MMhn0A5 |
NewerOlder