Skip to content

Instantly share code, notes, and snippets.

@xi
xi / contrast.scss
Created Jul 20, 2017
flexible contrast function inspired by css-color-4
View contrast.scss
// This implements a flexible contrast function similar to the one
// proposed in <https://github.com/w3c/csswg-drafts/issues/1627>.
//
// Note that it uses some approximations and RGB instead of HWB
// interpolation.
@function srgb($channel) {
$x: $channel / 255;
@if $x <= .03928 {
@return $x / 12.92;
View leo.py
#!/usr/bin/env python3
"""Get translations from leo.org on the command line."""
import argparse
import itertools
import collections
import xml.etree.ElementTree as ET
import requests
@xi
xi / package.json
Last active Sep 12, 2018
Run multiple linters
View package.json
{
"name": "polylint.sh",
"description": "Run multiple linters efficiently.",
"homepage": "https://gist.github.com/xi/63216e505a6d55562eaf695811c6fc9c",
"version": "0.0.4",
"os": ["darwin", "linux"],
"files": ["polylint.sh"],
"bin": {
"polylint": "./polylint.sh"
}
@xi
xi / makepkg
Last active Apr 8, 2017
wrapper around checkinstall that supports a subset of arch linux' PKGBUILD format
View makepkg
#!/bin/bash -e
# This script is a wrapper around checkinstall that supports a subset of arch
# linux' PKGBUILD format. This means that it can be used to build debian
# packages from a single file.
#
# PKGBUILD files are written in bash and can define the following variables:
#
# - pkgname [required]
# - pkgver [required]
@xi
xi / Makefile
Created Nov 6, 2016
Build a Debian package that adds guest-account functionality to LightDM.
View Makefile
# Build a Debian package that adds guest-account functionality to LightDM.
#
# For guest accounts to work LightDM needs a binary "guest-account" which it
# will run to create / destroy guest accounts.[0] The default Debian package
# does not provide one.[1] However, the Ubuntu package does.[2]
#
# The simple way to use this script is simply to call `make install`. This will
# fetch the Ubuntu package, unpack it and install only the files that are
# relevant for guest accounts. However, this is strongly discouraged because
# it bypasses the package system.
@xi
xi / SassMeister-input.scss
Created Feb 25, 2016
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// libsass (v3.2.5)
// ----
// This provides some common mathemetical functions implemented in pure sass:
//
// - $PI
// - ln($x, $steps: 32)
// - pow($x, $exponent, $steps: 32)
// - sqrt($x, $exponent: 2, $steps: 32)
You can’t perform that action at this time.