Skip to content

Instantly share code, notes, and snippets.

View aaronc's full-sized avatar

Aaron Craelius aaronc

View GitHub Profile
@aaronc
aaronc / ideas.md
Last active August 22, 2019 18:26
Cosmos client ideas

Codec

It seems like one of the core issues with client side support is an implementation of Amino in some language other than golang.

A couple work-arounds that occur to me are:

  • Create a REST server endpoint that decodes JSON with Amino and re-encodes it in binary Amino.
  • Compile Amino using gopherjs. I have tried this and it appears to be possible, although I haven't tested the generated JS. This is still a work-around, however, because to natively use from JS you would still need to emit JS, have the gopherjs Amino build decode the JS then re-encode it into binary (because the gopherjs compiled go structs aren't native JS structs). For iOS & Android, it may be possible to do the same with gomobile.

Long term solutions:

  • Implementing Amino in JS and other frontend languages. If one were going to implement Amino for just one more language I would suggest Kotlin specifically aims to be multiplatform and comp
@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";
@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

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
...
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 / 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
]
@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 / 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-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-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