Skip to content

Instantly share code, notes, and snippets.

View selfsame's full-sized avatar

Joseph Parker selfsame

View GitHub Profile
@nasser
nasser / realize.clj
Last active November 18, 2016 03:18
Hiccup-inspired Unity Scene Graph DSL
(ns realize.core
(:use arcadia.core)
(:require [clojure.string :as string]))
(defn- reflective-set! [obj field value]
(if-let [^System.Reflection.FieldInfo info (.GetField (type obj) (str field))]
(.SetValue info obj value)
(if-let [^System.Reflection.PropertyInfo info (.GetProperty (type obj) (str field))]
(.SetValue info obj value nil)
(throw (Exception. (str "No field or property '" field "' on object of type " (type obj)))))))
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditorInternal;
#endif
(import [UnityEditor RagdollBuilder])
;-)
(defn- invoke-private [obj meth & args]
(.Invoke
(.GetMethod
(type obj) meth
(enum-or BindingFlags/Instance
BindingFlags/NonPublic))
obj
@munificent
munificent / generate.c
Last active December 26, 2025 00:01
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u