Skip to content

Instantly share code, notes, and snippets.

@pjullah
pjullah / tmux.sh
Created September 5, 2017 15:23
tmux
ctrl-b
d - detach
@pjullah
pjullah / ring.clj
Created July 13, 2017 16:13
Example of ring middleware
(defn one
[handler]
(println "handler one")
(fn [request]
(println "request one")
(handler request)))
(defn two
[handler]
(println "handler two")
shift P # paste before cursor position
v # select range of text
# comment a visual selection
ctrl-v
select lines
shift-i
type character
esc - wait a second
@pjullah
pjullah / generate_csv.bash
Created June 12, 2017 16:12
Generate some CSV data for testing
for i in {1..999}; do printf '%s\n' "row ${i}" "2011-03-11" ${i} true | paste -sd "," - ; done > data.csv
@pjullah
pjullah / vim_fireplace_cheat_sheet.md
Created June 8, 2017 09:56
Cheat sheet for vim fireplace

fireplace

  • cpr => (require ... :reload)
  • cpR => (require ... :reload-all)

Evaluation

  • :Eval (clojure code) => runs (clojure code) in repl
  • cpp => evaluate inn-most expessions under cursor
  • cp<movement> => evaluate text described by <movement>
  • cqp => opens quasi-repl
  • cqc => quasi-repl command line window
@pjullah
pjullah / clojurescript_notes.cljs
Last active September 16, 2021 07:26
Notes on Clojurescript
; Clojure strings are Javascript strings
(def s "This is a string")
; Can access Javascript functions, using dot-prefixed notation
(.toUpperCase s)
; To retrieve an object property
(.-length s)
; Javascript supports method-chaining. To accomplish the same in Clojurescript we would nest the function calls, or better still
@pjullah
pjullah / chapter_3.clj
Created May 23, 2017 13:57
The Little Schemer
(ns the-little-schema.core)
;;; Chapter 3 - Cons the magnificent
;; 1. Always ask null? as the first question in expressing any function
;; 2. Use cons to build lists
;; 3. When building a list, describe the first typical
;; element, and then cons in onto the natural recursion
@pjullah
pjullah / chapter_1.clj
Created May 23, 2017 13:53
Clojure Applied
(ns clojure-applied.core)
; define a map - values can be looked up in near constant time.
(def earth {
:name "Earth"
:moons 4
:volume 1.083
:mass 5.972
:type :Planet
})
@pjullah
pjullah / react_notes.md
Last active May 19, 2017 13:18
Some notes about React, Router, Redux, Thunk etc

ReactRouter.withRouter injects route information into wrapped component props.

render() { const { match, location, history } = this.props
const Component = withRouter(Component)

Redux-thunk

@pjullah
pjullah / n.clj
Last active June 20, 2017 10:08
Notes of Clojure function usage
; construct a map, using the keys from one vector, and the values from another
(zipmap keys vals)