Skip to content

Instantly share code, notes, and snippets.

Jason Whitlark jwhitlark

  • United States
Block or report user

Report or block jwhitlark

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jwhitlark / k8s-client.clj
Created Apr 30, 2019
Access Kubernetes API from inside a pod with clojure, clj-http, and a custom ca.crt, with help from aphyr's less-awful-ssl
View k8s-client.clj
;; less-awful-ssl {:mvn/version "1.0.4"}
;; clj-http {:mvn/version "3.9.1"}
(let [trust-store (less.awful.ssl/trust-store ( "/var/run/secrets/"))
bearer-token (format "Bearer %s" (slurp "/var/run/secrets/"))
kube-api-host (System/getenv "")
kube-api-port (System/getenv "")]
(format "https://%s:%s/apis/<something-protected>" kube-api-host kube-api-port)
{:trust-store trust-store
jwhitlark / .envrc
Created Feb 28, 2019
Autoclone$GITUSER/$GITREPO into the current directory, when direnv is installed.
View .envrc
PARENT=$(basename $PWD)
GRANDPARENT=$(basename $(dirname $PWD))
if [ ! -d .git ]; then
echo "Cloning $REPOPATH into $PWD"
tfile=$(mktemp /tmp/envrc.XXXXXXXXX)
mv .envrc $tfile
git clone$REPOPATH.git ./
mv $tfile .envrc
jwhitlark / google-api.clj
Created Jan 31, 2019 — forked from arohner/google-api.clj
Clojure example of accessing google APIs directly
View google-api.clj
(: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])
jwhitlark / reagent_datascript.cljs
Created Mar 14, 2016 — forked from allgress/reagent_datascript.cljs
Test use of DataScript for state management of Reagent views.
View reagent_datascript.cljs
(ns reagent-test.core
(:require [reagent.core :as reagent :refer [atom]]
[datascript :as d]
[cljs-uuid-utils :as uuid]))
(defn bind
([conn q]
(bind conn q (atom nil)))
jwhitlark / google.clj
Created Mar 25, 2015
Combine friend, oauth2, and JWT token processing.
View google.clj
(:require [clojure.string :as str]
[ :as io]
[ :as json]
[clojure.logging :refer :all]
[friend-oauth2.util :refer [format-config-uri]]
[friend-oauth2.workflow :as oauth2])
(:import [ CertificateFactory]
[org.apache.commons.codec.binary Base64]))
jwhitlark / gist:707f9fb5b379b39c51a5
Created Jun 20, 2014
Scrubbing Ints: Second attempt
View gist:707f9fb5b379b39c51a5
(defn scrubbing-int-app-event-view-2 [app owner]
(init-state [_]
{:capturing false
:start-x nil})
(will-mount [_]
(let [mouse-chan (async/map (fn [e] {:x (.-clientX e)
:type (.-type e)})
View gist:df071d0f065d9692031e
(if (zero? (mod difference 5))
(do (om/update-state! owner :my-val (partial + (/ difference 5)))
(om/set-state! owner :start-x x)))
jwhitlark / gist:0081c0b479591ce1b3c7
Created Jun 20, 2014
Scrubbing ints: first attempt
View gist:0081c0b479591ce1b3c7
(defn scrubbing-int-state-view [app owner]
(let [start-capturing #(do (om/set-state! owner :capturing true)
(om/set-state! owner :start-x (.-clientX %)))
stop-capturing #(do (om/set-state! owner :capturing false)
(om/set-state! owner :start-x nil))]
(init-state [_]
{:my-val 0
:capturing false
View gist:9b99e6448067e35f79b9
(defn listen [el & types]
(let [out (chan)]
(doall (map (fn [type] (events/listen el type #(put! out %))) types))
(defn set-states! [owner desired]
(doall (map #(om/set-state! owner (key %) (val %)) desired)))
View gist:5831b282ecce8e15d1e6
(defn clock-view [app owner]
(will-mount [_]
(fn [] (om/transact! app :time (fn [_] (js/Date.))))
(render [_]
(dom/div nil (. (:time app) toUTCString)))))
You can’t perform that action at this time.