Skip to content

Instantly share code, notes, and snippets.

diff --git a/src/main/java/com/theoryinpractise/clojure/ClojureSwankMojo.java b/src/main/java/com/theoryinpractise/clojure/ClojureSwankMojo.java
index d792b10..7fb29b9 100644
--- a/src/main/java/com/theoryinpractise/clojure/ClojureSwankMojo.java
+++ b/src/main/java/com/theoryinpractise/clojure/ClojureSwankMojo.java
@@ -62,13 +62,13 @@ public class ClojureSwankMojo extends AbstractClojureCompilerMojo {
StringBuilder sb = new StringBuilder();
sb.append("(do ");
- sb.append("(swank.swank/start-server \"");
- sb.append(swankTempFile.getAbsolutePath());
; Patch package.el to correctly download certain packages on Windows.
+ (defun package-write-file-no-coding (file-name excl)
+ (setq buffer-file-coding-system 'no-conversion)
+ (write-region (point-min) (point-max) file-name nil nil nil excl))
(defun package-unpack-single (file-name version desc requires)
"Install the contents of the current buffer as a package."
(let* ((dir (file-name-as-directory package-user-dir)))
(defun my-indent-line ()
"Make single-semicolon lisp comments indent like ;;-comments.
Mostly cribbed from `lisp-indent-line'."
(interactive)
(let ((indent (calculate-lisp-indent)) shift-amt end
(beg (progn (beginning-of-line) (point))))
(skip-chars-forward " \t")
(if (or (looking-at "\\s<\\s<") (not (looking-at "\\s<")))
(lisp-indent-line)
(if (listp indent) (setq indent (car indent)))
require 'open-uri'
require 'hpricot'
url = "http://www.lowes.com/webapp/wcs/stores/servlet/ProductDisplay?storeId=10151&catalogId=10051&productId=3200897"
cookie = "selectedStore1=Lowe's Of C Indianapolis## IN|0635|2|46220|no|Y|6002 North Rural Street|Indianapolis|M-Sa 6:30 Am - 10 Pm## Su 8 Am - 8 Pm|(317) 202-9142|(317) 202-9543|OA"
open(url, "Cookie" => cookie) do |f|
xml = Hpricot.XML(f)
text = (xml/"#buy-now").first.inner_text
if text =~ /Unavailable at LOWE'S OF C. INDIANAPOLIS/i
#!/bin/bash
# A clj.sh that works on Windows in Cygwin. I just converted : to ; in the
# classpath.
#
# Sadly, you have to copy jars into
# your user clj dir; symlinks won't work with a win32 build of java.exe.
# Originally from http://gist.github.com/237162, and requires run.clj from there.
USER_CLJ_DIR=c:/Users/Shawn/.clojure
(ns mrssxml
"Prints out an mrss xml playlist for a directory of mp3s.
Usage:
java -cp clojure-1.0.0.jar:clojure-contrib-1.0-compat.jar clojure.main \\
~/mrssxml.clj some-dir > playlist.xml"
(:use [clojure.contrib prxml])
(:require [clojure.contrib.str-utils2 :as s]
[clojure.contrib.java-utils :as java]
[clojure.contrib.command-line :as cl]))
; A CLR port of Brian's functional brain from
; http://blog.bestinclass.dk/index.php/2009/10/brians-functional-brain/
;
; A WPF app is fired up in another thread. Anything you type in the REPL
; is dispatched to the WPF thread and evaluated there.
;
; Requires a ClojureCLR implmentation of futures and the following addition
; to ClojureCLR's GenDelegate.cs:
; public static Delegate CreateFunc(IFn fn)
; {
; A CLR port of Chouser's Christmas tree http://gist.github.com/40012
;
; A WPF app is fired up in another thread. Anything you type in the REPL
; is dispatched to the WPF thread and evaluated there.
;
; Requires the following addition to ClojureCLR's GenDelegate.cs:
; public static Delegate CreateFunc(IFn fn)
; {
; Type delegateType = typeof(Func<>).MakeGenericType(new Type[] { typeof(object) });
; return Create(delegateType, fn);
; A CLR port of http://bestinclass.wordpress.com/2009/09/24/chaos-theory-vs-clojure/
; Updated to use Rich Hickey's changes: http://paste.lisp.org/display/87799
;
; A WPF app is fired up in another thread. Anything you type in the REPL
; is dispatched to the WPF thread and evaluated there.
;
; Requires the following addition to ClojureCLR's GenDelegate.cs:
; public static Delegate CreateFunc(IFn fn)
; {
; Type delegateType = typeof(Func<>).MakeGenericType(new Type[] { typeof(object) });
;;; Phil H's revised slime-project; can't remember where I found it
(defun slime-project (path)
"Setup classpaths for a clojure project and starts a new SLIME session.
Kills existing SLIME session, if any."
(interactive (list
(ido-read-directory-name
"Project root: "
(locate-dominating-file default-directory "pom.xml"))))
(when (get-buffer "*inferior-lisp*")