Skip to content

Instantly share code, notes, and snippets.

View RickMoynihan's full-sized avatar

Rick Moynihan RickMoynihan

  • Swirrl
  • Manchester
View GitHub Profile
# This function updates the current branch with the latest changes from the
# origin repository. The master branch is checked out, a git pull is performed,
# the original branch is checked out again, and then the changes from master
# are rebased back into the branch.
#
# Essentially, the following steps are performed. The command is smart enough
# to do the right thing when the current branch _is_ the master branch.
#
# git checkout master
# git pull --rebase
@RickMoynihan
RickMoynihan / Migration-Syntax.clj
Created February 26, 2010 15:09
Rails like Database Migrations in Clojure... Using clojure.contrib.sql
(def migrations (sorted-map
;; Migrations are numbered by integer values to explicitly document them
1 {
:doc "Foo Table"
:up (fn []
(create-table
:Foo
[:id :int "PRIMARY KEY" "NOT NULL GENERATED ALWAYS AS IDENTITY"]
; store a JSON blob in here for the screening record
Exception in thread "main" java.lang.IllegalArgumentException: No matching field found: getCommandLine for class org.apache.tools.ant.taskdefs.Java (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:4658)
at clojure.core$eval__5236.invoke(core.clj:2017)
at clojure.main$eval_opt__7411.invoke(main.clj:227)
at clojure.main$initialize__7418.invoke(main.clj:246)
at clojure.main$null_opt__7446.invoke(main.clj:271)
at clojure.main$main__7466.doInvoke(main.clj:346)
at clojure.lang.RestFn.invoke(RestFn.java:426)
at clojure.lang.Var.invoke(Var.java:363)
at clojure.lang.AFn.applyToHelper(AFn.java:175)
(defun slime-reset-clojure-namespace ()
"Reloads the current Clojure namespace by first removing it and
then re-evaluating the slime buffer. Use this to remove old
symbol definitions and reset the namespace to contain only what
is defined in your current Emacs buffer."
(interactive)
(slime-interactive-eval (concat "(remove-ns '" (slime-current-package) ")"))
(slime-eval-buffer))
(add-hook 'slime-connected-hook
(lambda ()
(interactive)
(slime-redirect-inferior-output t)))
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
(add-hook 'clojure-mode-hook '(lambda ()
(paredit-mode 1)))
@RickMoynihan
RickMoynihan / ricks-clojure.el
Created June 4, 2010 09:03
elisp for SLIME and swank-clojure
(defun clojure-reset-namespace ()
"Reloads the current Clojure namespace by first removing it and
then re-evaluating the slime buffer. Use this to remove old
symbol definitions and reset the namespace to contain only what
is defined in your current Emacs buffer."
(interactive)
(slime-interactive-eval (concat "(remove-ns '" (slime-current-package) ")"))
(slime-eval-buffer))
(defun clojure-switch-repl-to-current-namespace ()
(let [server (Server. 8080)
context (doto (ServletContextHandler. ServletContextHandler/SESSIONS)
(.setContextPath "/")
(.setResourceBase "./war")
(.addServlet (ServletHolder. (DefaultServlet. )) "/")
(.addServlet (ServletHolder. (servlet #'app)) "/foo/*")
(.addServlet (ServletHolder. (my.gwt_servlet. env)) "/my.gwt.Application/data"))]
(doto server
(.setHandler (doto (HandlerCollection.)
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the branch/status of the current git repository
# * the branch of the current subversion repository
# * the return value of the previous command
#
# USAGE: