Skip to content

Instantly share code, notes, and snippets.

View trptcolin's full-sized avatar

Colin Jones trptcolin

View GitHub Profile
@trptcolin
trptcolin / gist:11309006
Created April 26, 2014 01:13
Lein templates via `lein search`
Updating the search index. This may take a few minutes...
Searching over Artifact ID...
== Showing page 1 / 1
[heroku/lein-template "0.1.0"] Template for new ring-based Leiningen projects for Heroku.
[cljs-template/lein-template "0.1.5"] A lein-newnew template for clojurescript projects
[noir/lein-template "1.3.0"] A lein-newnew template for generating new noir projects.
[lein-gnome/lein-template "0.1.0-SNAPSHOT"] A template for new Gnome Shell extensions.
[pallet/lein-template "0.2.0"] Leiningen plugin for creating Pallet projects
[pallet/lein-template "0.2.1"] Leiningen plugin for creating Pallet projects
[cljs-template-one/lein-template "0.1.5"] A lein-newnew template for clojurescript projects

Vim Regexes

When do I need a backslash?

  • this is all dependent on the "magic" option being set to the default, magic (:set magic? will tell you what you're set on)

  • vim regexes are beyond reason

  • (defn finds a literal paren, and \(defn\) creates a group.

  • | finds a literal pipe and, \| separates alternatives

@trptcolin
trptcolin / gist:9265825
Created February 28, 2014 05:26
amb implementation with delimc
(require '[delimc.core :as d])
(defmacro amb [xs]
`(d/shift k# (doseq [x# ~xs]
(k# x#))))
(d/reset
(let [a (amb [1 2 3])
b (amb ["a" "b" "c"])]
(println a b)))
@trptcolin
trptcolin / gist:9122852
Last active August 29, 2015 13:56
Cool story, Node
> parseInt('000039')
3
> parseInt('000039', 10)
39
$ ./hello_world
Hello World!
$ ./hello_world > output && cat output
Hello World!
$ ./hello_world >> output && cat output
Hello World!
Hello World!
$ ./hello_world >> output && cat output
Hello World!
Hello World!
(require '[backtick :refer [template syntax-quote]])
;=> nil
(let [x 2] (template (foo ~x)))
;=> (foo 2)
(let [x 2] (syntax-quote (foo ~x)))
;=> (user/foo 2)
@trptcolin
trptcolin / mavericks_upgrade
Created October 23, 2013 04:37
mavericks upgrade journal
√ Zephyros (window manager) needs universal access:
http://www.tekrevue.com/2013/06/25/how-to-enable-access-for-assistive-devices-in-os-x-mavericks/
√ gcc can’t find stdio.h (& similar) - /usr/include got blown away
xcode-select --install
see https://github.com/mxcl/homebrew/issues/20427
√ java install got blown away & replaced with a stub that says to download java
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
# General comment: I assume here that I'm just doing it wrong as I haven't been using Arel that long.
# If I knew for sure this was broken I'd just file a bug instead.
# Note that these specific ActiveRelations are just a trimmed-down example; the actual use case would
# really be better with a UNION, I promise.
1.9.3-p448 :301 > users = User.where(:email => "one@two.com").union(User.where(:email => "foo@bar.com"))
# => #<Arel::Nodes::Union:0x8d1e608 @left=#<Arel::Nodes::SelectStatement:0x8d1eb58 @cores=[#<Arel::Nodes::SelectCore:0x8d1eb44 @source=#<Arel::Nodes::JoinSource:0x8d1eb30 @left=#<Arel::Table:0x9b6d628 @name="users", @engine=User(id: integer, email: string, encrypted_password: string, reset_password_token: string, reset_password_sent_at: datetime, remember_created_at: datetime, sign_in_count: integer, current_sign_in_at: datetime, last_sign_in_at: datetime, current_sign_in_ip: string, last_sign_in_ip: string, created_at: datetime, updated_at: datetime, company_id: integer, locale: string, au
git filter-branch -f --prune-empty --index-filter 'git rm -rf --cached --ignore-unmatch vendor' --tag-name-filter cat -- --all
git filter-branch -f --prune-empty --index-filter 'git rm -rf --cached --ignore-unmatch vendor' --tag-name-filter cat -- --all
git -c gc.reflogExpire=0 -c gc.reflogExpireUnreachable=0 -c gc.rerereresolved=0 \
-c gc.rerereunresolved=0 -c gc.pruneExpire=now gc --aggressive --prune=now
@trptcolin
trptcolin / gist:3470744
Created August 25, 2012 20:39
Why naming conventions are important
colin:level08-code/ (master✗) $ gem install restclient
ERROR: Could not find a valid gem 'restclient' (>= 0) in any repository
^CERROR: Interrupted
colin:level08-code/ (master✗) $ gem install rest_client
ERROR: Could not find a valid gem 'rest_client' (>= 0) in any repository
^CERROR: Interrupted
colin:level08-code/ (master✗) $ gem install RestClient
ERROR: Could not find a valid gem 'RestClient' (>= 0) in any repository
^CERROR: Interrupted
colin:level08-code/ (master✗) $ gem install rest-client