Skip to content

Instantly share code, notes, and snippets.

View boxxxie's full-sized avatar
👙
disrupting absurdism

Paul Iannazzo boxxxie

👙
disrupting absurdism
View GitHub Profile
worker_processes 4;
pid nginx.pid;
#daemon off;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# fix for npm ERR! "Error: EROFS, symlink" issues
# http://blog.liip.ch/archive/2012/07/25/vagrant-and-node-js-quick-tip.html
@boxxxie
boxxxie / rabbit.clj
Created January 4, 2013 02:29
trying to get (println)s printing to the same repl output
(ns api.rabbitmq
(:gen-class)
(:require [langohr.core :as rmq]
[langohr.channel :as lch]
[langohr.queue :as lq]
[langohr.consumers :as lc]
[langohr.basic :as lb]))
(def ^{:const true}
default-exchange-name "")
(def user-to-add {
:name "sharedadmin"
:email "[email protected]"
:display_name "En Ginuity"
:password "somepass"
})
(def deftest-datomic
(do-template [deftest-name schemas body]
(deftest deftest-name
(def user-to-add {
:name "sharedadmin"
:email "[email protected]"
:display_name "En Ginuity"
:password "somepass"
})
(deftest add-and-retrieve-user
(ds/start {:schemas user/schema})
(binding [*connection* (d/connect *uri*)]
;;this fn doesn't work. couchdb is still being called even though with-redef is replacing the authenticator.
(with-redefs [
api.routes.login/conn (db.datomic.seeding/connection-to-seeded-db)
api.db.couch/authenticator (constantly {:basic-authentication {:ok true :name nil :roles ["_admin"] } :couchdb-id "sharedadmin"})
]
;;use mem DB for this
(deftest login-route
(testing "testing logging in as sharedadmin"
(is (= (-> (session api.core/app) ;Use your ring app
user=> (use 'librarian-clojure.security)
nil
user=> (def request {:params {:login "jacek" :password "secr3t"}})
#'user/request
user=> (log-in request)
AssertionError Assert failed: (somnium.congomongo/connection? c__793__auto__) librarian-clojure.db/db-get-user (db.clj:63)
user=> ;; no CongoDB up and running - mock its availability
user=> (def ^:dynamic db-get-user)
#'user/db-get-user
user=> (binding [db-get-user (fn [v] (println "user: " v) v)]
[
;; put shared admin in DB
{
:db/id #db/id[:db.part/user -1000001],
:user/roles :role/super-user, ;enum
:user/couch-id "sharedadmin",
:user/firstname "En",
:user/lastname "Ginuity"
}
]
(def simple-user-schema
[{:db/id {:part :db.part/db, :idx -1000050},
:db/ident :user/firstname,
:db/valueType :db.type/string,
:db/cardinality :db.cardinality/one,
:db/fulltext true,
:db/doc "A user's first name",
:db.install/_attribute :db.part/db}
{:db/id {:part :db.part/db, :idx -1000051},
:db/ident :user/lastname,