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
/** | |
* winCount | |
* returns the count of all games that the human player won. | |
* | |
* @returns int | |
*/ | |
+(int) winCount { | |
NSError *error; | |
NSManagedObjectContext *context = [(BFHeartsAppDelegate *)[UIApplication sharedApplication].delegate managedObjectContext]; | |
NSEntityDescription *entityDesc = [NSEntityDescription entityForName:@"GameFinalScore" inManagedObjectContext:context]; |
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
Broken Function: | |
function bob(a) { | |
var str = a; | |
return a.map(function() { a + 1 }) | |
} | |
Tables: |
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
public funciton testLogin() { | |
/* in this case $this->f is a User object */ | |
$r = new ReflectionObject($this->f); | |
$m = $r->getMethod('login'); | |
$this->assertEquals(2,$m->getNumberOfParameters()); | |
} |
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 Temporal | |
def to_human_minutes(minutes) | |
_h = minutes % 60 | |
if _h > 0 | |
sprintf("%d hours and %s",_h,ActionView::Helpers::TextHelper.pluralize((minutes / 60).to_i,"minute")) | |
else | |
ActionView::Helpers::TextHelper.pluralize((minutes / 60).to_i,"minute") | |
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
(use 'clojure.contrib.datalog) | |
(use 'clojure.contrib.datalog.rules) | |
(use 'clojure.contrib.datalog.database) | |
(use 'clojure.contrib.datalog.util) | |
(def d (make-database | |
(relation :person [:name :room-id :seat-number]) | |
(index :person :name))) | |
(def db (add-tuples d |
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
; now with multimethods. | |
(ns properties) | |
(defn from_string_file | |
[fname] | |
{:propfile :text :filename fname}) | |
(defn from_xml_file | |
[fname] | |
{:propfile :xml :filename fname}) | |
(defn to_string_file |
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 'rubygems' | |
require 'spec' | |
class RDingus | |
def initialize(parent = nil, invocation = nil) | |
@parent = parent | |
@invocation = invocation | |
@invocation_exceptions = InvocationList.new | |
@invocation_expectations = InvocationList.new | |
@invocation_expectation_set = InvocationList.new |
NewerOlder