Skip to content

Instantly share code, notes, and snippets.

View chrisfjones's full-sized avatar

Chris Jones chrisfjones

  • reclaim.ai
  • Portland
View GitHub Profile
@chrisfjones
chrisfjones / secret-test.yml
Created August 24, 2017 20:29
kubernetes - test dynamic secrets
apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
data:
hello: d29ybGQ=
---
apiVersion: v1
kind: Pod
@chrisfjones
chrisfjones / auto-inc.clj
Last active August 29, 2015 14:06
Auto-inc in Datomic
; For each attribute being auto-inc'ed, this will create a unique entity with :db/ident (str :ns/orig-attr "-auto-inc")
; i.e. for :order/num, there will be an entity :order/num-auto-inc
; That entity will have a ::current-id attribute containing the current auto-inc value
; schema
[{:db/id (d/tempid :db.part/db)
:db/ident ::num
:db/valueType :db.type/long
:db/cardinality :db.cardinality/one
:db/unique :db.unique/value
@chrisfjones
chrisfjones / gist:2063df25a8abef6a2e6e
Created June 20, 2014 18:36
lazy sequence of all the tweets!
(ns twitter
(:use [environ.core]
[twitter.oauth]
[twitter.api.restful])
(:require [clj-time.format :as f]
[clj-http.client :as clj-http]))
(def tw-consumer-key (env :tw-consumer-key))
(def tw-consumer-secret (env :tw-consumer-secret))
(def tw-user-access-token (env :tw-user-access-token))
(ns tic-tac-toe.core
(:use [clojure.pprint]))
(def board (take 9 (repeat nil)))
(defn- print-board-cell [cell]
(cond
(= :o cell) "O"
(= :x cell) "X"
:else "."))
@chrisfjones
chrisfjones / datomic_session.clj
Created September 6, 2013 23:01
modified datomic_session
; original https://github.com/hozumi/datomic-session
; https://github.com/hozumi/datomic-session/blob/master/epl-v10.html
(ns datomic-session
(:use [always]
[clojure.pprint])
(:require [clojure.data :as data]
[datomic.api :as d]
[my-ns.db.datomic :as db]
[ring.middleware.session.store :as rs]
[ring.middleware.session.memory :as memstore]))
@chrisfjones
chrisfjones / api.clj
Created February 19, 2013 18:28
Simple clojure futures for parallel queries
; dashboard
(defn get-dashboard []
(let [questions (future (questions/get-top-questions 5))
companies (future (companies/get-top-companies 5))
profiles (future (profiles/get-top-profiles 5))
music (future (profiles/get-top-music 5))]
{:questions @questions
:companies @companies
:profiles @profiles
:music @music
@chrisfjones
chrisfjones / gist:2063838
Created March 17, 2012 18:26
gremlin spock radiohead
@Grapes([
@Grab("com.tinkerpop.gremlin:gremlin-groovy:1.5"),
@Grab("org.spockframework:spock-maven:0.6-groovy-1.8")
])
import com.tinkerpop.gremlin.groovy.*
import spock.lang.Specification
import spock.lang.Shared
import com.tinkerpop.blueprints.pgm.Graph
import com.tinkerpop.blueprints.pgm.impls.tg.TinkerGraphFactory