Skip to content

Instantly share code, notes, and snippets.

(def burton)
burton ; Le Var Burton!
(def players
[{:id 1 :health 100} {:id 2 :health 90}])
(def game
{:players players})
(def current-game
(atom game))
(defn kill-player
-- splitWith even [0,1,3,5,0,0,7,7,0,0] >>> [[1,3,5], [7,7]]
splitWith :: (a -> Bool) -> [a] -> [[a]]
splitWith f list = splitWithIter f ansl [] list
splitWithIter :: (a -> Bool) -> ([[a]] -> a -> [[a]]) -> [[a]] -> [a] -> [[a]]
splitWithIter _ _ xs [] = xs
splitWithIter f o xs (l:ls)
| f l = splitWithIter f ansl xs ls
| otherwise = splitWithIter f atlsl (o xs l) ls
From 27114d268267fce766dbb3511f54463851b2f3bd Mon Sep 17 00:00:00 2001
From: David James <djwonk@collectiveinsight.net>
Date: Sun, 12 Oct 2008 21:14:07 -0400
Subject: [PATCH] Fixed warning about STATUS_CODES due to 2 requires.
---
lib/merb-core/autoload.rb | 4 ----
lib/merb-core/controller/status_codes.rb | 4 ++--
2 files changed, 2 insertions(+), 6 deletions(-)
Perhaps model.rb line 195 has a bug.
The addition operator is probably intended to remove duplicates
(set like behavior) but does not appear to actually do so.
I *suspect* that the benchmark summary line might be wrong
A B A / B
10 8 1.25
100 50 2.00
-------------------
110 58 1.90
A straight average of 1.25 and 2.00 would be 1.62.
# merb-core
# exceptions.rb
class InternalServerError < Merb::ControllerExceptions::ServerError #:doc:
self.status = 500;
# def initialize(exception = nil)
# @exception = exception
# end
#
# def backtrace
This is a way to use run_later from Merb in a DataMapper model.
It runs the code in the block at some unspecified point in the
future.
I don't like that I copied and pasted run_later from Merb, but
run_later was defined at the controller level and this seemed
like a quick and easy way to do it.
# /spec/public/controller/url_spec.rb
# round 'bout line 118
it "should match with an object as second arg and preserve content type" do
@monkey = Monkey.new
@controller.content_type = :xml
@controller.url(:monkey, @monkey).should == "/monkeys/45.xml"
end