Skip to content

Instantly share code, notes, and snippets.

@pulcheri
pulcheri / IosevkaConfigGen.hs
Created February 25, 2019 10:52 — forked from mrkgnao/IosevkaConfigGen.hs
Render Iosevka ligatures to Private Use Area glyphs, for Emacs
{-# LANGUAGE RecordWildCards, Arrows #-}
import Numeric
import Data.Char
import Control.Monad
import Data.Monoid ((<>))
import Data.List (nub, sort, reverse)
data RepeatBounds = RB
@pulcheri
pulcheri / playground.rs
Created July 18, 2018 10:16 — forked from rust-play/playground.rs
Code shared from the Rust Playground
extern crate regex;
#[derive(Debug)]
enum GrammarItem {
F(String),
L(String),
R(String),
Digits(String),
Other(String),
}
@pulcheri
pulcheri / Example.hx
Created July 5, 2017 09:30 — forked from puffnfresh/Example.hx
Macro to generate "value classes" in Haxe
import precog.macro.ValueClass;
class ABC implements ValueClass {
var a: Int;
var b: Bool;
var c: String;
}
/*
class ABC extends ValueClass {
import js.Browser.*;
import js.html.CanvasElement;
import js.html.CanvasRenderingContext2D;
import js.html.HTMLDocument;
import js.html.MouseEvent;
import sf.test.Test.Entity;
/**
* @author YellowAfterlife
* http://yal.cc/top-down-bouncing-loot-effects/
@pulcheri
pulcheri / Zip.hs
Created February 21, 2017 12:50 — forked from roman/Zip.hs
Haskell's zip and zipWith functionality in Clojure
numbers :: [Int]
numbers = zip [1, 2, 3] [4, 5, 6]
main :: IO ()
main = print numbers
-- Output: [(1,4), (2,5), (3,6)]
@pulcheri
pulcheri / lisp90.cpp
Created February 10, 2017 23:47 — forked from Mooophy/lisp90.cpp
Lisp interpreter in 90 lines of C++
//Lisp interpreter in 90 lines of C++
//I've enjoyed reading Peter Norvig's recent articles on Lisp. He implements a Scheme interpreter in 90 lines of Python in the first, and develops it further in the second.
//Just for fun I wondered if I could write one in C++. My goals would be
//1. A Lisp interpreter that would complete Peter's Lis.py test cases correctly...
//2. ...in no more than 90 lines of C++.
//Although I've been thinking about this for a few weeks, as I write this I have not written a line of the code. I'm pretty sure I will achieve 1, and 2 will be... a piece of cake!
@pulcheri
pulcheri / core.cljs
Created February 10, 2017 23:43 — forked from ChillyBwoy/core.cljs
Simple particles in ClojureScript
(ns particles.core)
(def display (.getElementById js/document "display"))
(def context (.getContext display "2d"))
(def damping 0.999)
(def max-particles 250)
(def line-width 2)
(def app-state (atom {:width (.-innerWidth js/window)
:height (.-innerHeight js/window)}))
@pulcheri
pulcheri / lisp.cpp
Created August 16, 2016 00:05 — forked from ofan/lisp.cpp
Lisp interpreter in 90 lines of C++
Lisp interpreter in 90 lines of C++
I've enjoyed reading Peter Norvig's recent articles on Lisp. He implements a Scheme interpreter in 90 lines of Python in the first, and develops it further in the second.
Just for fun I wondered if I could write one in C++. My goals would be
1. A Lisp interpreter that would complete Peter's Lis.py test cases correctly...
2. ...in no more than 90 lines of C++.
Although I've been thinking about this for a few weeks, as I write this I have not written a line of the code. I'm pretty sure I will achieve 1, and 2 will be... a piece of cake!
http://ianlunn.co.uk/articles/quickly-showhide-hidden-files-mac-os-x-mavericks/
@pulcheri
pulcheri / dijkstra.clj
Created July 19, 2016 15:47 — forked from valpackett/dijkstra.clj
Dijkstra's algorithm in Clojure
; http://www.algolist.com/Dijkstra's_algorithm
(defn dijkstra [g src]
(loop [dsts (assoc (zipmap (keys g) (repeat nil)) src 0)
curr src
unvi (apply hash-set (keys g))]
(if (empty? unvi)
dsts
(let [unvi (disj unvi curr)
nextn (first (sort-by #(% dsts) unvi))