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
(ns clojurebreaker.core | |
(:use [trammel.core :only (defconstrainedfn defcontract)]) | |
(:require [clojure.data :as data] | |
[trammel.provide :as provide] | |
[trammel.factors :as factors])) | |
(defn valid-inputs? [& colls] | |
(and (every? vector? colls) | |
(every? true? (map (fn [coll] | |
(every? #(some #{%} [:r :g :b :y]) coll)) |
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
(use 'clojure.test) | |
(defn fizzbuzz [coll] | |
(map (fn [num] | |
(cond | |
(and (zero? (mod num 3)) (zero? (mod num 5))) "FizzBuzz" | |
(zero? (mod num 3)) "Fizz" | |
(zero? (mod num 5)) "Buzz" | |
:else num)) | |
coll)) |
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
RSpec.configure do |config| | |
config.mock_with :rspec | |
config.infer_base_class_for_anonymous_controllers = false | |
config.around(:each, :transactional => true) do |example| | |
Sequel::DATABASES.first.transaction do | |
example.run | |
raise Sequel::Error::Rollback | |
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
~/Desktop> jrubyc test.rb | |
~/Desktop> javap -c test | |
Compiled from "test.rb" | |
public class test extends org.jruby.ast.executable.AbstractScript{ | |
public test(); | |
Code: | |
0: aload_0 | |
1: invokespecial #18; //Method org/jruby/ast/executable/AbstractScript."<init>":()V | |
4: aload_0 | |
5: ldc #8; //String test.rb |
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
user=> (defn foo [] "foo") | |
#'user/foo | |
user=> (binding [foo (constantly "bar")] (foo)) | |
IllegalStateException Can't dynamically bind non-dynamic var: user/foo clojure.lang.Var.pushThreadBindings (Var.java:339) |
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
(import '(java.net URL URLEncoder) | |
(java.io BufferedReader InputStreamReader))) | |
(defn request [address] | |
(let [url (URL. address)] | |
(with-open [stream (. url (openStream))] | |
(let [buf (BufferedReader. (InputStreamReader. stream))] | |
(apply str (line-seq buf)))))) |
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
(ns bowling.core | |
(:use clojure.test)) | |
(defn strike? [rolls] | |
(= 10 (first rolls))) | |
(defn spare? [rolls] | |
(= 10 (reduce + (take 2 rolls)))) | |
(defn rolls-to-advance [rolls frame] |
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
(defproject zookeeper-test "1.0.0-SNAPSHOT" | |
:description "FIXME: write" | |
:dependencies [[org.clojure/clojure "1.2.0"] | |
[org.apache.hadoop/zookeeper "3.3.1"]] | |
:dev-dependencies [swank-clojure "1.3.0-SNAPSHOT"]) |
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
<script type="text/javascript"> | |
// Framebusting | |
if (top != self ) { top.location.replace(document.location); } | |
</script> |
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
From 9f9636c75eb9b53b0bd30bb82b787da4cc753070 Mon Sep 17 00:00:00 2001 | |
From: Aaron Bedra and Jon Distad <[email protected]> | |
Date: Thu, 29 Apr 2010 14:56:23 -0400 | |
Subject: [PATCH] exits with 1 when tests have failures or errors | |
--- | |
src/leiningen/compile.clj | 2 +- | |
src/leiningen/test.clj | 7 +++++-- | |
2 files changed, 6 insertions(+), 3 deletions(-) |