Skip to content

Instantly share code, notes, and snippets.

View jolby's full-sized avatar

Joel Boehland jolby

View GitHub Profile
@jolby
jolby / schemata-scratchpad.lisp
Last active October 14, 2023 22:24
Schemata sketches -- adding whole object instance validation
(in-package :schemata)
;; Marker class for objects that know how to validate themselves.
(defclass validating-object-mixin ()
((%schema :initarg :schema
:initform (error "No schema specified")
:reader object-schema)))
(defmethod initialize-instance :after ((instance validating-object-mixin) &rest args)
(declare (ignore args)
@jolby
jolby / java_interop.clj
Created May 23, 2019 17:25 — forked from kylewlacy/java_interop.clj
Small DSL for making Java classes in Clojure, using ASM
; Based on https://gist.github.com/athos/1033052
(ns cljl.java-interop
(:require [clojure.string :as str])
(:import (clojure.asm Opcodes Type ClassWriter)
(clojure.asm.commons Method GeneratorAdapter)))
(def ^:dynamic *version* Opcodes/V1_6)
(def modifier->opcode
@jolby
jolby / Ambly app delegate
Last active August 29, 2015 14:19
Creating JSContext for Ambly
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
// Loading JavaScript code - uncomment the one you want.
// OPTION 1
// Load from development server. Start the server from the repository root:
//
// $ npm start
@jolby
jolby / REPL_session.clj
Created August 6, 2011 23:31
Working load-externs function for closure.clj (Clojurescript)
cljs.closure> (load-externs {})
[#<JSSourceFile externs.zip//es3.js> #<JSSourceFile externs.zip//es5.js> #<JSSourceFile externs.zip//w3c_event.js> #<JSSourceFile externs.zip//w3c_event3.js> #<JSSourceFile externs.zip//gecko_event.js> #<JSSourceFile externs.zip//ie_event.js> #<JSSourceFile externs.zip//webkit_event.js> #<JSSourceFile externs.zip//w3c_dom1.js> #<JSSourceFile externs.zip//w3c_dom2.js> #<JSSourceFile externs.zip//w3c_dom3.js> #<JSSourceFile externs.zip//gecko_dom.js> #<JSSourceFile externs.zip//ie_dom.js> #<JSSourceFile externs.zip//webkit_dom.js> #<JSSourceFile externs.zip//w3c_css.js> #<JSSourceFile externs.zip//gecko_css.js> #<JSSourceFile externs.zip//ie_css.js> #<JSSourceFile externs.zip//webkit_css.js> #<JSSourceFile externs.zip//google.js> #<JSSourceFile externs.zip//deprecated.js> #<JSSourceFile externs.zip//fileapi.js> #<JSSourceFile externs.zip//flash.js> #<JSSourceFile externs.zip//gears_symbols.js> #<JSSourceFile externs.zip//gears_types.js> #<JSSourceFile externs.zip//gecko_xml.js> #
@jolby
jolby / core.cljs
Created August 2, 2011 00:12
Clojurescript on Appcelerator Titanium
(ns tiexample.core)
(defn ^{:export dbg} dbg [s]
(js* "Titanium.API.debug(~{s})"))
;;stolen from another gist I saw
(defn make-js-map
"makes a javascript map from a clojure one"
[cljmap]
(let [out (js-obj)]
@jolby
jolby / core.clj
Created April 22, 2010 15:01
Using com.evocomputing.colors with incanter to get semantic colors
(ns colorstats.core
(:use
(com.evocomputing [colors :only [create-color awt-color]])
(incanter [charts :only [line-chart set-stroke set-stroke-color bar-chart]]
[core :only [view]]
[datasets :only [get-dataset]])
(clojure.contrib [seq-utils :only [indexed]]))
(:require
[com.evocomputing.colors.palettes.core :as core-palettes]
[com.evocomputing.colors.palettes.color-brewer :as color-brewer]))