Skip to content

Instantly share code, notes, and snippets.

use v5.014;
use warnings;
use List::MoreUtils qw/zip/;
use Term::ANSIColor qw/color/;
# Basic log colourisation for Clojure apps using the default Timbre config
# N.B. '\ ' is an escaped space, as /x modifier ignores whitespace in pattern
my $log_line_re = qr/^(\d{4}-[A-z]{3}-\d\d)\ # date
@cursork
cursork / gist:c039febac6a2326fbdc8
Last active August 29, 2015 14:02
Issues altering Idents in Datomic

Follow up from issues raised here: https://groups.google.com/d/msg/datomic/blgLZkYF5xA/LFjGCASHZNUJ

N.B. These experiments were carried out on a restored backup of the DB (so therefore backing up and restoring isn't a viable solution).

Keywords appear to get added to DB values like so:

user=> (.addKeyword db :this-is-a-test 999999999)
datomic.db.Db@d37f7c59
user=> (d/ident *1 999999999)
@cursork
cursork / gist:c4cec824638f2afac217
Last active August 29, 2015 14:01
Creating a new ns from Vim
" Initial workings for creating a new namespace from Vim:
" * Transform - to _ (I *still* always forget and have to do a mv)
" * Make directories if needed
" TODO auto-completion would be ah-maaazing!
" TODO only copes with typical src / src/clj setups
" TODO handle cljs
" TODO currently assumes use of Rooter to go to git root directory
" Requires classpath.vim
if !exists('*EditNamespace')
(defn arities
"Returns the possible arities of a function implementing ifn. For want of
anything better to return for a variadic 'rest function', returns
nil."
[ifn]
{:pre [(ifn? ifn)]}
(let [invokes (filter #(= (.getName %) "invoke") (.getDeclaredMethods (class ifn)))
arity #(count (.getParameterTypes %))]
(if (instance? clojure.lang.RestFn ifn)
'(nil)
@cursork
cursork / gist:8435140
Created January 15, 2014 12:13
Example vim buffer for playing with JSON APIs...
// # nmap <F3> :exec 'r!'.substitute(getline('.'),'^//','','')<CR>
// echo test
// curl http://google.com
@cursork
cursork / circle-last-good-jar.pl
Created December 18, 2013 11:37
Gets the artifact from Circle for the last successful build on master. Outputs {"changed":true} if a new .jar was linked into place (for SaltStack to pick up in a cmd.run: ... stateful declaration).
#!/usr/bin/env perl
use v5.012;
use warnings FATAL => 'all';
use utf8;
use autodie ':all';
use Mojo::UserAgent;
my $circle_token = $ENV{'CIRCLE_TOKEN'}
use strict;
use warnings;
use Test::More;
use FindBin::libs;
use CompareXML qw/compare_xml/;
ok(compare_xml(
'<foo><bar baz="456">123</bar></foo>',
@cursork
cursork / git config
Last active December 14, 2015 08:09
[user]
email = TODO
name = Neil Kirsopp
[push]
default=current
[merge]
defaulttoupstream=true
alias ls="ls -G -F"
source ~/perl5/perlbrew/etc/bashrc
source ~/perl5/perlbrew/etc/perlbrew-completion.bash
export HISTCONTROL="ignoreboth"
export HISTFILESIZE=25000
export HISTSIZE=25000
shopt -s histappend
shopt -s histverify
@cursork
cursork / .perltidyrc
Created December 4, 2012 16:26
perltidyrc
# Allow slightly longer lines
--maximum-line-length 100
# 4 space tabs used everywhere
--entab-leading-whitespace 4
--tabs
--continuation-indentation 4
# Don't outdent labels
--no-outdent-labels