Skip to content

Instantly share code, notes, and snippets.

@sogaiu
sogaiu / gist:d471eb059d93722f36c3cf240bc0e2b5
Created September 9, 2018 14:12
mysteries of arcadia
;; assuming game object named "Ball" exists
(def ball-name "Ball")
;; this works
(GameObject/Instantiate (Resources/Load "Ball"))
;; but the following leads to error output
(GameObject/Instantiate (Resources/Load ball-name))
MissingMethodException Cannot find member Instantiate matching args
@sogaiu
sogaiu / gist:2b107564ad532d1a5023a02d14650f3a
Created September 12, 2018 03:16
attempt at support for loading multiple scenes in tween/timeline
;; just use DontDestroyOnLoad?
(defn mono-obj []
(if (. Application isPlaying)
(or (if (not (UnityEngine.Object/op_Equality @-mono-obj nil))
@-mono-obj)
(vreset! -mono-obj
(let [o (or (GameObject/Find "tween.core/-mono-obj")
(let [obj (GameObject. "tween.core/-mono-obj")]
(UnityEngine.Object/DontDestroyOnLoad obj)))]
(or (.GetComponent o MonoObj)
@sogaiu
sogaiu / gist:fc170a4bd512fcc63a1c863cd500b190
Created November 7, 2018 07:06
arcadia repl behavior tcp4 vs tcp6?
# tcp 4
$ telnet 127.0.0.1 5555
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
014-01-02 15:28:22.957823
# tcp 6
$ telnet ::1 5555
Trying ::1...
@sogaiu
sogaiu / gist:fcb8674b24bbb6ebc6f09639e28864a1
Created November 9, 2018 10:32
sketch of tcp socket repl - modification of original udp repl-client.javascript
// based on original udp repl-client.javascript
const net = require('net');
const readline = require('readline');
const client = new net.Socket();
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
@sogaiu
sogaiu / gist:aaa2c34a92599bf5e9733b96e1a0a0d4
Created November 13, 2018 21:51
pprint not working in dbfbd785b9e18ed9f83996b2608169991b4ada76?
user=> (use 'clojure.pprint)
nil
user=> (pprint 1)
TypeLoadException Could not resolve type with token 01000027 (from typeref, class/assembly clojure.pprint.proxy$TextWriter$IDeref$PrettyFlush$AEF722B8$_COMP_clojure.pprint.pretty_writer.clj, clojure.pprint.pretty_writer.clj, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null)
clojure/pprint$pretty_writer__24142.invoke (:0)
clojure/pprint$make_pretty_writer__24275.invokeStatic (:0)
clojure/pprint$make_pretty_writer__24275.invoke (:0)
clojure/pprint$pprint__24328.invokeStatic (:0)
clojure/pprint$pprint__24328.invoke (:0)
clojure/pprint$pprint__24328.invokeStatic (:0)
user=> (require 'clojure.pprint)
nil
user=> (clojure.pprint/pprint
(let [g (fn f [i]
(if (<= i 0)
:leaf
(vec
(repeatedly 3
#(f (dec i))))))]
@sogaiu
sogaiu / gist:56c5aeb41a3f05688c68053f43e25635
Created November 29, 2018 16:10
clojure.tools.trace with java-bits removed, take 1
;;;
;; trace.clj -- simple call-tracing macros for Clojure
;; by Stuart Sierra, http://stuartsierra.com/
;; December 3, 2008
;; Copyright (c) Stuart Sierra, 2008. All rights reserved. The use
;; and distribution terms for this software are covered by the Eclipse
;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this
@sogaiu
sogaiu / gist:2378a3e547139f6271e2d70aee911ba0
Created November 29, 2018 16:22
trace-ns doesn't seem to work yet(?)
game.core=> (trace-ns (the-ns 'game.core))
InvalidCastException Specified cast is not valid.
clojure/core$find_ns__41059.invokeStatic (:0)
clojure/core$find_ns__41059.invoke (:0)
clojure/core$the_ns__41083.invokeStatic (:0)
clojure/core$the_ns__41083.invoke (:0)
clojure/tools/trace$trace_ns_STAR___1190.invokeStatic (:0)
clojure/tools/trace$trace_ns_STAR___1190.invoke (:0)
game/core$eval__1420__1425.invokeStatic (:0)
game/core$eval__1420__1425.invoke (:0)
@sogaiu
sogaiu / gist:a3c5ea15d25ac68368de926274c3ae1c
Created November 29, 2018 22:03
clojure.tools.trace with java-bits removed, take 2 -- trace-ns seems to work too
;;;
;; trace.clj -- simple call-tracing macros for Clojure
;; by Stuart Sierra, http://stuartsierra.com/
;; December 3, 2008
;; Copyright (c) Stuart Sierra, 2008. All rights reserved. The use
;; and distribution terms for this software are covered by the Eclipse
;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this
@sogaiu
sogaiu / gist:5f269e8a0b68240ea4f66bf2ab5acb0a
Created December 7, 2018 04:42
sketch of Util.cs for specter
using System;
public class Util
{
public static Object[] makeObjectArray(int size)
{
return new Object[size];
}
}