Skip to content

Instantly share code, notes, and snippets.

View mrmcc3's full-sized avatar

Michael McClintock mrmcc3

View GitHub Profile
@mrmcc3
mrmcc3 / workbox.js
Created May 6, 2020 11:36
Next.js + Workbox
const { generateSW } = require('workbox-build')
const { readFileSync } = require('fs')
const { map, concat, flatMap, pickBy, uniq } = require('lodash')
const buildId = readFileSync('.next/BUILD_ID', 'utf8')
const extraPreCachePatterns = [
'public/img/**',
'public/favicon.ico',
'public/manifest.json'
]
@mrmcc3
mrmcc3 / demo.clj
Last active December 21, 2020 04:58
CommonMark from Clojure + EDN front matter https://mrmcc3.github.io/blog/posts/commonmark-in-clojure/
(ns demo
(:import
(org.commonmark.parser Parser)
(org.commonmark.renderer.html HtmlRenderer)))
(def parser (.build (Parser/builder)))
(def renderer (.build (HtmlRenderer/builder)))
(defn -main [input]
(->> (slurp input)
@mrmcc3
mrmcc3 / Dockerfile
Created October 23, 2017 03:12
Clojure Docker
FROM openjdk:8-jre-alpine
# install the official clojure cli tooling
WORKDIR /tmp/clojure-scripts
RUN apk add --update curl bash ruby && \
curl -O https://download.clojure.org/install/brew/clojure-scripts.tar.gz && tar xzf clojure-scripts.tar.gz && \
mkdir -p /root/clojure-scripts && ./install.sh /root/clojure-scripts && \
apk del curl ruby && rm -rf /var/cache/apk/* && rm -rf /tmp/clojure-scripts
ENV PATH=$PATH:/root/clojure-scripts/bin

Keybase proof

I hereby claim:

  • I am mrmcc3 on github.
  • I am mrmcc3 (https://keybase.io/mrmcc3) on keybase.
  • I have a public key ASCkjr0Fu9-UPxZXz84T__hxWxG3-2SK1S8H4e-8jorvaAo

To claim this, I am signing this object:

@mrmcc3
mrmcc3 / keybase.md
Created November 1, 2016 06:26
keybase.md

Keybase proof

I hereby claim:

  • I am mrmcc3 on github.
  • I am mrmcc3 (https://keybase.io/mrmcc3) on keybase.
  • I have a public key ASAhdeR2yQsKat3uUMJAugMrnH3aO2P5gl4ZFAYuYDQnnwo

To claim this, I am signing this object:

@mrmcc3
mrmcc3 / config.edn
Created June 5, 2016 17:16
include aero config from s3
{:remote #include "s3://aero-s3-example/secrets.edn"
:local #include "../project.clj"}
@mrmcc3
mrmcc3 / tokens.clj
Created April 2, 2016 04:13
Generate Firebase JWTs in Clojure (with buddy-sign)
(ns tokens
(:require [buddy.sign.jws :as jws]
[buddy.sign.util :refer [to-timestamp]]
[clj-time.core :as time]))
;; see https://www.firebase.com/docs/rest/guide/user-auth.html#section-token-generation
(defn firebase-token
"generates a firebase JWT. (generated JWT must be less than 1024 characters)
a nil token is returned if requirements aren't met
@mrmcc3
mrmcc3 / project.clj
Last active July 21, 2017 14:48
Clojure EventSource client via java interop with Jersey SSE impl. (example uses firebase streaming api)
(defproject sse-example "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.8.0"]
[cheshire "5.5.0"]
[org.glassfish.jersey.media/jersey-media-sse "2.22.2"]])