Skip to content

Instantly share code, notes, and snippets.

View arohner's full-sized avatar

Allen Rohner arohner

View GitHub Profile
@arohner
arohner / gist:7063186
Created October 20, 2013 00:14
Circle .gemrc
ubuntu@box3:~$ cat ~/.gemrc
:sources:
- https://rubygems.org
gem: --no-ri --no-rdoc
$:~/foo$ rvm --version
rvm 1.23.8 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
~/foo$ cat .ruby-gemset
foo
~/foo$ which bundle
/home/ubuntu/.rvm/gems/ruby-2.0.0-p247@global/bin/bundle
remote: Counting objects: 579, done.
remote: Compressing objects: 100% (249/249), done.
remote: Total 579 (delta 303), reused 567 (delta 293)
Receiving objects: 100% (579/579), 130.75 KiB | 0 bytes/s, done.
Resolving deltas: 100% (303/303), done.
Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most
likely your system doesn't have the CA certificates needed for verification. For
information about OpenSSL certificates, see bit.ly/ruby-ssl. To connect without
using SSL, edit your Gemfile sources and change 'https' to 'http'.
@arohner
arohner / gist:6504697
Created September 10, 2013 03:43
(try+ true)
(try
true
(catch
java.lang.Throwable
&throw-context
(clojure.core/let [&throw-context (clojure.core/->
&throw-context
slingshot.support/get-context
slingshot.support/*catch-hook*)]
(clojure.core/cond
@arohner
arohner / gist:6432328
Created September 4, 2013 03:02
core.typed 0.2.1
java.lang.AssertionError: Assert failed: clojure.core.typed.type_rep.TCResult@fed09158
(not expected)
check.clj:4426 clojure.core.typed.check/eval65845[fn]
RestFn.java:423 clojure.lang.RestFn.invoke
MultiFn.java:231 clojure.lang.MultiFn.invoke
check.clj:3074 clojure.core.typed.check/eval65274[fn]
check.clj:3066 clojure.core.typed.check/eval65274[fn]
protocols.clj:143 clojure.core.protocols/fn
protocols.clj:19 clojure.core.protocols/fn[fn]
protocols.clj:31 clojure.core.protocols/seq-reduce
@arohner
arohner / gist:5688067
Created May 31, 2013 21:15
Fixed clojure.test fixtures
(ns circle.monkey-patch-clojure-test
"less buggy test runner"
(:require clojure.test))
(in-ns 'clojure.test)
(require '[clojure.core.strint :refer (<<)])
(defn test*
"Circle monkeypatch."
[v]
(defn resolve-map-fn
"given a record type, resolve and return it's map->Foo fn"
[record-class]
(let [simple-name (.getSimpleName record-class)
full-name (.getName record-class)
[_ the-ns] (re-find (re (<< "(.*)\\.~{simple-name}")) full-name)]
(when the-ns
(ns-resolve (find-ns (symbol the-ns)) (symbol (<< "map->~{simple-name}"))))))
@arohner
arohner / gist:4534779
Created January 15, 2013 00:08
analyze.core :refer trouble
;; File 1
(ns foo.bar
;; any :use or :refer is acceptable here, as long as the refer'd fn is not present in the user namespace (or wherever analyze is run from)
(:require [clojure.set :refer (intersection)]))
(defn foo [x y]
(intersection x y))
;; at the repl
@arohner
arohner / gist:3863185
Created October 10, 2012 04:34
macro generating macro
(defmacro def-with-disable-macro
"Generates a pair of macros, with-enable-foo and with-disable-foo, which use with-redefs to replace foo with (constantly nil), or restore it."
[v short-name]
(let [disable-name (symbol (format "with-disable-%s" short-name))
enable-name (symbol (format "with-enable-%s" short-name))]
`(do
(let [v# #'~v
v-name# (quote ~v)
old-value# (deref #'~v)
ns# *ns*]
@arohner
arohner / gist:3357459
Created August 15, 2012 07:54
trouble setting timezone in ubuntu 12.04
root@box16:~# cat /etc/timezone
Etc/UTC
root@box16:~# echo Americas/Los_Angeles | sudo tee /etc/timezone
Americas/Los_Angeles
root@box16:~# cat /etc/timezone
Americas/Los_Angeles
root@box16:~# sudo dpkg-reconfigure --frontend noninteractive tzdata
Current default time zone: 'Etc/UTC'