This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def cds (collection)) | |
;; interact with database | |
(go | |
(>! (:in cds) | |
{:op :create | |
:val {:title "Soft Machine Vol. 1" | |
:artist "Soft Machine" | |
:year 1969}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Check out README.md to get started editing Clojure with Emacs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |