Skip to content

Instantly share code, notes, and snippets.


Jason Gilman jasongilman

View GitHub Profile
View atom_canvas_block_decoration.js
// Paste this into the inspector in Atom.
var element = document.createElement('div')
var canvas = document.createElement("canvas")
element.appendChild(canvas)"width", "100%")"height", "150px")"width", "100%")"height", "100%")"background-color", "white")
jasongilman /
Last active Feb 7, 2022
This describes how I setup Atom for Clojure Development.

Atom Clojure Setup

This describes how I setup Atom for an ideal Clojure development workflow. This fixes indentation on newlines, handles parentheses, etc. The keybinding settings for enter (in keymap.cson) are important to get proper newlines with indentation at the right level. There are other helpers in and keymap.cson that are useful for cutting, copying, pasting, deleting, and indenting Lisp expressions.

Install Atom

Download Atom

The Atom documentation is excellent. It's highly worth reading the flight manual.

View Notes and Commands
# Note (clue): Exact queue size triggering the problem will depend on your available RAM
# Clean, compile, run C program:
rm a.out; cc -O3 -Wpedantic gc.c; time ./a.out 100000
# Clean, compile, run Java program:
rm *.class; javac; time java GC 100000
# Clean, compile, run Java program with verbose GC:
rm *.class; javac; time java -verbose:gc -XX:+PrintGCDetails GC 100000
jasongilman / transparent_functions.clj
Last active Jan 16, 2017
Transparent Functions
View transparent_functions.clj
;; Transparent Functions
;; I was experimenting with transducers and wanted a way to understand how they worked. Transducer
;; code uses many nested functions in various locations with other nested functions defined as local
;; variables in scope. Typically after an anonymous Clojure function is defined you have no visibility
;; into the locals that were in scope when the function was defined, where the function came from,
;; or the code in the function. I defined a macro, tfn, that creates a transparent function. It's
;; a normal Clojure function with additional metadata including the function code and local
;; variable names and values.
View torquebox_backslash_fix_middleware.rb
require 'uri'
# There's a bug in jboss or torquebox where encoded backslashes in URLs are incorrectly converted into forward slashes.
# This is rack middleware that detects when the original request included a backslash and will correct the env variable
# before forwarding it to the other middleware
# See
class TorqueboxBackslashFixMiddleware
jasongilman / multiplier.clj
Created Sep 9, 2012
high order function example
View multiplier.clj
(defn multiplier [n]
(fn [x] (* x n)))
(def doubler (multiplier 2))
(doubler 7)
View incanter_example.clj
(ns clojure_helpers.incanter_helper
(:use (incanter core stats charts)))
(defn view-histogram [values]
(view (histogram values)))
View clojure_example.clj
(def users [{:first-name "William" :last-name "Hudson"}
{:first-name "Ellen" :last-name "Ripley"}
{:first-name "Dwayne" :last-name "Hicks"}
{:first-name "Carter" :last-name "Burke"}])
(def user {:first-name "William" :last-name "Hudson"})
(get :first-name user)
(:first-name user)
jasongilman / jruby_long_line_parse.rb
Created Aug 28, 2012
Demonstrates a JRuby parsing bug with long lines
View jruby_long_line_parse.rb
list = [{"string0"=>"value0"}, {"string1"=>"value1"}, {"string2"=>"value2"}, {"string3"=>"value3"}, {"string4"=>"value4"}, {"string5"=>"value5"}, {"string6"=>"value6"}, {"string7"=>"value7"}, {"string8"=>"value8"}, {"string9"=>"value9"}, {"string10"=>"value10"}, {"string11"=>"value11"}, {"string12"=>"value12"}, {"string13"=>"value13"}, {"string14"=>"value14"}, {"string15"=>"value15"}, {"string16"=>"value16"}, {"string17"=>"value17"}, {"string18"=>"value18"}, {"string19"=>"value19"}, {"string20"=>"value20"}, {"string21"=>"value21"}, {"string22"=>"value22"}, {"string23"=>"value23"}, {"string24"=>"value24"}, {"string25"=>"value25"}, {"string26"=>"value26"}, {"string27"=>"value27"}, {"string28"=>"value28"}, {"string29"=>"value29"}, {"string30"=>"value30"}, {"string31"=>"value31"}, {"string32"=>"value32"}, {"string33"=>"value33"}, {"string34"=>"value34"}, {"string35"=>"value35"}, {"string36"=>"value36"}, {"string37"=>"value37"}, {"string38"=>"value38"}, {"string39"=>"value39"}, {"string40"=>"value40"}, {"string41"
jasongilman / Results
Created Apr 16, 2012
JRuby Concurrency Bug in ShellLauncher
View Results
Starting to modify env
Sleeping 0
Done sleeping 0
Sleeping 1
Exception in thread "RubyThread-1: jruby_bug.rb:4" java.lang.ArrayIndexOutOfBoundsException: 8495
at org.jruby.util.ShellLauncher.getCurrentEnv(
at org.jruby.util.ShellLauncher.popenShared(
at org.jruby.util.ShellLauncher.popenShared(