Skip to content

Instantly share code, notes, and snippets.

puts "dupa!"
# 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)
javascripts:
base:
prototype
effects
controls
dragdrop
application
secondary:
foo
bar
---
javascripts:
- base:
- prototype
- effects
- controls
- dragdrop
- application
- secondary:
- foo
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
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
object Ex01 {
def sayHello() =
"Jestem metodą klasą"
def main(args: Array[String]) {
System.out.println(Ex01.sayHello)
}
}
class Ex01 {
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)] }
# mongo_template.rb
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842)
#
# To use:
# rails project_name -m http://gist.github.com/gists/219223.txt
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/controls.js"
# WTF?!
email_regexp_1 = /^[\w\.-_]+@[a-zA-Z0-9\.]+\.([a-zA-Z]{2}|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum)$/x
email_regexp = /^ # początek dopasowania
[\w\.-_]+ # nazwa użytkownika: znaki alfanumeryczne, kropa, myślnik, podkreślenie
@ # 'at' - małpa
[a-zA-Z0-9\.]+ # domena np. gmail poczta.wp: znaki alfanumeryczne, kropka
\. # ostatnia kropa
([a-zA-Z]{2} # dwuliterowa top-level domain dla kraju np pl, us, de, be, ru
|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum) # dopuszczone top-level domain