Skip to content

Instantly share code, notes, and snippets.

View tabatkins's full-sized avatar

Tab Atkins Jr. tabatkins

View GitHub Profile
@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 / problem.md
Created August 30, 2017 20:41
Problems with .then() handling the lock stuff

Currently, lock.asyncHold() isn't specced to take any arguments. It just returns a promise, and you pass the code you want to operate under the lock to the .then() method. This is problematic - it requires promise subclassing, and has some unintuitive and probably unexpected behavior.

For example, this code doesn't lock anything at all:

const p = lock.asyncHold();
...never call .then()...

This is extremely different from lock.hold(cb);, which immediately acquires the lock (and calls the cb with it held).

@tabatkins
tabatkins / AXS_error.md
Last active March 14, 2018 17:23
Error spewed *to the user* when you try to sign up for an AXS account with a password that's too long.

```Oracle.DataAccess.Client.OracleException ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at "AEG_NCALIFORNIA.TIX_CUSTOMER_DA", line 200 ORA-06512: at line 1 at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck) at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery() at VA.Services.CustomerDA.InsertRow(TransactionContext tc, String lastName, String firstName, String middleName, String phone1, String phone2, String fax, Nullable1 isFemale, String email, String customerPassword, String companyName, Nullable1 birthDay, String prefix, String suffix, String phone3, Nullable`1 phone1type, Nullable`1 phone2type, Nullable`1 phone3type, String salutation, String careof, String stateid, Nullable`1 optedin, Nullable`1 sentwelcomemsg, String notes, Nullable`1 securityquestionid, String securityanswer, Nullable`1 securityquestion2id, Stri

@tabatkins
tabatkins / IO.js
Created August 30, 2017 15:32
The IO monad, in JS
class IO {
constructor(val) {
this._fn = ()=>val;
return this;
}
static fromFn(fn) {
const ret = new IO();
ret._fn = fn;
return ret;
}
@tabatkins
tabatkins / wedding-crimes.txt
Last active December 7, 2019 00:02
Transcript of Wedding Crimes, an AI Dungeon Adventure
You are Xanthir, a rogue living in the kingdom of Larion. You have a long steel dagger and a length of rope. You walk down the city street looking for somehwere to steal from. You look around and see nothing that you can't get away with. You notice a group of soldiers walking along the road. They stop when they see you.
"What do you want?" One of them asks
> You say "Your money, or your life. Or both, I'm not picky.".
The soldier looks at you for a moment and then nods. He points to his sword and says "I'll take it".
You quickly grab the soldier's hand and pull him over to the side of the road. The soldier is surprised by this, but he doesn't resist
@tabatkins
tabatkins / at-switch.md
Created May 9, 2020 00:32
Variant syntax for switch() function from @bkardell

@bkardell proposes a switch() function for providing Container-Query-ish functionality inline in CSS.

The switch() function gets a bit complicated, tho, mixing two distinct and complex grammars (comparisons and <any-value>) in one spot. It also doesn't let you style multiple properties together; you instead have to write multiple switch()es, one per property, and duplicate your tests, even if a property is only affected in one of the conditions.

Here's an alternate syntax proposal I think I like a little better. There is no change to the power of the proposal.

Create a new conditional rule, called @switch. It is only allowed nested inside a style rule; if put at the top level, it's invalid.

The @switch contains rules; the prelude of each rule is a condition (which can use information evaluated against the element selectede by the outer style rule), the body is a set of properties to apply to the element when the condition matc

Topic-Style Pipelines

Note: This is a distillation of @jschoi's excellent and thorough "Smart Mix Pipeline" proposal. @jschoi's proposal is perhaps too thorough, tho, and includes a number of optional features that I think muddy the waters and make the whole thing seem far more complex than it is.

So here's the minimal "topic-style pipeline" syntax I think we need, along with the two most important optional extensions only.

  • Topic-style pipeline
    • Optional (mildly desired) feature: bare-style syntax
    • Optional (strongly desired) feature: pipeline function
@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 / apprentice-properties.md
Last active February 4, 2021 03:53
Somewhat sorted list of apprentice weapon properties

Masterwork Properties

Masterwork properties can be applied to any masterwork weapon or suit of armor, provided you can spare the time and gold cost required to apply it. Each property entry details the property’s level and the type of equipment it can be applied to.

Unless otherwise noted, a piece of gear cannot have the same property more than once; for example, you cannot

There's a reason people don't like to write HTML tables,
and it's because they don't write good HTML in the first place.
Case in point, taken from a spec I'm editting right this moment:
```html
<table id="distinguishable-table" class="matrix data complex">
<tr>
<th class="corner"></th>
<th><div>