Skip to content

Instantly share code, notes, and snippets.

View soulnafein's full-sized avatar

David Santoro soulnafein

View GitHub Profile
class CreditCard
{
Provider provider;
string name;
string description;
decimal? apr;
Fee balanceTransferFee;
Fee purchaseRateFee;
//...
}
class Fee
{
decimal? rate;
decimal? minimum;
decimal? maximum;
// ...
}
class CreditCard
{
Provider provider;
string name;
string description;
decimal? apr;
Fee balanceTransferFee;
Fee purchaseRateFee;
//...
}
class InvestmentFund
{
Provider provider;
string name;
string description;
decimal? averageInterestRate;
decimal? annualFee;
decimal? annualMinimumFee;
decimal? annualMaximumFee;
decimal? withdrawFee;
class InvestmentFund
{
Provider provider;
string name;
string description;
decimal? averageInterestRate;
Fee annualFee;
Fee withdrawFee;
//...
}
#python
class Page(object)
def __init__(self, a, b)
super.__init__(Page, a, b)
self.a, self.b = a,b
def _something_private_but_not_really(self):
# do something
# do something
return 123
an_object = Object.new
// This is if I know in advance param_1, param_2, param_3
an_object.define_singleton_method(:method_name) do |param_1, param_2, param_3|
do_something
end
// What should I do if the number and name of parameters is only known at run time?
// Is there a way for example to add parameters to a Proc?
// a_proc = Proc.new { puts 'whatever'}
// a_proc.parameters << [:req, :name] <---- this doesn't append :(
@soulnafein
soulnafein / new_controller_spec.rb
Created November 15, 2010 09:27
new_controller_spec
require 'spec_helper'
describe EventsController, "Adding a new event to a group" do
include SessionTestHelper
before :each do
@david = Factory(:david)
@ken = Factory(:ken)
@the_group = Factory(:group, :organizer => @ken)
end
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \[\033[01;33m\]$(bash_git_branch) \[\033[01;31m\]$(ruby_versio n)\[\033[00m\]\$$
36113416
36315112
36739696
37608861
38268795
38268903
38871755
38880250
39036128
39101895