Skip to content

Instantly share code, notes, and snippets.

View Conaws's full-sized avatar

Conor White-Sullivan Conaws

View GitHub Profile
@allgress
allgress / reagent_datascript.cljs
Last active February 16, 2023 21:16
Test use of DataScript for state management of Reagent views.
(ns reagent-test.core
(:require [reagent.core :as reagent :refer [atom]]
[datascript :as d]
[cljs-uuid-utils :as uuid]))
(enable-console-print!)
(defn bind
([conn q]
(bind conn q (atom nil)))
@olierxleben
olierxleben / fish tree function
Created April 26, 2014 05:56
tree printing terminal command for fish shell
function tree
find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
end
@alandipert
alandipert / maptemplate.md
Created January 30, 2013 00:28
ClojureScript macros: kinda, sorta, not really.

ClojureScript macros: kinda, sorta, not really.

ClojureScript does not have a standalone macro system. To write ClojureScript macros, one must write them in Clojure and then refer to them in ClojureScript code. This situation is workable, but at a minimum it forces one to keep ClojureScript code and the macros it invokes in separate files. I miss the locality of regular Clojure macros, so I wrote something called maptemplate that gives me back some of what I miss. The technique may be useful in other scenarios.

Problem

Suppose you're wrapping functionality in another namespace or package so that you can have your own namespace of identically named but otherwise decorated functions:

ClojureScript:

@jackrusher
jackrusher / gist:3182488
Created July 26, 2012 14:49
Fetching PDF text with attributes in Clojure using PDFBox
(ns pdfbox.core
(:import [org.apache.pdfbox.pdmodel PDDocument]
[org.apache.pdfbox.util PDFMarkedContentExtractor TextPosition]
[java.util ArrayList]))
(defn parse-pdf [filename]
(let [pages (.getAllPages (.getDocumentCatalog (PDDocument/load filename)))
textpool (ArrayList.)
extract-text (proxy [PDFMarkedContentExtractor] []
(processTextPosition [text]
@iloveitaly
iloveitaly / graffle2hash.rb
Created December 16, 2011 18:34
Convert Hierarchical OmniGraffle Document to JSON
#!/usr/bin/env ruby
# rubycocoa
require 'osx/cocoa'
include OSX
OSX.require_framework 'ScriptingBridge'
class GraffleConverter
def initialize
@graffle = SBApplication.applicationWithBundleIdentifier_("com.omnigroup.OmniGraffle")