Skip to content

Instantly share code, notes, and snippets.

Avatar

Tab Atkins Jr. tabatkins

View GitHub Profile
View gist:5c336285c7f6d7d6522561e97f4d98fb
View real-world-pipeline.md

Core Proposal real-world examples

Living Document. J. S. Choi, 2018-12.

WHATWG Fetch Standard

The [WHATWG Fetch Standard][] contains several examples of using the DOM fetch function, resolving its promises into values, then processing the values in various ways. These examples may become more easily readable with smart pipelines.

View topic-style-pipeline.md

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 / at-switch.md
Created May 9, 2020
Variant syntax for switch() function from @bkardell
View at-switch.md

@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

@tabatkins
tabatkins / wedding-crimes.txt
Last active Dec 7, 2019
Transcript of Wedding Crimes, an AI Dungeon Adventure
View wedding-crimes.txt
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 / AXS_error.md
Last active Mar 14, 2018
Error spewed *to the user* when you try to sign up for an AXS account with a password that's too long.
View AXS_error.md

```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 / problem.md
Created Aug 30, 2017
Problems with .then() handling the lock stuff
View problem.md

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 / IO.js
Created Aug 30, 2017
The IO monad, in JS
View IO.js
class IO {
constructor(val) {
this._fn = ()=>val;
return this;
}
static fromFn(fn) {
const ret = new IO();
ret._fn = fn;
return ret;
}
View SpecRef edits
{
"css-animations-1": {
"aliasOf": "css3-animations"
},
"css-backgrounds-3": {
"aliasOf": "css3-background"
},
"css-box-3": {
"aliasOf": "css3-box"
},
View gist:6a5f74fc50d8e16e2d39
CookieBot = {
$bigCookie: null,
$products: null,
running: true,
init: function() {
CookieBot.$bigCookie = document.querySelector("#bigCookie");
CookieBot.$products = [].slice.call(document.querySelectorAll(".product"));
},
You can’t perform that action at this time.