Skip to content

Instantly share code, notes, and snippets.

View lyzadanger's full-sized avatar

Lyza Gardner lyzadanger

View GitHub Profile
@lyzadanger
lyzadanger / open_groups.md
Created January 24, 2018 22:19
Group Access, Scope and Types

This is my overall assessment of what groups “mean” as an intersection of prose requirements and what the h backend app currently has in its code. Some (most?) of this may be rehash and may elicit the “yeah, right, we already know this” response, but if that happens, yay, we’re in alignment and if you think “gosh, this is wrong in some/all ways” that’s a good thing to identify, too.

Extreme tl;dr:

  1. For open groups, Group resources need an additional constraint that defines what the set of valid URLs are for target documents that may be annotated within that group, and this is distinct from access or permissions. I am calling that constraint scope for shorthand, which may be a totally terrible name.
  2. The list of “this user’s groups” is variable and depends on scope/context.
  3. I’m not proposing a specific way to implement a scope constraint (yet, at least) in the data model

Vocabulary Interlude

I am going to use the following terms as defined here. Some of this may seem overtly pedantic, but

@lyzadanger
lyzadanger / groups.md
Last active January 24, 2018 22:41
Groups as the h application code currently sees them

What does “groups” mean to the application right now?

Activity

Acitivity’s query module has some interaction with groups in constructing and executing queries for activity pages.

API

Profile

The GET profile endpoint returns an object with a groups attribute—an Array of objects with:

@lyzadanger
lyzadanger / APDS9960.js
Last active April 28, 2017 16:59
Johnny-Five Component Plugin Support for APDS-9960 Gesture Sensing
// Datasheet: https://cdn.sparkfun.com/assets/learn_tutorials/3/2/1/Avago-APDS-9960-datasheet.pdf
const Emitter = require('events').EventEmitter;
const util = require('util');
const I2C_ADDR = 0x39; // Sensor's hardwired I2C address (p.8)
const DEVICE_ID = 0xAB; // The device will report this ID (p.25)
const REGISTERS = { // Register addresses
ENABLE : 0x80, // Enable different sensors/features (p.20)
WTIME : 0x83, // Wait time config value (p.21)

Context

These notes and questions are the summary of my analysis of Section 7.1: Browsing Contexts in the WHATWG HTML spec and its related WPT test coverage in html/browsers/windows/.

While I'm a long-time spec consumer and standards-based web dev, this is my first project involving contribution to the https://github.com/w3c/web-platform-tests project.

General Test Running and Authorship Questions

These are notes or questions that arose from examining the tests for 7.1 but apply more broadly to the WPT infrastructure and conventions.

@lyzadanger
lyzadanger / deleteEmptyTrees.js
Created May 13, 2015 23:38
Recursive delete all empty directory trees
'use strict';
var walk = require('walkdir');
var fs = require('fs');
var path = require('path');
var extfs = require('extfs');
var deleteEmptyPath = function deleteEmptyPath(delPath, cb) {
extfs.isEmpty(delPath, function (isEmpty) {
if (isEmpty) {
@lyzadanger
lyzadanger / Thinking-points.md
Created March 26, 2015 18:55
Thinking about scope (for Sara)

(You should be able to clone this gist and run node example[x].js for each JS file here to do the exercises).

  • What do you think will happen when you execute example1.js?
  • What happens if you comment out line 12 and run example1.js? Why?
  • What do think will happen when you execute example2.js? Did it work as you expected?
  • What would happen if you added a new line to the end of example3.js and console.log(mySecretValue);? Why?
  • What type is secretKeeper on line 12 of example4.js? How did it get assigned?
  • What code does secretKeeper() execute when it is invoked on line 13 of example4.js? What does it return and how?
  • What type is secret as of line 13 of example4.js?
  • What will log to the console in line 14 of example5.js? Line 15?
@lyzadanger
lyzadanger / gulp-strip-scripts.js
Last active June 28, 2022 08:58
Gulp plugin to strip inline scripts from HTML- or HTML-like files, stick 'em in a file property
/* global Buffer, console */
/**
* Strip inline <script> elements and push each
* <script> tag's contents to `file.scripts`
* (Array; each element is the contents of a script element)
*/
'use strict';
var through = require('through2');
var gutil = require('gulp-util');
var cheerio = require('cheerio');
@lyzadanger
lyzadanger / gulp-template-through2.js
Last active August 29, 2015 14:11
Template for gulp plugin using through2
var through = require('through2');
var gutil = require('gulp-util');
// Anything in this scope will execute once on `require`
module.exports = function thisIsMyGulpPlugin() {
// Do some stuff here if you want
// Anything at this scope level will execute once per
// task-level stream (i.e. every time a task is invoked
// and the stream piped through this plugin)
@lyzadanger
lyzadanger / _button-group.scss
Last active August 29, 2015 14:01
Jacket + Custom MQ-handling Mixin
body {
margin: 2em;
}
.button {
background-color: #007dc6;
border-radius: 0.25em;
box-sizing: border-box;
color: #fff;
display: inline-block;
@lyzadanger
lyzadanger / pxToEm.js
Created November 16, 2012 23:30
Jehl's jQuery px-to-em Conversion, Lyza's Version
$.fn.toEm = function(settings){
settings = jQuery.extend({
scope: 'body',
asNumber: false
}, settings);
var that = parseInt(this[0],10),
inEms,
scopeTest = jQuery('<div style="display: none; font-size: 1em; margin: 0; padding:0; height: auto; line-height: 1; border:0;">&nbsp;</div>').appendTo(settings.scope),
scopeVal = scopeTest.height();
scopeTest.remove();