Skip to content

Instantly share code, notes, and snippets.

View kfranqueiro's full-sized avatar

Kenneth G. Franqueiro kfranqueiro

View GitHub Profile
@kfranqueiro
kfranqueiro / store.css
Created November 22, 2014 18:04
Less Annoying Steam Store
/* Discovery Queue should DIAFplzkthx */
.discovery_queue_ctn {
display: none !important;
}
@kfranqueiro
kfranqueiro / forDocument.ts
Last active August 29, 2015 14:18
forDocument example in TypeScript
function forDocument(ownerDocument: Document) {
return lang.partial(this, ownerDocument);
}
var byId:{
(ownerDocument: Document, id: string);
forDocument: (ownerDocument: Document) => (id: string) => Node;
} = <any> function (ownerDocument, id) {
return ownerDocument.getElementById(id);
}
@kfranqueiro
kfranqueiro / test.html
Created June 18, 2015 22:26
Test case for Dojo loader inconsistency issue in IE < 11
<!DOCTYPE html>
<html>
<body>
<script>
var dojoConfig = {
async: true,
baseUrl: "",
tlmSiblingOfDojo: false
};
</script>
@kfranqueiro
kfranqueiro / README.md
Last active September 11, 2020 16:16
Rudimentary visual regression testing strategery

Introduction

This gist documents the setup I originally used to run visual diffs on the MDC Web demo pages for testing material-components/material-components-web#1285, but I have used it since then on other projects.

Setup

  1. Create a directory containing the js and txt files from this gist
  2. npm i

Process

@kfranqueiro
kfranqueiro / input.scss
Last active March 16, 2018 01:01
MDC Web #2415 experimentation
@function replace-or-append($list, $target, $value) {
$newlist: ();
$replaced: false;
@for $i from 1 through length($list) {
@if (nth($list, $i) == $target) {
$newlist: append($newlist, $value);
$replaced: true;
} @else {
$newlist: append($newlist, nth($list, $i));
@kfranqueiro
kfranqueiro / README.md
Last active February 27, 2019 19:17
Script to replace MDC Web npm dependencies with packages from local clone

This script will replace the MDC Web packages it finds under node_modules with copies of the folders from a local MDC Web clone. This can be used to test MDC Web code ahead of releases.

Instructions

Easiest usage:

  1. Add this js file to a directory in PATH
  2. chmod 700 it
  3. Go into the root directory of a project that uses MDC Web dependencies and run the script
@kfranqueiro
kfranqueiro / resize.js
Last active October 9, 2019 14:03
Bookmarklet to create a window and resize it multiple times (for condensing breakpoint screenshots into gifs)
(function() {
const bg = document.createElement('div');
bg.style.position = 'absolute';
bg.style.top = '0';
bg.style.width = '100%';
bg.style.height = '100%';
bg.style.background = '#000';
bg.style.zIndex = '99999';
document.body.appendChild(bg);
@kfranqueiro
kfranqueiro / inclusiveCards.tsx
Created June 13, 2021 20:37
Implementation of https://inclusive-components.design/cards/ (using Chakra UI, but shouldn't be hard to migrate to something else) - demo at https://codesandbox.io/s/inclusive-components-cards-using-react-chakra-ui-vq9mm
import * as React from "react";
import { BoxProps, CSSObject } from "@chakra-ui/react";
interface Options {
/** Distance (in px) under which to still consider interaction a click */
threshold?: number;
}
/**
* Returns mousedown and mouseup handlers to process clicks on an ancestor of the