Skip to content

Instantly share code, notes, and snippets.

View lyzadanger's full-sized avatar

Lyza Gardner lyzadanger

View GitHub Profile
@lyzadanger
lyzadanger / oof.js
Created December 13, 2011 21:47
Painful JS Scoping
var Swiper = function(el) {
var startX, startY, lastX, lastY;
var minswipe;
var init=function(el) {
Swiper.minswipe = 50;
el.bind('touchstart', function(event) {
Swiper.startX = event.originalEvent.targetTouches[0].screenX;
Swiper.startY = event.originalEvent.targetTouches[0].screenY;
$(this).bind('touchmove', function(event) {
Swiper.lastX = event.originalEvent.targetTouches[0].screenX;
@lyzadanger
lyzadanger / drupal.mdown
Created September 28, 2012 16:43
My Woes with Drupal

Hokay, please keep in mind I know nothing about Drupal 8, so much of what I comment on here may well be problems that are already being addressed or have been solved therein. AGAIN: If I make a poopoo face at something that has been rectified in D8, please don't be terribly irritated at me!

I am a longtime D6 dev, and have been working in D7 for the past few months, as well.

Core issues as I see them in terms of the mobile Web and the pan-device Web as a whole:

  • Controllers need to be separated from template/view layers in so much as is possible. There is still too much munging between page callbacks/action and the rendered response. I think this is sort of part of what render arrays aim to ease in D7, but render arrays are complex and abysmally documented. I have asked around and no one can find true documentation on them. They're far too convoluted to figure out on one's own unless one has a lot of time, which I sadly do not.
  • Let me clarify: I believe in the kind of idea that a render array repr
@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();

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 / 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)
@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 / groups_api_high_level.md
Created January 25, 2018 17:16
High Level Groups API Approach Ideas

What we have now

GET /profile

Returns a profile object that contains, among other things, a groups property, an Array of objects; that part of the schema looks like:

    "groups": {
      "type": "array",
 "items": {
@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 / ListGroupsServiceAPI.py
Created February 8, 2018 17:02
Quick sketch of plausible surface of `ListGroupsService` service
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
class ListGroupsService(object):
"""
A service for providing filtered lists of groups.
@lyzadanger
lyzadanger / group_json.py
Created February 13, 2018 14:46
Sub-classed Presenter?
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
class GroupJSONPresenter(object):
"""Present a group in the JSON format returned by API requests."""
def __init__(self, group, route_url=None):
self.group = group