------------------------------------------------------------------- | |
--Hammerspoon config to replace Cinch & Size-up (Microsoft Windows style) window management for free | |
--By Jayden Pearse (spartanatreyu) | |
--Sort of messy, forgive me. Never scripted in lua before | |
------------------------------------------------------------------- | |
------------------------------------------------------------------- | |
--Options, feel free to edit these | |
------------------------------------------------------------------- |
(ns myapp.core (:gen-class)) | |
(gen-class | |
:name myapp.Application | |
:extends javafx.application.Application | |
:prefix "myapp-") | |
(defn ^:Private myapp-start | |
"Implements javafx.application.Application.start." | |
[app ^javafx.stage.Stage stage] |
package shim; | |
import clojure.lang.RT; | |
import clojure.lang.Symbol; | |
import clojure.lang.Var; | |
public class Main { | |
public static void main(String[] args) { | |
Var REQUIRE = RT.var("clojure.core", "require"); | |
Var APPLY = RT.var("clojure.core", "apply"); | |
REQUIRE.invoke(Symbol.intern("user")); |
(defn ns-str-shortener | |
([ns-str] ns-str) | |
([ns-str number] | |
(let [length (.length ns-str)] | |
(if (< number length) | |
(let [splitted (.split #"\." ns-str) | |
endi (dec (alength splitted)) | |
short (volatile! false)] | |
(areduce splitted i ret "" | |
(let [j (- endi i) |
A note on terminology: There are a lot of things with similar meanings/use-cases around: subscriptions, reactions, derived atoms, view models.
I'll introduce another to make things even worse: derivative. A derivative implements IWatchable
and it's value is the result of applying a function to the value of other things (sources) implementing IWatchable
. Whenever any of the sources change the value if the derivative is updated.
Let's assume you're hooked about the idea of storing all your application state in a single atom (db
). (Why this is a great idea is covered elsewhere.)
Most of your components don't need the entirety of this state and instead receive a small selection of it that is enough to allow the components to do their job. Now that data is not always a subtree (i.e. (get-in db ...)
) but might be a combination of various parts of your state. To transform the data in a way that it becomes useful for components you can use a function: `(f @
(ns mk.fe.core.why-update | |
(:require [cljsjs.react])) | |
(defn comp-did-update [prev-props prev-state] | |
(this-as this | |
(let [name (or (aget this "displayName") | |
(aget this "constructor" "displayName") | |
(aget this "constructor" "name")) | |
prev-state (aget prev-state ":rum/state") | |
state (aget (.-state this) ":rum/state")] |
This is a full set of key bindings (as of Vimium v1.45); covering all Vimium functionality. I have tried to map all Vimium functionality to comparable Emacs functionality (whenever possible). In cases where there is no equivalent, those commands are prefixed by <c-g>
(indicating <c-g>
oogle Chrome; and because <c-g>
does not conflict with other Emacs shortcuts at all).
Commented Shortcuts: There are a few Emacs-style shortcuts that are simply not possible in Vimium. All of my shortcuts (including those which were not possible; i.e. where I used a decent alternative) have been commented below. This should help to clarify my rationale.
_Compatibility: All of these shortcuts were tested on Mac OS X (Mavericks). Please note that all of my shortcuts operate under the assumption that your Emacs Meta key is the ⌥
Alt/Option key. This really was my only choice, because the ⌘
key is already used in Chrome for shortcuts that c
(let [t (transient [])] | |
(doseq [[k v] (zipmap (range 200) (range 200 400))] | |
(conj! t [k v])) | |
(count t)) |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>Lorem ipsum</title> | |
<style type="text/css"> | |
body { |