Skip to content

Instantly share code, notes, and snippets.

<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>
<dependency>
<groupId>com.sun.grizzly.osgi</groupId>
<artifactId>grizzly-httpservice</artifactId>
<version>1.9.9-SNAPSHOT</version>
<!-- Or for latest released version RELEASE -->
</dependency>
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"]
@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)
(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 / 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)))
#!/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
2010-05-17 11:26:26
Full thread dump Java HotSpot(TM) 64-Bit Server VM (14.3-b01-101 mixed mode):
"Attach Listener" daemon prio=9 tid=0x0000000102135000 nid=0x114fe6000 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Swank REPL Thread" prio=5 tid=0x00000001024f8000 nid=0x1155bf000 waiting on condition [0x00000001155bd000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000001094a4508> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
@neotyk
neotyk / gist:568486
Created September 7, 2010 14:51
Generating multiple fns on a fly
(doseq [[fn-name fn-doc] [testname "sample doc" anothername "detailed documentation"]]
`(defn ~fn-name ~fn-doc [a] a))
import com.ning.http.client.AsyncCompletionHandler;
import com.ning.http.client.AsyncHttpClient;
import com.ning.http.client.Request;
import com.ning.http.client.Response;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;
public class Problem {