Skip to content

Instantly share code, notes, and snippets.

💭
Happy prototyping with ClojureScript

Jon jiyinyiyong

View GitHub Profile
@jiyinyiyong
jiyinyiyong / pudica-history.edn
Created Mar 28, 2019
Old history data from Pudica Viewer
View pudica-history.edn
{:states {},
:router {:name :viewer},
:content {:tasks {"S1z3WZSk7X" {:id "S1z3WZSk7X",
:text "没有尾递归的介绍",
:done? false,
:sort-id "T",
:created-time 1531035908457,
:done-time nil,
:archived-time nil},
"W6GwOL21l" {:id "W6GwOL21l",
@jiyinyiyong
jiyinyiyong / slide.md
Last active Sep 17, 2018
cljs intro in FCC
View slide.md

ClojureScript 的开发体验(演示)


自我介绍

View browser-file-tree.text
.
├── README.md
├── assets
│ └── index.html
├── package.json
├── shadow-cljs.edn
├── src
│ └── app
│ ├── lib.cljs
│ └── main.cljs
View cljs-slide.md

函数式语言 ClojureScript 在前端开发的体验


Me

题叶, ChenYong, 上海

Teambition, 饿了么, 积梦智能(工业大数据).

@jiyinyiyong
jiyinyiyong / orthogonality.text
Created Apr 12, 2018
Find a orthogonality vector based on two existing vectors
View orthogonality.text
line1 = a*i + b*j + c*k
line2 = d*i + e*j + f*k
line3 = x*i + y*j + z*k
line1 .* line3 = ax + by + cz = 0
line1 .* line3 = dx + ey + fz = 0
z = -(ax + by)/c
View resources.md

"

ClojureScript and Clojure

ClojureScript and Clojure share the same syntax but distinguish by .cljs extension name. The most different part is the difference in host platforms, like JavaScript is known as single-threaded and restricted by browser APIs.

Libraries of both sides release code on Clojars in jar files.

ClojureScript and npm

With JavaScript InterOp, you may call some JavaScript code from in Clojure syntax. ClojureScript is designed to use features from host platform. You are free to import npm modules in ClojureScript, most of them will work correctly, especially in shadow-cljs and Lumo.

@jiyinyiyong
jiyinyiyong / any-op.coffee
Created Apr 4, 2018
Hijack `get`, `set` and `apply`, then everything is a lie...
View any-op.coffee
createAny = (path, collector) ->
new Proxy (->),
get: (target, key, receiver) ->
createAny path.concat([key]), collector
set: (target, key, value, receiver) ->
newPath = path.concat [key]
collector ['set', newPath, value]
apply: (target, ctx, args) ->
collector ['apply', path, args]
View lumo-cljs.md

|Lumo is a standalone ClojureScript environment that runs on Node.js and the V8 JavaScript engine. It starts up instantaneously and has out-of-the-box access to the entire Node.js ecosystem.

To install:

$ brew install lumo
# or
$ npm install -g lumo-cljs
View shadow-cljs.md

Easy to install

shadow-cljs can be installed from npm as command-line tool. JVM installation is required, but shadow-cljs handles configurations for you.

npm install -g shadow-cljs
# or
yarn global add shadow-cljs
@jiyinyiyong
jiyinyiyong / page.md
Last active Mar 18, 2018
Respo home page drafts
View page.md

|Create elements in Clojure syntax:

(div {:class-name "demo"
      :style {:color :red
              :font-size 16
              :font-family "Josefin Sans"}
      :on-click (fn [event dispatch! mutate!])})

; respo.macros/div
You can’t perform that action at this time.