Skip to content

Instantly share code, notes, and snippets.

View davidwallacejackson's full-sized avatar

David Jackson davidwallacejackson

View GitHub Profile
import FormInput from './form-input';
var displayValuePath = 'name';
export default FormInput.extend({
valid: function() {
// Values in 'selection' are always promise proxies for models. By this
// point, they should *always* be resolved, so _data should have a model in
// it (or null).
Connection = require('./irc/connection').Connection
exports.load_irc = (req, res, next) ->
if req.params.connection?
connection_name = decodeURIComponent(req.params.connection)
req.connection = Connection.all_connections[connection_name] ? null
if req.connection is null
res.send(404, 'Connection #{connection_name} could not be found.')
if req.params.channel?
project.clj:
(...
(:dependencies [[org.clojars.amu/libgdx "0.9.2"]])
some file:
(ns ...
(:import (com.badlogic.gdx ApplicationListener Gdx)))
(defsignal inc-a [a [:a]] [:a]
(+ a 1))
;;should generate:
(defn inc-a [state_unique_blah]
(let [a (get-in state_unique_blah [:a])]
(+ a 1))
;;next, I'll rework it to generate something more like
(defsignal inc-a [a :a] :a
(+ a 1))
;;should generate:
(defn inc-a [state_unique_blah]
(let [a (get-in state_unique_blah [:a])]
(+ a 1))
;;next, I'll rework it to generate something more like
(defn vectors-to-lookups [state-symbol list-element]
(if (vector? list-element)
`(get-in ~state-symbol ~list-element)
list-element))
(defmacro defsignal [name
arg-binds
out-path
&func]
`(defn ~name [state#]
(defmacro test-macro [s] ('a s))
(macroexpand-1 '(test-macro 3))
;;expected: (a 3)
;;got: nil
(ns clj-game.core)
;; hacky first pass at making a functional style game loop
;;
;; game state is just a map
;; behaviors represent a transformation on a state
;;;
;; this is a stub of a pong implementation containing two paddles and a ball
;; the only behavior in the system moves the ball right by 10 every step