Skip to content

Instantly share code, notes, and snippets.

View yeehaa123's full-sized avatar

Jan Hein Hoogstad yeehaa123

View GitHub Profile
const sectionData = [
{ type: "title", data: "bar" },
{ type: "meta", data: [
{ title: "curator", value: "foobar" },
{ title: "followers", value: 3 }
] },
{ type: "collection", data: {
type: "foo",
collection: ["foo", "bar", "baz"]
}
let schema = {
map: { fields: { foobar: "collection" }] component: Map, handlers: handlers },
title: {},
meta: { fields: ["curator", "followers"] },
list: { fields: { foobar: "collection" } }
};
let schema = {
map: { fields: "foobar", component: Map, handlers: handlers },
title: {},
meta: { fields: ["curator", "followers"] },
todo: { fields: { foobar: "collection" }] component: Map, handlers: handlers },
list: { fields: { foobar: "collection" } }
};
let schema = {
map: { fields: "foobar", component: TodoList },
title: {},
meta: { fields: ["curator", "followers"] },
todo: { fields: { foobar: "collection" }, component: Map, handlers: handlers },
list: { fields: { foobar: "collection" } }
};
@yeehaa123
yeehaa123 / test_helpers.cljc
Created August 28, 2015 23:12
Clojure Core.Async test helpers
; http://stackoverflow.com/questions/30766215/how-do-i-unit-test-clojure-core-async-go-macros
; HELPERS
(defn test-async
"Asynchronous test awaiting ch to produce a value or close."
[ch]
#?(:clj
(<!! ch)
:cljs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration."
(setq-default
;; List of additional paths where to look for configuration layers.
;; Paths must have a trailing slash (i.e. `~/.mycontribs/')
dotspacemacs-configuration-layer-path '()
set -g prefix C-a
unbind C-b
set -g default-terminal 'gnome-256color'
@yeehaa123
yeehaa123 / tags-query.js
Created December 10, 2015 22:51
query for couchdb
function(doc) {
var checkpoints = doc['checkpoints'];
var tagsTemp = Object.keys(checkpoints).map(function (key) {return checkpoints[key]['tags']});
var tags = [].concat.apply([], tagsTemp);
if(tags.length > 0){
tags.forEach(function(tag) {emit(tag, doc['_id'])});
}
}
@yeehaa123
yeehaa123 / design-doc.js
Created December 10, 2015 22:58
couch design doc
{
"_id": "_design/jsviews",
"_rev": "194-ab29c1b084e81b2e2fc4b0fa4a7fbb21",
"views": {
"course-tags": {
"map": "function(doc) {\n var checkpoints = doc['checkpoints'];\n var tagsTemp = Object.keys(checkpoints).map(function (key) {return checkpoints[key]['tags']});\n var tags = [].concat.apply([], tagsTemp);\n if(tags.length > 0){\n tags.forEach(function(tag) {emit(tag, doc['_id'])});\n }\n}",
"reduce": "_count"
},
"course-flags": {
(ns history-handler
(:require [compojure.core :refer [GET defroutes]]
[ring.util.http-response :refer :all]
[compojure.route :as route]
[hiccup.core :refer [html]]
[hiccup.page :refer [html5 include-js include-css]]))
(def index-page
(html
(html5