Skip to content

Instantly share code, notes, and snippets.

@jeffh
jeffh / rss.clj
Last active April 12, 2021 23:39
Meander RSS Example
(require '[meander.epsilon :as m])
(require '[clojure.data.xml :as xml])
(import 'java.net.URI)
;; TODO: more imports & requires
(defn- feed-content [type content]
{:type type
:content content})
(defn- assoc-hash [m hash-key keys]
# Use https instead of git and git+ssh
[url "https://github.com/"]
insteadOf = git://github.com/
[url "https://github.com/"]
insteadOf = git@github.com:
@jeffh
jeffh / keybase.md
Created February 14, 2016 18:28
Keybase

Keybase proof

I hereby claim:

  • I am jeffh on github.
  • I am jeffh (https://keybase.io/jeffh) on keybase.
  • I have a public key whose fingerprint is A1B9 17EB 55BC 6505 7454 359C 2972 76AC 3F8D 4441

To claim this, I am signing this object:

@jeffh
jeffh / cedar.bash
Created October 20, 2014 22:39
Cedar Bootstrap
#!/bin/bash
set -e
set -x
cd ~/workspace
git clone https://github.com/pivotal/Cedar.git || (cd Cedar && git pull)
git clone https://github.com/cppforlife/BetterConsole.git || (cd BetterConsole && git pull)
git clone https://github.com/cppforlife/CedarShortcuts.git || (cd CedarShortcuts && git pull)
git clone https://github.com/akitchen/XcodePreferences.git || (cd XcodePreferences && git pull)
git clone https://github.com/akitchen/AppCodePreferences.git || (cd AppCodePreferences && git pull)
import Foundation
protocol Mappable {
typealias T
func fmap<M: Mappable>(f: (T) -> M) -> M
}
extension Array : Mappable {
func fmap<M: Mappable>(f: (Array<T>) -> M) -> M {
return f(self)
@jeffh
jeffh / gist:ab817b95cb0ce22544bf
Created July 14, 2014 01:10
Manual Heroku Deploy
$ git push staging head
Fetching repository, done.
Counting objects: 10, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 536 bytes | 0 bytes/s, done.
Total 6 (delta 5), reused 0 (delta 0)
-----> Python app detected
@jeffh
jeffh / gist:3260100
Created August 4, 2012 21:34
sudo python distribute_setup.py
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
Extracting in /tmp/tmpMNBg3e
Now working in /tmp/tmpMNBg3e/distribute-0.6.28
Installing Distribute
Before install bootstrap.
Scanning installed packages
No setuptools distribution found
running install
Checking .pth file support in /usr/local/lib/python2.7/dist-packages/
/usr/bin/python -E -c pass
@jeffh
jeffh / hw2_test.py
Created October 18, 2011 19:08
HW2 Test Cases
import urllib.request
import sys
from io import BytesIO, StringIO
try:
import huij as hw2
except ImportError:
print("Could not import homework. Change the import statement on line 7 from 'huij' to your python homework file.")
sys.exit(1)
@jeffh
jeffh / microtest.py
Created October 18, 2011 19:05
Python Micro-testing Framework. Inspired from py.test
# paste code here at bottom of any test file. Then run that python file.
# Provides primitive mocking and assertion behavior with some decent
# debugging output.
#
# Designed for use in homework allow sharing test cases with others
# (any not require them to install pip and py.test).
#
# simply prefix test functions with test and use the assert keyword
# for all test assertions.
#
(global-set-key [(tab)] 'smart-tab)
(defun smart-tab ()
"This smart tab is minibuffer compliant: it acts as usual in
the minibuffer. Else, if mark is active, indents region. Else if
point is at the end of a symbol, expands it. Else indents the
current line."
(interactive)
(if (minibufferp)
(unless (minibuffer-complete)
(dabbrev-expand nil))