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
(defroutes chapter-routes | |
;; Example story-slug: 42-my-first-story | |
;; Example chapter-slug: 99-introduction | |
;; (util/parse-uid "42-my-first-story") -> 42 | |
;; (util/parse-uid "99-introduction") -> 99 | |
(GET "/chapters/:chapter-slug" [story-slug chapter-slug] | |
(let [story (some-> story-slug util/parse-uid db/find-story-by-uid) | |
chapter (some-> chapter-slug util/parse-uid db/find-chapter-by-uid)] | |
(and story chapter | |
(zizkov.views/show-chapter layout story chapter))))) |
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
# In example.rb | |
module Example | |
extend self | |
# This method does something | |
def command1(arg1, arg2, options = {}) | |
end | |
# This method does something else | |
def command2(arg1, arg2, options = {}) |
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
#!/usr/bin/env ruby | |
module Chars | |
extend self | |
def scale(args, options={}) | |
scale = options[:scale] | |
chars = args.map { |x| Chars.char(x.to_i).map { |row| row.split("") } } | |
print_chars scale_vertically(scale_horizontally(chars, scale), scale) | |
end | |