Skip to content

Instantly share code, notes, and snippets.

@Dr-Nikson
Dr-Nikson / README.md
Last active January 14, 2019 06:35 — forked from vjpr/README.md

Reduce boilerplate in Redux

  • Create actions similar to Flummox.
  • Generate action ids.
  • Supports actions with decorators, promises, and therefore ES7 async.
@vjpr
vjpr / README.md
Last active February 4, 2016 21:29 — forked from skevy/gist:8a4ffc3cfdaf5fd68739
Reduce boilerplate in Redux

Reduce boilerplate in Redux

  • Create actions similar to Flummox.
  • Generate action ids.
  • Supports actions with promises, and therefore ES7 async.
@eslick
eslick / datomic-schema.clj
Last active May 6, 2016 02:56
One solution to integrating Schema and Datomic
(in-ns test
(:require
[schema.macros :as macros]
[schema.utils :as sutils]))
;; Wrapper type needed because Entity values do not implement
;; IPersistentMap interface
(defrecord EntitySchema
[schema]
Schema
@threepointone
threepointone / csp.js
Last active February 25, 2017 16:15
parallel / series requests with js-csp
var csp = require('js-csp'),
{ chan, putAsync, take, go, put, timeout, spawn} = csp,
request = require('superagent');
var urls = ['http://www.google.com', 'http://www.jlongster.com', 'http://www.myntra.com'];
go(function*(){
// 1. do a bunch of requests in parallel, and save their response lengths
var parallel = yield map(urls, function*(url){
return (yield fetch(url)).text.length;
@mikaelbr
mikaelbr / partial-components.js
Last active November 2, 2015 00:01
(Experimental) Derivate coupled components instead of creating non reusables. See running demo here: http://goo.gl/LgF5mz
var data = immstruct({
message: 'Hello, World!'
});
// Reference cursors is kind of a compromise and is a result of this:
// https://github.com/omniscientjs/omniscient/issues/42 (sorry, alot of text)
// One of the problem I have with reference cursors is that
// by using "reference cursors" directly in a component, we bind
// that component to the specific part of the structure and it hurts
@mikaelbr
mikaelbr / 01-functional-ui.js
Last active February 21, 2017 23:50
Example of functional UI and higher order components for React/Omniscient.js (http://omniscientjs.github.io/)
import React from 'react';
import component from 'omniscient';
import immstruct from 'immstruct';
import { compose, valueNode, partialProps } from './compose';
const data = immstruct({ counter: 0, title: 'My title' });
const em = component(({partialedTitle, children}) =>
<em>{partialedTitle}: {children}</em>);
(ns datascript-to-datomic-util
(:require [datascript :as d]))
;;;; a utility to help with a datomic-datascript roundtrip process involving:
;;; 1. export some data from a datomic database and transact into a datascript instance.
;;; 2. perform one or more transactions against datascript.
;;; 3. transact the sum of all changes made against datascript back into datomic in a single tx
;;; this namespace contains two public functions:
;;; listen-for-changes: listen to datascript transactions and build up a record of changes

2011.03.10

Recursive Interfaces for Reactive Objects by Travers

Talks briefly about Kay's Vivarium Project... TODO: find out more

Frames

(ns path.to.services.env
(:require
[clojure.tools.logging :as log]
[puppetlabs.trapperkeeper.core :as tk]
[puppetlabs.trapperkeeper.services :as s]))
(defprotocol EnvironmentConfigService
(get-config [this]
"Returns a map containing all of the configuration values (enviornmentally aware). Any string value that is
prefixed by ENV_, will be considered an environmental variable.")
@pixelhandler
pixelhandler / slides.js
Created January 14, 2015 17:59
Ember CLI http-mock backed by RethinkDB
/*
Add `nouns` as http mocks and use in a local db, available via API in develoment
* Install the adapter `npm install rethinkdb_adapter --save-dev`
* Install RethinkDB, see https://github.com/pixelhandler/ember-slide-deck/blob/master/bin/install_rethinkdb.sh
* Start db `rethinkdb`
* Setup Db and Table, see https://github.com/pixelhandler/ember-slide-deck/blob/master/bin/setup_db.js
* Generate a mock `ember g http-mock nouns` and edit your mock to use the db, see code below for 'slides'
* Set your application adapter to use `namespace: 'api'`
* In our routes use Ember Data in your model hook