Skip to content

Instantly share code, notes, and snippets.

@pithyless
pithyless / gist:1208841
Created September 10, 2011 21:49
Install Python 2.7 (homebrew + pip + virtualenv) on Mac OS X Lion

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7

Symlinks...

@pithyless
pithyless / README.md
Last active April 6, 2018 13:09
Pedestal sync vs async error-handling

I expected the async error to be handled by the error-handler interceptor (i.e. [OK] Handling error.).

❯ clj -m dev

Do some work...
[OK] Got a response.
{:async :ok, :sync :ok}
@pithyless
pithyless / datomic-mysql-bootstrap.sql
Created April 3, 2018 15:50 — forked from favila/datomic-mysql-bootstrap.sql
Better MySQL bootstrap setup for datomic's datomic_kvs table
-- Optimized MYSQL schema for datomic
-- Unfortunately the bin/sql/mysql-*.sql bootstrapping files for datomic are not
-- very good, and can actually cause failures if not adjusted.
-- One symptom of this is the following error:
-- SQL Error (1071): Specified key was too long; max key length is 767 bytes.
-- Reported here: https://support.cognitect.com/entries/28462168-MySQL-Caveats
-- This is caused by the default collation for the `id` column possibly being
(ns background
(:require [clojure.tools.logging :as log])
(:import [java.util.concurrent]))
(defonce !executor (delay (java.util.concurrent.Executors/newCachedThreadPool)))
(defn background
"Calls the fn passed in a thread from a thread pool, returning immediately.
Unlike future, background does not swallow exceptions."
[f]
@pithyless
pithyless / doctest.clj
Created January 4, 2018 13:35
Test executable docstrings à la Python's doctest.
(ns sursolid.fribble.doctest
"Test executable docstrings à la Python's doctest.
Inspired by Python's doctest, this namespace provides tools to
turn your regular docstrings into REPL sessions that will be
run and checked via your regular testing suite.
## Formatting the docstring
@pithyless
pithyless / gist:1261919
Created October 4, 2011 15:18
Carrierwave custom store_path

Carrierwave recommends overriding store_dir in the uploader, but it only gives you a way to modify the directory name, not the whole path with the file name. Overriding store_path let's you modify the entire path.

def store_path(for_file = filename)
  self.model.class.name.underscore.pluralize + "/" + self.model.slug + "/" + (version_name || :original).to_s + ".jpg"
end

This is the original:

@pithyless
pithyless / doo-bug.md
Last active November 11, 2016 09:21
CLJS lein-doo not flushing correctly?

Running lein node test once (but also happens in auto watch-mode).

10 items map - OK

(deftest foo-test
  (is (= 'foo
         (reduce #(assoc %1 %2 inc) {} (range 10)))))
@pithyless
pithyless / gist:3428884
Created August 22, 2012 20:06
OSX Mountain Lion - Install Notes
# Don't write to Disk on Sleep
sudo pmset -a hibernatemode 0
# Install Developer Tools (no XCode)
# https://developer.apple.com/downloads/index.action#
# Install DropBox
# Install 1Password
# Install Homebrew
@pithyless
pithyless / mac-homebrew-pyexiv2.sh
Created January 22, 2012 17:19 — forked from jpwatts/mac-homebrew-pyexiv2.sh
In which I finally get pyexiv2 working on my Mac using Homebrew and a series of disgusting hacks
#!/bin/sh
brew install python scons boost exiv2
curl -O http://launchpadlibrarian.net/83595798/pyexiv2-0.3.2.tar.bz2
tar xjvf pyexiv2-0.3.2.tar.bz2
cd pyexiv2-0.3.2
# https://answers.launchpad.net/pyexiv2/+question/140742
echo "env['FRAMEWORKS'] += ['Python']" >> src/SConscript
@pithyless
pithyless / Gemfile
Created November 12, 2012 14:52
Configuration required to setup newrelic-moped
group :production, :acceptance do
gem 'rpm_contrib'
gem 'newrelic-moped' # https://github.com/joinwire/newrelic-moped
gem 'newrelic_rpm'
end