Skip to content

Instantly share code, notes, and snippets.

View bostonaholic's full-sized avatar
🏕️

Matthew Boston bostonaholic

🏕️
View GitHub Profile
@bostonaholic
bostonaholic / Hexable.rb
Created August 1, 2012 21:10
Rails models with generated hex as parameter instead of id
module Hexable
def self.included(base)
base.class_eval do
before_create :generate_hex
attr_accessible :hex
end
end
def to_param
self.hex
@bostonaholic
bostonaholic / Gemfile
Last active December 10, 2015 07:18
Rails 3 Action Sweeper on Heroku
gem 'memcachier'
gem 'dalli'
@bostonaholic
bostonaholic / postgres_install.md
Last active December 10, 2015 15:28
Tips for install Postgres on OS X

Tips for installing Postgres on OS X

  1. Install postgres with homebrew.

brew install postgres

  1. Add /usr/local/bin to the head of your $PATH to ensure the homebrew version of postgres is used.

Add this to your .bashrc or .zshrc depending on your preferred shell.

@bostonaholic
bostonaholic / gist:7588800
Created November 21, 2013 20:14
Can anyone explain why Ruby Range#last works in this way?
irb(main):017:0> (1..10).last # OK
=> 10
irb(main):019:0> (1...10).to_a.last # OK
=> 9
irb(main):018:0> (1...10).last # WAT
=> 10
irb(main):020:0>
@bostonaholic
bostonaholic / keybase.md
Last active October 22, 2018 15:58
Keybase proof

Keybase proof

I hereby claim:

  • I am bostonaholic on github.
  • I am bostonaholic (https://keybase.io/bostonaholic) on keybase.
  • I have a public key whose fingerprint is D216 2778 BAE9 031B E58D 8BB6 0F36 90C4 EFD6 F2E6

To claim this, I am signing this object:

@bostonaholic
bostonaholic / Recipes.md
Created July 11, 2014 03:35
Here are some of my most requested recipes

Recipes

Cast Iron Chicken

Ingredients

  • Bone-in Chicken (thighs, quarters, etc.)
  • Spices
  • Well-seasoned cast iron
@bostonaholic
bostonaholic / gist:cef5a4916d46782ed368
Last active August 29, 2015 14:08
Top 10 Clojure Features Requested in 2014
@bostonaholic
bostonaholic / schema.edn
Last active October 22, 2018 15:57
Different datomic schema migrations with conformity
;; version 1 i.e. [[a] [b] [c] [d] [e] [f]]
{:app/schema
{:txes [[{:db/id #db/id [:db.part/db]
:db/ident :something/title
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/index false
:db.install/_attribute :db.part/db}]]
[{:db/id #db/id [:db.part/db]
@bostonaholic
bostonaholic / datomic-search.clj
Last active October 22, 2018 15:55
Showing datomic or-join searches
(require '[clojure.test :refer [is]])
(require '[datomic.api :as d])
(def url "datomic:mem://localhost:4334/test")
(d/create-database url)
(def conn (d/connect url))
(def schema [{:db/id #db/id[:db.part/db]
:db/ident :person/name
:db/valueType :db.type/string
@bostonaholic
bostonaholic / CLJS 1.8.51 stacktrace
Last active October 22, 2018 15:54
CLJS 1.8.51 stacktrace
$ lein --version
Leiningen 2.6.1 on Java 1.8.0_66 Java HotSpot(TM) 64-Bit Server VM
$ lein cljsbuild auto dev
Compiling "resources/public/js/main.js" failed.
java.lang.NoSuchMethodError: com.google.common.base.CharMatcher.javaUpperCase()Lcom/google/common/base/CharMatcher;
JsDocInfoParser.java:1216 com.google.javascript.jscomp.parsing.JsDocInfoParser.validTemplateTypeName
JsDocInfoParser.java:946 com.google.javascript.jscomp.parsing.JsDocInfoParser.parseAnnotation
JsDocInfoParser.java:283 com.google.javascript.jscomp.parsing.JsDocInfoParser.parseHelperLoop
JsDocInfoParser.java:273 com.google.javascript.jscomp.parsing.JsDocInfoParser.parse