Skip to content

Instantly share code, notes, and snippets.

View rodnaph's full-sized avatar
🈲
On vacation

Rhodri Pugh rodnaph

🈲
On vacation
View GitHub Profile
Including algo.monads-0.1.0.jar
Including classpath-1.3.0-alpha3.jar
Including clojure-1.3.0.jar
Including colorize-0.1.1.jar
Including core.unify-0.5.1.jar
Including find-namespaces-1.3.0-alpha3.jar
Including jar-1.3.0-alpha3.jar
Including joda-time-2.0.jar
Including lazytest-1.2.3.jar
Including math.combinatorics-0.0.1.jar
/* BAD */
function foo() {
stuff( 123, function() {
// unpossible to test really
});
}
/* better */
@rodnaph
rodnaph / toggle-xdebug.sh
Created September 22, 2012 22:06
Toggle Macports XDebug
#!/bin/sh
TOGGLE="deactivate"
if [ "`php -i | grep xdebug`" = "" ]; then
TOGGLE="activate"
fi
sudo port $TOGGLE php5-xdebug
sudo apachectl stop
@rodnaph
rodnaph / Portfile
Created October 14, 2012 08:59
thieriot portfile
PortSystem 1.0
name Thieriot
version 0.0.5
categories devel shells
platforms darwin
maintainers rodnaph
description Shell tool for managing a projects Jenkins builds
@rodnaph
rodnaph / gist:3968384
Created October 28, 2012 11:30
Simple Aleph websocket
;; src/myapp/core.clj
(ns myapp.core
(:use lamina.core
aleph.http))
(def ws-channel (channel))
(defn app [ch _]
@rodnaph
rodnaph / update_params.sh
Created January 19, 2013 18:04
Simple one-liner for updating a Symfony 2 parameters file with any new settings after an update.
diff -u app/config/parameters.yml app/config/parameters.yml.dist | patch -p0 app/config/parameters.yml
@rodnaph
rodnaph / gist:4703280
Last active December 12, 2015 02:59
RFC: Relation for flattened lists, only support one level of nesting though... is there an easier way using clojure functions possibly?
; This only support one level...
(defne flatteno
"A relation which matches ys as a flattening of xs, only supports one level"
[xs ys]
([() _] (== ys ()))
([[a . b] _]
(fresh [c]
(flatteno b c)
(defn flatteno [xs ys]
(let [zs (flatten ys)]
(permuteo xs zs)))
(defn nullo
[x]
(== '() x))
(defn pairo
[x]
(fresh [a b]
(conso a b x)))
(defn flatteno
// oh boy...
String [] tranTypes = new String[1];
String tranType = "_salesOrder";
tranTypes[0] = tranType;
semsfTranType.searchValue = tranTypes;
// ==