This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns streaker-service.routes | |
(:require [io.pedestal.http.route :as route] | |
[io.pedestal.http.body-params :as body-params] | |
[io.pedestal.http.route.definition :refer [expand-routes]] | |
[ring.util.response :as ring-resp] | |
[streaker-service.api :as api] | |
[streaker-service.page :as page] | |
[streaker-service.pedestal-util :as pedestal-util] | |
[streaker-service.models.question :as question] | |
[streaker-service.models.friend :as friend])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([ | |
'underscore.mixed', 'react', 'wingspan-forms', 'wingspan-contrib' | |
], function (_, React, Forms, Contrib) { | |
'use strict'; | |
var MultiSelectCheckbox = React.createClass({ | |
displayName: 'MultiSelectCheckbox', | |
statics: { fieldClass: function () { return 'formFieldCheckbox'; } }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; the route currently maps to this ring handler | |
(fn [{{:keys [tx]} :query-params {:keys [id]} :path-params}] | |
(ring-resp/response | |
(api/entity-read item-route | |
(Long/parseLong id) | |
(Long/parseLong tx) | |
typeinfo))) | |
(defn entity-read [item-route eid tx typeinfo] | |
(with-db-as-of tx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn mk-item-get [item-route typeinfo] | |
(fn [{{:keys [tx]} :query-params {:keys [id]} :path-params}] | |
(-> (api/entity-read (Long/parseLong id) (Long/parseLong tx)) | |
(#(cj/item item-route [] % typeinfo tx)) | |
ring-resp/response))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// type is: Cursor[List[T]] => List[U] | |
function map_cursor_list (cur, f) { | |
return map_indexed(cur.value, function (i, v) { | |
return f(cur.refine(i)); | |
}); | |
} | |
function map_indexed (list, f) { | |
return map(zip(range(list.length), list), function (pair) { | |
return f(pair[0], pair[1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns streaker-service.url-resolver | |
(:require [streaker-service.service] | |
[streaker-service.server :refer [service-instance]] | |
[io.pedestal.http :as bootstrap] | |
[io.pedestal.test :refer [test-servlet | |
test-servlet-request | |
test-servlet-response | |
test-servlet-response-status | |
test-servlet-response-headers]])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; This buffer is for notes you don't want to save, and for Lisp evaluation. | |
;; If you want to create a file, visit that file with C-x C-f, | |
;; then enter the text in that file's own buffer. | |
{:client-uuid "3" :time-stamp 12345 :type "mousemove" :clientX 245 :clientY 144} | |
query("log entry 12345 join domevent 1234").clientX | |
{:client-uuid "1" :time-stamp 1234 :type "dombodychange" :html "{:node-name \"body\" :attributes {}}"} | |
{:client-uuid "2" :type "mousemove"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- :: Integer -> Maybe Integer | |
f0 = \x -> Just (x + 1) | |
f1 = \x -> Just (x + 10) | |
f2 = \x -> Just (x + 100) | |
g0 = \_ -> Nothing -- failure | |
Just 0 >>= f0 | |
Just 1 | |
Just 0 >>= f0 >>= f1 >>= f2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let [master-detail-cur (cur [:app :master-detail] {:form {}})] | |
[:fieldset | |
[:legend "livecoding demo"] | |
(let [root-hc-node {:href "/api?prod=true"}] | |
[hypercrud/resolve client root-hc-node | |
(fn [root-hc-node'] | |
(if (not (hypercrud/loaded? client root-hc-node')) | |
[:h1 "Loading root node"] | |
[hypercrud/resolve client (-> root-hc-node' :links :communities) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var entry_hc_node = {href: "/api?prod=true"}; | |
hypercrud_client.resolve(entry_hc_node, function (entry_hc_node) { | |
var communities = entry_hc_node.links.communities; | |
return hypercrud_client.resolve(communities, function (communities) { | |
var communities_dom = communities.data.map(function (community) { | |
return hypercrud_client.resolve(community, function (community) { | |
return <li>{community.data["community/name"]</li>; | |
}); | |
}); | |
return <ul>{communities_dom}</ul>; |