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 prepare_vars #:nodoc: | |
h = eval(%q{instance_variables.map {|var| "#{var.gsub("@",":")} => #{eval(var+'.inspect')}"}.join(", ").chomp(", ")}) | |
return eval("{#{h}}") | |
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
>> hash = { 'password' => 'pass*123', 'login' => 'testperson', 'key' => '1234567890' } | |
=> {"key"=>"1234567890", "login"=>"testperson", "password"=>"pass*123"} | |
>> ActiveMerchant::Shipping::UPS.new(hash) ArgumentError: Missing required parameter: key | |
from /Users/cadwallion/.rvm/gems/ruby-1.8.7-p352@gatorade_direct/gems/active_shipping-0.9.13/lib/active_merchant/common/requires_parameters.rb:11:in `requires!' | |
>> hash = { :password => 'pass*123', :login => 'testperson', :key => '1234567890' } | |
=> {:login=>"testperson", :key=>"1234567890", :password=>"pass*123"} | |
>> ActiveMerchant::Shipping::UPS.new(hash) => #<ActiveMerchant::Shipping::UPS:0x103d6b9c0 @last_request=nil, @options={:login=>"testperson", :key=>"1234567890", :password=>"pass*123"}, @test_mode=nil> | |
>> |
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
PROMPT='%{$fg_bold[red]%}%m%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' | |
RPROMPT='%{$reset_color%} %{$fg[yellow]%}$(todo_prompt) %{$reset_color%}' | |
ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[green]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[blue]%})%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}" |
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
using System; | |
class NamedWelcome { | |
static void Main(string[] args) { | |
string name; | |
if (args.Length == 0) { | |
Console.WriteLine("What is your name: "); | |
name = Console.ReadLine(); | |
} else { | |
name = args[0]; |
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
using System; | |
class Address { | |
public string name; | |
public string address; | |
public Address(string name, string address) { | |
this.name = name; | |
this.address = address; | |
} |
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
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
using System; | |
namespace TestProject1 | |
{ | |
/// <summary> | |
///This is a test class for AddressBookTest and is intended | |
///to contain all AddressBookTest Unit Tests |
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
# EXPECTED OUTPUT | |
a = Foo::Bar.new | |
b = AnotherFoo::AnotherBar.new | |
a.thing # => [1,2,3,4] | |
b.thing # => [5,6,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
# BEFORE | |
[32mINFO [0m Rendered app/api/tournaments/bracket.json.jbuilder (3651.1ms) | |
[32mINFO [0m Completed 200 OK in 3792ms (Views: 3551.0ms | ActiveRecord: 123.4ms) | |
# AFTER | |
[32mINFO [0m Rendered app/api/tournaments/bracket.json.jbuilder (465.3ms) | |
[32mINFO [0m Completed 200 OK in 593ms (Views: 360.9ms | ActiveRecord: 126.2ms) |
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
module Namespace | |
class Address < ActiveRecord::Base | |
include Namespace::AddressMethods | |
end | |
end | |
=== | |
module Namespace | |
class MailingAddress < ActiveRecord::Base |
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
class FuckLogger | |
class << self | |
attr_reader :count | |
attr_accessor :logger | |
def fuck | |
add | |
log "FUCK#{count}" | |
end |