Skip to content

Instantly share code, notes, and snippets.

View joshcho's full-sized avatar

Josh Cho joshcho

View GitHub Profile
@joshcho
joshcho / relay-atom.cljc
Last active April 2, 2024 08:56
Implement optimistic update for atoms in Electric
;; This is free and unencumbered software released into the public domain.
;;
;; Anyone is free to copy, modify, publish, use, compile, sell, or
;; distribute this software, either in source code form or as a compiled
;; binary, for any purpose, commercial or non-commercial, and by any
;; means.
;;
;; In jurisdictions that recognize copyright laws, the author or authors
;; of this software dedicate any and all copyright interest in the
;; software to the public domain. We make this dedication for the benefit
@joshcho
joshcho / relay-example.cljc
Last active August 7, 2023 04:40
A simple example of optimistic bidirectional updates in Electric
(ns relay.example
#?(:cljs (:require-macros [app.push :refer [make-relay]]))
(:require
#?(:clj [datascript.core :as d])
[hyperfiddle.electric :as e]))
#?(:clj
(defmacro make-relay
"Make `ref` into a client-side relay atom. The relay atom does bidirectional updates with the server,
indicated by server-value (the flow) and server-effect (the client to server update). The server to
@joshcho
joshcho / reactive_render.cljc
Last active January 5, 2024 06:02
Delight, Generating Interactive Controls over Electric Code
;; This is free and unencumbered software released into the public domain.
;;
;; Anyone is free to copy, modify, publish, use, compile, sell, or
;; distribute this software, either in source code form or as a compiled
;; binary, for any purpose, commercial or non-commercial, and by any
;; means.
;;
;; In jurisdictions that recognize copyright laws, the author or authors
;; of this software dedicate any and all copyright interest in the
;; software to the public domain. We make this dedication for the benefit
@joshcho
joshcho / adblock-options.txt
Created October 22, 2016 18:30
Adblock Options
github.com##DIV[class="news column two-thirds"]
github.com##DIV[class="boxed-group js-repo-filter flush"]
www.quora.com##DIV[id="__w2_wvTBZNX__truncated"][class="SimpleToggle Toggle HomeMainFeed"]
www.quora.com##DIV[class="SimpleToggle Toggle HomeMainFeed"]
www.quora.com##A[class="nav_item_link selected"]
www.quora.com##DIV[class="EditableList HomeNavList NavList"]
www.quora.com##DIV[class="EditableList TrendingTopicsNavList NavList"]
www.quora.com##DIV[class="EndorseByTopicSidebar ActivationSidebar"]
www.facebook.com##DIV[id="u_0_0"][class="_4-u2 _5v6e cardRightCol _4-u8"]
www.facebook.com##DIV[id="u_0_q"][class="_64b fixed_elem"]