Skip to content

Instantly share code, notes, and snippets.

var Dialog = React.createClass({
render: function() {
// 1) render nothing, this way the DOM diff will never try to do
// anything to it again, and we get a node to mess with
return React.DOM.div();
},
componentDidMount: function() {
// 2) do DOM lib stuff
this.node = this.getDOMNode();
@stuarthalloway
stuarthalloway / schema_history.clj
Last active March 31, 2017 21:40
Complete schema history of a live Datomic database
;; Complete schema history for a live Datomic database.
(require
'[clojure.pprint :as pp]
'[clojure.set :as set]
'[datomic.api :as d])
;; fill this in with your own database connection
(def uri "datomic:dev://localhost:4334/my-db")
(def conn (d/connect uri))
(def db (d/db conn))
@daveray
daveray / merge.clj
Created January 30, 2014 05:42
merge a channel of channels in core.async
(defn merge+
"Takes a *channel* of source channels and returns a channel which
contains all values taken from them. The returned channel will be
unbuffered by default, or a buf-or-n can be supplied. The channel
will close after all the source channels have closed."
([in-ch] (merge+ in-ch nil))
([in-ch buf-or-n]
(let [out-ch (async/chan buf-or-n)]
(async/go-loop [cs [in-ch]]
(if-not (empty? cs)
@stuartsierra
stuartsierra / spellcheck.clj
Created July 9, 2013 01:47
Example implementation of Norvig's Spellchecker in Clojure, using core.async
;; Example implementation of Norvig's Spellchecker in Clojure,
;; using core.async
;;
;; There are probably some bugs in this.
;;
;; Original problem: https://github.com/ericnormand/spelling-jam
;; from Lambda Jam, Chicago, 2013: http://lambdajam.com/
;;
;; Clojure core.async introduction:
;; http://clojure.com/blog/2013/06/28/clojure-core-async-channels.html
(def cds (collection))
;; interact with database
(go
(>! (:in cds)
{:op :create
:val {:title "Soft Machine Vol. 1"
:artist "Soft Machine"
:year 1969}})
@avescodes
avescodes / Editing Clojure with Emacs
Last active July 5, 2022 13:32
Get started editing Clojure in Emacs with this basic config.
Check out README.md to get started editing Clojure with Emacs.
@ProLoser
ProLoser / alerts.html
Last active October 9, 2019 18:38
AngularJS Bootstrap implemented without any additional code
<h1>Alert</h1>
<p>Bootstrap JS</p>
<div class="alert fade in">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.
</div>
<p></p><a ng-click="alert=true">Open Alert (AngularJS)</a></p>
<div class="alert fade" ng-class="{in:alert}">
<button type="button" class="close" ng-click="alert=false">×</button>