Skip to content

Instantly share code, notes, and snippets.

@hugoduncan
hugoduncan / gist:1961474
Created March 2, 2012 21:16
paredit with {}
(when (and (featurep 'paredit) paredit-mode (>= paredit-version 21))
(define-key clojure-mode-map "{" 'paredit-open-curly)
(define-key clojure-mode-map "}" 'paredit-close-curly))
@hugoduncan
hugoduncan / gist:1934037
Last active October 1, 2015 05:58
.emacs fragment for slime setup with ritz
;;;; slime setup
;;; Setup the hooks for loading customisations
;; one-off slime configuration
(add-hook 'slime-load-hook 'my-slime-setup)
;; per slime connection
(add-hook 'slime-connected-hook 'my-slime-connection-setup)
(add-hook 'slime-clj-connected-hook 'my-slime-clj-connection-setup)
;; per buffer
@hugoduncan
hugoduncan / gist:1919487
Created February 26, 2012 22:58
outline for with-ssh-tunnel
(action/def-clj-action post-to-port
[session port]
;; forward port remote port `port` to local port `local-port`
(execute/with-ssh-tunnel session {local-port port}
(let [endpoint (format "http://localhost:%s%s" local-port url-path)]
(comment do something here)
session)))
@hugoduncan
hugoduncan / gist:1912528
Created February 26, 2012 03:18
composing group and server specs
(def s1 (pallet.core/server-spec :phases {:fred (fn [x] (+ x 1))}))
#'user/s1
(def s2 (pallet.core/server-spec :extends [s1] :phases {:fred (fn [x] (+ x 2))}))
#'user/s2
((-> s2 :phases :fred) 0)
3
(def g (pallet.core/group-spec "g" :extends [s2] :phases {:fred (fn [x] (+ x 4))}))
#'user/g
((-> g :phases :fred) 0)
7
#! /usr/bin/env bash
# Script to build the pallet-1.3 branch
git checkout pallet-1.3
git reset --hard clojure-1.3.0
git merge 1.3-001/update-pom
git merge 1.3-860/add-disable-locals-clearing
git merge 1.3-103/incorrect-error-with-if-let
git merge 1.3-196/fix-docstring-for-file-refs
(defproject lein-ritz "0.1.0-SNAPSHOT"
:description "Lein plugin for launching a ritz server"
:dev-dependencies [[org.clojure/clojure "1.3.0-lc"]])
@hugoduncan
hugoduncan / gist:1870288
Created February 20, 2012 17:51
~/.lein/profiles.clj
{:1.2 {:dependencies [[org.clojure/clojure "1.2.1"]]}
:1.4 {:dependencies [[org.clojure/clojure "1.4.0-beta1"]]}}
@hugoduncan
hugoduncan / gist:1870224
Created February 20, 2012 17:35
.meta file for centos
{:CentOS53-32-large
{:description "Centos 5.3 (32bit)"
:os-type-id "RedHat"
:os-version "5.3"
:username "duncan"
:os-family :centos
:os-64-bit false
:no-sudo false
;; :uuid "4697bdf7-7acf-4a20-8c28-e20b6bb58e25"
:uuid "/Users/duncan/.vmfest/models/vmfest-CentOS53-32-large.vdi"}}
@hugoduncan
hugoduncan / gist:1690974
Created January 27, 2012 21:17
rvm crate
(ns pallet.crate.rvm
"Standard rvm install"
(:require
[pallet.crate.git :as git]
[pallet.action.conditional :as conditional]
[pallet.action.exec-script :as exec-script]
[pallet.action.package :as package]
[pallet.action.remote-file :as remote-file]
[pallet.action.user :as user]
[pallet.context :as context]
@hugoduncan
hugoduncan / gist:1666286
Created January 23, 2012 23:15
jekyll-mumamo with clojure-mode support
; highlight support for multiple languages
(defconst mumamo-highlight-tag-start-regex
(rx "{%"
(0+ space)
"highlight"
space
(submatch
(1+ (any "a-za-z")))
(0+ space)
"%}"