Skip to content

Instantly share code, notes, and snippets.

magnars /
Last active March 20, 2019 18:50
Donations for any of my open source work

Are you happily using one of my open source projects, and want to donate somehow? I'm so glad to hear it. I am happy to accept donations to any of the following non-profits:

  • uses online campaigns, grassroots organizing, and mass public actions to oppose new coal, oil and gas projects, take money out of the companies that are heating up the planet, and build 100% clean energy solutions that work for all. 350's network extends to 188 countries.

  • Environmental Defense Fund create environmentally sound solutions that also carry economic benefits, such as removing obsolete rules that hamper the clean energy market in the U.S. EDF rewards people for protecting the environment, not exploiting it. Rooted in strong science and economics, they work with allies across the political spectrum and partnering with business, turning ideas into lasting change.

  • Sierra Club Foundation promotes climate solutions, conservation, an

magnars / dev.clj
Last active February 11, 2019 22:36
Suppress datomic transactions to prod from dev
View dev.clj
(defn suppress-datomic-transactions-to-prod [config]
(when (str/starts-with? (:datomic-uri config) "datomic:ddb://")
(println "Warning! Suppressing transactions to production datomic from dev environment. Check your config.")
(let [the-conn (d/connect (:datomic-uri config))]
(alter-var-root (var datomic.api/transact)
(fn [transact]
(fn [conn txs]
(if (= conn the-conn)
(do (log/warn "Suppressed datomic transaction to production.")
(let [db (d/db conn)] (future {:db-after db :db-before db :tx-data nil})))
View system.clj
(reify Thread$UncaughtExceptionHandler
(uncaughtException [_ thread ex]
(log/error ex "Uncaught exception on" (.getName thread)))))
View index.html
<!DOCTYPE html>
<!-- This file is autogenerated with info from build/link_app/build_config.clj
Regen with build/ -->
<head><meta charset="UTF-8"><meta content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width" name="viewport"><meta content="yes" name="apple-mobile-web-app-capable"><meta content="yes" name="mobile-web-app-capable"><link href="/css/reset.css" rel="stylesheet" /><link href="/css/ionicons.css" rel="stylesheet" /><link href="/css/lato.css" rel="stylesheet" /><link href="/css/init.css" rel="stylesheet" /><link href="/css/inspector.css" rel="stylesheet" /><link href="/css/main.css" rel="stylesheet" /></head><body><div id="main-app-area"></div><script src="/app-config/local-defaults.js"></script><script src="/app-config/local-overrides.js"></script><script src="/js/lib/linkBrowser.js"></script><script src="/js/lib/base64Decode.js"></script><script src="/js/lib/intercom-tracking.js"></script><script src="/js/lib/heap-tracking.js"></script><script src="/js/
View isearch-delete-me.el
(defun isearch-delete-me ()
(delete-char (- (length isearch-string))))
(define-key isearch-mode-map (kbd "<C-backspace>") 'isearch-delete-me)
View client.clj
(ns undead.client
(:require [chord.client :refer [ws-ch]]
[cljs.core.async :refer [<!]]
[undead.components :refer [render-game]])
(:require-macros [cljs.core.async.macros :refer [go]]))
View client.clj
(let [gateways-chan (get-json "/gateways.json")
versions-chan (get-json "/jar-versions.json")]
(jars/render-page (<! gateways-chan) (<! versions-chan))))
View *scratch5*.el
* React all the things
* Split Authentication and Authorization
- Naive helsegris-api
* Anti Corruption Service, prodreg
- thin wrapper
* Context maps all the way down
* Docker + Fig for Oracle + mock
* Memcached sessions
View index.html
<!DOCTYPE html>
<html lang="en">
.hidden {display: none;}
<div class="text">
View *scratch1*.el
bowling-cata git:(master) ✗ buster-test
Failure: Bowling should score 0 for no hits
[assert.equals] undefined expected to be equal to 0
AssertionError: [assert.equals] undefined expected to be equal to 0
at (/Users/magnars/courses/tdd-course/practice/bowling-cata/node_modules/buster/node_modules/referee/lib/referee.js:156:25)
at (/Users/magnars/courses/tdd-course/practice/bowling-cata/node_modules/buster/node_modules/referee/lib/referee.js:43:17)
at Function.referee.(anonymous function).(anonymous function) [as equals] (/Users/magnars/courses/tdd-course/practice/bowling-cata/node_modules/buster/node_modules/referee/lib/referee.js:86:29)
at Object.buster.testCase.should score 0 for no hits (/Users/magnars/courses/tdd-course/practice/bowling-cata/bowling-test.js:12:12)
at asyncFunction (/Users/magnars/courses/tdd-course/practice/bowling-cata/node_modules/buster/node_modules/buster-test/lib/test-runner.js:224:19)