Skip to content

Instantly share code, notes, and snippets.

View aaronc's full-sized avatar

Aaron Craelius aaronc

View GitHub Profile
@aaronc
aaronc / auto-save.el
Created February 24, 2012 02:14
A simple minor mode that can be added to emacs to automatically save a file while you are typing.
(define-minor-mode auto-save-mode
"Auto-save mode"
nil " Reload" nil
(if auto-save-mode
;; Edit hook buffer-locally.
(add-hook 'post-command-hook 'auto-save nil t)
(remove-hook 'post-command-hook 'auto-save t)))
(defun auto-save ()
(when (buffer-modified-p)
(ns simpleschema)
(defn make-validator
([name func] (make-validator name func nil))
([name func params]
(with-meta func
{:validator-name name
:validator-params params})))
(defmacro defvalidator [name validator-args & body]
set -x
curl http://nodejs.org/dist/v0.10.28/node-v0.10.28-linux-x64.tar.gz | tar xz
mv node-v0.10.28-linux-x64 /opt/nodejs
ln -s /opt/nodejs/bin/node /usr/local/bin/node
ln -s /opt/nodejs/bin/npm /usr/local/bin/npm
curl https://install.meteor.com | /bin/sh
npm i -g meteorite
@aaronc
aaronc / freactive-server-side.cljx
Last active August 29, 2015 14:11
An idea for server-side prerendering in freactive. This code DOES NOT work in any current version of freactive!
(ns freactive.server-side-prerender-concept
(:refer-clojure :exclude [atom])
(#+cljs :require-macros #+clj :require [freactive.macros :refer [atom]])
#+cljs (:require [freactive.dom :as dom])
#+clj (:require [freactive.dom-prerender :as dom])
(#+clj :require #+cljs :require-macros [freactive.util :refer [cfn]]))
(defn app-view [state]
[:div {:on-click (cfn [e])} ;; cfn is a macro that evals to fn on the client side and nil on the server
[:ul
@aaronc
aaronc / freactive-observable-collections.md
Last active August 29, 2015 14:11
freactive observable collections

Two data types - observable-map and observable-vector - will be provided that implement an IObservableCollection protocol. observable-maps's and observable-vector's will basically wrap an atom (or atom-like structure such as a cursor) with operations that allow it to be updated in an "observable" way.

The IObservableCollection protocol will be the minimum necessary functionality required to bind a collection to an items-view. It will be completely orthogonal to the other functionality provided by observable-map's and observable-vector's so that database collections, etc. can also implement IObservableCollection and be bound to items-view's without necessarily supporting operations of observable-map's and observable-vector's

@aaronc
aaronc / bootstrap.sh
Last active January 2, 2022 18:52 — forked from anonymous/bootstrap.sh
sudo apt-get update
sudo apt-get install -y git vcsh vim tmux zsh curl software-properties-common wget
chsh -s /bin/zsh
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get build-dep -y emacs24
wget ftp://ftp.gnu.org/gnu/emacs/emacs-24.4.tar.xz
tar -xf emacs-24.4.tar.xz && rm emacs-24.4.tar.xz && cd emacs-24.4
@aaronc
aaronc / freactive-items-view.md
Last active August 29, 2015 14:11
freactive items-view ideas

items-view will be a function taking a map of arguments:

(items-view
  {:items items
   :container [:ul]
   :template (fn [item] [:li @item])})

We can do sorting like this:

@aaronc
aaronc / gist:3318c76b3a79d8cd443e
Last active August 29, 2015 14:12
Latest observable collections protocols
(defprotocol IObservableCollection
"Defines the minimum protocol required for an observable collection
to be bound to an items-view."
(-subscribe [coll key f]
"Where f is a functional taking 3 arguments:
the key, the collection, a sequence of changes in the form of:
[[key1 new-value1]
[key2 new-value2]
[key3] ;; missing new value indicates the element was removed
]
ERROR clojure.tools.nrepl.server - Unhandled REPL handler exception processing message {:op stacktrace, :session a7afd57f-03be-4d66-8b59-d2d64a6729f2, :print-length 50, :print-level 50, :id 436}
java.lang.NullPointerException: null
at java.util.regex.Matcher.getTextLength(Matcher.java:1283) ~[na:1.8.0_31]
at java.util.regex.Matcher.reset(Matcher.java:309) ~[na:1.8.0_31]
at java.util.regex.Matcher.<init>(Matcher.java:229) ~[na:1.8.0_31]
at java.util.regex.Pattern.matcher(Pattern.java:1093) ~[na:1.8.0_31]
at clojure.core$re_matcher.invoke(core.clj:4648) ~[clojure-1.7.0-RC1.jar:na]
at clojure.core$re_find.invoke(core.clj:4700) ~[clojure-1.7.0-RC1.jar:na]
at cider.nrepl.middleware.stacktrace$flag_tooling$tool_QMARK___11580.invoke(stacktrace.clj:68) ~[na:na]
at clojure.core$complement$fn__4378.invoke(core.clj:1374) ~[clojure-1.7.0-RC1.jar:na]
clojure.lang.ExceptionInfo: java.lang.ExceptionInInitializerError
data: {:file "/tmp/boot.user3149510563468310428.clj", :line 73}
java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError:
clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate datomic/api__init.class or datomic/api.clj on classpath., compiling:(core/cache.clj:1:1)
java.io.FileNotFoundException: Could not locate datomic/api__init.class or datomic/api.clj on classpath.
...
clojure.core/load/fn core.clj: 5866
clojure.core/load core.clj: 5865
...