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 is your Prisma schema file, | |
// learn more about it in the docs: https://pris.ly/d/prisma-schema | |
datasource db { | |
provider = "postgres" | |
url = env("DATABASE_URL") | |
} | |
generator client { | |
provider = "prisma-client-js" |
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
{:paths ["."] | |
:deps {clansi {:mvn/version "1.0.0"}}} |
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
rules_version = '2'; | |
service cloud.firestore { | |
match /databases/{database}/documents { | |
match /rooms/{roomId} { | |
allow get | |
allow create: if | |
request.resource.data.keys().hasOnly(['hostId', 'timestamp']) && | |
request.resource.data.hostId == request.auth.uid && | |
request.resource.data.timestamp == request.time | |
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 useReconciler [reconciler effect-handler initial-state] | |
(let [[state&effects set-state] (react/useState {:state initial-state}) | |
[state effects] ((juxt get dissoc) state&effects :state) | |
dispatch (uix/callback | |
(fn [action] (set-state (fn [{:keys [state]}] (merge {:state state} (reconciler state action))))) | |
[reconciler])] | |
(uix/effect! | |
(fn [] | |
(when-not (empty? effects) | |
(doseq [effect effects :let [[type payload] effect]] |
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
Array.prototype.chunk = function (groupsize) { | |
var sets = []; | |
var chunks = this.length / groupsize; | |
for (var i = 0, j = 0; i < chunks; i++, j += groupsize) { | |
sets[i] = this.slice(j, j + groupsize); | |
} | |
return sets; | |
}; | |
var interleave = (a1, a2) => { |
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
import React from 'react'; | |
import './App.css'; | |
const actionType = { | |
SHOW: "show", | |
HIDE: "hide" | |
} | |
function reducer(state, action) { |
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 is an example on how to use the library | |
import React from 'react'; | |
// This is the hook | |
function useReducerWithEffects(reducer, handlers, initialState) { | |
const [{ state, ...effects }, setState] = React.useState({ state: initialState }) | |
const dispatch = React.useCallback(action => setState(({ state }) => ({ state, ...reducer(state, action) })), [reducer]) | |
React.useEffect(function () { |
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 reducer-context.core | |
(:require ["react" :as react :rename {createElement $}] | |
["react-dom" :as dom] | |
[goog.object :as obj])) | |
(extend-type object | |
ILookup | |
(-lookup | |
([o k] (obj/get o (name k))) | |
([o k not-found] (obj/get o (name k) not-found)))) |
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 react.wrapper | |
#?(:cljs (:require ["react" :as react] | |
[goog.object :as obj]))) | |
#?(:cljs | |
(defn component [display-name render] | |
(let [f (fn [props] (apply render (obj/get props "value"))) | |
m (react/memo f #(= (obj/get %1 "value") (obj/get %2 "value")))] | |
(obj/set f "displayName" display-name) |
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 example.app | |
(:require | |
["expo" :as ex] | |
["react-native" :as rn] | |
["react" :as react :rename {createElement $}] | |
[shadow.expo :as expo])) | |
(defn useEffectiveReducer [reducer handlers initial-state] | |
(let [[state set-state] (react/useState initial-state) | |
[queue update-queue] (react/useReducer (fn [state action] (action state)) []) |
NewerOlder