Skip to content

Instantly share code, notes, and snippets.

View ciniglio's full-sized avatar

Alejandro Ciniglio ciniglio

View GitHub Profile
@cemerick
cemerick / user.clj
Last active August 29, 2015 14:21
user.clj to recover pre-1.7.0 printing of Objects and Throwables in the REPL
; add to your user.clj to recover pre-1.7.0 printing of Objects and Throwables in the REPL
; https://github.com/clojure/clojure/blob/master/changes.md#17-printing-as-data
(in-ns 'clojure.core)
; from 1242c48
(defn- print-object [o, ^Writer w]
(when (instance? clojure.lang.IMeta o)
(print-meta o w))
(.write w "#<")
@favila
favila / async-util.clj
Created November 28, 2014 17:06
Some missing pieces of core.async. as-transducer: Make a transducer function easily without Clojure 1.7. go-pipe: async/pipe, but returns the go-loop. fast-pipeline-blocking: faster than async/pipeline-blocking, but unordered results. blocking-consumer: consume a channel with multiple worker threads.
(ns favila.async-util
"Some missing pieces of core.async.
as-transducer: Make a transducer function easily without Clojure 1.7.
go-pipe: async/pipe, but returns the go-loop.
fast-pipeline-blocking: faster than async/pipeline-blocking, but unordered results.
blocking-consumer: consume a channel with multiple worker threads."
(:require [clojure.core.async :as async
:refer [go go-loop <! >! <!! >!! close! take! put! chan]]))
@mattconnolly
mattconnolly / gist:4158961
Created November 28, 2012 04:04
RSpec basic authentication helper module for request and controller specs
module AuthHelper
def http_login
user = 'username'
pw = 'password'
request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(user,pw)
end
end
module AuthRequestHelper
#
@ciniglio
ciniglio / gist:4077081
Created November 15, 2012 06:50
Installing postgres on mac for rails dev

Installation

Install Postgres and have it load on startup

sudo port install postgresql92-server
sudo port load postgresql92-server

Make needed dirs

sudo mkdir -p /opt/local/var/db/postgresql92/defaultdb
@dnagir
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")