This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns ui.core | |
(:require [seesaw.core :as c] | |
[seesaw.border :as b]) | |
(:gen-class :main true)) | |
(defn send-msg [event] | |
(let [val (-> event | |
(c/to-frame) | |
(c/select [:#msg-txt]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LoggingHandler : DelegatingHandler | |
{ | |
public LoggingHandler(HttpMessageHandler innerHandler) | |
: base(innerHandler) | |
{ | |
} | |
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) | |
{ | |
Debug.WriteLine("Request:"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn path-info | |
"Returns the relative path of the request." | |
[request] | |
(or (:path-info request) | |
(:uri request))) | |
(defn authentication-failed [] | |
{:status 401 | |
:headers {"Content-Type" "application/json;charset=UTF-8"} | |
:body (json/write-str {:error "Unknown username or password."})}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defresource put-delete-get [system path id json-body {:keys [find-by-id find-versions | |
create update delete-by-id validation-fn | |
has-permission] :or {has-permission (constantly true)}}] | |
:allowed-methods [:put :delete :get] | |
:available-media-types ["application/json"] | |
:allowed? (fn [{{method :request-method} :request}] | |
{::instance (find-by-id system id)}) | |
:exists? ::instance | |
:can-put-to-missing? false | |
:new? false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ brew install nginx | |
$ cd /user/local/var/www | |
$ ln -s /Users/ebaxt/Projects/ardoq-front/src/css | |
$ ln -s /Users/ebaxt/Projects/ardoq-front/src/js | |
$ ln -s /Users/ebaxt/Projects/ardoq-front/src/less | |
$ ln -s /Users/ebaxt/Projects/ardoq-front/resources/public/img img | |
$ ln -s /Users/ebaxt/Projects/ardoq-front/src/html/* ./ | |
$ pwd | |
/usr/local/var/www |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn with-test-auth | |
([] (with-test-auth {})) | |
([credentials] | |
(fn [f] | |
(with-redefs-fn | |
{#'cemerick.friend/current-authentication | |
(fn [] (merge {:identity "test", | |
:username "test", | |
:email "[email protected]"} credentials))} | |
f)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let [[message-seq put] (pipe)] | |
(letfn [(message-handler [ch msg-meta payload] | |
(put {:ch ch :msg-meta msg-meta :payload payload}))] | |
(lc/subscribe ch qname message-handler :auto-ack true)) | |
message-seq) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn pipe | |
"Returns a vector containing a sequence that will read from the | |
queue, and a function that inserts items into the queue. | |
Source: http://clj-me.cgrand.net/2010/04/02/pipe-dreams-are-not-necessarily-made-of-promises/" | |
[] | |
(let [q (LinkedBlockingQueue.) | |
EOQ (Object.) | |
NIL (Object.) | |
s (fn queue-seq [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def fibs | |
(concat (lazy-seq [0 1]) (lazy-seq (map + fibs (rest fibs))))) | |
;fibs: 0 1 1 2 3 5 8... | |
;rest: n 0 1 1 2 3 5 | |
;res: 0 1 2 3 5 8 | |
; A | |
;[0 1 | |
; (map + [0 1] [1]) => [0 1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<technomancy> ebaxt: the problem is that the http connector for aether (called a wagon for whatever reason) isn't found | |
[01:12:02] jodaro ([email protected]) left IRC. (Ping timeout: 246 seconds) | |
[01:12:14] <technomancy> ebaxt: usually you see this when you're trying to deploy to some nonstandard repository type like S3 | |
[01:12:21] ToBeReplaced ([email protected]) left the channel. | |
[01:12:21] <aperiodic> dakrone: it seems to me that the proxy functionality doesn't work with SOCKS (i've got a local SOCKS tunnel open that my web browser is using fine, but i get the same no response exception w/clj-http) | |
[01:12:33] <technomancy> the fact that aether would be unable to find a wagon that it bundles with itself is bizarre |
NewerOlder