Skip to content

Instantly share code, notes, and snippets.

View danielytics's full-sized avatar
🚰

Dan Kersten danielytics

🚰
  • Dublin, Ireland
View GitHub Profile
@danielytics
danielytics / changing install locations
Last active March 13, 2018 11:58
Code snippets for "Using C++ and GDNative in Godot 3" tutorial
GODOT_HEADERS=path to godot_headers
CPP_BINDINGS=path to cpp-godot
@danielytics
danielytics / generate sources and compile godot-cpp
Last active March 13, 2018 11:57
Code snippets for "Using C++ and GDNative in Godot 3" tutorial
scons godotbinpath="/Applications/Godot.app/Contents/MacOs/Godot" platform=osx use_llvm=yes
@danielytics
danielytics / clone dependency repos
Last active March 13, 2018 11:58
Code snippets for "Using C++ and GDNative in Godot 3" tutorial
git clone https://github.com/GodotNativeTools/godot_headers
git clone https://github.com/GodotNativeTools/godot-cpp
@danielytics
danielytics / install scons
Last active May 5, 2019 16:47
Code snippets for "Using C++ and GDNative in Godot 3" tutorial
brew install scons
@danielytics
danielytics / helpers.hpp
Created March 5, 2018 20:02
Helper template functions for registering and emitting Godot signals with arguments from GDNative
#ifndef HELPERS_H
#define HELPERS_H
#include <core/Godot.hpp>
#include <core/Dictionary.hpp>
#include <core/String.hpp>
#include <Node.hpp>
namespace helpers {
(def rui-components
{'list rui/list
'list-item rui/list-item})
(def component-registry
(merge
rui-components
{}))
(def my-template
template <typename T> constexpr T bitfield (T bit) { return 1 << bit; }
namespace Telemetry {
enum TelemetryType {
Guage = bitfield(0),
Counter = bitfield(1),
Debug = bitfield(2),
Info = bitfield(3),
Warn = bitfield(4),
Error = bitfield(5)
(defn infect [{inputs :pathogen/infected
immune :pathogen/immune
traits :pathogen/diseases
:as c}]
;'([protocol [output-key output-fn]] [protocol [output-key output-fn]])
(->>
(for [infected (->> (or (seq inputs) (keys c))
(filter (complement (or immune #{})))
(map (partial get c)))
[protocol [output-key output-fn]] traits]
; ok
(println foo
bar
baz
quux)
; ok
(println
foo
bar
postwalk comes from clojure.walk/postwalk (namespace might be cljs.walk in cljs, you'll have to check)
may need to look at prewalk, i didn't test so dunno. also didn't pay attention to which (pre or post) is more efficient in this case (if they both work)
(postwalk
(fn [item]
(let [t (:type item)]
(if (or (not (map? item))
(nil? t)
(= t filter-type))
item