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
| # This file is copied to ~/spec when you run 'ruby script/generate rspec' | |
| # from the project root directory. | |
| ENV["RAILS_ENV"] ||= 'test' | |
| require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) | |
| require 'spec/autorun' | |
| require 'spec/rails' | |
| Dir[File.dirname(__FILE__) + "/spec_helpers/**/*.rb"].each do |file| | |
| require file | |
| 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
| aquarius@arrakeen ~ $ cat .screenrc | tail -n 19 | head -n 6 | |
| # Make shift-PgUp and shift-PgDn work like they do in xterm. (Note that this | |
| # requires xterm to be configured to pass those keys through, and not try to | |
| # act on them itself.) | |
| bindkey "^[[5;2~" eval "copy" "stuff ^u" | |
| bindkey -m "^[[5;2~" stuff ^u | |
| bindkey -m "^[[6;2~" stuff ^d |
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 egn_valid? | |
| egn =~ /^(\d{2})(\d{2})(\d{2})\d{3}(\d)$/ and | |
| egn.each_char[0...9].zip([2, 4, 8, 5, 10, 9, 7, 3, 6]).sum { |d, w| d.to_i * w } % 11 % 10 == $4.to_i and | |
| Date.valid_civil?($1.to_i, $2.to_i % 20, $3.to_i) and | |
| $2.to_i / 20 <= 2 | |
| end | |
| # Алгоритъм от тук: http://www.grao.bg/esgraon.html |
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
| sub opening_slide { | |
| $_ = shift; | |
| my ($title, $date, $intro) = (/^(.*?)\n(.*?)\n(.*)$/s); | |
| $intro = html_escape(trim($intro)); | |
| $intro =~ s#\n#<br />\n#g; | |
| $intro =~ s# # #g; | |
| html_head($title, $date, $intro); | |
| } |
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 TopicsController < ApplicationController | |
| before_filter :set_topic, :only => [:show, :edit, :update, :destroy] | |
| def index | |
| @topics = current_user.topics | |
| end | |
| def show | |
| @topic.update_topic_hits |
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
| Автоматизирано (unit) тестване | |
| 12.04.2009 | |
| == Disclaimer == | |
| Днес няма да си говорим за acceptance testing, quality assurance или нещо, което се прави от "по-низшия" отдел във фирмата. Всичко тук е дело на програмиста. | |
| == Митът == | |
| Проектът идва с готово, подробно задание. Прави се дизайн. С него работата се разбива на малки задачи. Те се извършват последователно. За всяка от тях пишете кода и приключвате. Изискванията не се променят, нито се добавя нова функционалност. |
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
| describe "#overlaps?(span)" do | |
| def span(lower, upper) | |
| Search::Span.new(lower, upper) | |
| end | |
| def overlap(expected) | |
| simple_matcher do |given, matcher| | |
| matcher.description = "overlap with #{expected}" | |
| matcher.failure_message = "expected #{given} to overlap with #{expected}" | |
| matcher.negative_failure_message = "expected #{given} not to overlap with #{expected}" |
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 Sunglass | |
| module Slave | |
| class WEBrick | |
| def initialize(application, port) | |
| @application = application | |
| @port = port | |
| @mutex = Mutex.new | |
| @condition = ConditionVariable.new | |
| 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
| class WidgetsController < ApplicationController | |
| before_filter :assign_widget, :only => [:show, :new, :edit, :create:, :update, :destroy] | |
| def show; end | |
| def new; end | |
| def edit; end | |
| def create | |
| if @widget.save | |
| redirect_to(@widget, :notice => 'Widget was successfully created.') |
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 StrangeIntQue extends Queue[Int] { | |
| override def append(x: Int) { | |
| println(Math.sqrt(x)) | |
| super.append(x) | |
| } | |
| } | |
| val x: Queue[Any] = new StrangeIntQueue | |
| x.append("abc") // Math.sqrt("abc") ? |
OlderNewer