Skip to content

Instantly share code, notes, and snippets.

Joshua Ballanco jballanc

Block or report user

Report or block jballanc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View spec-cfg.clj
;; warm up: balancing
=> (s/def ::balanced
(s/* (s/cat :open #{'<} :children ::balanced :close #{'>})))
=> (s/conform ::balanced '[< < > < > > < >])
[{:open <, :children [{:open <, :close >} {:open <, :close >}], :close >} {:open <, :close >}]
=> (s/conform ::balanced '[< < > < < > > > < >])
[{:open <, :children [{:open <, :close >} {:open <, :children [{:open <, :close >}], :close >}], :close >} {:open <, :close >}]
;; infix to prefix
DamienCassou / configuration.nix
Created Oct 22, 2014
configuration.nix file for NixOS on my macbook pro
View configuration.nix
{ config, pkgs, ... }:
hostname = "luz3";
in {
imports =
[ # Include the results of the hardware scan.
# I use VirtualBox to connect to Windows and Linux guests
robert-stuttaford / datomic.clj
Last active Apr 27, 2018
Handy protocols for working with Datomic
View datomic.clj
;;; Connection
(defprotocol DatomicConnection
(as-conn [_]))
(extend-protocol DatomicConnection
(as-conn [c] c)
john2x /
Last active Oct 9, 2019
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

joshmoore /
Last active Aug 29, 2015
OMERO Permissions


  • rw---- : private group (admin can read)
  • rwr--- : collab. read-only
  • rwra-- : collab. read-annotate

Currently proposed

  • r----- : and
cgrand / comprehensions.clj
Created May 24, 2013
Comprehension framework, upon which are (re)implemented, for, doseq, reducible/foldable for and reduce-based doseq
View comprehensions.clj
;; I wrote this in the Eurostar on my way back from the last clojure course.
(ns comprehensions
(:refer-clojure :exclude [for doseq])
(:require [clojure.core.reducers :as r]))
;; borrowed from clojure.core
(defmacro ^{:private true} assert-args
[& pairs]
`(do (when-not ~(first pairs)
colinta /
Created May 7, 2013
Here's what I mean when I say "ReactiveCocoa is just a fancy word for: 'DSL'"

I don't want anyone to think that I am not a big fan of ReactiveCocoa. I'm a HUGE FAN of it!

But look how LONG it took for something like this to come about. Cocoa is an OLD OLD system, and even though KVO/KVC wasn't there at the birth, it has been there at least a decade. I pretty much gave up on Obj-C in favor of RubyMotion, and look at our landscape: Futuristic, ProMotion, Formotion, Geomotion, Elevate, Teacup - all of these projects bring expressiveness to Cocoa, and RubyMotion is barely a year old.

So what I meant to say is that Obj-C suffers from a lack of expressiveness - this has nothing to do with ReactiveCocoa, that's just my example. To illustrate my point, I will translate the first example of the ReactiveCocoa README. I encourage you to read the ReactiveCocoa source and try and consolidate all the code that is used to handle this function. I will include all of the Ruby code that is necessary for my translation to work.

I do have one qualm with ReactiveCocoa: the names. I'm going to t

seanlilmateus / app_delegate.rb
Last active Dec 15, 2015
Countries example using Concurrency
View app_delegate.rb
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds).tap do |win|
win.rootViewController = UINavigationController.alloc.initWithRootViewController(
win.backgroundColor = UIColor.whiteColor
mrb / parse_ruby.clj
Last active Dec 14, 2015
Using JRuby's Ruby Parser from Clojure
View parse_ruby.clj
(ns graaaph.core
(:import (org.jrubyparser Parser
(org.jrubyparser.parser ParserConfiguration)
(org.jrubyparser.ast Node)
(:require [ :as z]))
(defn parse-ruby [ruby-string]
(let [config (ParserConfiguration. 0 (CompatVersion/RUBY1_9))
ferrous26 / bf.rb
Last active Dec 11, 2015
Brainfuck interpreter in Ruby
View bf.rb
#!/usr/bin/env ruby
mem =
iptr = dptr = 0
prog = ARGV.first
jmp = lambda { |op, a, b|
(iptr = iptr.send(op, 1);, a, b) if prog[iptr] == a) until prog[iptr] == b
nop = lambda {}
cmds = {
'>' => lambda { dptr += 1 },
You can’t perform that action at this time.