Skip to content

Instantly share code, notes, and snippets.

View jkxyz's full-sized avatar
🍋
Do whatever you want, all of the time

Josh Kingsley jkxyz

🍋
Do whatever you want, all of the time
View GitHub Profile
(ns tailwind
(:require
[clojure.spec.alpha :as s]))
(defn- parse-map [m]
(reduce
(fn [classes [k v]]
(cond
;; If v is another collection of classes, we prepend k as the variant
;; prefix for all of the classes in v, e.g.

Keybase proof

I hereby claim:

  • I am jkxyz on github.
  • I am jkxyz (https://keybase.io/jkxyz) on keybase.
  • I have a public key ASDHJCdQ0EbGsGG_VSwzDpvWxy9ls1NjRTGTXfWDZaiTMQo

To claim this, I am signing this object:

@jkxyz
jkxyz / forth.clj
Last active March 29, 2018 12:10
Forth in Clojure, so far
(ns forth.core
"Forth in Clojure"
(:require [clojure.test :refer [deftest is are]]))
(defn npop
"Returns a list without the first n items by applying pop repeatedly."
[n coll]
((apply comp (repeat n pop)) coll))
(defn ffn
@jkxyz
jkxyz / chords.html
Last active March 23, 2018 18:06
Old chord practice tool (2012)
<!doctype html>
<html>
<head>
<title>Chord Randomiser</title>
<style type="text/css">
body, html { margin: 0; padding: 0; background: #fff; font: 19pt serif; }
div#outer { width: 300px; margin: 0 auto; padding-top: 50px; text-align: center; }
div#key, div#chord, div#type { font-weight: bold; position: absolute; top: 49px; }
div#key { margin-left: 125px; }
div#chord { margin-left: 230px; }
@jkxyz
jkxyz / byol.c
Last active August 5, 2016 21:52
Code from Build Your Own Lisp
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <editline/readline.h>
#include "mpc.h"
typedef enum {
@jkxyz
jkxyz / atoi.c
Created May 31, 2015 09:28
Converting a string to an unsigned integer value in C
// Implements a standard library function `atoi` which returns an
// int for an input string. Also contains functions to calculate
// the length of a string and the value of an exponent expression.
#include <stdio.h>
unsigned int
str_length(const char str[])
{
int len;
@jkxyz
jkxyz / periods.erl
Created May 29, 2015 22:42
Calculate continuous periods in a sorted list of periods
-module(periods).
-export([get_periods/1, dummy_data/0]).
%% Dummy data for demonstration purposes
dummy_data() -> [{1, 3}, {2, 10}, {10, 11}, {20, 23}, {21, 23}, {21, 23}, {50, 51}].
%% Returns a list of continuous periods within a sorted list of periods
%% i.e. [{1,4},{3,5},{6,7}] -> [{6,7},{1,5}]
%% This was largely written to demonstrate how to solve a problem functionally to my boyfriend
get_periods(Periods, Period, []) ->