Skip to content

Instantly share code, notes, and snippets.

@rm-hull
rm-hull / script.pl
Created July 20, 2019 08:26 — forked from bessarabov/script.pl
Script to generate data shown in post 'At what time of day does famous programmers work? Part 2. Workweek vs Weekend.' — https://ivan.bessarabov.com/blog/famous-programmers-work-time-part-2-workweek-vs-weekend
#!/usr/bin/perl
# This script is made to show graphs with git commit time made on workweek vs weekend
#
# The desription of this script and results of its usage is avaliable at:
# https://ivan.bessarabov.com/blog/famous-programmers-work-time-part-2-workweek-vs-weekend
#
# usage:
#
# git log --author="Sebastian Riedel" --format="%H %ai" | perl script.pl
@rm-hull
rm-hull / content.md
Created January 4, 2017 19:16 — forked from ayosec/content.md
Why Lisp macros are cool, a Perl perspective
@rm-hull
rm-hull / SSD1331.py
Created November 27, 2016 11:56 — forked from TheRayTracer/SSD1331.py
The below Python source files control an OLED display (size 96 x 64, 65K colours) using a SSD1331 chipset and the SPI interface. The source code initialises the chipset and includes hardware accelerated functions for drawing primitive shapes and a non-hardware accelerated full ASCII set. Examples include a basic Space Invaders game, and a clock.
import struct
import spidev
import sys
import time
import random
import RPi.GPIO as gpio
ascii = [
[ 0x55, 0x00, 0x55, 0x00, 0x55 ],
[ 0x55, 0x00, 0x55, 0x00, 0x55 ],
@rm-hull
rm-hull / answer.md
Last active August 29, 2015 14:21 — forked from non/answer.md

What is the appeal of dynamically-typed languages?

Kris Nuttycombe asks:

I genuinely wish I understood the appeal of unityped languages better. Can someone who really knows both well-typed and unityped explain?

I think the terms well-typed and unityped are a bit of question-begging here (you might as well say good-typed versus bad-typed), so instead I will say statically-typed and dynamically-typed.

I'm going to approach this article using Scala to stand-in for static typing and Python for dynamic typing. I feel like I am credibly proficient both languages: I don't currently write a lot of Python, but I still have affection for the language, and have probably written hundreds of thousands of lines of Python code over the years.

@rm-hull
rm-hull / introrx.md
Last active August 29, 2015 14:08 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@rm-hull
rm-hull / sin.cljs
Last active December 30, 2015 01:49 — forked from martintrojer/sin.cljs
Sample core.async - see it running in the browser: http://programming-enchiladas.destructuring-bind.org/rm-hull/7758795
(ns async-test.sinewave.core
(:require [cljs.core.async :refer [<! >! chan timeout]])
(:require-macros
[cljs.core.async.macros :as m :refer [go]]))
(defn sin-vals [offset]
(map #(Math/sin %) (iterate (partial + 0.1) offset)))
(let [events (chan)]
@rm-hull
rm-hull / three.cljs
Last active March 27, 2021 10:13 — forked from michiakig/three.cljs
Simple demonstration of using THREE.js with ClojureScript [from a fork of https://gist.github.com/spacemanaki/1157978], now working with thanks to @seabre
(ns three.demo
(:require [THREE :as THREE]))
(def camera
(THREE/PerspectiveCamera.
75
(/ 800 600)
1
10000))
@rm-hull
rm-hull / sudoku.cljs
Last active December 24, 2015 14:49 — forked from swannodette/gist:3217582
(ns sudoku
;(:refer-clojure :exclude [==])
(:require-macros [cljs.core.logic.macros :as m])
(:use [cljs.core.logic :only [everyg infd distinctfd]]))
(defn get-square [rows x y]
(for [x (range x (+ x 3))
y (range y (+ y 3))]
(get-in rows [x y])))
(defmacro def-curry-fn [name args & body]
{:pre [(not-any? #{'&} args)]}
(if (empty? args)
`(defn ~name ~args ~@body)
(let [rec-funcs (reduce (fn [l v]
`(letfn [(helper#
([] helper#)
([x#] (let [~v x#] ~l))
([x# & rest#] (let [~v x#]
(apply (helper# x#) rest#))))]