Skip to content

Instantly share code, notes, and snippets.

@gtallen1187
gtallen1187 / scar_tissue.md
Created November 1, 2015 23:53
talk given by John Ousterhout about sustaining relationships

"Scar Tissues Make Relationships Wear Out"

04/26/2103. From a lecture by Professor John Ousterhout at Stanford, class CS142.

This is my most touchy-feely thought for the weekend. Here’s the basic idea: It’s really hard to build relationships that last for a long time. If you haven’t discovered this, you will discover this sooner or later. And it's hard both for personal relationships and for business relationships. And to me, it's pretty amazing that two people can stay married for 25 years without killing each other.

[Laughter]

> But honestly, most professional relationships don't last anywhere near that long. The best bands always seem to break up after 2 or 3 years. And business partnerships fall apart, and there's all these problems in these relationships that just don't last. So, why is that? Well, in my view, it’s relationships don't fail because there some single catastrophic event to destroy them, although often there is a single catastrophic event around the the end of the relation

@mikeball
mikeball / core.clj
Last active June 3, 2020 13:22
Postgres listen/notify in Clojure using http://impossibl.github.io/pgjdbc-ng/
; Postgres listen/notify in Clojure using http://impossibl.github.io/pgjdbc-ng/
; in project.clj dependencies
; [com.impossibl.pgjdbc-ng/pgjdbc-ng "0.5"]
(ns pglisten.core
(:import [com.impossibl.postgres.jdbc PGDataSource]
[com.impossibl.postgres.api.jdbc PGNotificationListener]))
@vvvvalvalval
vvvvalvalval / mock-connection.clj
Last active September 19, 2018 06:09
Mocking datomic.Connection for fast in-memory testing
(ns bs.utils.mock-connection
"Utilities for using Datomic"
(:require [datomic.api :as d])
(:use clojure.repl clojure.pprint)
(:import (java.util.concurrent BlockingQueue LinkedBlockingDeque)
(datomic Connection)))
(defrecord MockConnection
[dbAtom, ^BlockingQueue txQueue]
@vlinhart
vlinhart / buy_endpoint.json
Last active April 30, 2017 01:16
/buy/ proposed api
// Request POST body - common
{
"seller_site": "http://localhost:8000/backend/v1/sites/28950",
"buyer_site": "http://localhost:8000/backend/v1/sites/1", // the SFO for example, we can't say on backend which site user wants
"start_date": "2015-12-01",
"end_date": "2015-12-02",
"room_guests": {
"room_data": {
"price": 250,
@Deraen
Deraen / silk-data.cljs
Last active August 29, 2015 14:27
Additional data to Silk routes
(deftype AdditionalData [data]
silk/Pattern
(-match [_ _]
data)
(-unmatch [_ _]
nil)
(-match-validator [_]
(constantly true))
(-unmatch-validators [_]
{}))
@martinklepsch
martinklepsch / logging.cljc
Last active October 22, 2018 18:27
simple Clojurescript logging using Google Closure logging tools
;; This previously was CLJX but has now been updated to use cljc. Thanks @caskolkm
;; https://gist.github.com/caskolkm/39d823f5bac7051d3062
(ns app.logging
(:refer-clojure :exclude [time])
(:require #?(:clj [clojure.tools.logging :as log]
:cljs [goog.log :as glog]))
#?(:cljs (:import goog.debug.Console)))
#?(:cljs
@bensu
bensu / maps.cljs
Last active February 1, 2016 21:33
google maps config
(ns component.maps
(:require [google.maps])
(defn map-opts []
"Default initial map options."
{:zoom 3
:mapTypeId google.maps.MapTypeId.ROADMAP
:center (google.maps.LatLng. 59, 18)
:mapTypeControl false
:styles [{:stylers [{:visibility "on"}]}]})
(defui Artist
static IQuery
(query [cl _]
[:db/id :artist/name])
Object
(render [{:keys [props]}]
(dom/div nil (:artist/name props))))
(defui ArtistList
static IQuery
@noprompt
noprompt / complies.clj
Created March 16, 2015 04:13
complies? macro for ClojureScript. Verifies than an object not only satisfies a protocol but implements all of it.
(ns example.macros
(:require
[cljs.analyzer :as a]
[cljs.compiler :as c]))
(defmacro complies?
"True if x satisfies and implements all methods of a protocol.
Ex.
@sparkofreason
sparkofreason / util.cljx
Last active January 20, 2016 17:44
Utility functions for bridging Datomic/Datascript
(ns allgress.datascript.util
(:require [clojure.walk :refer [postwalk]]))
;;; Datomic pull API will return :db/idents as references, like {:my-enum-att {:db/ident :enum-value}}.
;;; This function replaces with the Datascript equivalent {:my-enum-att :enum-value}. Only works
;;; for true "enums", whose only attribute in the entity map is :db/ident.
defn replace-enum-refs [entity-map]
(postwalk
(fn [arg]
(if (and (coll? arg) (map? (second arg)) (= 1 (count (second arg))) (contains? (second arg) :db/ident))