Skip to content

Instantly share code, notes, and snippets.

View runexec's full-sized avatar

Ryan Kelker runexec

View GitHub Profile
@runexec
runexec / git-snapshot-ignore.sh
Created May 23, 2022 10:40
Git Snapshot Nothing Hidden
find ./ -type d -maxdepth 1 -iname '.*' -exec echo {}/* \; | sed s/\\.\\///g | sed s/^\\/\\*//g > .gitignore
git add .gitignore
git add .
# Arch Linux Install dpkg
yaourt -S dpkg
# Fetch Latest
wget -O latest.html -k https://downloads.iridiumbrowser.de/ubuntu/pool/main/i/iridium-browser/
# Find AMD64 Packages
(defn object->clj
"My personal utility for converting NodeJS objects.
Somtimes js->clj doesn't work..."
[object]
(let [props (.keys js/Object object)
ret (transient {})]
(amap props
idx
_
(let [prop (aget props idx)]
@runexec
runexec / repl.clj
Created April 12, 2015 09:28
ClojureScript NodeJS Repl - Compatible with CIDER
(require
'[cljs.repl :as repl]
'[cljs.repl.node :as node])
(compile 'cljs.repl.node)
(repl/repl* (node/repl-env)
{:output-dir "out"
:optimizations :none
:cache-analysis true
@runexec
runexec / websocket-path-resolution.cljs
Created February 4, 2015 08:04
Websocket Path Resolution in ClojureScript.
(defn current-web-port []
(as-> js/document x
(-> x .-URL str)
(or (re-find #":(\d+)/" x)
(re-find #":(\d+)" x))
(or (last x) 80)))
(defn current-domain [] (.-domain js/document))
(defn websocket-path [& [path]]
@runexec
runexec / clojure-style-string-conversion.md
Last active August 29, 2015 14:12
Clojure style string conversion

Clojure Style String Conversion

(def example-str "anExampleSTRINGthatCanBeConverted")

(defn conversion-handler [x]
  (let [r clojure.string/replace]
    (-> x        
        (r #"[a-z]{1}[A-Z]{1}"
 (fn [x]
@runexec
runexec / Om Does Frontend Better.cljs.md
Last active January 23, 2018 17:09
Om and React.js Does It Better

Om and React.js Does It Better

A hopefully short and concise explanation as to how Om/React.js works. This probably isn't for you if you already use ClojureScript or Om.

The front end and JavaScript God known as David Nolen created a ClojureScript library called Om. Om is a front end library that uses React.js and makes web MVC not just obsolete, but an anti-pattern.

In Om there's just the data and the view.

  1. data =>
@runexec
runexec / Clojure Does Objects Better.clj.md
Last active June 17, 2020 03:47
Clojure Does Objects Better

Clojure does Objects Better

A hopefully short and concise explanation as to how Clojure deals with Objects. If you already write Clojure, this isn't for you.

You know what an Interface is if you write/read Java or PHP 5+. In Clojure it might be called defprotocol.

user> (defprotocol IABC
        (also-oo [this])
        (another-fn [this x]))

IABC

@runexec
runexec / clojure-transduce-reduce.md
Last active August 16, 2017 22:11
Clojure's Transducers and Reducers

Transducers and Reducers

Notes and examples of Transducers and Reducers

Reducers

  • Used on collections

  • Eager evaluation only. (not lazy)