Skip to content

Instantly share code, notes, and snippets.

@geraldodev
geraldodev / helix-autocomplete.cljs
Last active Nov 27, 2020
Thin layer over mui autocomplete.
View helix-autocomplete.cljs
(ns app.helix_autocomplete
(:require
["@material-ui/lab/Autocomplete" :default Autocomplete]
["@material-ui/core/TextField" :default TextField]
["react" :as r]
[goog.object :as gobj]
))
(defnc AutocompleteHelix
@geraldodev
geraldodev / mui-autocomplete.cljs
Created Nov 20, 2020
mui Autocomplete with helix. The render-input node needs to be created with plain react
View mui-autocomplete.cljs
(ns app.ui.contratualizacao.regra
(:require
["@material-ui/lab/Autocomplete" :default Autocomplete]
["@material-ui/core/TextField" :default TextField]
["react" :as r]
[goog.object :as gobj]
))
($ ^:native
Autocomplete
@geraldodev
geraldodev / hooks.cljs
Last active Oct 6, 2020
extracted from helix zulip chat from a message of wilkerlucio
View hooks.cljs
(ns app.util.hooks
(:require
["react" :refer [useState]]
))
(defn use-state
"A simple wrapper around React/useState. Returns a cljs vector for easy destructuring"
[initial-value]
(into-array (useState initial-value)))
@geraldodev
geraldodev / diff_excel_template.diff
Created Jun 16, 2020
;; dependencias de excel-templates joda-time/joda-time {:mvn/version "2.7"} org.clojure/data.zip {:mvn/version "0.1.1"} org.apache.poi/ooxml-schemas {:mvn/version "1.4"} ;; era 1.1 org.apache.commons/commons-lang3 {:mvn/version "3.4"}
View diff_excel_template.diff
diff build.clj ~/projetos/api/src/main/excel_templates/build.clj
6c6
< [org.apache.poi.ss.usermodel Cell Row DateUtil WorkbookFactory]
---
> [org.apache.poi.ss.usermodel Cell Row Row$MissingCellPolicy DateUtil WorkbookFactory CellType]
50c50
< (= (.getCellType cell) Cell/CELL_TYPE_FORMULA))
---
> (= (.getCellType cell) CellType/FORMULA))
63c63
View material_ui_helix.cljs
(ns app.renderer.core
(:require
["@material-ui/core" :refer [AppBar Toolbar Badge Hidden IconButton]]
["@material-ui/core/Button" :default Button]
["@material-ui/core/styles" :refer [createMuiTheme makeStyles ThemeProvider]]
["react-dom" :as rdom]
[app.renderer.myhelix :refer [defnc]]
[helix.core :as hx :refer [$ <>]]
[helix.dom :as d]
))
@geraldodev
geraldodev / denfc_input.clj
Created May 24, 2020
why defnc bean property is not interoperable with helix.dom ?
View denfc_input.clj
(ns app.ui.tw
(:require
["react" :as r]
["react-dom" :as rdom]
["react-hook-form" :as rhf]
["react-router-dom" :as rr]
[app.myhelix :refer [defnc]]
[helix.core :as hx :refer [$ <>]]
[helix.dom :as d]
[helix.hooks :as hooks]
View wrap-enforce-roles.clj
(defn wrap-enforce-roles [handler]
(fn [{::keys [roles request-method] :as request}]
(let [required (some-> request (ring/get-match) :data request-method ::roles)]
(if (and (seq required) (not (set/subset? required roles)))
{:status 403, :body "forbidden"}
(handler request)))))
View malli_zipper.clj
(ns app.malli-teste
(:require
[clojure.zip :as z]
[clojure.pprint :refer [pprint]]
[malli.core :as m]
[malli.util :as mu]
[malli.error :as me]
))
(defn make-malli-node
View hooks.cljs
(defnc App
[]
(j/let [[state set-state] (hooks/use-state {} )
^:js {:keys [register
handleSubmit
watch
errors] :as obj} (rhf/useForm)]
; (.log js/console obj)
; (.log js/console (type state))
(d/form
View into_com_transducer.clj
(ns into-com-transducer
[criterium.core :refer [bench]])
; coloque no deps.dn
; criterium {:mvn/version "0.4.5"}
(def campo-exemplo
#:columninfo{:remarks "COMPET�NCIA FINAL",
:is_autoincrement "NO",
:column_size 6,