Skip to content

Instantly share code, notes, and snippets.

@pjstadig
pjstadig / gist:4585215
Last active December 11, 2015 10:09 — forked from hiredman/gist:4583350
(defn indent-as-defun []
""
(interactive)
(let [s (symbol-at-point)]
(put-clojure-indent s 'defun)))
(use '(clojure.contrib monads str-utils))
(defn tag* [the-tag & attrs]
(let [attrs (map (fn [[k v]]
(format "%s=\"%s\"" (name k) v)) (partition 2 attrs))
opening (apply str "<" the-tag (when (seq attrs) " ") (concat attrs [">"]))
closing (str "</" the-tag ">")]
{:opening opening
:closing closing}))
;; let's create a simple protocol that just returns a number
user> (defprotocol NumberP (number [_]))
NumberP
;; now we'll create an implementation that always returns '1'
user> (deftype One [] NumberP (number [_] 1))
user.One
;; unsurprisingly, this type only has a single static value, which wraps the '1'
> (-> One .getDeclaredFields seq)
function rm () {
local path
for path in "$@"; do
# ignore any arguments
if [[ "$path" = -* ]]; then :
else
local dst=${path##*/}
# append the time if necessary
while [ -e ~/.Trash/"$dst" ]; do
dst="$dst "$(date +%H-%M-%S)
@pjstadig
pjstadig / .gitconfig
Created September 5, 2013 12:08 — forked from gnarf/..git-pr.md
[alias]
pr = "!f() { git fetch -fu origin refs/pull/$1/head:pr/$1; } ; f"
prr = "!f() { git fetch -fu $1 refs/pull/$2/head:pr/$2; } ; f"
pru = "!f() { git fetch -fu upstream refs/pull/$1/head:pr/$1; } ; f"
pr-clean = "!git for-each-ref refs/heads/pr/* --format='%(refname)' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done"

Rich Hickey on becoming a better developer

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

  • Knowledge
  • Focus