Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
pidfile=$WHERE_YOUR_PIDFILE_IS_LOCATED
if [ -e $pidfile ]; then
pid=`cat $pidfile`
if kill -0 >/dev/null 2>&1 $pid; then
echo "Already running"
exit 1
else
rm $pidfile
fi
@neotyk
neotyk / mini-httpserv.clj
Created February 7, 2010 23:56
Found it very useful in last days
(ns serv (:use compojure))
(defroutes greetings
(GET "/"
(html [:h1 "Hello World"]))
(ANY "*"
(page-not-found)))
(def server (run-server {:port 8080} "/*" (servlet greetings)))
(ns test-clean
(:refer-clojure :exclude [compile])
(:use [leiningen.core :only [read-project defproject]]
[leiningen.deps :only [deps]]
[leiningen.clean :only [clean]]
[leiningen.compile :only [compile]] :reload-all)
(:use [clojure.test]
[clojure.contrib.set]
[clojure.contrib.java-utils :only [file]]))
@neotyk
neotyk / mystr.clj
Created January 10, 2010 19:38
clojure.core/str version that shows how it works
(defn mystr
"With no args, returns the empty string. With one arg x, returns
x.toString(). (str nil) returns the empty string. With more than
one arg, returns the concatenation of the str values of the args."
{:tag String}
([] (println "0:")
"")
([#^Object x] (println "1: x:" x)
(if (nil? x) "" (. x (toString))))
([x & ys] (println "2: x: " x ", ys: " ys)
diff --git a/project.clj b/project.clj
index adac2b2..3c05f8f 100644
--- a/project.clj
+++ b/project.clj
@@ -1,6 +1,6 @@
(defproject fnparse "2.2.4"
:description "A library for creating functional parsers in Clojure."
- :dependencies [[org.clojure/clojure "1.0.0"]
- [org.clojure/clojure "1.0.0-SNAPSHOT"]]
+ :dependencies [[org.clojure/clojure "1.1.0-master-SNAPSHOT"]
<dependency>
<groupId>com.sun.grizzly.osgi</groupId>
<artifactId>grizzly-httpservice</artifactId>
<version>1.9.9-SNAPSHOT</version>
<!-- Or for latest released version RELEASE -->
</dependency>
<dependency>
<groupId>com.sun.grizzly.osgi</groupId>
<artifactId>grizzly-httpservice-bundle</artifactId>
<version>1.9.9-SNAPSHOT</version>
<!-- Or for latest released version RELEASE -->
</dependency>