Skip to content

Instantly share code, notes, and snippets.

Re-Clojure Conf

Growing Mobile Apps with ClojureScript and React Native - Dan Neal

  • Use Expo for React Native
  • Shadow-cljs
    • npm libs are easier to use
    • simple config
    • e.g. for externs {:infer-externs :auto}
  • Use tachyons for design
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Strategy
Pae White's non-blank graphic metacard
Make it more sensual
Do the words need changing?
Remember those quiet evenings
Spectrum analysis
Take away the important parts
Honour thy error as a hidden intention
Repetition is a form of change
Emphasise repetitions
(defmulti multimethod
(fn [opt-one opt-two] opt-one))
(defmethod multimethod :path-one [_ opts]
(println (:first-opt opts)))
(defmethod multimethod :path-two [_ opts]
(println (:second-opt opts)))
(multimethod :path-one {:first-opt 1
@the-frey
the-frey / indenting.el
Created September 5, 2019 11:33
Some stuff for indenting properly
;; adapted from http://blog.binchen.org/posts/easy-indentation-setup-in-emacs-for-web-development.html
(defun setup-indent (n)
;; java/c/c++
(setq-local c-basic-offset n)
;; web development
(setq-local coffee-tab-width n) ; coffeescript
(setq-local javascript-indent-level n) ; javascript-mode
(setq-local js-indent-level n) ; js-mode
(setq-local js2-basic-offset n) ; js2-mode, in latest js2-mode, it's alias of js-indent-level
;; example vector
(def test-vec [["1" "foo"]["2" "bar"]])
;; via reduce, the verbose way
(reduce (fn [acc i] (assoc acc (first i) (second i))) {} test-vec)
;; also via reduce, the terse way
(reduce conj {} test-vec)
;; via a handy built-in

We need to do more with object-oriented classes. Programming needs to become simpler – not harder. It needs to make objects do the nitty-gritty work. It needs to de-geek itself and become user-friendly in the extreme. It needs to do away with the acronyms. It should be more like BASIC, with objects that extend its usefulness to the max. Saving, opening, reading and resaving any file should be built in. Access to changing pixels and saving them in any lossless format (and every format should be lossless) should be easy. Pixel colors should be assigned numbers with a base of 256 in which to both read them and write them with. Going to a specific address, to use the data there, should instead take the form of nesting data in arrays. We need IDEs a 10-year-old could easily learn. We need to do away with the run line. Everything needs to be simplified. That is the idea of using higher level languages in the first place. The fact is, we need more programmers and we’re not getting enough of them. There is also anoth

#!/bin/sh
# see https://gist.github.com/dergachev/4627207
ffmpeg -i in.mov -s 1200x800 -pix_fmt rgb8 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > out.gif
@the-frey
the-frey / profiles.clj
Created June 18, 2019 09:33
REPL funtimes
;; in ~/.lein/profiles.clj
{:nrepl {:dependencies [[cider/cider-nrepl "0.21.1"]]
:plugins [[cider/cider-nrepl "0.21.1"]
[org.clojure/tools.nrepl "0.2.13"]
[refactor-nrepl "2.4.0" :exclusions [org.clojure/clojure]]]}}
;; to use in terminal
;; $ lein with-profile +nrepl repl
@the-frey
the-frey / serverless_workshop.md
Last active March 23, 2021 22:52
Clojurescript Serverless Workshop

Goal

The goal is:

  • To deploy a serverless application to AWS
  • To see the REPL-based workflow in action for a CLJS project
  • To build a mini-API

Note to instructors: periodically stop and make sure people are following along with a show of hands. Help out where needed.

You should know in advance that I have a bias towards hacker and maker culture as having shared roots in creativity and creative thinking; that I like love functional programming, and I think that somehow (at least in the UK) in the software engineering game we manage to simultaneously do down both the importance of strong tech skills and of strong people skills (sigh). Both of these skills can be learned, as can, well, pretty much anything if you're a true hacker. Anyway.

The most important stuff

This is the basics for working in a professional context. Your side hacks are largely a different game entirely.

  • In terms of bang for buck, Apprenticeship Patterns by Adewale Oshineye and Dave Hoover is the book I've gone back to the most over the years. Crucially, if you don't want to splash the cash, it's available for free at that link.
  • 'Agile' is largely a cult for overpriced consultants, but you should read [the o