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 Dog | |
| def hungry? | |
| true | |
| end | |
| def full? | |
| false | |
| end | |
| 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
| # Year 2014 | |
| require 'export' | |
| require 'export/secure_name' | |
| require 'active_support/core_ext/object/blank' | |
| describe Export::SecureName do | |
| subject { described_class.new('name', '.ext') } | |
| it '#initialize' do |
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 Export::SecureName | |
| attr_accessor :name, :extension | |
| def initialize(name, extension = nil) | |
| self.name = name | |
| self.extension = extension | |
| end | |
| def get | |
| sanitize(sliced_name) |
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
| # lib/carrier.rb | |
| module Carrier | |
| def send_to_browser(file, options = {}) | |
| extension = File.extname(file.path)[1..-1].downcase # '.jpg' => 'jpg' for Mime::Type | |
| options[:type] ||= Mime::Type.lookup_by_extension(extension) | |
| send_file(file.path, options) | |
| end | |
| # TODO: it changes parameter value!!! |
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 Creature | |
| def self.metaclass | |
| class << self | |
| self | |
| end | |
| end | |
| 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
| require 'test/unit' | |
| class TestRecursiveReverse < Test::Unit::TestCase | |
| def test_o_make | |
| assert_equal [3, 2, 1], RecursiveReverse.new.o_make([1, 2, 3]) | |
| end | |
| def test_f_make | |
| assert_equal [3, 2, 1], RecursiveReverse.new.f_make([1, 2, 3]) |
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
| http://gmapuploader.com/ | |
| http://gmapuploader.com/view/wpfzJD4T4P | |
| Каждый масштабный уровень содержит в 4 раза большее количество элементов, чем предыдущий. | |
| http://dl.dropbox.com/u/11808009/%D1%84%D0%BE%D1%82%D0%BE%D0%B3%D1%80%D0%B0%D1%84%D0%B8%D1%8F.JPG | |
| map.setCenter(new YMaps.GeoPoint(0,0),1); задается центр карты на первом уровне масштаба /= Это для яндекса, надо прочекать в leaflet | |
| http://www.xakep.ru/post/47006/default.asp |
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
| sort_by { |x| [x.a, x.b] } |
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
| C = "top level" | |
| class AboutConstants < EdgeCase::Koan | |
| C = "nested" | |
| def test_nested_constants_may_also_be_referenced_with_relative_paths | |
| assert_equal "nested", C | |
| end |
NewerOlder