Skip to content

Instantly share code, notes, and snippets.

View buntine's full-sized avatar
💭
Gringo Starr

Andrew Buntine buntine

💭
Gringo Starr
View GitHub Profile
@traviskaufman
traviskaufman / logback_disable_in_unit_tests.md
Last active March 20, 2023 08:38
Logback: Disable all logging in unit tests

After scouring the internet and piece-mealing together the correct way to do this, here is a step-by-step, all-in-one-place guide to making logback STFU when running your unit tests.

Here's how to do it

Save the following as logback-test.xml under src/test/resources:

<configuration>
  <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
      <pattern>%msg%n</pattern>
@alexfaber2011
alexfaber2011 / with-redefs-and-go.cljs
Created January 13, 2016 20:17
Using `with-redefs` to redef a function that's called inside a go block
; ---------------------------------------------------------------------------------
; handler code
; ---------------------------------------------------------------------------------
; My handler code fetches messages in parrallel and then picks them off of the channel
; vector within the go block. I've succesfully redef'ed `http/get` by bringing it out
; of the `go` block, but redef'ing 're-frame/dispatch` doesn't seem to be working.
(defn fetch-full-messages [db [scenario-name]]
(if-let [scenario (get-in db [:admin-configuration :scenarios scenario-name])]