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
Option Explicit | |
Private Function GetNamedArguments(ByVal strName, ByVal strDefault) | |
If WScript.Arguments.Named.Exists(strName) Then | |
GetNamedArguments = WScript.Arguments.Named.Item(strName) | |
Else | |
GetNamedArguments = strDefault | |
End If | |
End Function |
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 clj-ex-mkd.core | |
(:import (com.petebevin.markdown MarkdownProcessor))) | |
(defn markdown-to-html | |
[markdown] | |
(-> | |
(MarkdownProcessor.) | |
(.markdown markdown))) | |
(defn read-markdown-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
(defn load-jekyll-post-file | |
[post-file] | |
(let [text (slurp post-file) | |
[_ yaml content] (re-find #"(?m)(?s)^---\s*(.*?)^---\s*^(.*)" text)] | |
(reduce (fn [m [_ k v]] (assoc m (keyword k) v)) | |
{:content (markdown-to-html content)} | |
(re-seq #"(\w+):\s*(.*)\n" yaml)))) |
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 clj-ex-mkd.core | |
(:require [clojure.java.io :as io] | |
[net.cgrand.enlive-html :as eh]) | |
(:import (com.petebevin.markdown MarkdownProcessor))) | |
(defn markdown-to-html | |
[markdown] | |
(-> | |
(MarkdownProcessor.) | |
(.markdown markdown))) |
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
(defn get-template-files | |
"Get all template files. Find specified directory with `:dir` option." | |
[& {:keys [dir] :or {dir (str *base-dir* (:template-dir *config*))}}] ;; :template-dirで返るパスが*base-dir*からの相対パスなので、compileが通らない。 | |
(let [exts (get-watch-file-extensions)] | |
(filter | |
(fn [file] | |
(some #(has-extension? % file) exts)) | |
(find-files dir)))) |
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
; my misaki's directory | |
; #"^_" is ignore pattern. | |
; | |
; *base-dir* "/" ; | |
; :public-dir "_public/" ; | |
; :tag-out-dir "tag/" ; :public-dir/:tag-out-dir | |
; :coffee-script-out-dir "script/" ; :public-dir/:coffee-out-dir | |
; :lesscss-out-dir "style/" ; :public-dir/:lesscss-out-dir | |
; :template-dir *base-dir* | |
; :post-dir "_post/" ; :template-dir/:post-dir |
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
; ファイルの書き込み | |
(spit "test.txt" "foobarbaz") ; => nil | |
; ファイルの読み込み | |
(slurp "test.txt") ; => "foobarbaz" |
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
(defn str-to-int | |
[s] | |
{:pre [(string? s)] | |
:post [(number? %)]} | |
(Integer/parseInt s)) | |
(str-to-int 10) ; java.lang.AssertionError | |
(str-to-int "10") ; => 10 |
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
(apply + (filter #(or (zero? (mod % 3)) (zero? (mod % 5))) (range 1000))) |
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
;;; Project Euler #8 | |
;;; http://projecteuler.net/problem=8 | |
;;; http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%208 | |
(use 'clojure.test) | |
(def input | |
(str | |
"73167176531330624919225119674426574742355349194934" | |
"96983520312774506326239578318016984801869478851843" |