Skip to content

Instantly share code, notes, and snippets.

View johnbintz's full-sized avatar

John Bintz johnbintz

View GitHub Profile
@johnbintz
johnbintz / clj-into-js.clj
Created April 18, 2014 00:22
clj->into->js
(defn- map-names [items]
(into {} (mapv (fn [item] {(item :name) item}) items))
)
(defn- reset-objects! [objects mapped-clj-objects]
(.forEach objects
(fn [object]
; the objects in these happen to be indexed by object.name
(let [clj-object (mapped-clj-objects (.-name object))]
(doseq [[k v] clj-object]
@johnbintz
johnbintz / board.cljs
Created April 13, 2014 17:11
Board directive for Can't Catch Me, Olivia!
(def.directive cant_catch_me_olivia.board []
(obj :restrict "E"
:replace true
:templateUrl "partials/board.html"
:link (fn [scope element attrs]
(let [board (.find element ".board")
cells (atom [])
each-span (fn [code] (doseq [data @cells] (apply code data)))]
(doseq [y (range 0 5)]
(let [row (js/$ "<li class='row'><ol class='board-row'></ol></li>")
@johnbintz
johnbintz / Gruntfile.coffee
Last active August 29, 2015 13:57
Run lein cljsbuild auto with Grunt
module.exports = (grunt) ->
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks)
grunt.initConfig {
app:
dev: "app"
watch:
sass:
files: ['<%= app.dev %>/**/*.scss']
tasks: ['compass:dist']
@johnbintz
johnbintz / def-run.clj
Last active August 29, 2015 13:57
def.run for ClojureScript and AngularJS
(defmacro def.run [sym params & body]
(list '.run ;; .run(
(list '.module 'js/angular sym) ;; angular.module(sym)
(concat ['array] ;; Array.new(
(map str params) ;; "$rootScope", "$q"
[(concat ['fn params] body)] ;; , function($rootScope, $q) { code; }))
)
)
)
@johnbintz
johnbintz / space_tool_toggle.patch
Created January 24, 2014 02:22
Make space in Inkscape toggle tools only
=== modified file 'src/ui/tools/tool-base.cpp'
--- src/ui/tools/tool-base.cpp 2014-01-20 01:30:15 +0000
+++ src/ui/tools/tool-base.cpp 2014-01-24 02:16:47 +0000
@@ -689,13 +689,7 @@
break;
case GDK_KEY_space:
- xp = yp = 0;
- within_tolerance = true;
- panning = 4;
@johnbintz
johnbintz / Gemfile
Created January 14, 2014 00:30
Ruby example for using The Game Crafter API.
source 'https://rubygems.org'
gem 'httmultiparty'
@johnbintz
johnbintz / gist:7599569
Created November 22, 2013 13:07
Stripped-down Cardfile for SVGGVS 0.0.4
@session.configure do |c|
# manipulate the data after reading from the spreadsheet
# c.post_read_data = proc { |data|
# data[:replacements]['Superpower Text'] << '!!'
# }
c.data_source = "data.ods"
end
@johnbintz
johnbintz / gist:7574995
Last active December 28, 2015 22:58
Adding references to our images in the Cardfile.
@session.configure do |c|
c.svg_source = "template.svg"
c.svg_merged_target = "merged-template.svg"
c.png_export_width = 825
c.pdf_dpi = 300
c.pdf_card_size = "750x1050"
c.individual_files_path = "svgout/output_%03d.svg"
@johnbintz
johnbintz / Cardfile.rb
Last active December 28, 2015 20:19
Adding our new superpowers to our animals
@session.configure do |c|
c.svg_source = "template.svg"
c.svg_merged_target = "merged-template.svg"
c.png_export_width = 825
c.pdf_dpi = 300
c.pdf_card_size = "750x1050"
c.individual_files_path = "svgout/output_%03d.svg"
@johnbintz
johnbintz / Cardfile.rb
Created November 18, 2013 12:38
Cardfile with added Animal Power layer display
@session.configure do |c|
c.svg_source = "template.svg"
c.svg_merged_target = "merged-template.svg"
c.png_export_width = 825
c.pdf_dpi = 300
c.pdf_card_size = "750x1050"
c.individual_files_path = "svgout/output_%03d.svg"