Skip to content

Instantly share code, notes, and snippets.

(use '[clojure.contrib.str-utils])
(defn map->querystring [m]
(let [join-pair (fn [[k v]]
(str-join "=" [(.toUpperCase (name k)) v]))]
(str-join "&"
(reduce (fn [acc pair]
(conj acc (join-pair pair))) [] m))))
(map->querystring {:class "RES" :mlsnum "23823" :format "COMPACT"})
#!/bin/sh
# port install jpeg libpng xpm
CPPFLAGS=-I/opt/local/include; export CPPFLAGS
LDFLAGS=-L/opt/local/lib; export LDFLAGS
./configure \
--prefix=/usr/local/pkgs/emacs \
--with-ns \
--without-x \
(ns rets
(:import (org.apache.http.impl.client DefaultHttpClient)
(org.apache.http.client.methods HttpGet HttpPost)
(org.apache.http.auth UsernamePasswordCredentials)
(org.apache.http.util EntityUtils)))
(use '[clojure.contrib.str-utils])
(def base-url "http://rets.realtracs.net:6103")
(def login-path "/rets/login")
(ns org.buntin.github.github)
(defn- perform-request [url]
; HTTP stuff...
url)
(defn make-github [version return-type]
(fn [url & args]
(perform-request
(apply format
(ns com.notifymd.zip
(:import [com.csvreader CsvReader]))
(defn slurp-csv
"Return a map where key equals (keyword \"37211\") and
value equals the rest of the row minus the zip code"
[filename]
(let [reader (doto (CsvReader. filename)
(.readHeaders))
headers (map #(keyword (.toLowerCase %))
#!/bin/sh
CPPFLAGS="-I/opt/local/include -I/opt/local/include/boost"; export CPPFLAGS
LDFLAGS="-L/opt/local/lib"; export LDFLAGS
./acprep \
--opt \
--switch --prefix=/usr/local/pkgs/ledger-3 \
--switch --with-boost-suffix=-mt
% ledger reg -p dec -n ^expenses:food
Error: Assertion failed in "src/filters.cc", line 283: void ledger::collapse_xacts::report_subtotal(): count >= 1
Debugger entered--Lisp error: (wrong-number-of-arguments (lambda (account) (interactive "sAccount to reconcile:
P") (let ((buf (current-buffer)) (rbuf (get-buffer "*Reconcile*"))) (if rbuf (kill-buffer rbuf)) (add-hook (quote after-save-hook) (quote ledger-reconcile-refresh-after-save)) (with-current-buffer (pop-to-buffer (get-buffer-create "*Reconcile*")) (ledger-reconcile-mode) (set (make-local-variable (quote ledger-buf)) buf) (set (make-local-variable (quote ledger-acct)) account) (ledger-do-reconcile)))) 2)
ledger-reconcile("Assets:Checking" nil)
call-interactively(ledger-reconcile)
% git grep -E "defn .*?-seq"
src/clj/clojure/core.clj:(defn line-seq
src/clj/clojure/core.clj:(defn resultset-seq
src/clj/clojure/core.clj:(defn re-seq
src/clj/clojure/core.clj: (defn tree-seq
src/clj/clojure/core.clj:(defn file-seq
src/clj/clojure/core.clj:(defn xml-seq
src/clj/clojure/core.clj:(defn iterator-seq
src/clj/clojure/core.clj:(defn enumeration-seq
; -*- ledger -*-
= account =~ /^Income/
(Liabilities:Tithe) 0.12
~ Monthly
Assets:Checking $500.00
Income:Salary
2003/12/01 * Checking balance