Skip to content

Instantly share code, notes, and snippets.

View L9m's full-sized avatar
🎯
Focusing

L9m L9m

🎯
Focusing
  • 21:59 (UTC -12:00)
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@L9m
L9m / reboot.css
Last active March 29, 2019 06:22
My reboot css
/* Document */
html {
box-sizing: border-box;
font-family: sans-serif;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
-webkit-tap-highlight-color: transparent;
}
*,
function countByte (str) {
return decodeURI(
encodeURI(str)
).length //URL-encode use UTF-8
} //Note: this fails for input that contains lone surrogates.
}
Use http://mths.be/utf8js if you need something more robust.
function countByte (str) {
var pfx = ["webkit", "moz", "MS", "o", ""],
function PrefixedEvent(element, type, callback) {
element.removeEventListener(pfx[p] + type, callback, false);
for (var p = 0; p < pfx.length; p++) {
if (!pfx[p]) type = type.toLowerCase();
element.addEventListener(pfx[p] + type, callback, false);
}
}