Skip to content

Instantly share code, notes, and snippets.

@rbxbx
rbxbx / discogs2disconest.js
Created March 22, 2016 02:13
Easily look up bpm and key information from a discogs release page
javascript:(function(){var discogsUrl=window.location['href'].match(/master.\d+$/)[0];var url="http://www.disconest.com/?discogsurl=https://www.discogs.com/"+discogsUrl;window.location=url;})();
if $VIM_PLUGINS != 'NO'
runtime! autoload/pathogen.vim
if exists('g:loaded_pathogen')
execute pathogen#infect('~/.vimbundles/{}', '~/.vim/bundle/{}')
endif
endif
syntax on
filetype plugin indent on
@rbxbx
rbxbx / lady_author_fantasy.txt
Last active December 14, 2015 12:46
Fantasy Novels for people sensitive to humans being terrible
[Original Thread](https://twitter.com/rbxbx/status/604492988065169408)
Specific Novels / Series
========================
Closer to Home, The Fairy Godmother - Mercedes Lackey
The Earthsea Trilogy, The Dispossessed (SF) - Ursula K. Le Guin
Ship of Magic - Robin Hobb
The Killing Moon – N. K. Jemisin
The Goblin Emperor - Katherine Addison
Karen Memory – Elizabeth Bear
@rbxbx
rbxbx / table_names.clj
Created February 17, 2015 14:28
get table names from jdbc w/ Clojure
(-> @db-connection
jdbc/get-connection
(.getMetaData)
(.getTables nil nil nil (into-array ["TABLE" "VIEW"]))
resultset-seq
doall)
@rbxbx
rbxbx / rakoff_quote.txt
Last active December 10, 2020 05:51
David Rakoff on terminating his relationship with his longtime therapist
Should you happen to be possessed of a certain verbal acuity coupled with a
relentless, hair-trigger humor and surface cheer spackling over a chronic
melancholia and loneliness – a grotesquely caricatured version of your deepest
Self which you trot out at the slightest provocation to endearing and glib
comic effect, thus rendering you the kind of fellow who is beloved by all yet
loved by none, all of it to distract, however fleetingly, from the cold and
dead-faced truth that with each passing year you face the unavoidable certainty
of a solitary future in which you will perish one day while vainly attempting
the Heimlich maneuver on yourself over the back of a kitchen chair – then this
confirmation that you have triumphed again and managed to gull yet another
@rbxbx
rbxbx / deep_fetch.rb
Created August 27, 2014 15:25
Similar to Clojure's get-in for Ruby hashes
def deep_fetch(*keys, &default)
keys.inject(self) do |hsh, key|
hsh.fetch(key, &(proc { |*args| return default.call(*args) } if default))
end
end
function drip
{
BASE="$HOME/src/drip/drip"
cd $BASE
vagrant up
tmux start-server
if tmux has-session -t drippin
then
tmux attach-session -t drippin
@rbxbx
rbxbx / jruby.clj
Last active December 27, 2015 16:59
(ns as.rn
(:require [clojure.xml :as xml]
[clojure.zip :as zip]
[clojure.data.zip.xml :as zip-xml])
(:import org.jruby.javasupport.JavaEmbedUtils))
(def runtime (JavaEmbedUtils/initialize '()))
(let [evaler (JavaEmbedUtils/newRuntimeAdapter)
eval-rb* (fn [expr] (.eval evaler runtime expr))]
@rbxbx
rbxbx / with-test-db.clj
Created October 18, 2013 17:57
A clojure macro that wraps its body in a transactional test database
(defn- with-test-db* [db f]
(let [schema (slurp "resources/project/schema.sql")]
(jdbc/with-connection db
(jdbc/transaction
(jdbc/set-rollback-only)
(apply jdbc/do-commands
(clojure.string/split schema #";"))
(f)))))
(defmacro with-test-db [[bound db] & body]
(storm/defspout amqp-spout ["message"] {:params [queue]}
[conf context collector]
(let [[conn ch] (connect-to-queue queue)
qcs (QueueingConsumer. ch)]
(lb/consume ch queue qcs
:exclusive false
:auto-delete false
:persistent true
:durable true)
(storm/spout