Skip to content

Instantly share code, notes, and snippets.

View tabatkins's full-sized avatar

Tab Atkins Jr. tabatkins

View GitHub Profile
@tabatkins
tabatkins / RGBAtoHSLA.js
Created March 19, 2012 18:18 — forked from jonathantneal/RGB2HSL.js
RGBA to HSLA
function RGBAtoHSLA(r, g, b, a) {
var
min = Math.min(r, g, b),
max = Math.max(r, g, b),
diff = max - min,
hsla = [0, 0, (min + max) / 2, a];
if (diff != 0) {
hsla[1] = hsla[2] < 0.5 ? diff / (max + min) : diff / (2 - max - min);
<?php
/**
*
* ----------------------------------------------
* HTML to JSON
* ----------------------------------------------
*
* [Currently used in Wordpress to output HTML into a Google Maps InfoWindow correctly]
*
@tabatkins
tabatkins / gist:4950013
Created February 14, 2013 01:45
What it might look like to write the Variables spec in Markdown, with a few obvious extension points for a custom processor to fill in.
CSS Custom Properties for Cascading Variables Module Level 1
============================================================
~~~~metadata
Status: ED
TR draft: http://www.w3.org/TR/css-variables/
Editor's draft: http://dev.w3.org/csswg/css-variables/
Editor: Tab Atkins Jr. (Google, Inc.) http://xanthir.com/contact
Editor: Luke Macpherson (Google, Inc.) macpherson@google.com
Editor: Daniel Glazman (Disruptive Innovations) daniel.glazman@disruptive-innovations.com
@tabatkins
tabatkins / jsonplist.py
Last active December 20, 2015 13:09
Tiny library/command-line-program for converting between json and plist formats. I use it for editing SublimeText setting files.
#!/usr/bin/python
# -*- coding: utf-8 -*-
import plistlib
import json
import StringIO
# Takes as input a string of either JSON or Plist.
# Returns the opposite, assuming no errors.
def convert(input):
@tabatkins
tabatkins / .bash_functions
Created August 2, 2013 01:15
Small python script to find the relevant CSS spec folder from just a shortname and optionally a level, and a tiny shell script to actually change the directory accordingly.
function spec {
cd $(~/bin/findspec "$@")
}
@tabatkins
tabatkins / gist:9946593
Created April 3, 2014 01:14
Markdown BS: `<dl>` format

Similarly to Markdown ULs and OLs, the DL format is defined by grouping its items.

A DT is indicated by a line starting with a :. A DD is indicated by a line starting with a ::. As with UL/OL, you can linebreak within a block by indenting the subsequent lines, and a block can contain multiple paragraphs as long as you indent. Two blank lines, or a single blank line followed by an unindented line, ends the list.

:term
::definition
:another term
::a longer definition
    stretching over two lines

Keybase proof

I hereby claim:

  • I am tabatkins on github.
  • I am tabatkins (https://keybase.io/tabatkins) on keybase.
  • I have a public key whose fingerprint is DC31 DBD2 B540 C41C 082C 94DF 873F 4A7E 14B4 98DE

To claim this, I am signing this object:

@tabatkins
tabatkins / gist:57d07e4b75a9fc66ee30
Last active August 29, 2015 14:07
List of Suggested Extensions to CSS

List of Suggested Extensions to CSS

This is a breakdown of "List of Suggested Extensions to CSS", produced by the CSSWG back in 1998. It goes through each feature and either lists where the feature has been defined in the intervening 16 years, or notes that it has yet to be addressed.

Out of the 67 suggested extensions, 30 have been added, 10 have been partially added or been added but with uncertain implementor interest, and 27 have not been added.

  1. Columns: http://dev.w3.org/csswg/css-multicol/
  2. Swash letters and other glyph substitutions: http://dev.w3.org/csswg/css-fonts/#font-rend-props
  3. ~ Running headers and footers: , but unproven so
@tabatkins
tabatkins / gist:8c0cb8043dbb2787d59a
Created October 22, 2014 18:07
All strings [a-z]+ of length N or less, in lexicographic order
function gen(N) {
var strings = [];
var max = Math.pow(36, N);
for(var i = 10; i < max; i++) {
var candidate = i.toString(36);
if(/^[a-z]+$/.test(candidate)) {
strings.push(candidate);
}
}
return strings;
@tabatkins
tabatkins / gist:b9b07594dbcde338fd86
Last active August 29, 2015 14:09
Comparing two linking syntaxes
[
{
"linkingText": "blob",
"url": "http://dev.w3.org/2006/webapi/FileAPI/#blob",
"type": "dfn"
},
{
"linkingText": "blob url store",
"url": "http://dev.w3.org/2006/webapi/FileAPI/#BlobURLStore",
"type": "dfn"