Skip to content

Instantly share code, notes, and snippets.

View ebaxt's full-sized avatar

Erik Bakstad ebaxt

View GitHub Profile
@ebaxt
ebaxt / Duplicate
Last active December 19, 2015 22:39
Duplicate
(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
(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."})})
public class LoggingHandler : DelegatingHandler
{
public LoggingHandler(HttpMessageHandler innerHandler)
: base(innerHandler)
{
}
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
Debug.WriteLine("Request:");
@ebaxt
ebaxt / core.clj
Created September 15, 2014 06:11
(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])