Skip to content

Instantly share code, notes, and snippets.

@a2ndrade
a2ndrade / gist:9623509
Created March 18, 2014 16:19
Git: Ordered list of tags
git for-each-ref --format="%(taggerdate:short) %(refname)" --sort="taggerdate" refs/tags
-- Learn you a Haskell for Great Good --
-- GIST: 4e3241f2a73fe93d7a96
import Data.List
import Data.Char
import qualified Data.Map as Map
-- head, tail, take, drop, takeWhile, dropWhile
-- fst, snd, zip, zipWith, flip
-- sum, product, maximum
@a2ndrade
a2ndrade / gist:127a422c194738e4ddb4
Last active August 29, 2015 14:19
React Native Scratchpad
'use strict';
var React = require('react-native');
var {
TextInput,
Text,
View,
ListView
} = React;
@a2ndrade
a2ndrade / proxy.js
Created September 8, 2015 23:11
proxy
const httpProxy = require('http-proxy');
module.exports = function(target) {
const proxy = httpProxy.createProxyServer({
target: target,
secure: false,
changeOrigin: true,
auth: 'user:password'
});
@a2ndrade
a2ndrade / fluetconf.md
Last active September 23, 2015 13:48
Fluent Conf 2016: Talk Proposal

##Server-side FRP: Powerful UIs, no added complexity

###Description We’ll present FRP (Functional Reactive Programming) ideas and novel techniques applied to the development of an enterprise application platform that let non-programmers build cross-platform UIs that have complete access to backend services. All with a very simple, purely functional, interpreted language used to declaratively create and persist UIs that are dynamically rendered on web and mobile.

###Abstract We’ll show why a unidirectional data flow architecture makes event-driven systems easier to reason about, how using a single language to describe both business logic and UI views allow us to compose complex UIs out of simpler, independent components. How we use Haskell-inspired ideas to isolate side-effects and perform them under a controlled environment, how we provide the illusion of local state by hiding it behind a globally-managed state tree, how we take advantage of functional purity and use FRP techniques to only recompute the par

# copy files preserving path; ae|web => source dirs; patch => target dir
for f in `git log --name-only -1 | awk /ae\|web/`; do find . -regex "./$f" -type f -exec cp --parents "{}" patch \;; done
# for-loop
for i in `seq 1 10`; do echo $i; done
# for-each + counter
c=10; for i in `seq 1 10`; do echo "$i => $c"; c=$[c+1]; done
@a2ndrade
a2ndrade / gist:5235019
Last active December 15, 2015 08:59
Datomic: constructor-like transaction function
; See http://stackoverflow.com/questions/15595540/datomic-insert-blocks
(require '[datomic.api :as d])
(def uri "datomic:mem://test")
(d/create-database uri)
(def conn (d/connect uri))
(d/transact conn [{:db.install/_attribute :db.part/db
:db/id #db/id[:db.part/db]
:db/ident :car/model
@a2ndrade
a2ndrade / gist:5625075
Last active December 17, 2015 14:29
Datomic: DB Functions & Java Compilation Errors
import java.util.Map;
import java.util.UUID;
import datomic.Connection;
import datomic.Peer;
import datomic.Util;
public class JavaDbFunction {
/**
@a2ndrade
a2ndrade / gist:5641681
Last active December 17, 2015 16:49
Datomic: Finding duplicate attribute values
;; see http://stackoverflow.com/questions/16727590/what-is-a-good-way-of-finding-duplicates-in-datomic
(require '[datomic.api :as d])
(def uri "datomic:mem://duplicate-values")
(d/create-database uri)
(def conn (d/connect uri))
;; sample attribute definiton
(d/transact conn [{:db.install/_attribute :db.part/db
:db/id #db/id[:db.part/db]
@a2ndrade
a2ndrade / gist:5820364
Created June 20, 2013 04:44
Datomic: nested component entities
;; see http://stackoverflow.com/questions/16242750/nesting-structures-with-datomic
(require '[datomic.api :as d])
(def uri "datomic:mem://test")
(d/create-database uri)
(def conn (d/connect uri))
;; sample attributes
(d/transact conn [{:db/id #db/id[:db.part/db]
:db/ident :some/ref-value
:db/valueType :db.type/ref