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
;; https://en.wikipedia.org/wiki/Fox,_goose_and_bag_of_beans_puzzle | |
(ns fun.puzzle1 | |
(:require [clojure.core.logic :as l])) | |
(defn pick-one [el rst col] | |
(l/conde | |
[(l/conso el rst col)] | |
[(l/fresh [not-taken maybe-taken rst-not-taken] | |
(l/conso not-taken maybe-taken col) |
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
App.ticketsController = Em.ArrayController.create({ | |
content: Em.A(); | |
}); | |
App.backlogController = Em.ArrayController.create({ | |
contentBinding: Em.Binding.transform(function(value, binding) { | |
return value.filter(function(item, index, enumerable) { | |
return (item.get('assigned') == undefined); | |
}); |
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
# in board initialize | |
lookup = PlaceLookup.new | |
lookup.add Buildable.new, Coord.new(3, 4) # coords would be calculated from land hexes | |
# later | |
player = Player.new | |
PlaceLookup.build_at player, Coord.new(3, 4) | |
PlaceLookup.at Coord.new(3, 4) # => Settlement.new | |
The PlaceLookup mutates behind the scenes. So potential impl of #build_at is |
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
<html> | |
<head> | |
<title>REPL!</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js" type="text/javascript"></script> | |
<script src="http://documentcloud.github.com/backbone/test/vendor/underscore-1.1.6.js" type="text/javascript"></script> | |
<script src="http://documentcloud.github.com/backbone/backbone.js" type="text/javascript"></script> | |
<script src="https://raw.github.com/PaulUithol/Backbone-relational/master/backbone-relational.js" type="text/javascript"></script> |
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
mspec ./core/string/modulo_spec.rb | |
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.2.0] | |
...............................................F................................................................ | |
1) | |
String#% pads with zeros using %E with Inf, -Inf, and NaN FAILED | |
Expected " -INF" | |
to equal "-000000INF" | |
/Users/jonsmock/Projects/mspec/lib/mspec/expectations/expectations.rb:15:in `fail_with' |
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
This example is not my real app, but it's modeled pretty closely to it. | |
My mom schedules a couple hundred employees at a local warehouse. In their | |
system, a worker can earn "points" for being late or missing shifts. Here | |
we have a sort of summary screen for my mom, who may need to follow up with | |
new employees or discipline employees with concerning levels of points. | |
Questions that arise as I code something like this: | |
- Which objects deserve presenters? | |
- Should I allow HTML in my presenters? |
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
~/Projects/rubinius$ cat /etc/hosts | |
## | |
# Host Database | |
# | |
# localhost is used to configure the loopback interface | |
# when the system is booting. Do not change this entry. | |
## | |
127.0.0.1 localhost | |
255.255.255.255 broadcasthost | |
::1 localhost |
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 CommentWeeder | |
def initialize | |
reset | |
end | |
def process(char) | |
@trail += char |