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
sec1 = "(1) toplama" | |
sec2 = "(2) çıkarma" | |
sec3 = "(3) çarpma" | |
sec4 = "(4) bölme" | |
puts sec1 | |
puts sec2 | |
puts sec3 | |
puts sec4 |
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
# Middleware: my_app.rb | |
class MyApp < Sinatra::Base | |
enable :sessions | |
get '/testing' do | |
puts env['rack.session'].inspect | |
'testing' | |
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
it "tests something..." do | |
sess = {'warden.user.user.key' => [User, User.first.id]} | |
encoded = [Marshal.dump(sess)].pack("m*") | |
get "/testing", {}, {'HTTP_COOKIE' => "rack.session=" + encoded} | |
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
<div style="background-color: green; width:500px; height: 500px">Text</div> |
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
# eg: I am on the advertisers ad campaign's the ad's edit page | |
when /^the (.+?) #{capture_model}(?:'s)? #{capture_model}(?:'s)? (.+?) page$/ | |
polymorphic_path [$1.to_sym, model($2), model($3)], :action => $4 | |
# eg: I am on the advertisers the ad campaign's the ad's page | |
when /^the (.+?) #{capture_model}(?:'s)? #{capture_model}(?:'s)? page$/ | |
polymorphic_path [$1.to_sym, model($2), model($3)] | |
# eg: I am on the advertisers the ad's edit page | |
when /^the (.+?) #{capture_model}(?:'s)? (.+?) page$/ |
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
<html_code><![CDATA[<a href="http://example.com" target="_blank"><img src="http://kozgun.net/images/screenshots/0000/0025/sopar-0.1-800_thumb.png" hspace="0" vspace="0" border="0" id="htmlbannerinstance"/></a>]]></html_code> |
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
SplashScreen.blueprint do | |
image { File.open(File.join(Rails.root, "features", "assets", "images", "splash_screen.jpg")) } | |
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
module ActiveRecord | |
module ModelSchema | |
module ClassMethods | |
def compute_table_name | |
base = base_class | |
if self == Globalize::ActiveRecord::Translation #globalize3 | |
tbl_name = "translations" | |
elsif superclass == Globalize::ActiveRecord::Translation #globalize3 | |
tbl_name = "#{self.parent.table_name.singularize}_translations" | |
elsif self == base |
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
mode: "textareas" | |
theme: "advanced" | |
#skin: "o2k7" | |
#skin_variant: "silver" | |
editor_selector: "mceEditor" | |
language: "tr" | |
#content_css : "/stylesheets/tinymce.css" | |
plugins: | |
- inlinepopups | |
- preview |
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
# http://www.broadcastingadam.com/2012/07/advanced_caching_part_2-using_strategies/ | |
# Step 3: Caching Views Generated from Arrays | |
# missing "}" | |
class Post | |
def cache_key | |
Digest::MD5.hexdigest "#{maximum(:updated_at).try(:to_i)}-#{count}" | |
end | |
end |