Skip to content

Instantly share code, notes, and snippets.

View kfranqueiro's full-sized avatar

Kenneth G. Franqueiro kfranqueiro

View GitHub Profile
@scottjehl
scottjehl / inert-unert.js
Created August 5, 2020 21:28
inert-unert.js: a quick utility for applying or removing the inert property
// inert-unert.js: a quick utility for applying or removing the inert property
// - @scottjehl, @filamentgroup
// (note: inert support polyfill is still needed in some browsers)
// usage:
// when a modal element such as a dialog is active,
// this function will make unrelated elements inert, aiming to affect as few as possible
// example: inert( document.querySelector(".modal-open") );
function inert( allButThisElement ){
function inertSiblings( node ){
if( node.parentNode ){
@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

@neonstalwart
neonstalwart / config
Last active December 15, 2015 10:29
my nginx *.dev config - the first line in each file is the full path to the file because gists don't give enough context. see https://gist.github.com/neonstalwart/5246908 for some extra config for virtualbox (not included here because it's ugly)
# /usr/local/etc/nginx/common
index index.html index.htm index.json;
if_modified_since before;
location ~ /\.(svn|git|ht) {
deny all;
}
@jrburke
jrburke / apiexamples.js
Created April 7, 2011 05:50
Description of browser-friendly module APIs: AMD and Loader Plugins
//*******************************************
// Level 1, basic API, minimum support
//*******************************************
/*
Modules IDs are strings that follow CommonJS
module names.
*/
//To load code at the top level JS file,
//or inside a module to dynamically fetch
@dmachi
dmachi / LocalStorage.js
Created March 22, 2011 05:26
LocalStorage wrapper providing dojo.store interface
define("dojo/store/LocalStorage", ["dojo", "dojo/store/util/QueryResults", "dojo/store/util/SimpleQueryEngine"], function(dojo) {
dojo.declare("dojo.store.LocalStorage", null, {
constructor: function(/*dojo.store.LocalStorage*/ options){
// summary:
// localStorage based object store.
// options:
// This provides any configuration information that will be mixed into the store.
// This should generally include the data property to provide the starting set of data.
if (!dojo.global.localStorage){
@PEM-FR
PEM-FR / widget.dnd.MultiAreaManager.js
Created March 14, 2011 15:18
[enhancement] - dojox.mdnd.areaManager : A class to add support of multiple nested areas
// Author : PEM-FR (on github), PEM on #dojo on freenode, PEM_FR on dojofoundation
dojo.provide("widget.dnd.MultiAreaManager");
dojo.require("dojox.mdnd.AreaManager");
dojo.require("dojox.mdnd.DropIndicator");
//Attention : for instance this code only work for OverDropMode :)
dojo.require("dojox.mdnd.dropMode.OverDropMode");
dojo.declare(
@kriszyp
kriszyp / define-node.js
Created October 27, 2010 21:08
Add AMD/define() support to NodeJS
var currentModule, defaultCompile = module.constructor.prototype._compile;
module.constructor.prototype._compile = function(content, filename){
currentModule = this;
try{
return defaultCompile.call(this, content, filename);
}
finally {
currentModule = null;
}
};