Skip to content

Instantly share code, notes, and snippets.

View djblue's full-sized avatar

Chris Badahdah djblue

View GitHub Profile
@jeroenvandijk
jeroenvandijk / git.zsh.clj
Last active August 29, 2019 17:16
bash to closh porting examples (https://github.com/dundalek/closh)
(defcmd git [& [dispatch :as args]]
(if (= dispatch "browse")
(let [{:keys [code stderr]
remote-url :stdout} (sh-value "git" "remote" "get-url" "origin")]
(if (zero? code)
(do (println "Opening" remote-url)
(sh "open" (clojure.string/trim remote-url)))
(println stderr)))
(eval `(sh "git" ~@args))))
@ericnormand
ericnormand / 00_script.clj
Last active January 6, 2024 07:13
Boilerplate for running Clojure as a shebang script
#!/bin/sh
#_(
#_DEPS is same format as deps.edn. Multiline is okay.
DEPS='
{:deps {clj-time {:mvn/version "0.14.2"}}}
'
#_You can put other options here
OPTS='
@apropos-cast
apropos-cast / Jan-18-2019-Show-Notes.md
Last active January 18, 2019 05:03
Show notes for Apropos on January 18, 2019.
@hjertnes
hjertnes / doom.txt
Created April 6, 2018 08:28
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch

How Clojure's documentation can leapfrog other languages

Summary

I made a documentation generator that cashes in on Clojure's dynamism. See the play-cljs docs (a ClojureScript game library) for an example of its output.

The Problem

Like many of you, I've often wondered what my final regret will be on my deathbed. My best guess came to me in a dream recently. I was walking across the charred earth of an apocalyptic future world, maneuvering around the remains of the less fortunate. I was startled to find a young girl, barely holding onto her life. She murmured something to me. I asked her to repeat it, and she said more loudly: "I...wish your Clojure projects didn't have such crappy documentation."

@buren
buren / cross-origin-local-storage.js
Created November 1, 2017 10:21
Cross origin local storage sharing example (using an iframe and postMessage)
const CrossOriginLocalStorage = function(currentWindow, iframe, allowedOrigins, onMessage) {
this.allowedOrigins = allowedOrigins;
let childWindow;
// some browser (don't remember which one) throw exception when you try to access
// contentWindow for the first time, it works when you do that second time
try {
childWindow = iframe.contentWindow;
} catch(e) {
childWindow = iframe.contentWindow;
@kirbyUK
kirbyUK / 6502_instructions.json
Created October 17, 2017 15:24
6502 instruction set in JSON
[
{
"bytes" : "2",
"description" : "Add with Carry",
"name" : "ADC",
"opcode" : "$69",
"mode" : "Immediate"
},
{
"opcode" : "$65",
@grillermo
grillermo / .vimrc
Created March 6, 2015 17:50
Ctrlp using ag the silver searcher
"" The Silver Searcher
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" " ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 1, 2024 03:34
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...