Skip to content

Instantly share code, notes, and snippets.

Peter Ullah pjullah

Block or report user

Report or block pjullah

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pjullah
pjullah / ring.clj
Created Jul 13, 2017
Example of ring middleware
View ring.clj
(defn one
[handler]
(println "handler one")
(fn [request]
(println "request one")
(handler request)))
(defn two
[handler]
(println "handler two")
View vim_cheat_sheet
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 Jun 12, 2017
Generate some CSV data for testing
View generate_csv.bash
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 Jun 8, 2017
Cheat sheet for vim fireplace
View vim_fireplace_cheat_sheet.md

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 Aug 22, 2017
Notes on Clojurescript
View clojurescript_notes.cljs
; 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
The Little Schemer
View chapter_3.clj
(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
View chapter_1.clj
(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
Some notes about React, Router, Redux, Thunk etc
View react_notes.md

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 Jun 20, 2017
Notes of Clojure function usage
View n.clj
; construct a map, using the keys from one vector, and the values from another
(zipmap keys vals)
You can’t perform that action at this time.