Skip to content

Instantly share code, notes, and snippets.

@mkxml
mkxml / gist:6779218
Last active December 24, 2015 09:39
Switch made in HTML + CSS. Inspired by iOS7.
<!DOCTYPE html>
<html>
<!--
Switch inspired by iOS7.
Works well in Chrome, Opera and FF.
Safari works but it is a little glitchy.
-->
<head>
<meta charset="UTF-8">
<style>
@mkxml
mkxml / checkDigit11.js
Last active April 20, 2021 13:27
Check Digit JavaScript function for modulo 11
/*
Check digit using modulo 11
Arguments:
- n is your given number to test the check digit
- x is an optional argument that is used to determine the check digit
used in case of the rest of the division is less than 2. Defaults to 0.
Returns an integer, the checkDigit for the given number.
*/
var checkDigit11 = function(n, x) {
@mkxml
mkxml / checkDigitGS1.js
Last active January 25, 2020 07:43
Check Digit GS1
/*
Check digit GS1
Arguments:
- [String] GS1 code without check digit to generate
the check digit
Returns:
- [Number] Check digit for given code
Author: Matheus R. Kautzmann
*/
@mkxml
mkxml / index.html
Created October 9, 2014 17:35
Polymer platform.js Web Components polyfill conditional loader
<script>
var wc = document.registerElement &&
window.HTMLTemplateElement &&
window.ShadowRoot &&
window.WeakMap &&
window.MutationObserver &&
("import" in document.createElement("link"));
if(!wc) {
var polyfill = document.createElement("script");
polyfill.src = "polymer/platform.js";
# initialization file (not found)
@mkxml
mkxml / cloudSettings
Last active December 1, 2020 14:38
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-12-01T14:38:37.703Z","extensionVersion":"v3.4.3"}