Edward Tsech edtsech

View split_by.clj
1 2 3 4 5 6 7 8 9 10
(defn split-by
"Create from sequence (l) sequence of sequences with specified number of elemenets (c)
Example:
(split-by 2 [1 2 3 4 5 6 7])
=> '((1 2) (3 4) (5 6) (7))"
[c l]
(if (seq l)
(cons (take c l) (split-by c (drop c l)))))
 
(defn split-into-chunks
View vali.clj
1 2 3 4 5 6 7 8 9
(defn validate [data schema]
(into {} (for [[x y] schema]
[x (if (contains? data x)
(let [res (x data)]
(try (y res) (catch IllegalArgumentException e false)))
false)])))
 
(defn valid? [data schema]
(every? true? (vals (validate data schema))))
View merge.rb
1 2 3 4 5
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 254, "c" => 300 }
h3 = h1.merge(h2)
h3 #=> {"a"=>100, "b"=>254, "c"=>300}
h1 #=> { "a" => 100, "b" => 200 }
View compojure.clj
1 2 3 4 5
(defroutes posts-routes
(context "/posts" []
(GET "/" request ...)
(GET "/new" request ...)
(POST "/" request ...)))
View blog.clj
1 2 3 4 5 6 7 8 9 10
(use 'net.cgrand.enlive-html)
 
; Define our posts, it can be response from the database.
(def posts [{:title "First post"
:content "Content of my first post."
:comments [{
:user "edtsech"
:text "boom"}
{:user "anonymous"
:text "blah-blah-blah"}]}
View 1000.rb
1 2 3 4 5
THOUSAND = -> p { -> x { p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[
p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[
p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[
p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[
p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p
View boom.rb
1 2 3 4 5 6 7 8 9 10
ContentFor = Class.new
x = ContentFor.new
 
puts x.class.object_id # => 2266662780
# puts x.class.name
 
ContentFor = Class.new
y = ContentFor.new
 
puts x.class.object_id # => 2266662780
View acts_as_untitled.gemspec
1 2 3 4 5 6 7 8 9 10
Gem::Specification.new do |s|
s.name = 'acts_as_untitled'
s.version = '0.1.0'
s.platform = Gem::Platform::RUBY
s.author = 'Edward Tsech'
s.email = 'edtsech@gmail.com'
s.summary = 'Acts as untitled!'
s.description = ''
 
s.files = ['acts_as_untitled.rb']
Something went wrong with that request. Please try again.