Skip to content

Instantly share code, notes, and snippets.

View kypflug's full-sized avatar

Kyle Pflug kypflug

View GitHub Profile
@kypflug
kypflug / edge-at-build-2020.md
Last active November 1, 2020 19:47
Microsoft Edge @ Build 2020
@kypflug
kypflug / Example-detection.js
Last active August 29, 2015 14:22
Example of feature detection for responsive images
(function (window) {
document.addEventListener("DOMContentLoaded", function (e) {
var supports = {
srcset: false,
currentSrc: false,
sizes: false,
picture: false
};
var toggleGainState = function(elementId, elementClass, outputElement){
var ele = document.getElementById(elementId);
return function(){
if (outputElement.gain.value === 0) {
outputElement.gain.value = 1;
ele.classList.remove(elementClass);
} else {
outputElement.gain.value = 0;
ele.classList.add(elementClass);
}
@kypflug
kypflug / Complex default parameter scope case Chakra handles properly
Last active August 29, 2015 14:21
Complex default parameter scope case Chakra handles properly
function fn() { return "outside" }
function outer(a = fn()) {
function fn() { return "inside" };
return fn();
}
outer(); // "outside"
@kypflug
kypflug / Complex default parameter scope that Chakra doesn’t yet handle
Last active August 29, 2015 14:21
Complex default parameter scope that Chakra doesn’t yet handle
let x = "outside";
function outer(a = () => eval("x")) {
let x = "inside";
return a();
}
outer(); // "inside", should be "outside"
@kypflug
kypflug / functionsquare
Created May 6, 2015 02:57
function square in an asm.js module
function PhysicsEngine(global, foreign, heap) {
"use asm";
// Function Declaration
function square(x) {
x = +x;
return +(x*x);
}
}
// code for IE
if (window.ActiveXObject || xhttp.responseType == "msxml-document") {
xml.setProperty("SelectionLanguage", "XPath");
nodes = xml.selectNodes(path);
for (i = 0; i < nodes.length; i++) {
document.write(nodes[i].childNodes[0].nodeValue);
document.write("<br>");
}
}
@kypflug
kypflug / css touch-action property
Created February 23, 2015 19:53
CSS touch-action property from Pointer Events
.disable300msDelay {
touch-action: manipulation;
}
@kypflug
kypflug / media queries
Created February 5, 2015 00:45
Media Queries Level 4 Demo
<!DOCTYPE html>
<html lang="en">
<head>
<title>Media Queries Level 4 Demo</title>
<style>
body, html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
@kypflug
kypflug / Windows 10 Phone UA String
Last active August 29, 2015 14:14
Windows 10 Technical Preview for phones UA String
Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; DEVICE INFO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Mobile Safari/537.36 Edge/12.0