Skip to content

Instantly share code, notes, and snippets.

(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]
(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)))))
@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)
TorqueBox::Web::Server.sockjs('/messages').on_connection do |conn|
TorqueBox::Messaging::Topic.new('browser-messages').listen do |m|
conn.write(m)
end
end
require 'torquebox-web'
require 'torquebox-messaging'
topic = TorqueBox::Messaging::Topic.new('browser-messages')
TorqueBox::Web::Server.sockjs('/messages').on_connection do |conn|
listener = topic.listen do |m|
conn.write(m)
end
-*- mode: grep; default-directory: "~/w/immutant/immutant/" -*-
Grep started at Wed Aug 20 14:01:10
git --no-pager grep --no-color -n -e "TODO" -- "*.*"
etc/bin/ci-prep-wildfly.sh:20:# TODO: domain mode
etc/build-helper/src/build_helper/docs.clj:21: (update-in project [:dependencies] conj '[org.immutant/build-helper "0.1.6"]) ;; TODO: don't hardcode this version?
messaging/src/immutant/messaging.clj:139: TODO: more docs/examples"
messaging/test/immutant/messaging/pipeline_test.clj:359: (println "NOTE: pipeline record test disabled out-of-container, as it will fail. TODO: fix it")))
web/test/immutant/web/websocket_test.clj:92: ;; TODO: bug in undertow! (is (= "/?x=y&j=k" (-> handshake uri str)))
wildfly/src/immutant/wildfly.clj:116: ;; TODO: figure out where to store/get the web-context
(deftask eval
"eval some stuff"
[e eval CODE [str] "code snippets to eval"]
(with-pre-wrap fileset
(doseq [e eval]
(clojure.core/eval (read-string e)))
fileset))
#!/bin/bash
IN="LVDS1"
EXT="HDMI3"
if (xrandr | grep "$EXT disconnected"); then
xrandr -d :0.0 --output $IN --auto --output $EXT --off
else
xrandr -d :0.0 --output $IN --auto --output $EXT --auto --right-of $IN --primary
fi
get '/' do
haml :index
end
post '/unwind' do
@url, @unwound_url, @unwind_error = unwind(params[:url])
haml :index
end
def test_index
get_it '/'
assert_match /Unwind It/, @response.body
end
def test_unwind_with_blank_url
post_it '/unwind', :url => ''
assert_match /Please enter/, @response.body
end