Skip to content

Instantly share code, notes, and snippets.

@hmaurer
hmaurer / datomic-erasing-data-migration.clj
Created April 28, 2018 11:43 — forked from vvvvalvalval/datomic-erasing-data-migration.clj
Erasing data from Datomic via a manual data migration
;; # EMULATING DATOMIC EXCISION VIA MANUAL DATA MIGRATION
;; *************************************
;; ## Introduction
;; *************************************
;; This Gist demonstrates a generic way to migrate an entire Datomic database
;; from an existing 'Origin Connection' to a clean 'Destination Connection',
;; while getting rid of some undesirable data and otherwise preserving history.
@hmaurer
hmaurer / exclude.sql
Created April 19, 2018 19:42 — forked from fphilipe/exclude.sql
PostgreSQL EXCLUDE constraint
CREATE EXTENSION btree_gist;
CREATE TABLE room_reservations (
room_id integer,
reserved_at timestamptz,
reserved_until timestamptz,
canceled boolean DEFAULT false,
EXCLUDE USING gist (
room_id WITH =, tstzrange(reserved_at, reserved_until) WITH &&
) WHERE (not canceled)
@hmaurer
hmaurer / gist:2a1c1c48dc180d4eb1a7b8ba1d3ad3c4
Created October 7, 2017 23:37 — forked from rtaibah/gist:0922731c452c6d1ab682
Linux Mint 17 + Xmonad on Macbook Pro Retina 15

Base installations

sudo apt-get install blueman build-essentials calcurse chromium-browser cpufrequtils gnupg2 gparted hfsprogs imagemagick linux-tools-common lxappearance mplayer rtorrent ruby skype ubuntu-restricted-essentials urlview vagrant vim xclip

System Configurations

Lastpass

{
object(rid: "2450090569620309683") {
id
children {
rid
name
children {
id
}
}
@hmaurer
hmaurer / GraphQL-Architecture.md
Created July 7, 2017 23:16 — forked from idibidiart/GraphQL-Architecture.md
Building an Agile, Maintainable Architecture with GraphQL

Building a Maintainable, Agile Architecture for Realtime, Transactional Apps

A maintainable application architecture requires that the UI only contain the rendering logic and execute queries and mutations against the underlying data model on the server. A maintainable architecture must not contain any logic for composing "app state" on the client as that would necessarily embed business logic in the client. App state should be persisted to the database and the client projection of it should be composed in the mid tier, and refreshed as mutations occur on the server (and after network interruption) for a highly interactive, realtime UX.

With GraphQL we are able to define an easy-to-change application-level data schema on the server that captures the types and relationships in our data, and wiring it to data sources via resolvers that leverage our db's own query language (or data-oriented, uniform service APIs) to resolve client-specified "queries" and "mutations" against the schema.

We use GraphQL to dyn

@hmaurer
hmaurer / atom_clojure_setup.md
Created July 7, 2017 00:00 — forked from jasongilman/atom_clojure_setup.md
This describes how I setup Atom for Clojure Development.

Atom Clojure Setup

This describes how I setup Atom for an ideal Clojure development workflow. This fixes indentation on newlines, handles parentheses, etc. The keybinding settings for enter (in keymap.cson) are important to get proper newlines with indentation at the right level. There are other helpers in init.coffee and keymap.cson that are useful for cutting, copying, pasting, deleting, and indenting Lisp expressions.

Install Atom

Download Atom

The Atom documentation is excellent. It's highly worth reading the flight manual.

@hmaurer
hmaurer / README.md
Created June 17, 2017 20:02 — forked from bruth/README.md
Postgres push notification

Postgres push triggers

Watch a table for changes and push a notification with a payload describing the change.

Example

In the Postgres shell:

-- Create the functions
@hmaurer
hmaurer / CoqIDE bundled with ssreflect.md
Created June 10, 2017 23:34 — forked from rplacd/CoqIDE bundled with ssreflect.md
CoqIDE (8.5pl1, OS X) bundled with ssreflect.

The CoqIDE bundle (8.5pl1, OS X) with ssreflect preinstalled.

coqide-8.5pl1-ssreflect.7z - around 75 MB. (Smaller than the standard CoqIDE bundle!)

A great big caveat: the app bundle is no longer codesigned. If you wish to keep CoqIDE*.app codesigned, install a clean CoqIDE*.app, and replace the Resource/bin and Resources/lib/coq/user-contrib with the ones here.

Sanity testing the installation

I’m sure the reference manual is out of date - instead, I use test cases from the mathcomp/ssrtest folder. Note the new, extended library import paths. Try this, for example:

@hmaurer
hmaurer / better-nodejs-require-paths.md
Created March 24, 2017 10:51 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

(my response to https://twitter.com/apotonick/status/717105889845624832)

I haven't yet came across readily available resources for large-scale application architecture for Elixir apps. I found Programming Phoenix to be a good start for that though. And there's ~30 years of knowledge in the Erlang land :)

For web apps, I found the abstractions that Elixir/Phoenix provides to be really helpful. Indeed, the list below is somewhat ORM focused.

In the small, Ecto.Schema, Ecto.Query, Ecto.Changeset, and Phoenix.View allow me to build highly composable and side-effect free modules. I can have many schemas, changesets and queries all interacting with the same underlying DB table(s) if I want to. Most of the side-effects (through Ecto.Repo for DBs) are usually in the Phoenix.Controller (or other Plugs).