Skip to content

Instantly share code, notes, and snippets.

Mark McGranaghan mmcgrana

Block or report user

Report or block mmcgrana

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View README.md
# in one terminal
$ lein deps
$ lein run -m server

# in another terminal
$ curl -i http://localhost:8080/sync
$ curl -i http://localhost:8080/poll
$ curl -i http://localhost:8080/stream
$ ./wsclient ws://localhost:8080/websocket?name=bob
=> hi
View error.clj
Clojure 1.3.0-alpha2
user=> (try (throw (Throwable. "fail")) (catch Exception e (println "error:" e)))
Throwable fail user/eval1 (NO_SOURCE_FILE:1)
user=> (try (throw (Exception. "fail")) (catch Exception e (println "error:" e)))
error: #<Exception java.lang.Exception: fail>
View trace_data.clj
{:class java.lang.Exception,
:message "I regret to inform you that you are doing it wrong.",
:trace-elems
({:annon-fn false,
:fn "biz",
:ns "user",
:clojure true,
:file "trace_test.clj",
:line 7}
{:annon-fn true,
View trace_results.txt
~/Desktop $ java -cp clojure-1.3.0-alpha2.jar:clj-stacktrace-0.2.0.jar clojure.main trace_test.clj
== java
java.lang.Exception: I regret to inform you that you are doing it wrong.
at user$biz.invoke(trace_test.clj:8)
at user$bat$f__104.invoke(trace_test.clj:12)
at user$bat.invoke(trace_test.clj:13)
at user$bar.invoke(trace_test.clj:17)
at user$foo.invoke(trace_test.clj:22)
at user$eval109.invoke(trace_test.clj:25)
at clojure.lang.Compiler.eval(Compiler.java:6168)
View trace_results.txt
~/Desktop $ java -cp clojure-1.3.0-alpha2.jar:clj-stacktrace-0.2.0.jar clojure.main trace_test.clj
== java
java.lang.Exception: I regret to inform you that you are doing it wrong.
at user$biz.invoke(trace_test.clj:8)
at user$bat$f__104.invoke(trace_test.clj:12)
at user$bat.invoke(trace_test.clj:13)
at user$bar.invoke(trace_test.clj:17)
at user$foo.invoke(trace_test.clj:22)
at user$eval109.invoke(trace_test.clj:25)
at clojure.lang.Compiler.eval(Compiler.java:6168)
View path.clj
;; "to help support nested routes and mounted applications within applications"
; we have some sub-apps we want to be active at different contexts
(defn blog-app [req] ...)
(defn forum-app [req] ...)
(defn core-app [req] ...)
; a heler function for setting up context keys
(defn in-context [context req]
(assoc req
View s3
#!/usr/bin/env ruby
require 'rubygems'
require 'aws/s3'
class S3Cmd
include AWS::S3
def initialize
Base.establish_connection!(
View callbacks.js
});
}
);
});
});
});
});
});
});
});
View markdown.clj
; dependencies:
; http://build.clojure.org/releases/org/clojure/clojure/1.2.0/clojure-1.2.0.jar
; http://github.com/downloads/sirthias/parboiled/parboiled4j-0.9.8.2.jar
; http://github.com/downloads/sirthias/pegdown/pegdown-0.8.5.3.jar
(import 'org.pegdown.PegDownProcessor)
(def input-text "
A First Level Header
====================
You can’t perform that action at this time.