Skip to content

Instantly share code, notes, and snippets.

View arohner's full-sized avatar

Allen Rohner arohner

View GitHub Profile
### Keybase proof
I hereby claim:
* I am arohner on github.
* I am arohner (https://keybase.io/arohner) on keybase.
* I have a public key ASDBb6_DdjJJsU7SDLNwjCHqnyvRDgmULf_nDTu9-RWpLQo
To claim this, I am signing this object:
@arohner
arohner / google-api.clj
Created November 5, 2016 21:53
Clojure example of accessing google APIs directly
(ns example.api.google
(:require [cemerick.url :as url]
[cheshire.core :as json]
[clj-jwt.core :as jwt]
[clj-jwt.key :as key]
[clj-time.core :as time]
[clj-http.client :as http]
[clojure.string :as str])
(:import java.io.StringReader))
{:user {:mirrors {#"clojars" {:name "tcrawley"
:url "https://clojars-mirror.tcrawley.org/repo/"}}
}}
@arohner
arohner / gist:77deaf47503c73654493
Last active August 29, 2015 14:22
core.typed & pedestal tools.analyzer.jvm conflict
(defn- go-async
"When presented with a channel as the return value of an enter function,
wait for the channel to return a new-context (via a go block). When a new
context is received, restart execution of the interceptor chain with that
context.
This function is non-blocking, returning nil immediately (a signal to halt
further execution on this thread)."
[old-context context-channel]
(prepare-for-async old-context)
@arohner
arohner / gist:d7a6bb057824c224b5b3
Created May 25, 2015 16:00
rudimentary core.typed datomic annotations
;;; Extremely incomplete type annotations for Datomic.
(ns foo.util.type.datomic
(:require [clojure.core.typed :as t]
[datomic.api :as d])
(:import (datomic Connection
Database)
(datomic.db DbId)
(java.util Date UUID)))
@arohner
arohner / gist:70596d1ca051a94de83d
Created May 1, 2015 20:08
annotating tools.logging
(ns foo.bar
(:require [clojure.tools.logging.impl]
[clojure.core.typed :as t :refer (ann)])
(:import (clojure.tools.logging.impl LoggerFactory Logger)
(clojure.lang Namespace
Symbol)))
(ann ^:no-check clojure.tools.logging/*logger-factory* LoggerFactory)
(ann ^:no-check clojure.tools.logging.impl/get-logger (t/Fn [LoggerFactory (t/U clojure.lang.Symbol Namespace) -> clojure.tools.logging.impl.Logger]))
(ann ^:no-check clojure.tools.logging.impl/enabled? (t/Fn [Logger t/Keyword -> Boolean]))
java.util.zip.ZipException: duplicate entry: WEB-INF/lib/tagsoup-1.2.1.jar
at java.util.zip.ZipOutputStream.putNextEntry (ZipOutputStream.java:233)
java.util.jar.JarOutputStream.putNextEntry (JarOutputStream.java:109)
sun.reflect.GeneratedMethodAccessor78.invoke (:-1)
sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke (Method.java:483)
clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:93)
clojure.lang.Reflector.invokeInstanceMethod (Reflector.java:28)
leiningen.ring.war$write_entry.invoke (war.clj:185)
leiningen.ring.war$file_entry.invoke (war.clj:201)
(defn wrap-reloading [{:keys [reloading?] :as args}]
(if reloading?
(fn [req]
((#'handler args) req))
(handler args)))
@arohner
arohner / gist:e8b839ea82ce78aed7a0
Created February 20, 2015 17:12
cljs foreign libs weirdness
Uncaught Error: Undefined nameToPath for com.bootstrapbase.js:739
visitNodebase.js:753
goog.writeScripts_base.js:459
goog.requiredashboard:4
(anonymous function)
:cljsbuild {:builds {:dev {:source-paths ["src/cljs"]
:compiler {:output-to "dev-resources/public/js/app.js"
:output-dir "dev-resources/public/js/"
@arohner
arohner / gist:566f7811ce30dd295b51
Created September 29, 2014 22:25
working with CFArray
public class LaunchAtStartup : NSObject
{
public class func enumerateLaunchItems()
{
let loginItemsRef = LSSharedFileListCreate(nil, kLSSharedFileListSessionLoginItems.takeUnretainedValue(), nil).takeUnretainedValue()
var itemUrl:NSURL?