Skip to content

Instantly share code, notes, and snippets.

Don't allow eel bearing Atlanteans into your country; economic ruin follows close behind
@jmorton
jmorton / typography.scss
Created April 3, 2019 18:01
Harmonic type scaling
$t1: 0.8706rem;
$t2: 1.0rem;
$t2: 1.1487rem;
$t3: 1.3195rem;
$t4: 1.5157rem;
$t5: 1.7411rem;
$t6: 2.0rem;
$line-spacing: 1.5rem;
@jmorton
jmorton / dabblet.css
Last active August 31, 2018 17:17
SVG tracer
/**
* SVG tracer
*/
body {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
}
import pika
import msgpack
import logging
import sys
from . import spark
from .app import logger
logger = logging.getLogger(__name__)
version: "2"
services:
cassandra:
image: cassandra:3.9
network_mode: host
volumes:
- ./volumes/cassandra/var:/var/lib/cassandra
zookeeper:
image: zookeeper:3.4.9
network_mode: host
(defmulti numberize (fn [n] (type n)))
(defmethod numberize :default [n]
':clojure.spec/invalid)
(defmethod numberize Number [number]
number)
(defmethod numberize String [string]
(let [number-format (java.text.NumberFormat/getInstance)]
(ns scrape.core
(:require [clojure.edn :as edn]
[org.httpkit.client :as client]
[net.cgrand.enlive-html :as html]))
(defn get-links
"Get all links at URL as absolute URLs."
[url]
(->> ;; first get all <a href="">...</a> elements...
(-> (java.net.URL. url)
@jmorton
jmorton / snap.clj
Last active January 13, 2017 02:59
Point snapping function
(defn offset
"Calculate distance between point and nearest tile pixel"
[point pixel-size tile-pixel-count]
(mod point (* pixel-size tile-pixel-count)))
(defn near
"Find nearest point"
[point interval shift]
(-> point
(- shift)
(defn parse-quality
"Convert the first 'q' parameter to a number (or 1.0)"
[extension]
(let [[_ qvalue] (re-find #";q=([0-9\.]+)" (or extension ""))]
(java.lang.Double. (or qvalue "1.0"))))
(defn +media-range
""
[accept]
(->> (re-find #"(([\w\*]+)/([^;]+))(;.*)?" accept)
@jmorton
jmorton / 01_setup.sh
Last active June 8, 2016 15:47
My LCMAP Setup Script [WIP]
## Preliminaries
apt-get install git curl
## Java
echo "Installing JDKs"
add-apt-repository ppa:webupd8team/java -y
apt-get update -qq
apt-get install oracle-java7-installer