Skip to content

Instantly share code, notes, and snippets.

@facundoolano
facundoolano / clj->cljs.md
Last active November 21, 2016 22:30
clj->cljs
@facundoolano
facundoolano / server.erl
Last active June 12, 2017 14:03
universal server
-module(server).
-export([start/0]).
-export([become/1]).
-export([shutdown/0]).
-export([request/1]).
-export([ping/1]).
-export([factorial/1]).
-export([sum/1]).
@facundoolano
facundoolano / avatar.png
Last active October 10, 2017 02:18
clojure meetup re-frame
avatar.png
@facundoolano
facundoolano / webrtc.md
Last active May 16, 2019 12:58
webrtc.md

WebRTC

WebRTC is a free, open project that provides browsers and mobile applications with Real-Time Communications (RTC) capabilities via simple APIs. It's supported by most major browsers (except Safari).

WebRTC APIs

To acquire and communicate streaming data, WebRTC implements the following APIs:

  • MediaStream: get access to data streams, such as from the user's camera and microphone.
@facundoolano
facundoolano / navigation.clj
Created December 4, 2017 14:50
navigation.clj
(def panels {:panel1 [panel1]
:panel2 [panel2]})
(defn high-level-view
[]
(let [active (re-frame/subscribe [:active-panel])]
(fn []
[:div
[:div.title "Heading"]
(get panels @active)])))
@facundoolano
facundoolano / navigation2.clj
Created December 4, 2017 14:51
navigation2.clj
(re-frame/reg-event-fx
:navigate
(fn [{:keys [db]} [_ new-view]]
{;; trigger the load-view event in case data from the server is required
:dispatch [:load-view new-view]
;; update the browser history API and switch to the given view
:set-history new-view
;; set the current view in the app-db so the dom is updated
:db (assoc db
:loading-view? true
@facundoolano
facundoolano / forms.clj
Created December 4, 2017 14:52
forms.clj
[forms/form-view {:submit-text "Register"
:on-submit [:register-submit]
:fields [{:key :email
:type "email"
:validate :valid-email?
:required true}
{:key :password
:type "password"
:required true}
{:key :password-repeat
@facundoolano
facundoolano / forms2.clj
Created December 4, 2017 14:52
forms2.clj
(re-frame/reg-sub
:valid-required?
(fn [db [_ value]]
(if (string/blank? value)
[false "This field is required."]
[true])))
(re-frame/reg-sub
:valid-form?
(fn [[_ form fields]]