Skip to content

Instantly share code, notes, and snippets.

View PlumpMath's full-sized avatar
🏠
Pro

PlumpMath

🏠
Pro
View GitHub Profile
@PlumpMath
PlumpMath / index.html
Created January 31, 2019 17:13 — forked from bellbind/index.html
[threejs] simplified gltf2 loader example
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<script src="https://unpkg.com/three"></script>
<script
src="https://unpkg.com/three/examples/js/loaders/GLTF2Loader.js"
></script>
<script src="script.js" defer="defer"></script>
</head>
@PlumpMath
PlumpMath / idb.cljs
Created February 17, 2019 20:24 — forked from leblowl/idb.cljs
simple clojurescript interface to IndexedDB for github.com/leblowl/lokate
(def db (atom nil))
(defn error [e]
(.error js/console "An IndexedDB error has occured!" e))
(defn new [cb]
(let [version 1
request (.open js/indexedDB "lokate" version)]
(set! (.-onupgradeneeded request) (fn [e]
(reset! db (.. e -target -result))
@PlumpMath
PlumpMath / clojure-make-nested-map.clj
Created February 17, 2019 22:30 — forked from dnaeon/clojure-make-nested-map.clj
clojure-make-nested-map
;;
;; Making a deeply nested map by following parent-child relations between items
;;
(defn make-items [n]
(concat [{:id 0 :name "item-root"}]
(for [x (range 1 n)] {:id x :parent (dec x) :item (format "item-%d" x)})))
(defn item-children [item coll]
(if-let [children (-> (filter #(= (:parent %) (:id item)) coll) seq)]
@PlumpMath
PlumpMath / deepmap.clj
Created February 17, 2019 22:30 — forked from joinr/deepmap.clj
building a deep nested map without blowing the stack
(defn children [item coll]
(-> (filter #(= (:parent %) (:id item)) coll)
seq))
(defn item-children
([get-children item coll]
(if-let [xs (get-children item coll)]
(map #(lazy-seq (cons item (item-children get-children % coll))) xs)
(list [item nil])))
([item coll] (item-children (memoize children) item coll)))
@PlumpMath
PlumpMath / polyglot.md
Created February 21, 2019 21:19 — forked from mfikes/polyglot.md
Polyglot Graal from ClojureScript

You need to first install GraalVM, and then set your PATH so that you get the GraalVM binaries (incluing the GraalVM version of node).

You can then install R and Ruby via

gu -c install org.graalvm.r
gu -c install org.graalvm.ruby
@PlumpMath
PlumpMath / config.scm
Created March 8, 2019 16:27 — forked from TeMPOraL/config.scm
GuixSD with custom kernel
(define-module (my packages)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages linux)
#:use-module (guix build-system trivial)
#:use-module (gnu)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix packages))
(define (linux-nonfree-urls version)
int steps = 40;
Orbiter[] Orb = new Orbiter[steps]; // tmpX, tmpY, tmpOff, tmpDiam, tmpIncr
float r = 0;
float rad, off;
float the = 0;
void setup() {
float x, y;
size(500, 500);
background(0);
@PlumpMath
PlumpMath / gist:e962b8eec2ef2a38881af00ae3293f64
Created January 7, 2020 13:36 — forked from HairyFotr/gist:4995607
Scala Clojure interop wrapper
class ClojureWrap(ns: String, objName: String) {
import clojure.lang.{RT,Var}
import scala.collection.mutable.HashMap
RT.loadResourceScript(objName+".clj")
val obj = ns+"."+objName
val funcs = new HashMap[String, Var]
def /(func: String, a: Any): Object =
funcs.getOrElseUpdate(func, RT.`var`(obj, func)).invoke(a.asInstanceOf[Object])
@PlumpMath
PlumpMath / gist:059edfcf680e73514366d13471a1e5ea
Created January 8, 2020 19:01 — forked from weavejester/gist:5484183
jMonkeyEngine in Clojure example
(ns jme3-example.core
(:import com.jme3.app.SimpleApplication
com.jme3.material.Material
com.jme3.math.Vector3f
com.jme3.scene.Geometry
com.jme3.scene.shape.Box
com.jme3.texture.Texture))
(defn application
"Create an jMonkeyEngine application."
@PlumpMath
PlumpMath / SimpleHTTPServer.cs
Created January 9, 2020 09:18 — forked from aksakalli/SimpleHTTPServer.cs
SimpleHTTPServer in C#
// MIT License - Copyright (c) 2016 Can Güney Aksakalli
// https://aksakalli.github.io/2014/02/24/simple-http-server-with-csparp.html
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.IO;