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
@steveosoule
steveosoule / 01__miva-user-friendly-date-time-with-am-pm.md
Last active February 27, 2024 18:05
Miva - User Friendly Date & Time with AM/PM (ex MM/DD/YYYY HH:MM AM/PM)

Miva - User Friendly Date & Time with AM/PM

The following code snippet will output a date with a format like this pattern:

MM/DD/YYYY HH:MM (AM/PM)

For example:

<!DOCTYPE html>
<html>
<head>
<title>Dice</title>
<style type="text/css">
body {
margin: 1em auto;
max-width: 40em;
width: 88%;
@adactio
adactio / sharebutton.js
Last active April 13, 2024 19:22
A polyfill for `button type="share"`
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
/* Use <button type="share"> in your HTML.
Include this JavaScript in a <script> element on the same page or in an external script.
The script checks for three ways of sharing:
1. Native support for <button type="share">.
2. Support for the JavaScript Web Share API.
3. A mailto: link.
This will share the current URL and page title.
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']
@aronhoyer
aronhoyer / _grid.scss
Last active August 29, 2021 21:15
SASS grid system with CSS grid
$screen-sizes: (
xxl: 1920px,
xl: 1440px,
l: 1360px,
ml: 1280px,
m: 768px,
s: 576px
);
$col-count: 24;
@ireade
ireade / sw.js
Last active October 7, 2023 20:56
Handle broken images with the service worker
self.addEventListener('install', (e) => {
e.waitUntil(
caches.open("precache").then((cache) => cache.add("/broken.png"))
);
});
function isImage(fetchRequest) {
return fetchRequest.method === "GET" && fetchRequest.destination === "image";
}
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active May 3, 2024 12:55
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@steveosoule
steveosoule / miva-action-descriptions.md
Last active August 11, 2021 20:41
Miva Action Descriptions

Miva Action Descriptions

Here is a table that lists out the actions found within the merchant.mv file of the 9.12.00 LSK

Action Description
LOGN Customer Login
LOGO Customer Logout
EMPW Customer Email Password
CPWD Customer Change Password
@vviikk
vviikk / nicely-named-fluid-typography-with-custom-properties.css
Last active January 17, 2020 21:08
Better Fluid type with custom properties
:root {
/* CONSTANTS */
--FONT-SIZE-MIN: 16;
--FONT-SIZE-MAX: 26;
/* Notice, no calcs used yet */
--FONT-SIZE-MIN-PX: (var(--FONT-SIZE-MIN) * 1px);
--FONT-SIZE-MAX-PX: (var(--FONT-SIZE-MAX) * 1px);
--BROWSER-WIDTH-MIN: 300;
@jonathantneal
jonathantneal / detect-autofill.js
Created September 11, 2018 14:56
Detect autofill in Chrome, Edge, Firefox, and Safari
export default scope => {
// match the filter on autofilled elements in Firefox
const mozFilterMatch = /^grayscale\(.+\) brightness\((1)?.*\) contrast\(.+\) invert\(.+\) sepia\(.+\) saturate\(.+\)$/
scope.addEventListener('animationstart', onAnimationStart)
scope.addEventListener('input', onInput)
scope.addEventListener('transitionstart', onTransitionStart)
function onAnimationStart(event) {
// detect autofills in Chrome and Safari by: