Skip to content

Instantly share code, notes, and snippets.

View stephenbrady's full-sized avatar

Stephen Brady stephenbrady

View GitHub Profile
@stephenbrady
stephenbrady / boot-core.clj
Created August 8, 2016 21:24
Exposing boot file watching
(def FileChangeCallbacks (atom []))
(defn on-file-changes
[changes]
(sync-user-dirs!)
(doseq [callback (seq @FileChangeCallbacks)]
(try (callback changes)
(catch Throwable t
(println "Exception in boot watch callback: " t))))
(reset! last-file-change (System/currentTimeMillis)))
;; Datomic example code
;; Demonstrates using datalog with Clojure defrecords
(use '[datomic.api :only [q db] :as d])
;;; http://www.lshift.net/blog/2010/08/21/some-relational-algebra-with-datatypes-in-clojure-12
(defrecord Supplier [number name status city])
(defrecord Part [number name colour weight city])
(defrecord Shipment [supplier part quantity])
;; sample data
(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]]))
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten