Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am holguinj on github.
* I am justinh (https://keybase.io/justinh) on keybase.
* I have a public key whose fingerprint is 599E BD9F F53F 6F4B 1579 8122 0B52 DC36 64FE C3D1
To claim this, I am signing this object:
#!/bin/bash
sudo apt-get install git -y
cd /usr/local/src
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
tar -xjf vim-7.4.tar.bz2
cd vim74
./configure --prefix=/usr --with-features=huge --enable-rubyinterp --enable-pythoninterp
make && sudo make install
@juxtin
juxtin / new-lein-project.el
Last active August 29, 2015 14:08
Create a new Leiningen project in Emacs and open its project.clj file
(defun new-lein-project (name &optional template)
"Interactively ask for a project and optional template name,
then create a Leiningen project with the parameters
and open its project.clj file."
(interactive "sProject name: \nMTemplate (optional): ")
(shell-command-to-string
(concat "cd ~/src && " ;; change this to the directory where you keep your projects
"lein new "
template
" " name))
@juxtin
juxtin / unconditional_fizz_buzz.clj
Created November 14, 2014 05:44
FizzBuzz without Conditionals
(ns unconditional-fizz-buzz
"Note: this namespace occupies a bizarro world where there are no conditionals."
(:refer-clojure :exclude [case cond cond-> cond->> condp if if-let
if-not if-some when when-let when-not when-some]))
(defn not-divisible-by
"Given a number (divisor), returns a closure that: takes a numerator and returns
false (divisible) or the numerator. Please excuse the double negative; it's just
that false is easier to replace later on."
[n]
@juxtin
juxtin / clj_tcx.core.clj
Created December 20, 2014 06:47
Parse Garmin TCX files with Clojure
(ns clj-tcx.core
(:require [clojure.data.xml :as xml]
[clojure.java.io :as io]
[clojure.walk :refer [postwalk]]))
(defmulti tcx-walker
"A multimethod that converts xml.Elments into Clojure maps and
LazySeqs into either bare strings or vectors depending on context.
Calls identity otherwise. Should be used to walk a parsed XML tree
to make it look more like an idiomatic Clojure data structure."
@juxtin
juxtin / lt.sh
Created March 3, 2015 22:03
lt: wrapper around "lein test"
#!/bin/bash
#### lt -- a wrapper around "lein test"
# The purpose of this script is to provide some conveniences around
# running Leiningen tests. Specifically, it does the following:
# 1) fails if there any unsaved Emacs buffers
# 2) prints out any lines containing "DEBUG" or Spyscope statements
# 3) runs the test with the supplied arguments
#
# unofficial strict mode
@juxtin
juxtin / gist:cbbf39d94c9cfc08f2f4
Created May 12, 2015 17:31
create new migratus migration
;; Run with M-x create-migration
(defun current-datestamp ()
;; 2014 01 14 13 17 03
;; %Y %m %d %H %M %S
(let ((datestamp-format "%Y%m%d%H%M%S"))
(format-time-string datestamp-format (current-time))))
(defun create-migration (name directory)
(interactive "sMigration name: \nDWhere?")
module LearnYouAn where
data ℕ : Set where
zero : ℕ
suc : ℕ → ℕ
_+_ : ℕ → ℕ → ℕ
zero + zero = zero
zero + n = n
(suc n) + n′ = suc (n + n′)
@juxtin
juxtin / helm-clojure-headlines.el
Created July 9, 2015 17:41
helm-clojure-headlines
(defun helm-clojure-headlines ()
"Display headlines for the current Clojure file."
(interactive)
(setq helm-current-buffer (current-buffer)) ;; Fixes bug where the current buffer sometimes isn't used
(jit-lock-fontify-now) ;; https://groups.google.com/forum/#!topic/emacs-helm/YwqsyRRHjY4
(helm :sources (helm-build-in-buffer-source "Clojure Headlines"
:data (with-helm-current-buffer
(goto-char (point-min))
(cl-loop while (re-search-forward "^(\\|testing\\|^;.*[a-zA-Z]+" nil t)
for line = (buffer-substring (point-at-bol) (point-at-eol))
@juxtin
juxtin / ajaxTest
Created September 7, 2013 17:58
example to test for a successful ajax call
the AJAX call succeeded!