Skip to content

Instantly share code, notes, and snippets.

@devn
devn / todo.exs
Last active December 1, 2017 22:38
do todo
defmodule Do do
def dont think, about, it, but, please do
[think, about, it, please]
end
end
Do.dont :worry, :about, :grouping, :any, :arguments
=> [:worry, :about, :grouping, :arguments]
@devn
devn / ci.sh
Created March 28, 2012 16:20 — forked from rsanheim/ci.sh
Simple continuous deployment via Jenkins and Capistrano for all branches. Wire this up with Github post receive hooks from Jenkins for best results.
#!/bin/bash -x
# This should be your "script/ci" checked into version control, and then wired as your sole build step in Jenkins.
#
# Simplifying Assumptions:
#
# * You build all branches
# * You want to deploy all branches.
# * You wired up an SSH key to your CI server appropriately so it can talk to your deployment target(s) via Cap
@devn
devn / strum.clj
Created December 24, 2016 14:30 — forked from noprompt/strum.clj
Macro for defining instrumented functions which verify their arguments and return values against specs.
(ns strum.core
(:refer-clojure :exclude [defn])
(:require
[clojure.spec :as spec]
[clojure.spec.test :as spec.test]))
;; ---------------------------------------------------------------------
;; Prelude
;; HACK: Currently, as of Clojure 1.9.0-alpha14, there is a bug with
@devn
devn / state-is-a-fold.clj
Created June 21, 2011 00:16 — forked from ordnungswidrig/state-is-a-fold.clj
State is a fold over events
(ns state-is-a-fold
(:use clojure.test))
;;; After all, state is a fold of events. For example let's say the events are a sequence of numbers
;;; and we are folding by addition:
(deftest simple
(let [events [1 5 2 4 3]
state (reduce + events)]
(is (= 15 state))))
Warning: The file properties have changed:
File: /usr/bin/dpkg
Current hash: 8e820f6ffa1ba84be7c5256a8bd344a49fec7182
Stored hash : 7c5ab2420dfddf22f3794a1f2aa4b61243e44a08
Current inode: 52015 Stored inode: 1969
Current file modification time: 1268271700
Stored file modification time : 1253435089
Warning: The file properties have changed:
File: /usr/bin/dpkg-query
Current hash: b5a6de09d70cd24592cb59dbdd2d58e9280a7cc0

Keybase proof

I hereby claim:

  • I am devn on github.
  • I am devn (https://keybase.io/devn) on keybase.
  • I have a public key whose fingerprint is F782 0ED3 7BE8 3639 1130 3C76 EB31 8EE6 4426 0178

To claim this, I am signing this object:

@devn
devn / winamp.clj
Created January 28, 2014 06:46
winamp skins for clojure
(ns defjam.core)
(defn __verb [__noun __noun_place]
(filter #{__noun} __noun_place))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(ns defjam.dude
(:require [clojure.java.io :as io]
[clojure.string :as str]
@devn
devn / local.clj
Created January 27, 2014 22:20
example caribou local.clj environment for heroku
{:database {:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:database "YOURUNIQUESTRING"
:host "ec2-123-456-789.compute-1.amazonaws.com"
:port 5432
:user "postgres_username"
:ssl true
:sslfactory "org.postgresql.ssl.NonValidatingFactory"
:password "postgres_password"}}
(extend-type js/RegExp
cljs.core.IFn
(-invoke ([this s] (re-matches this s))))
(#"foo.*" "foobar") ;=> "foobar"
(#"zoo.*" "foobar") ;=> nil
(filter #".*foo.*" ["foobar" "goobar" "foobaz"]) ;=> ("foobar" "foobaz")
(extend-type js/RegExp
cljs.core.IFn
(-invoke ([this s] (re-matches this s))))
(#"foo.*" "foobar") ;=> "foobar"
(#"zoo.*" "foobar") ;=> nil
(filter #".*foo.*" ["foobar" "goobar" "foobaz"]) ;=> ("foobar" "foobaz")