Skip to content

Instantly share code, notes, and snippets.

View bonkydog's full-sized avatar

Brian Jenkins bonkydog

  • Nubank
  • SF Bay Area
View GitHub Profile
@bonkydog
bonkydog / datomic_attribute_type_query.clj
Created January 17, 2014 18:27
Query for Datomic attribute types. Shows use of anonymous function literal in query.
d.q('[:find ?e ?ident ?doc
:where
[?e :db/doc ?doc]
[?e :db/ident ?ident]
[(#(clojure.core/re-find #"db.type" (str %)) ?ident)]
]')
@bonkydog
bonkydog / focus-hooks.patch
Created November 17, 2013 17:54
Elisp hooks for gain and loss of focus.
diff --git a/src/frame.c b/src/frame.c
index 4494edda..6c89b7e 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -109,6 +109,8 @@ Lisp_Object Qalpha;
Lisp_Object Qface_set_after_frame_default;
+static Lisp_Object Qfocus_in_hook;
+static Lisp_Object Qfocus_out_hook;
http://en.wikipedia.org/wiki/My_Dinner_with_Andre
http://en.wikipedia.org/wiki/Jerzy_Grotowski
http://www.paratheatrical.com/orientation.html
http://www.amazon.com/Promethea-Book-1-Alan-Moore/dp/1563896672
http://www.amazon.com/The-Book-SubGenius-Sacred-Teachings/dp/0671638106
http://www.amazon.com/Consider-Phlebas-Culture-Iain-Banks/dp/031600538X
http://www.amazon.com/Player-Games-Culture-Iain-Banks/dp/0316005401
http://www.amazon.com/Jack-Faust-Michael-Swanwick/dp/0380974444/
@bonkydog
bonkydog / emacs-toolbar-default-off
Last active December 27, 2015 12:59
Make Emacs toolbar off by default and fix toolbar-always-on-in-fullscreen bug. When I start up emacs 24.3 (built with brew install emacs --cocoa), it does this annoying little dance where the window starts up with the toolbar. Then it gets to the part of my .emacs file where I turn the toolbar off. This makes the upper edge of the window do this…
diff --git a/src/frame.c b/src/frame.c
index 14e8fab..52a4304 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -4491,7 +4491,7 @@ See the command `tool-bar-mode' for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node `Easy Customization')
or call the function `tool-bar-mode'. */);
-#ifdef HAVE_WINDOW_SYSTEM
+#ifdef I_WANT_THE_TOOLBAR_ON_BY_DEFAULT
@bonkydog
bonkydog / pre-commit
Created November 3, 2013 21:38
Remove Before Flight git pre-commit hook script. Install as .git/hooks/pre-commit
#!/bin/sh
PAGER=''
cd $GIT_DIR/..
if git grep --cached --quiet RBF;
then
echo '\naborting commit due to RBF tag:\n'
git grep --cached RBF
@bonkydog
bonkydog / oz-save-and-feed.el
Created September 7, 2013 19:38
Save and feed the current file to Oz compiler
(defun oz-save-and-feed-current-file ()
"Save the current file and feed it to the Oz Compiler"
(interactive)
(save-buffer)
(oz-feed-file buffer-file-name))
(global-set-key (kbd "<f12>") 'oz-save-and-feed-current-file)
In shell:
export RUBYLIB=/Applications/RubyMine.app/rb/testing/patch/common:/Applications/RubyMine.app/rb/testing/patch/bdd
spring rspec spec/ # to launch spring server
In Rubymine:
Uncheck bundler
Select custom runner script as spring_rspec.rb
add same variable to environment variables:
RUBYLIB=/Applications/RubyMine.app/rb/testing/patch/common:/Applications/RubyMine.app/rb/testing/patch/bdd
@bonkydog
bonkydog / object_dump.js
Created July 22, 2013 21:36
dump javascript object properties
// uses underscore.js
_(Object.keys(ajaxArguments.files[0])).sort().map(function(k) { var v; try {v = ajaxArguments.files[0][k]; } catch (e) { v = "[EXCEPTION]"}; return k + "=" + v })
@bonkydog
bonkydog / web.bash
Created July 6, 2013 16:22
webserver ruby one-liner
ruby -run -e httpd . -p5000
@bonkydog
bonkydog / read_edn_request.clj
Created May 9, 2013 18:04
Read an EDN request body (from a liberator context https://github.com/clojure-liberator)
(def model-readers {'tektite.model.design.Design #'tektite.model.design/map->Design})
(defn read-edn-body [context]
(clojure.edn/read {:readers model-readers, :eof nil}
(java.io.PushbackReader.
(java.io.InputStreamReader.
(get-in context [:request :body])
"UTF-8"))))