Skip to content

Instantly share code, notes, and snippets.

TorqueBox::Web::Server.sockjs('/messages').on_connection do |conn|
TorqueBox::Messaging::Topic.new('browser-messages').listen do |m|
conn.write(m)
end
end
@tobias
tobias / core.clj
Last active August 29, 2015 14:02 — forked from marianoguerra/core.clj
(ns logerror.core
(:require
[immutant.cache :as cache]
[clojure.tools.logging :as log]))
(println @#'clojure.tools.logging/*logger-factory*)
(try
(def my-cache (cache/create "cache"))
(catch Exception e
(.printStackTrace e)
(require 'compile)
(defun locate-all-dominating-files (dir filename)
"Searches for FILENAME in DIR and its parents, returning a list
of all dirs containing the file."
(let ((found-dir (locate-dominating-file (expand-file-name dir) filename)))
(if found-dir
(cons found-dir (locate-all-dominating-files
(concat found-dir "..")
filename)))))
(ns example.http.client
(:require [vertx.http :as http]
[vertx.stream :as stream]))
(-> (http/client {:port 8080 :host "localhost"})
(http/get-now "/"
(fn [response]
(-> response
(stream/on-data
(fn [buffer]
(define-key erc-mode-map (kbd "C-c m")
(lambda (nick)
(interactive (list (completing-read "Say 'morning!' to nick: " erc-channel-users)))
(erc-send-message (format "%s: morning!" nick))))
Server Port: 8097
Requests per second: 50152.41 [#/sec] (mean)
Server Port: 8097
Requests per second: 50727.22 [#/sec] (mean)
Server Port: 8097
Requests per second: 50621.04 [#/sec] (mean)
Server Port: 8097
Requests per second: 50338.69 [#/sec] (mean)
===============================================
(add-hook 'clojure-mode-hook 'tc/run-common-coding-hooks)
(add-hook 'clojure-mode-hook 'tc/run-lisp-coding-hooks)
(add-to-list 'auto-mode-alist '("\\.dtm$" . clojure-mode))
(add-to-list 'auto-mode-alist '("\\.edn$" . clojure-mode))
(add-to-list 'auto-mode-alist '("\\.cljs$" . clojure-mode))
(setq clojure-defun-style-default-indent t)
(setq nrepl-popup-stacktraces nil)
(defn ^:internal ^:no-doc delayed
"Creates an timeout-derefable delay around any function taking a timeout"
[f]
(let [val (atom ::unrealized)
realized? #(not= ::unrealized @val)
rcv (fn [timeout] (reset! val (f timeout)))]
(proxy [clojure.lang.Delay clojure.lang.IBlockingDeref] [nil]
(deref
([]
(if (realized?) @val (rcv 0)))
commit 7d4a8f4724ea8f82709550d8a55798c87bfab802 (HEAD, refs/heads/clj-1299-no-nil)
Author: Toby Crawley <toby@tcrawley.org>
Date: Fri Nov 22 09:49:44 2013 -0500
Prevent a conveyed binding frame from being removed by a popThreadBindings call [CLJ-1299]
This introduces a TOP frame that is used to mark the top of a
push/pop stack. It also removes unnecessary nil checks around dvals.
Modified src/jvm/clojure/lang/Var.java
Changes:
Modified src/jvm/clojure/lang/Var.java
diff --git a/src/jvm/clojure/lang/Var.java b/src/jvm/clojure/lang/Var.java
index 7463337..2dee064 100644
--- a/src/jvm/clojure/lang/Var.java
+++ b/src/jvm/clojure/lang/Var.java
@@ -63,8 +63,8 @@ static class Frame{
}
protected Object clone() {