Skip to content

Instantly share code, notes, and snippets.

Steve Purcell purcell

Block or report user

Report or block purcell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View rinari.el
(defun rinari-test (&optional edit-cmd-args)
"Test the current ruby function. If current function is not a
test, then try to jump to the related test using
`rinari-find-test'. Dump output to a compilation buffer allowing
jumping between errors and source code. With optional prefix
argument allows editing of the test command arguments."
(interactive "P")
(or (string-match "test" (or (ruby-add-log-current-method)
(file-name-nondirectory (buffer-file-name))))

The Eight Wondrous Places of the Human World

According to Buddhist mythology, the human world has eight wondrous places that give us protection. The first is a place where everyone is illuminated by a golden light. This golden light supports all sentient beings and helps them to grow and mature under all circumstances. Consider your own life. For the past ten, twenty, thirty, or forty years, how many troubles have you experienced? Countless troubles. But still, you're alive. How? You don't know. But this is reality. You are a survivor. You have been protected and nurtured by many things -- your parents, your teachers, your friends, and more. All this time, your life has been supported. You have been illumined by a golden light that constantly shines, and constantly helps you.

The second place is one in which you are immune to trouble. Of course, we all have troubles. But if you learn something from your troubles, then those troubles aren't exactly troubles. By realizing the true nature of trouble, trouble

purcell / application_helper.rb
Created Sep 9, 2011
Make will_paginate generate HTML that bootstrap.less will render nicely
View application_helper.rb
# Based on
class BootstrapLinkRenderer < ::WillPaginate::ActionView::LinkRenderer
def html_container(html)
tag :div, tag(:ul, html), container_attributes
def page_number(page)
tag :li, link(page, page, :rel => rel_value(page)), :class => ('active' if page == current_page)
View example.html
<!DOCTYPE html>
<script src="" type="text/javascript"></script>
<script src="example.js" type="text/javascript"></script>
purcell / example.html
Created Oct 3, 2011
Bootstrap dropdown breakage with yepnope/modernizr
View example.html
<!DOCTYPE html>
<script src="" type="text/javascript"></script>
<script src="" type="text/javascript"></script>
<script type="text/javascript">
yepnope({load: ""})
purcell / color-utils.el
Created Oct 17, 2011
A few hacky color-related functions
View color-utils.el
(defun format-color (rgb)
"Convert a triplet of floating point (0.0-1.0) RGB values into
a hex triplet"
(apply 'format "#%02x%02x%02x"
(mapcar (lambda (x) (* 255 x)) rgb)))
(defconst colour-triplet-regex
View gist:1300810
(defn follow-chain [base-url number]
(let [result (slurp (str base-url number))]
(if-let [next-number
(if (re-find #"^Yes" result)
(/ (Integer/parseInt number) 2)
(let [idx (.indexOf result "and the next")]
(when (>= idx 0)
(last (string/split (subs result idx) #" ")))))]
(println result)
View oxtail-stew.markdown

Oxtail stew recipe

By Steve Purcell

Serves 2-3. Prep time: 20 mins. Cooking time: around 4 1/2 hrs.

This stew is rich and satisfying, not to mention deceptively healthy, easy to make, and dirt cheap.

purcell / completion.js
Created Nov 28, 2011
Cached autocompletion of wikipedia page titles with jquery ui autocomplete plugin
View completion.js
function cached_completer(completer) {
var cache = {};
return function(request, response) {
if (request.term in cache) {
} else {
completer(request, function(resp) {
cache[request.term] = resp;
View wikipedia.js
// Wikipedia
(function(w) {
var call_wikipedia_api = function(data, callback) {
url: "",
data: $.extend({ format: "json" }, data),
dataType: "jsonp",
You can’t perform that action at this time.