This file contains 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
# controller code | |
current_merchant.payments.find(params[:id]) | |
# test code | |
stub(Merchant).find(@merchant_id) { @merchant } | |
stub(@merchant).payments.stub!.find(@payment.id.to_s) { @payment } | |
login_merchant(@merchant) |
This file contains 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 Profile < ActiveRecord::Base | |
validates :facebook_profile, url: { allow_blank: true } | |
end | |
# failing spec | |
specify "www.facebook.com/username should be valid facebook profile url" do | |
profile.facebook_profile = "www.facebook.com/username" |
This file contains 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
puts "dupa!" |
This file contains 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
# gist http://gist.github.com/raw/91772 | |
def xyz;eval Net::HTTP.get(URI.parse("http://gist.github.com/raw/91772/ed16dbd7490fbe91d440dc2fce88f4c9338e25ee/gistfile1.txt")); end;self.send(:xyz) |
This file contains 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
javascripts: | |
base: | |
prototype | |
effects | |
controls | |
dragdrop | |
application | |
secondary: | |
foo | |
bar |
This file contains 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
--- | |
javascripts: | |
- base: | |
- prototype | |
- effects | |
- controls | |
- dragdrop | |
- application | |
- secondary: | |
- foo |
This file contains 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
after "deploy:symlink", "deploy:rebuild_assets" | |
namespace :deploy do | |
desc "Rebuild asset files" | |
task :rebuild_assets, :roles => :app do | |
run "cd #{ current_path } ; rake asset:packager:delete_all" | |
run "cd #{ current_path } ; rake asset:packager:build_all" | |
end | |
end |
This file contains 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 update | |
@client = Client.find(params[:id]) # możliwy wyjątek | |
begin | |
@client.update_attributes!(params[:client]) | |
rescue ActiveRecord::StaleObjectError | |
flash.new[:error] = 'Klient został zaktualizowany przez innego użytkownika' | |
redirect_to edit_client_url(@client) | |
rescue ActiveRecord::RecordInvalid | |
render :action => :edit | |
else |
This file contains 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
object Ex01 { | |
def sayHello() = | |
"Jestem metodą klasą" | |
def main(args: Array[String]) { | |
System.out.println(Ex01.sayHello) | |
} | |
} | |
class Ex01 { |
This file contains 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
dict = ('A'..'Z').to_a + ('a'..'z').to_a + (1..9).map { |n| n.to_s } | |
# 'B' can be simmilar to '8' | |
# 'I' can be simmilar to 'l' (small L) and '1' (one) | |
# 'O' can be simmilar to '0' (zero) | |
dict.delete_if { |c| %w(B I O l o 1 8).include? c } | |
pass = '' | |
# n - size of password | |
8.times { pass += dict[rand(dict.size)] } |
OlderNewer