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
#!/bin/bash | |
#Sample rake task | |
#site = com,dk,de,fr etc... | |
#spec = spec/sites/, spec/default etc... | |
#browser = chorme, firefox etc... | |
#remote = false,true | |
#version = browser's version, especially for ie | |
#os = Os' name | |
#rake test_maniac:run[site,spec,browser,remote,version,os] |
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 FlattenArray | |
def self.flatten(ar, flatten_array = []) | |
ar.each do |el| | |
next unless el | |
if el.kind_of?(Array) | |
flatten(el,flatten_array) | |
else | |
flatten_array << el | |
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 partition(arr, int) | |
list = [[],[]] | |
return list if arr.empty? | |
if int == 0 | |
list[1] = arr | |
return list | |
end | |
if int.negative? |
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
require "test/unit" | |
InvalidRomanChars = Class.new(StandardError) | |
OutOfRange = Class.new(StandardError) | |
InvalidInteger = Class.new(StandardError) | |
class Roman | |
I,IV,V,IX,X,XL,L,XC,C,CD,D,CM,M = 1,4,5,9,10,40,50,90,100,400,500,900,1000 | |
LETTERS = %w(IV V IX I XL L XC X CD D CM C M) | |
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
require "test/unit" | |
def syntax_checker(str) | |
opening_tags = ['[', '(', '<', '{'] | |
closing_tags = [']', ')', '>', '}'] | |
set = [] | |
str.chars.each do |char| | |
if opening_tags.include?(char) | |
set << char |
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
require 'test/unit' | |
class HtmlBuilder < BasicObject | |
attr_accessor :html_data | |
SELF_CLOSING_TAGS = %i(area base br col embed iframe hr img input link meta param source track wbr command keygen menuitem) | |
class << self | |
attr_accessor :output | |
def build(&block) |