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
(ns async-example.core | |
(:gen-class) | |
(:require [clojure.core.async | |
:as a | |
:refer [>! <! >!! <!! go chan buffer close! thread | |
alts! alts!! timeout]])) | |
(def write-to-file-channel (chan 10000)) | |
(defn get-contents [name] |
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
#!/usr/bin/env ruby | |
REGXS = { | |
/context/ => "describe", | |
/assert_equal\(?\s*([^,]+), (.*)\s*\)?$/ => "\\2.should == \\1", | |
/setup do/ => "before( :each ) do", | |
/should([^_])/ => "it\\1", | |
/require File.dirname.*$/ => "require \"spec_helper\"", | |
/class (.*)Test < [^:]*::TestCase/ => "describe \\1 do" | |
} |
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
class HashWithIndifferentAccessTest < ActiveSupport::TestCase | |
def test_should_have_deep_clone | |
h = HashWithIndifferentAccess.new | |
h.deep_clone | |
end | |
end | |
# Fails for me in Rails 2.3.5 using REE | |
# | |
# test_should_have_deep_clone(HashWithIndifferentAccessTest): |
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 File.dirname(__FILE__) + '/../../test_helper/test_helper' | |
class IndexesOnForeignKeysTest < ActiveSupport::TestCase | |
context "IndexesOnForeignKeysTest" do | |
should "not have foreign keys without indexes as it leads to deadlocks" do | |
cursor = ActiveRecord::Base.connection.execute <<-SQL | |
select 'execute ''CREATE INDEX '||substr(constraint_name,1,28)||'_I ON '||table_name||'('|| | |
cname1 || nvl2(cname2,','||cname2,null) || | |
nvl2(cname3,','||cname3,null) || nvl2(cname4,','||cname4,null) || | |
nvl2(cname5,','||cname5,null) || nvl2(cname6,','||cname6,null) || |
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
(ns change.maker) | |
; The point of this exercise is to create a change maker. That is, given any amount of cents | |
; the code will return an array with the minimum amount of coins that add up to the required amount. | |
; The array should be arranged from highest to lowest value coin. | |
; | |
; A working version will provide the output specified below: | |
; (make-change 26) => [25,1] | |
; (make-change 24) => [10,10,1,1,1,1] | |
; (make-change 49) => [25,10,10,1,1,1,1] |