Skip to content

Instantly share code, notes, and snippets.

View mnewt's full-sized avatar

Matthew Newton mnewt

View GitHub Profile
@mnewt
mnewt / cljfmt.clj
Last active April 17, 2016 20:56 — forked from bartojs/build.boot
command line formatter for clojure using cljfmt
#!/usr/bin/env boot
;; Format files using cljfmt (https://github.com/weavejester/cljfmt)
(set-env! :dependencies '[[cljfmt "0.5.2"]])
(require '[cljfmt.core :as fmt]
'[clojure.java.io :as io])
(def help-text
"cljfmt: Format files using cljfmt (https://github.com/weavejester/cljfmt)
<?xml version="1.0" encoding="UTF-8"?>
<ulexpd:doPublish
xmlns:ulex="http://ulex.gov/ulex/2.0"
xmlns:ulexpd="http://ulex.gov/publishdiscover/2.0"
xmlns:ulexcodes="http://ulex.gov/codes/2.0"
xmlns:ulexlib="http://ulex.gov/library/2.0"
xmlns:j="http://niem.gov/niem/domains/jxdm/4.1"
@mnewt
mnewt / testing.clj
Created February 11, 2016 03:15
clj-xpath map issue with namespaces removed
(ns testing
(:require [clj-xpath.core :as xp]))
(def ^:dynamic xml-doc
(slurp "xml-test.xml"))
(xp/with-namespace-context (xp/xmlnsmap-from-root-node xml-doc)
(xp/$x "//Person" xml-doc))
(xp/with-namespace-context (xp/xmlnsmap-from-root-node xml-doc)
@mnewt
mnewt / test.clj
Last active February 11, 2016 01:31
clj-xpath namespace map issue
(ns testing
(:require [clj-xpath.core :as xp]))
(def ^:dynamic xml-doc
(slurp "xmlns-test.xml")
(xp/with-namespace-context (xp/xmlnsmap-from-root-node xml-doc)
(xp/$x "//lexsdigest:Person" xml-doc))
(xp/with-namespace-context (xp/xmlnsmap-from-root-node xml-doc)
function levenshtein(s1, s2) {
// http://kevin.vanzonneveld.net
// + original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com)
// + bugfixed by: Onno Marsman
// + revised by: Andrea Giammarchi (http://webreflection.blogspot.com)
// + reimplemented by: Brett Zamir (http://brett-zamir.me)
// + reimplemented by: Alexander M Beedie
// * example 1: levenshtein('Kevin van Zonneveld', 'Kevin van Sommeveld');
// * returns 1: 3
@mnewt
mnewt / conf.nmap
Created February 19, 2013 05:30 — forked from sygo/conf.hexdump
# ip number
regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
colours=bold yellow
======
# list header
regexp=(PORT|STATE|SERVICE|REASON|VERSION)
colours=bold white
======
# open
regexp=open
@mnewt
mnewt / grist.json
Last active December 13, 2015 19:28
blog.mnewton.com comments index
{ "localhost:3000/index.jade": 4963044 }
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@mnewt
mnewt / Preferences.sublime-settings
Last active December 11, 2015 22:28 — forked from benatkin/Global.sublime-settings
tell Sublime Text to ignore files/directories matching these strings
{
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "node_modules"]
}
@mnewt
mnewt / merge.sh
Created January 22, 2013 20:30
How to Merge Folders on a Mac (copied from http://the.taoofmac.com/space/HOWTO/Merge%20Folders)
#!/bin/sh
# How to Merge Folders on a Mac
# (copied from http://the.taoofmac.com/space/HOWTO/Merge%20Folders)
# The standard UNIX way
cp -R -v source/. destination
# The geeky UNIX way (restartable)
rsync -vaEW source/ destination
# The OSX "easy" way