Skip to content

Instantly share code, notes, and snippets.

View KGZM's full-sized avatar

KGZM

  • We Have The Web LLC
  • Brooklyn
View GitHub Profile
@KGZM
KGZM / .gitignore
Last active August 6, 2020 20:04
cards.rb
vendor
.bundle
@KGZM
KGZM / basicsynth.vue
Created July 29, 2017 04:26
Synthesizing..
<template>
<div class="synth">
<div class="synth__settings">
<div v-for="(controls, category) of settings">
<h2>{{category}}</h2>
<ul>
<li v-for="(value, label) of controls">
<label>{{label}}</label>
<input type="text" @input="updateSetting(category, label, $event)" v-model="settings[category][label]">
<!-- {group: "{{category}}", name: "{{label}}", default: {{JSON.stringify(value)}}, min: {{Number.MIN_VALUE}}, max: Infinity}, -->
@KGZM
KGZM / core.clj
Created April 26, 2016 01:15
Clojure state monad..
(ns grime.core
(:require [grime.state :as st :refer [run-state state >> >>=]]))
(def world-state
{:last-entity-id -1
:entities {}})
(defn mutate [entity f & args]
(state
(fn [world]
@KGZM
KGZM / print.js
Last active December 5, 2015 03:06 — forked from anonymous/print.js
var PDFDocument = require('pdfkit');
var fs=require('fs');
var process = require('process')
var captureText = function(cb) {
var text = ""
process.stdin.on('readable', () => {
chunk = process.stdin.read();
if(chunk) text = text + chunk;
});
@KGZM
KGZM / markov.clj
Last active August 29, 2015 14:23
Simple markov chain implementation
(ns markov.experiment
(:require [clojure.string :as string]))
(defn wrand [m]
(let [total (reduce + (vals m))
r (rand total)]
(loop [ks (keys m) sum 0]
(if (< r (+ (get m (first ks))
sum))
(first ks)
@KGZM
KGZM / 0-rps.hs
Last active August 29, 2015 14:11
Simple Comparison Between Haskell and OCaml
{- rps.hs Simple Rock Paper Scissors written in Haskell
- for translation to Ocaml as a learning exercise.
-}
data Move = Rock | Paper | Scissors deriving (Show, Eq)
data Player = Player String deriving (Show, Eq)
data Outcome = Winner Player | Tie deriving (Show, Eq)
{
"Alabama":{
"name":"Alabama",
"borders":[
"Mississippi",
"Tennessee",
"Georgia",
"Florida"
]
},
/*
* robotNav.js
*
* The green key is located in a slightly more
* complicated room. You'll need to get the robot
* past these obstacles.
*/
function startLevel(map) {
// Hint: you can press R or 5 to "rest" and not move the
@KGZM
KGZM / monosynth1.sc
Created November 26, 2013 20:16
Experimenting with SuperCollider.
(
var notes, on, off;
MIDIClient.init;
MIDIIn.connect();
SynthDef.new(\MonoSaw, {
|freq = 440, amp = 0.2,
dur = 1, gate = 0,
@KGZM
KGZM / ast.rs
Created October 2, 2013 03:08
Just experimenting a bit.
enum Operation {
Add,
Sub,
Mul,
Div,
Exp
}
impl Operation {
fn apply(self, a : int, b : int) -> int {