Skip to content

Instantly share code, notes, and snippets.

@mattdeboard
mattdeboard / atom.coffee
Last active August 29, 2015 14:08
Super naive impl of a Clojure-style atom in CoffeeScript
class Atom
__state:
initial: null
current: null
constructor: (state) ->
@__state['current'] = state
@__state['initial'] = state
_cloneState: (phase = 'current') ->
(eval-after-load 'hideshow
'(define-key hs-minor-mode-map [(mouse-9)] 'hs-mouse-toggle-hiding))
ssh-add
# Identify the home of our gtkrc file, important for setting styles of
# gtk-based applications
export GTK2_RC_FILES="$HOME/dotfiles/.gtkrc-2.0"
if [ -n $(xmodmap -pp | grep -q Caps) ]; then
xmodmap -e "remove lock = Caps_Lock"
xmodmap -e "add control = Caps_Lock"
xmodmap -e "keysym Caps_Lock = Control_L"
fi
(defn transition-handler
"This handler takes messages off the transition subscription channel and
uses that information to transition the grid after dots are removed."
[channel owner]
(go-loop []
(let [msg (<! channel)
dot-row (:dot-row msg)
dot-col (:dot-column msg)
cur (columns-state-cur)]
(. js/console log @cur))
;;; HACK: This is to allow compatibility between emacs trunk (>= 25.0.5) and
;;; CIDER 0.7.0, which is the last known good version of CIDER I could find.
;;; Please see https://github.com/clojure-emacs/cider/issues/838
;;; for more information.
(defun eldoc-beginning-of-sexp ()
"Move to the beginning of current sexp.
Return the number of nested sexp the point was over or after. "
(let ((parse-sexp-ignore-comments t)
(num-skipped-sexps 0))
(defproject kanfold "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:source-paths ["src/clj" "src/cljs"]
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/clojurescript "0.0-2322"]
[ring "1.2.2"]
(ns chestnut.core
(:require [clojure.browser.repl]
[om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[figwheel.client :as fw :include-macros true]))
(enable-console-print!)
(defonce app-state (atom {:text "Hello world!"}))
"Error evaluating:" (om/root wut app-state {:target (. js/document (getElementById "app"))}) :as "om.core.root.call(null,chestnut.core.wut,chestnut.core.app_state,new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,\"target\",\"target\",253001721),document.getElementById(\"app\")], null));\n"
#<TypeError: Cannot read property 'call' of undefined>
TypeError: Cannot read property 'call' of undefined
at rootf (eval at <anonymous> (http://localhost:59554/3741/repl/start:1758:348), <anonymous>:2253:268)
at root (eval at <anonymous> (http://localhost:59554/3741/repl/start:1758:348), <anonymous>:2342:14)
at eval (repl-1411168925743.js:1:78)
at eval (repl-1411168925743.js:5:3)
at http://localhost:59554/3741/repl/start:1758:343
at clojure.browser.repl.evaluate_javascript (http://localhost:59554/3741/repl/start:1759:260)
at Object.callback (http://localhost:59554/3741/repl/start:1767:109)
(extend-type js/HTMLCollection
ISeqable
(-seq [array] (array-seq array 0)))
(let [head (first (. js/document (getElementsByTagName "head")))
script (. js/document (createElement "script"))]
(set! (.-type script) "text/javascript")
(set! (.-src script) "http://fb.me/react-0.11.2.js")
(. head (appendChild script)))
(ns kanfold.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[weasel.repl :as ws-repl]
[kanfold.components.ticket :as ticket]))
(ws-repl/connect "ws://localhost:9001" :verbose true)
(enable-console-print!)
(def app-state (atom {:text "Hello world!"}))