Skip to content

Instantly share code, notes, and snippets.

View influxweb's full-sized avatar
Coffee Helps Me Focus...Coffee Helps Me Focus...Coffee Helps Me Focus...

Matt Zimmermann influxweb

Coffee Helps Me Focus...Coffee Helps Me Focus...Coffee Helps Me Focus...
View GitHub Profile
@influxweb
influxweb / debug-scroll.md
Created March 24, 2023 19:15 — forked from cuth/debug-scroll.md
Find the elements that are causing a horizontal scroll. Based on http://css-tricks.com/findingfixing-unintended-body-overflow/

Debug Horizontal Scroll

(function (d) {
    var w = d.documentElement.offsetWidth,
        t = d.createTreeWalker(d.body, NodeFilter.SHOW_ELEMENT),
        b;
    while (t.nextNode()) {
        b = t.currentNode.getBoundingClientRect();
 if (b.right > w || b.left < 0) {
<!--
================================
<URI_Add />
Description:
Adds a new URI to a page, category, product, or feed.
Rules:
Requires `uri` attribute with a value starting with "/"
For canonical URIs, add `canonical="yes"` attribute and ommit the `status` attribute.
Seven different types of CSS attribute selectors
// This attribute exists on the element
[value]
// This attribute has a specific value of cool
[value='cool']
// This attribute value contains the word cool somewhere in it
[value*='cool']
@influxweb
influxweb / swipe.js
Created November 20, 2019 21:20 — forked from chrishaensel/swipe.js
Simple swipe gesture recognizer in vanilla javascript
var swiper = {
touchStartX: 0,
touchEndX: 0,
minSwipePixels: 30,
detectionZone: undefined,
swiperCallback: function() {},
init: function (detectionZone, callback) {
swiper.swiperCallback = callback
@influxweb
influxweb / _grid.scss
Created August 15, 2019 21:36 — forked from aronhoyer/_grid.scss
SASS grid system with CSS grid
$screen-sizes: (
xxl: 1920px,
xl: 1440px,
l: 1360px,
ml: 1280px,
m: 768px,
s: 576px
);
$col-count: 24;
@influxweb
influxweb / css-variables.js
Created August 8, 2017 21:39 — forked from wesbos/css-variables.js
Test for CSS Variables
function testCSSVariables() {
var color = 'rgb(255, 198, 0)';
var el = document.createElement('span');
el.style.setProperty('--color', color);
el.style.setProperty('background', 'var(--color)');
document.body.appendChild(el);
var styles = getComputedStyle(el);
var doesSupport = styles.backgroundColor === color;
@influxweb
influxweb / Dice.cs
Created May 9, 2017 00:41 — forked from csasbach/Dice.cs
This module exposes static methods for rolling dice.
/**
* Dice
*
* @author C. Scott Asbach
*
* This module exposes static methods for rolling dice.
*/
using System;
namespace Dice
@influxweb
influxweb / tooltip.css
Created May 9, 2017 00:40 — forked from csasbach/tooltip.css
Create tooltips on mouseover or on click (for supporting touch interfaces).
abbr
{
border-bottom: 1px dotted #666;
cursor: help;
}
.tooltip
{
position:absolute;
background-color:#eeeefe;
@influxweb
influxweb / loadScript.js
Last active April 19, 2017 18:19 — forked from jnrbsn/gist:4268258
Loads a JavaScript file asynchronously with a callback, like jQuery's `$.getScript()` except without jQuery.
function loadScript(url, callback) {
var head = document.getElementsByTagName('head')[0],
scriptCalled = document.createElement('script');
scriptCalled.async = true;
scriptCalled.src = url;
scriptCalled.onload = scriptCalled.onreadystatechange = function () {
if (!scriptCalled.readyState || /loaded|complete/.test(scriptCalled.readyState)) {
scriptCalled.onload = scriptCalled.onreadystatechange = null;
@influxweb
influxweb / loadPageSection.js
Created April 7, 2017 23:59 — forked from lazamar/loadPageSection.js
Vanilla JS implementation of JQuery's .load
/**
* Loads an HTML document from a URL and retuns an element selected using
* the 'selector' parameter
* Example usage:
* loadPageSection('./myPage.html', '#container', (r, err) => console.log(r, err));
*
* @method loadPageSection
* @param {String} url
* @param {String} selector - A valid CSS selector
* @param {Function} callback - To be called with two parameters (response, error)