Skip to content

Instantly share code, notes, and snippets.

@djpowell
djpowell / github-pushes-only.js
Last active December 28, 2015 05:09
Hide everything but pushes from the github newsfeed
// ==UserScript==
// @name GitHub News Feed Pushes Only
// @namespace https://gist.github.com/djpowell/7447274
// @version 0.1
// @description Hide everything but pushes from the github newsfeed
// @match *://github.com
// @copyright 2013, David Powell
// ==/UserScript==
function hideNonNews() {
@djpowell
djpowell / leiningen-installer.iss
Last active December 14, 2015 18:59
A windows installer for leiningen
; InnoSetup 5.5.3 Installer definition for Leiningen - (c) David Powell 2013
#define MyAppName "Leiningen"
#define MyAppVersion "2.0-installer_alpha_1"
#define MyAppPublisher "djpowell"
#define MyAppURL "https://bitbucket.org/djpowell/leiningen-win-installer"
; Set the following lines to the location of the latest JDK and corresponding JRE to embed in the installer
#define JDK_Source "C:\Program Files (x86)\Java\jdk1.7.0_17"
#define JRE_Source "C:\Program Files (x86)\Java\jre7"
@djpowell
djpowell / countdown1.clj
Created August 16, 2012 23:33
The Countdown number round with clojure.core.logic
(ns countdown1
(:use
[clojure.core.logic])
(:require
[clojure.string :as str]))
;; Attempt to solve the "Numbers Game" from the UK Channel 4 gameshow
;; countdown.
;; Basically, 6 random numbers are chosen; then a random target is
@djpowell
djpowell / 0001-Android-claims-to-support-XPath-but-doesn-t.-Force-n.patch
Created February 4, 2012 15:20
Patch to get clojurescript one to work on android, by forcing the load of xpath.js implementation
From e6ec5aee30209240798663ca110bd2fa8cbe48a2 Mon Sep 17 00:00:00 2001
From: David Powell <djpowell@djpowell.net>
Date: Sat, 4 Feb 2012 15:19:11 +0000
Subject: [PATCH] Android claims to support XPath, but doesn't. Force
non-native xpath for platforms that clearly don't have it.
As a side-effect, include xpath.js for everyone.
---
templates/application.html | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
@djpowell
djpowell / 0001-Fix-shell-to-git-for-msysgit-users-on-Windows.patch
Created January 26, 2012 12:41
Fix lein bootstrap for Windows msysGit users
From 525365caf9635b2e0f2a06eb8993bb95febf1b20 Mon Sep 17 00:00:00 2001
From: David Powell <djpowell@djpowell.net>
Date: Thu, 26 Jan 2012 12:29:53 +0000
Subject: [PATCH] Fix shell to git for msysgit users on Windows
---
src/leiningen/git_deps.clj | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/leiningen/git_deps.clj b/src/leiningen/git_deps.clj
@djpowell
djpowell / 0001-Batch-files-for-Windows.patch
Created January 15, 2012 23:51
Batch files for ClojureScript One on Windows
From cdc729c0ac9dbc0caf8b2ed36888a45a2f582d52 Mon Sep 17 00:00:00 2001
From: David Powell <djpowell@djpowell.net>
Date: Sun, 15 Jan 2012 23:28:22 +0000
Subject: [PATCH] Batch files for Windows Including a batch file to bootstrap
clojurescript
---
script/build.bat | 21 ++++++++++++++++
script/build.clj | 3 ++
script/cljs-repl.bat | 9 +++++++
@djpowell
djpowell / reload_templates.clj
Created November 26, 2011 23:15
Ring middleware for reloading enlive templates
(ns net.djpowell.reload-templates
(:require [clojure.java.io :as io]))
;; Ring middleware that reloads namespaces when associated templates
;; change. Assumes a hypothetical version of enlive that stores the
;; template path against the deftemplate/defsnippet var under the key:
;; :net.cgrand.enlive-html/template
(defn ^:private ns-templates
"Get the list of templates and snippets associated with a given namespace"
@djpowell
djpowell / sortedlist.clj
Created November 29, 2010 08:09
sorted vector fingertree
(ns net.djpowell.fingertree.sortedlist
(:gen-class)
(:use clojure.data.finger-tree))
(defrecord SortedListMeter [^long lcount lmax])
(def ^:private not-an-object (gensym "not-an-object"))
(defn- make-object
[x]
@djpowell
djpowell / finger_tree_stats.clj
Created November 11, 2010 14:53
fingertree stats
(ns finger-tree-stats
(:use [clojure.data.finger-tree]))
(defrecord stats [^double number ^double mean ^double variance])
(def null-stats (stats. 0 0 Double/NaN))
(defn make-stats
[^double x]
(stats. 1 x 0))
@djpowell
djpowell / lcsdiff.clj
Created November 7, 2010 13:01
lcs diff
(ns net.djpowell.lcsdiff
(:use [clojure.test])
(:require [clojure.data]))
(defn- find-lcs-comm
"Take a calculated matrix, and track back through it to extract a
list of matching elements. Returns [left, right, both]."
[matrix a b i j]
(loop [i i j j left nil right nil both nil]
(cond