Skip to content

Instantly share code, notes, and snippets.

@tkadlec
tkadlec / libs-to-npm.json
Created May 26, 2017
JSON Map between Library Detector libraries and NPM packages
View libs-to-npm.json
{
"GWT": {
"url": "http://www.gwtproject.org/"
},
"Ink": {
"url": "http://ink.sapo.pt/"
},
"Vaadin": {
"url": "http://vaadin.com/home"
},
View Serverless-Post-Guy-Edits.md
title description date thumbnail layout authors
Introducing the Serverless Snyk Plugin
Using Serverless is a boon for security, as it greatly reduces the risk of unpatched servers. In this environment, vulnerable open source packages become the primary security risk. The new Serverless Snyk plugin addresses this issue.
2016-11-03
Post
FirstnameLastname
@tkadlec
tkadlec / perf.js
Created Apr 23, 2015
Super simple example of adding perf timing to the page display during dev work
View perf.js
(function () {
var perfBar = function(budget) {
window.onload = function() {
window.performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance || {};
var timing = window.performance.timing,
now = new Date().getTime(),
output, loadTime;
@tkadlec
tkadlec / mustard-test.js
Last active Aug 29, 2015
Cut the mustard with proxy browsers taken into consideration
View mustard-test.js
var hasStorage = (function() {
try {
localStorage.setItem("test", "mod" );
localStorage.removeItem("test");
return true;
} catch (exception) {
// console.info(exception);
if (exception && exception.name=="QuotaExceededError" && localStorage.length == 0) {
//private
return true;
@tkadlec
tkadlec / results-table
Last active Aug 29, 2015
Sizer-Soze Results Table
View results-table
<div class="fourth-content cf sizer-results">
<h1>Results for http://hugeinc.com</h1>
<table>
<thead>
<tr>
<th>Breakpoint</th>
<th>Original Weight</th>
<th>Lossless Savings</th>
<th>Lossy Savings</th>
@tkadlec
tkadlec / gist:3645415
Created Sep 5, 2012
"View Desktop Layout" link for responsive sites
View gist:3645415
<html>
<head>
<title>Mobile First "View Desktop" Link</title>
<meta id="vp" name="viewport" content="width=device-width" />
<style type="text/css">
body{
font-family: Helvetica, sans-serif;
}
#toggle{
text-decoration: underline;
@tkadlec
tkadlec / imageCheck.js
Created Aug 10, 2012
Determine if image has been downloaded
View imageCheck.js
var myImage = new Image();
myImage.src = "http://somedomain.com/image2.png";
if (myImage.complete) {
//already downloaded
} else {
//not yet downloaded
}
@tkadlec
tkadlec / ratio.js
Created Jul 15, 2012
Device Pixel Ratio Test
View ratio.js
//Adapted from http://www.broken-links.com/2012/07/13/using-media-queries-to-test-device-resolution
var dpr = window.devicePixelRatio,
msg = '';
// devicePixelRatio property
if (dpr) { msg += 'devicePixelRatio: ' + dpr; }
// matchMedia method
if (window.matchMedia) {
// resolution feature & dpi unit
if (window.matchMedia('(min-resolution: 96dpi)').matches) { msg += '\ndpi: true'; }
@tkadlec
tkadlec / trigram.html
Last active Nov 26, 2015
Trigram for heaven icon
View trigram.html
<!DOCTYPE html>
<html>
<head>
<title>Trigram for heaven icon</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
li {
list-style-type: none;
}
@tkadlec
tkadlec / hideaddrbar.min.js
Created Jun 29, 2012 — forked from scottjehl/hideaddrbar.min.js
Normalized hide address bar for iOS & Android
View hideaddrbar.min.js
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function(e){var d=e.document;if(!location.hash&&e.addEventListener){window.scrollTo(0,1);var c=1,b=function(){return e.pageYOffset||d.compatMode==="CSS1Compat"&&d.documentElement.scrollTop||d.body.scrollTop||0},a=setInterval(function(){if(d.body){clearInterval(a);c=b();e.scrollTo(0,c===1?0:1)}},15);e.addEventListener("load",function(){setTimeout(function(){if(b()<20){e.scrollTo(0,c===1?0:1)}},0)})}})(this);
You can’t perform that action at this time.