Skip to content

Instantly share code, notes, and snippets.

@JosePedroDias
JosePedroDias / wc.html
Created June 14, 2019 13:14
custom element
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>webcomponents test</title>
<link
href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII="
rel="icon"
type="image/x-icon"
/>
@ebidel
ebidel / feature_detect_es_modules.js
Last active September 4, 2023 13:56
Feature detect ES modules: both static import and dynamic import()
<!--
Complete feature detection for ES modules. Covers:
1. Static import: import * from './foo.js';
2. Dynamic import(): import('./foo.js').then(module => {...});
Demo: http://jsbin.com/tilisaledu/1/edit?html,output
Thanks to @_gsathya, @kevincennis, @rauschma, @malyw for the help.
-->
@bellbind
bellbind / zip.js
Last active April 26, 2022 23:06
[es6] zip generator for ES6
"use strict";
const zip = function* () {
const its = Array.from(arguments, e => e[Symbol.iterator]());
while (true) {
const es = its.map(it => it.next());
if (es.some(e => e.done)) return;
yield es.map(e => e.value);
}
};
@watson
watson / four-byte-emojis.json
Last active August 6, 2024 08:40
Emoji's sorted by byte-size
[
"😁",
"😂",
"😃",
"😄",
"😅",
"😆",
"😉",
"😊",
"😋",
@addyosmani
addyosmani / limitLoop.js
Last active April 25, 2024 19:10
Limit the frame-rate being targeted with requestAnimationFrame
/*
limitLoop.js - limit the frame-rate when using requestAnimation frame
Released under an MIT license.
When to use it?
----------------
A consistent frame-rate can be better than a janky experience only
occasionally hitting 60fps. Use this trick to target a specific frame-
rate (e.g 30fps, 48fps) until browsers better tackle this problem