Skip to content

Instantly share code, notes, and snippets.

View aaronc's full-sized avatar

Aaron Craelius aaronc

View GitHub Profile
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 / 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]
@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]
@aaronc
aaronc / idris-package-support.md
Last active December 17, 2015 04:51
Proposal for Idris Package Support to Prevent "Dependency Hell"

Proposal for Idris Package Support to Prevent "Dependency Hell"

I know there has been some discussion around what type of package manager to use for Idris. I know some people have proposed Nix and I've started checking it out myself. This proposal is really aimed just at low-level support that would help any package manager (including Nix) prevent the soul-sucking, time waster that is dependency hell.

It seems that most languages don't address this until it is too late and then need extraordinary community efforts to deal with it (ex. Haskell with Cabal sandboxes and Stack or Java with Project Jigsaw). Only one platform I know of (NodeJS with NPM) got it right from the start by allowing a nested dependency graph. With some careful planning and a few pieces of language-level support I think Idris can do this too.

I think what is most essential in preventing dependency hell is being able to reference two different dependencies that declare a module with the same name. I've done a check with Idris in it's c

@aaronc
aaronc / SassMeister-input.scss
Created January 6, 2016 22:43
Generated by SassMeister.com.
// ----
// libsass (v3.3.2)
// ----
@import "jeet/index";
@import "bourbon/bourbon";
@import "neat/neat";
@import "susy";