Skip to content

Instantly share code, notes, and snippets.

@illvart
illvart / bloop.js
Created October 4, 2018 10:02 — forked from jlongster/bloop.js
bloop
(function() {
// Do not use this library. This is just a fun example to prove a
// point.
var Bloop = window.Bloop = {};
var mountId = 0;
function newMountId() {
return mountId++;
}
@illvart
illvart / play.js
Created October 4, 2018 13:17 — forked from pbakondy/play.js
Play with Object.prototype.toString.call()
// under Google Chrome 36
Object.prototype.toString.call([])
// "[object Array]"
Object.prototype.toString.call(function(){})
// "[object Function]"
Object.prototype.toString.call({})
// "[object Object]"
Object.prototype.toString.call(null)
// "[object Null]"
@illvart
illvart / string-utils.js
Created October 4, 2018 16:23 — forked from jonlabelle/string-utils.js
Useful collection of JavaScript string utilities.
// String utils
//
// resources:
// -- mout, https://github.com/mout/mout/tree/master/src/string
/**
* "Safer" String.toLowerCase()
*/
function lowerCase(str){
return str.toLowerCase();
@illvart
illvart / matchesSelector.polyfill.js
Created October 8, 2018 10:00 — forked from jonathantneal/matchesSelector.polyfill.js
matchesSelector Polyfill // returns whether an element matches a selector
this.Element && function(ElementPrototype) {
ElementPrototype.matchesSelector = ElementPrototype.matchesSelector ||
ElementPrototype.mozMatchesSelector ||
ElementPrototype.msMatchesSelector ||
ElementPrototype.oMatchesSelector ||
ElementPrototype.webkitMatchesSelector ||
function (selector) {
var node = this, nodes = (node.parentNode || node.document).querySelectorAll(selector), i = -1;
while (nodes[++i] && nodes[i] != node);
@illvart
illvart / function-performance-test.js
Created December 12, 2018 21:17 — forked from AllThingsSmitty/function-performance-test.js
A quick JavaScript function performance test on the browser console
var i = performance.now();
yourFunction();
performance.now() - i;
//Or make a helper function, like this:
function performanceTest(testFunction, iterations) {
'use strict';
var sum = 0;
var start = performance.now();
for (var i = 0; i < iterations; i++) {
@illvart
illvart / svg-classes.js
Created January 11, 2019 15:41 — forked from branneman/svg-classes.js
SVG — hasClass, addClass, removeClass, toggleClass
//
// SVG — hasClass, addClass, removeClass, toggleClass
// Source:
// https://gist.github.com/branneman/8436956
// Taken and adapted from:
// http://toddmotto.com/hacking-svg-traversing-with-ease-addclass-removeclass-toggleclass-functions/
//
if (SVGElement && SVGElement.prototype) {
___ ___ ___ ___ ___ ___
___ /\__\ /\__\ /\__\ /\ \ /\ \ /\ \
/\ \ /:/ / /:/ / /:/ / /::\ \ /::\ \ \:\ \
\:\ \ /:/ / /:/ / /:/ / /:/\:\ \ /:/\:\ \ \:\ \
/::\__\ /:/ / /:/ / /:/__/ ___ /::\~\:\ \ /::\~\:\ \ /::\ \
__/:/\/__/ /:/__/ /:/__/ |:| | /\__\ /:/\:\ \:\__\ /:/\:\ \:\__\ /:/\:\__\
/\/:/ / \:\ \ \:\ \ |:| |/:/ / \/__\:\/:/ / \/_|::\/:/ / /:/ \/__/
\::/__/ \:\ \ \:\ \ |:|__/:/ / \::/ / |:|::/ / /:/ /
\:\__\ \:\ \ \:\ \ \::::/__/ /:/ / |:|\/__/ \/__/
@illvart
illvart / gist:dbd89605972d6bcdb77a8b704213d01b
Created April 23, 2019 13:34 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
var json1 = '{"enable": true, "emotion": ":)"}';
var json2 = '{"enable": "false", "emotion": ":)"}';
var obj1 = JSON.parse(json1);
var obj2 = JSON.parse(json2);
console.log(obj1.enable);
console.log(obj1.emotion);
console.log(obj2.enable);
@illvart
illvart / era-material-append-script-by-json.html
Last active May 4, 2019 13:50
Era Material: append script by JSON - The Keyword | Google: add support module and nomodule
<div id="base-scripts" data-scripts='[
{
"url": "/static/main.mjs",
"options": {
"async": false,
"defer": false,
"type": "module"
"nomodule": false
}
},