Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
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
# coding: utf-8 | |
require 'sinatra' | |
set server: 'thin', connections: [] | |
get '/' do | |
halt erb(:login) unless params[:user] | |
erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
end | |
get '/stream', provides: 'text/event-stream' do |
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
/** | |
* `Ember.MergedArray` is an array that observes multiple other arrays (called source arrays) for changes and includes | |
* all items from all source arrays in an efficient way. | |
* | |
* Usage: | |
* | |
* ```javascript | |
* var obj = Ember.Object.create({ | |
* people: [ | |
* { |
This gist has moved to a proper git repo so people can make pull requests: https://github.com/Zenexer/internet-reference/blob/main/Internet%20Slang%20and%20Emoticons.md
-
Kinesis Freestyle (Terrible key switches. Mushy and un-lovable)
-
Kinesis Freestyle Edge (Traditional layout with too many keys, mech switches, proably too big to be tented easily/properly)
-
Matias Ergo Pro (Looks pretty great. Have not tried.)
-
ErgoDox Kit (Currently, my everyday keyboard. Can buy pre-assembled on eBay.)
-
ErgoDox EZ (Prolly the best option for most people.)
Objectives/approach
- Load config conditionally, based on a release flag passed in at the command line. We use juxt/aero to read a static
config.edn
file, passing in the release flag as aero's:profile
. - Config should be exposed at runtime (in the browser / cljs) and macro-expansion time (clj). We store config in a plain map,
app.env/config
. Our build hook,app.build/load-env
, updates this usingalter-var-root!
. - Whenever config has changed, shadow-cljs must invalidate its caches so that changes are picked up immediately. We do this in
app.build/load-env
by putting the current environment in the shadow build state, under[:compiler-options :external-config ::env]
.
Why this approach?
- Reading config directly from macros breaks compiler caching - changing config will not cause changes to propagate to the build.
:clojure-defines
(ie.goog-define
) are not exposed inclj
, & therefore can't be used by macros. We want one single way to expose config that
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
Show hidden characters
{ | |
"compilerOptions": { | |
"plugins": [ | |
{ | |
"name": "@unsplash/ts-namespace-import-plugin", | |
"namespaces": { | |
"A": { | |
"importPath": "fp-ts/Array" | |
}, | |
"B": { |