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
| Coding challenge | |
| Graphical editors allow users to edit images in the same way text editors let us modify documents. Images are represented as an M x N array of pixels with each pixel given colour. | |
| Produce a program that simulates a simple interactive graphical editor. | |
| Input | |
| The input consists of a line containing a sequence of commands. Each command is represented by a single capital letter at the start of the line. Arguments to the command are separated by spaces and follow the command character. |
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
| To run: ./image_editor | |
| To run tests: #run with python -m unittest app_tests.TestImage | |
| ------original challenge------ | |
| Coding challenge | |
| Graphical editors allow users to edit images in the same way text editors let us modify documents. Images are represented as an M x N array of pixels with each pixel given colour. | |
| Produce a program that simulates a simple interactive graphical editor. |
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 "Conditional matching" do | |
| it "should understand binary/unary operators correctly, given the predecate to decide" do | |
| subject = Lexr.that { | |
| ignores /\s+/ => :whitespace | |
| legal_place_for_binary_operator = lambda { |prev| [:addition, | |
| :subtraction, | |
| :multiplication, | |
| :division, | |
| :left_parenthesis, |
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
| scope :dashboard_active, includes(:media_plan_line) | |
| .where(["((media_plan_lines.start_at <= ? AND media_plan_lines.end_at >= ?) | |
| OR | |
| (DATEDIFF(CURDATE(), media_plan_lines.end_at) <= 10)) AND NOT media_plan_lines.status = ?", | |
| Date.today, Date.today, "pipeline"]) |
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
| SELECT `campaigns`.* FROM `campaigns` | |
| WHERE | |
| ( | |
| ( | |
| (media_plan_lines.start_at <= '2012-09-21' | |
| AND | |
| media_plan_lines.end_at >= '2012-09-21') | |
| OR | |
| (DATEDIFF(CURDATE(), media_plan_lines.end_at) <= 10) | |
| ) |
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 is_votable? | |
| return false unless active | |
| running? | |
| end | |
| def time_boxed? | |
| starting_at.nil? && ending_at.nil? | |
| end | |
| def running? |
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
| $netRevenueTd = $tr.find("td[data-property='net_revenue']") | |
| if ddr.properties.net_revenue_estimated | |
| $netRevenueTd.addClass("estimated") | |
| else | |
| $netRevenueTd.removeClass("estimated") |
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
| resources :cars, :except => :index do | |
| collection do | |
| post :index | |
| end | |
| member do | |
| get :registration_details | |
| 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
| class Server | |
| def self.all | |
| load_all_server_info_from_api.collect { |server_info| Server.new(server_info) } | |
| end | |
| def name | |
| @server_info.name | |
| end | |
| def alive? |
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
| (rdb:1) pp nil ; 43 | |
| nil | |
| *** Unknown command: " 43". Try "help". |