Skip to content

Instantly share code, notes, and snippets.

View PlumpMath's full-sized avatar
๐Ÿ 
Pro

PlumpMath

๐Ÿ 
Pro
View GitHub Profile
@PlumpMath
PlumpMath / core.cljs
Created October 9, 2024 04:11 — forked from yogthos/core.cljs
Gjs ClojureScript example
(ns gjs-example.core)
(defn main []
(set! (-> js/imports .-gi .-versions .-Gtk) "3.0")
(let [Gtk (doto (-> js/imports .-gi .-Gtk) (.init nil))
window (Gtk.Window.
(clj->js
{:type (-> Gtk .-WindowType .-TOPLEVEL)
:title "A default title"
:default_width 300
@PlumpMath
PlumpMath / writeup.md
Created October 3, 2024 15:57 — forked from edmundsmith/writeup.md
Method for Emulating Higher-Kinded Types in Rust

Method for Emulating Higher-Kinded Types in Rust

Intro

I've been fiddling about with an idea lately, looking at how higher-kinded types can be represented in such a way that we can reason with them in Rust here and now, without having to wait a couple years for what would be a significant change to the language and compiler.

There have been multiple discussions on introducing higher-ranked polymorphism into Rust, using Haskell-style Higher-Kinded Types (HKTs) or Scala-looking Generalised Associated Types (GATs). The benefit of higher-ranked polymorphism is to allow higher-level, richer abstractions and pattern expression than just the rank-1 polymorphism we have today.

As an example, currently we can express this type:

@PlumpMath
PlumpMath / .gitignore
Created August 31, 2020 17:43 — forked from datakurre/.gitignore
Minimal Nix Docker
*.tar.gz
.sentinel.*
@PlumpMath
PlumpMath / minimal_ghc_ghcjs_nix.sh
Created August 28, 2020 09:49 — forked from louispan/minimal_ghc_ghcjs_nix.sh
Install Cabal, GHC, or GHCJS with one Nix command
# install nix (5.5 mins)
curl https://nixos.org/nix/install | sh
# open a new shell to source nix
bash
# query available haskell compilers
nix-env -qaP -A nixpkgs.haskell.compiler [QUERY]
# install ghc (2.5 mins, cached binary)
@PlumpMath
PlumpMath / install_qt5_for_brew.md
Created August 15, 2020 10:52 — forked from sigmadream/install_qt5_for_brew.md
OSX์—์„œ qt5๋ฅผ ์„ค์น˜ํ•˜๋Š” ๊ฐ„๋‹จํ•˜๊ณ  ์•„๋ฆ„๋‹ค์šด ๋ฐฉ๋ฒ•์— ๊ด€ํ•˜์—ฌ..

OSX์—์„œ 'brew'์™€ ํ•จ๊ป˜ํ•˜๋Š” qt5 ์„ค์น˜

0. ์ธํ„ฐ๋„ท์— ์—ฐ๊ฒฐ

  • ์ˆ˜๋‹จ๊ณผ ๋ฐฉ๋ฒ•์„ ๊ฐ€๋ฆฌ์ง€ ๋ง๊ณ  ๋„คํŠธ์›Œํฌ์— ์—ฐ๊ฒฐํ•˜์—ฌ, ์ธํ„ฐ๋„ท์ด ๊ฐ€๋Šฅํ•˜๋„๋ก ํ™˜๊ฒฝ์„ ๊ตฌ์„ฑํ•œ๋‹ค.

1. Xcode ์ตœ์‹ ๋ฒ„์ „

  • 'App Store'์— ๊ฐ€์…”์„œ Xcode ์ตœ์‹ ๋ฒ„์ „์„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค. ๋‹จ์ˆœํ•˜๊ฒŒ ์„ค์น˜๋งŒ ํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.

2. brew ์„ค์น˜ํ•˜๊ธฐ

  • 'Launchpad' - '๊ธฐํƒ€' - 'ํ„ฐ๋ฏธ๋„'์„ ์‹คํ–‰ํ•œ๋‹ค.
@PlumpMath
PlumpMath / 00README.adoc
Created June 7, 2020 19:51 — forked from mbbx6spp/00README.adoc
My ${HOME}/.nixpkgs/config.nix to setup my dev and desktop environments the way I like them :)

User env setup

Setup your user environment just the way you want with Nix.

  1. Add packageOverrides to the attrset returned by your ${HOME}/.nixpkgs/config.nix (see my example above).

  2. Then with one command you can setup your whole environment: nix-env -i desktop-mbbx6spp.

Then all you need is a simple ~/.bash_profile script like so:

@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;
@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 / 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])
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);