Skip to content

Instantly share code, notes, and snippets.

View mikebaldry's full-sized avatar

Michael Baldry mikebaldry

View GitHub Profile
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.
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.
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,
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"])
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)
)
def is_votable?
return false unless active
running?
end
def time_boxed?
starting_at.nil? && ending_at.nil?
end
def running?
$netRevenueTd = $tr.find("td[data-property='net_revenue']")
if ddr.properties.net_revenue_estimated
$netRevenueTd.addClass("estimated")
else
$netRevenueTd.removeClass("estimated")
resources :cars, :except => :index do
collection do
post :index
end
member do
get :registration_details
end
end
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?
(rdb:1) pp nil ; 43
nil
*** Unknown command: " 43". Try "help".