Skip to content

Instantly share code, notes, and snippets.

View joelittlejohn's full-sized avatar

Joe Littlejohn joelittlejohn

View GitHub Profile
@joelittlejohn
joelittlejohn / staqueue.clj
Last active August 29, 2015 13:56
The Staqueue, Coding for Interviews Issue #20
;; Building a functional queue using two stacks
;; We'll use vectors for our stacks, 'push' == conj
(def ^:private push conj)
;; We'll need be able to fill one stack from another
(defn ^:private refill
[s1 s2]
(if (empty? s1)
s2

Keybase proof

I hereby claim:

  • I am joelittlejohn on github.
  • I am joelittlejohn (https://keybase.io/joelittlejohn) on keybase.
  • I have a public key whose fingerprint is 1DA9 3EE1 7F6A 3324 18B0 DBB9 9ABE 584A 8CED 6563

To claim this, I am signing this object:

@joelittlejohn
joelittlejohn / test.clj
Last active July 3, 2023 21:08
Dynamically generate clojure.test deftests (and other tricks)
(ns dynamic.test
(:require [clojure.test :refer :all]))
;; This example shows how tests can be generated dynamically, by
;; creating new vars with the correct metadata.
(defn add-test
"Add a test to the given namespace. The body of the test is given as
the thunk test-fn. Useful for adding dynamically generated deftests."
[name ns test-fn & [metadata]]
<?php
$wgExtensionCredits['parserhook'][] = array(
'name' => 'WebServiceSequenceDiagram',
'version' => '1.0',
'author' => 'Eddie Olsson',
'url' => 'http://www.mediawiki.org/wiki/Extension:WebSequenceDiagram',
'description' => 'Render inline sequence diagrams using websequencediagrams.com'
);
if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
@joelittlejohn
joelittlejohn / .bash_profile_snippet.sh
Last active June 18, 2020 11:25
Once-per-week rotation of AWS keys stored by aws-vault (alternative to crontab, useful for keychain access)
[ "$(find ~/.rotate -mtime -7 2>/dev/null)" ] || (for p in $(aws-vault list --profiles | grep -v default | grep -v mfa); do aws-vault rotate -n $p; done && touch ~/.rotate)