Skip to content

Instantly share code, notes, and snippets.

View ebaxt's full-sized avatar

Erik Bakstad ebaxt

View GitHub Profile
@ebaxt
ebaxt / gist:910112
Created April 8, 2011 15:32
Heroku_mongo_sync
heroku plugins:install http://github.com/pedro/heroku-mongo-sync.git
@ebaxt
ebaxt / gist:951405
Created May 2, 2011 10:13
js-model with Plugin.Format
/* js-model JavaScript library, version 0.10.1
* (c) 2010-2011 Ben Pickles
*
* Released under MIT license.
*/
var Model = function(name, func) {
// The model constructor.
var model = function(attributes) {
this.attributes = this.setAttributeValues(Model.Utils.extend({}, attributes))
this.changes = {};
@ebaxt
ebaxt / radio_mustach_example.html
Created March 4, 2012 19:09
Checking radio with Mustache
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/mustache.js"></script>
</head>
<body>
<div id="formWrapper">
➜ .lein cat .profiles
{:user
{:dependencies {clj-stacktrace "0.2.4"}
:injections [(let [orig (ns-resolve (doto 'clojure.stacktrace require)
'print-cause-trace)
new (ns-resolve (doto 'clj-stacktrace.repl require)
'pst)]
(alter-var-root orig (constantly @new)))]
:plugins [[lein-midje "2.0.0-SNAPSHOT"]
[lein-pprint "1.1.1"]]}}%
<technomancy> ebaxt: the problem is that the http connector for aether (called a wagon for whatever reason) isn't found
[01:12:02] jodaro ([email protected]) left IRC. (Ping timeout: 246 seconds)
[01:12:14] <technomancy> ebaxt: usually you see this when you're trying to deploy to some nonstandard repository type like S3
[01:12:21] ToBeReplaced ([email protected]) left the channel.
[01:12:21] <aperiodic> dakrone: it seems to me that the proxy functionality doesn't work with SOCKS (i've got a local SOCKS tunnel open that my web browser is using fine, but i get the same no response exception w/clj-http)
[01:12:33] <technomancy> the fact that aether would be unable to find a wagon that it bundles with itself is bizarre
(def fibs
(concat (lazy-seq [0 1]) (lazy-seq (map + fibs (rest fibs)))))
;fibs: 0 1 1 2 3 5 8...
;rest: n 0 1 1 2 3 5
;res: 0 1 2 3 5 8
; A
;[0 1
; (map + [0 1] [1]) => [0 1]
@ebaxt
ebaxt / pipe.clj
Created January 11, 2013 11:18 — forked from anonymous/pipe.clj
(defn pipe
"Returns a vector containing a sequence that will read from the
queue, and a function that inserts items into the queue.
Source: http://clj-me.cgrand.net/2010/04/02/pipe-dreams-are-not-necessarily-made-of-promises/"
[]
(let [q (LinkedBlockingQueue.)
EOQ (Object.)
NIL (Object.)
s (fn queue-seq []
@ebaxt
ebaxt / pipe.clj
Last active December 10, 2015 23:29 — forked from pingles/pipe.clj
(let [[message-seq put] (pipe)]
(letfn [(message-handler [ch msg-meta payload]
(put {:ch ch :msg-meta msg-meta :payload payload}))]
(lc/subscribe ch qname message-handler :auto-ack true))
message-seq)
@ebaxt
ebaxt / gist:5925835
Last active December 19, 2015 08:29
Mocking out friend current-authentication
(defn with-test-auth
([] (with-test-auth {}))
([credentials]
(fn [f]
(with-redefs-fn
{#'cemerick.friend/current-authentication
(fn [] (merge {:identity "test",
:username "test",
:email "[email protected]"} credentials))}
f))))
@ebaxt
ebaxt / nginx.conf
Last active December 19, 2015 16:59
$ brew install nginx
$ cd /user/local/var/www
$ ln -s /Users/ebaxt/Projects/ardoq-front/src/css
$ ln -s /Users/ebaxt/Projects/ardoq-front/src/js
$ ln -s /Users/ebaxt/Projects/ardoq-front/src/less
$ ln -s /Users/ebaxt/Projects/ardoq-front/resources/public/img img
$ ln -s /Users/ebaxt/Projects/ardoq-front/src/html/* ./
$ pwd
/usr/local/var/www