Skip to content

Instantly share code, notes, and snippets.

View 01_content
Don't allow eel bearing Atlanteans into your country; economic ruin follows close behind
@jmorton
jmorton / typography.scss
Created Apr 3, 2019
Harmonic type scaling
View typography.scss
$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;
View dabblet.css
/**
* SVG tracer
*/
body {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
}
View message.py
import pika
import msgpack
import logging
import sys
from . import spark
from .app import logger
logger = logging.getLogger(__name__)
View docker-compose.yml
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
View numberize.clj
(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)]
View scrape.clj
(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 Jan 13, 2017
Point snapping function
View snap.clj
(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)
View accept-handler.clj
(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 Jun 8, 2016
My LCMAP Setup Script [WIP]
View 01_setup.sh
## 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