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
| (defun browse-url-ie () | |
| "Browse url with ie" | |
| (interactive) | |
| (let ((browse-url-generic-program "iexplore")) | |
| (call-interactively 'browse-url-generic))) |
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
| (dolist (variable '("PATH" "EMACSPATH")) | |
| (setenv variable | |
| (concat (getenv "HOME") "/bin:" | |
| (getenv "HOME") "/.gem/ruby/1.8/bin:" | |
| "/usr/local/bin:" | |
| (getenv "PATH")))) |
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
| (defn do-copy-tree [from to include-globs] | |
| (let [globs-pattern (globs->pattern include-globs) | |
| src-paths (map fs/normpath (filter #(re-matches globs-pattern (.getName %)) (file-seq (io/as-file from)))) | |
| from (fs/normpath from) | |
| to (fs/normpath to) | |
| dest-paths (map #(.replaceFirst % from to) src-paths)] | |
| (doall (map fs/copy+ src-paths dest-paths)))) |
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 good-guess? [guess number] | |
| (< (Math/abs (- (* guess guess) number)) 0.0001)) | |
| #'user/good-guess? | |
| user=> (defn improve-guess [guess number] | |
| (average guess (/ number guess))) | |
| #'user/improve-guess | |
| user=> (improve-guess 4 9) | |
| 25/8 | |
| user=> (good-guess? 25/8 9) | |
| java.lang.IllegalArgumentException: No matching method found: abs (NO_SOURCE_FILE:0) |
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
| (defn do-apply-snippets [] | |
| (let [snippet-paths (tree-paths "snippets") | |
| snippet-keywords (map keyword (map #(.concat ":" %) (map #(.substring % 0 (.lastIndexOf % ".")) (map fs/basename snippet-paths)))) | |
| snippet-contents (map slurp (map clojure.java.io/as-file snippet-paths)) | |
| snippets (zipmap snippet-keywords snippet-contents) | |
| html-files (map as-file (tree-paths target #{".html"})) | |
| html-file-line-seqs (map #(with-open [rdr (clojure.java.io/reader %)] (doall (line-seq rdr))) html-files) | |
| snippeted-html-file-line-seqs | |
| (map |
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
| #!/bin/sh | |
| # Runs clojure. | |
| # With no arguments, runs Clojure's REPL. | |
| # resolve links - $0 may be a softlink | |
| CLOJURE=$CLASSPATH:$(brew --cellar)/clojure/1.2.0/clojure.jar:$(brew --cellar)/clojure-contrib/1.2.0/clojure-contrib.jar | |
| java -cp $CLOJURE clojure.main "$@" |
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
| ;;Implement using infinite sequences | |
| (require ['clojure.contrib.math :as 'math]) | |
| (defn average [x y] (/ (+ x y) 2)) | |
| (defn improve-guess [[guess number]] | |
| [(average guess (/ number guess)) number]) | |
| (defn good-guess? [[guess number]] | |
| (< (math/abs (- (* guess guess) number)) 0.0001)) |
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
| set backOnAt to (current date) + 60 | |
| set turnOn to "/Users/tim/Library/Scripts/timeMachineOn.scpt" | |
| tell application "iCal" | |
| tell calendar "Scheduled Scripts" | |
| delete events | |
| set turnBackOn to ¬ | |
| make new event with properties ¬ | |
| {start date:backOnAt} | |
| tell turnBackOn |
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
| (defun cradle-run (args) | |
| (interactive "MRun Cradle with args: ") | |
| (let ((current-directory default-directory) | |
| (cradle-home (locate-dominating-file default-directory "build.clj"))) | |
| (progn | |
| (cd cradle-home) | |
| (shell-command (concat "cradle " args)) | |
| (cd current-directory)))) | |
| (defun cradle-deploy () |
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
| test |