Skip to content

Instantly share code, notes, and snippets.

View dantheobserver's full-sized avatar
🤖
I have a mission

dantheobserver dantheobserver

🤖
I have a mission
View GitHub Profile
@dantheobserver
dantheobserver / tachyons.clj
Last active November 10, 2020 03:30
Macro to hopefully make it easier managing utility css libraries like tachyons
(ns tachyons
(:require [clojure.string :as str]))
(defn styles->str [styles]
(let [ref-marker "*"
is-symbol? #(str/starts-with? % ref-marker)
class-or-sym #(cond
(is-symbol? %)
(-> %
name
@dantheobserver
dantheobserver / with_args.clj
Last active June 29, 2019 02:54
macro that given a sequence of values and default binding values evaluates body of form with bindings in args or defaults.
(ns with-args)
;; input
#_(with-args args
[hostname "127.0.0.1" ;; default values if args at position are not provided
port "3030"]
[hostname port])
;; output
#_(let [{hostname 0
;; This seems the fastest output of prettier-eslint_d I've seen, using prettier-eslint-emacs seemd
;; much slower, using the suggested cat | prettier_eslint_d --stdin with the added tee to the output file
;; is much quicker.
(defun user-prettier-eslint ()
"Format the current file with ESLint."
(interactive)
(let* ((binary (executable-find "prettier-eslint_d"))
(command (format "cat %s | %s --stdin | tee %s" buffer-file-name binary buffer-file-name)))
(progn
(shell-command command "*test-buffer*" "*prettier-eslint-errors*")
@dantheobserver
dantheobserver / tmux-cheatsheet.markdown
Created January 8, 2019 00:28 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@dantheobserver
dantheobserver / core.cljs
Created December 4, 2018 00:08 — forked from polymeris/core.cljs
re-frame + reagent + figwheel app running in the console
(ns hello-react-blessed.core
(:require
[cljs.nodejs :as nodejs]
[reagent.core :as reagent]
[re-frame.core :as rf]
[blessed :as blessed] ; or use neo-blessed
["react-blessed" :as rb]
[ws]))
(defonce logger (reagent/atom []))
;; WIP - cycle through buffers only within the existing project
;; MVP
;; * cycle forward and backward
;; *start *next .------- skip ------\ *next
;; --> #<buffer p1> -> #<buffer p2> -/ #<buffer notAproj> `-> #<buffer p3> -.
;; \________________________________________________________________________/
;; if buffer is not a project buffer, do normal buffer nav.
;;
;; Nice to have
;; Possible to only navigate to buffers that aren't open in other split windows
@dantheobserver
dantheobserver / lazy_cons.clj
Last active July 17, 2018 22:28
Data structure Manipulation Examples
(defn some-lazy
([] (some-lazy 1))
([next]
(cons next (lazy-seq
(do (println "getting next")
(some-lazy (inc next)))))))
;; Instead of recur, use the name of the function (e.g. some-lazy) to recur
;; lazy-seq gets turned to a function and recur target would be hidden.
;; Don't hold on to seq returned by some-lazy, only subsets