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
(ns rabscuttle.parser-combinator) | |
(comment | |
"Working through http://www.cs.nott.ac.uk/~gmh//parsing.ps" | |
"A parser is a function that takes in input and returns lazy list of list of parsed value, and remaining input pairs") | |
(def letters (map char (lazy-cat (range (int \a) (inc (int \z))) | |
(range (int \A) (inc (int \Z)))))) | |
(def digits (map char (lazy-cat (range (int \0) (inc (int \9)))))) |
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
(ns rabscuttle.parser-combinator) | |
(comment | |
"Working through http://www.cs.nott.ac.uk/~gmh//parsing.ps" | |
"A parser is a function that takes in input and returns lazy list of list of parsed value, and remaining input pairs") | |
(def letters (map char (lazy-cat (range (int \a) (inc (int \z))) | |
(range (int \A) (inc (int \Z)))))) | |
(def digits (map char (lazy-cat (range (int \0) (inc (int \9)))))) |
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
;; clojure | |
(require 'clojure-paredit) | |
;; slime | |
(require 'slime) | |
(slime-setup) | |
;; slime fancy repl | |
(require 'slime-repl) |
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
(require 'magit) | |
(defun my-magit-run (&rest args) | |
(apply #'magit-run (cons "git" args)) | |
(message (mapconcat #'identity args " "))) | |
(defun my-magit-hack () | |
(interactive) | |
(let ((working-branch (magit-get-current-branch))) | |
(my-magit-run "checkout" "master") |
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
(ns rabscuttle.parser-combinator) | |
(comment | |
"Working through http://www.cs.nott.ac.uk/~gmh//parsing.ps" | |
"parser is a function that takes in input and returns [[v, inp]]") | |
;; Primitive Parsers | |
(defn succeed [v] (fn [inp] [[v inp]])) | |
(defn fail [inp] []) |
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
(ns rabscuttle.test-json | |
(:require [rabscuttle.json :as json]) | |
(:use [clojure.contrib.test-is])) | |
(deftest encode-value | |
(let [pairs [["string" "\"string\""] | |
["" "\"\""] | |
["\"" "\"\"\""] | |
[:keyword "\"keyword\""] | |
['symbol "\"symbol\""] |
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
(try | |
(.createNewFile file) | |
(catch IOException e | |
(throw (Exception. (str "Failed to create " file) e)))) |
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
(require 'slime) | |
(slime-setup) | |
(require 'clojure-auto) | |
(require 'clojure-paredit) | |
(add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode)) | |
;; These are extra key defines because I kept typing them. | |
;; Within clojure-mode, have Ctrl-x Ctrl-e evaluate the last | |
;; expression. |
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- macosx? [] | |
(-> "os.name" System/getProperty .toLowerCase | |
(.startsWith "mac os x"))) | |
(defn- macosx? [] | |
(.startsWith (.toLowerCase (System/getProperty "os.name")) | |
"mac os x")) |
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
(ns org.buntin.github.github | |
(:require [org.danlarkin.json :as json]) | |
(:import [org.apache.http.impl.client DefaultHttpClient] | |
[org.apache.http.client.methods HttpGet] | |
[org.apache.http.util EntityUtils])) | |
(def user "%s") | |
(def search "search/%s") | |
(def commit "%s/%s/commit/%s") | |
(def recent "%s/%s/commits/%s") |