Skip to content

Instantly share code, notes, and snippets.

Paul Kinlan PaulKinlan

Block or report user

Report or block PaulKinlan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@PaulKinlan
PaulKinlan / unregister-service-worker.js
Last active Jun 1, 2016
unregister-service-worker bookmarklet
View unregister-service-worker.js
javascript: (function()%20%7B%20%0A%20%20%20%20console.log(%22test%22)%3B%0A%20%20%20%20var%20sw%20%3D%20navigator.serviceWorker%3B%0A%20%20%20%20if%20(sw.controller)%20%7B%0A%20%20%20%20%20%20sw.getRegistration(document.location).then(function(reg)%20%7B%20return%20reg.unregister()%3B%20%7D).then(function()%20%7B%20console.log(%22Unregister%20Successful%22)%20%7D).catch(function(e)%20%7B%20console.log(%22No%20Service%20Worker%3A%20%22%20%2B%20e)%7D)%3B%0A%20%20%20%20%7D%0A%20%20%7D())
@PaulKinlan
PaulKinlan / builder.html
Last active May 19, 2019
Bookmark Builder
View builder.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bookmarklet</title>
<script>
window.onload = function(e) {
var bookmark = document.getElementById("bookmark");
var code = document.getElementById("code");
View designer.html
<script
src="/components/platform/platform.js">
</script>
<link rel="import"
href="/components/core-toolbar/core-toolbar.html">
<link rel="import"
href="/components/core-menu/core-menu.html">
<link rel="import"
href="/components/core-item/core-item.html">
<link rel="import"
@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active Oct 25, 2019
CriticalCSS Bookmarklet and Devtool Snippet.js
View criticalcss-bookmarklet-devtool-snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@PaulKinlan
PaulKinlan / criticalcss.html
Last active Sep 30, 2019
Detect Critical CSS
View criticalcss.html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<h2>Original CSS</h2>
<style style="display: block; white-space: pre; font-family: monospace">
h2 { margin:0; }
@PaulKinlan
PaulKinlan / devicelab.sh
Last active Dec 12, 2015
Launch the same page across multiple connected Android devices. ./devicelab.sh http://paul.kinlan.me/
View devicelab.sh
#!/bin/sh
# Usage:
# Open browser on all connected devices -
# ./devicelab.sh
# Open a url on all connected devices -
# ./devicelab.sh http://paul.kinlan.me/
adb kill-server
port=9220
@PaulKinlan
PaulKinlan / gist:4160675
Created Nov 28, 2012
Encapsulating Request Animation Frame
View gist:4160675
/*
Javascript is a funny thing.
Here are two things that will hit you with requestAnimationFrame
1) If you alias the window.requestAnimationFrame function on to anything other
than a window object, you get an Illegal Invocation Error.
You can solve this by using call() with the window object set.
@PaulKinlan
PaulKinlan / dabblet.css
Created Jul 19, 2012
The first commented line is your dabblet’s title
View dabblet.css
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
View gist:2854138
var i = new Intent({
"action": "http://webintents.org/save",
"type": "text/uri-list",
"data": "http://placekitten.com/g/200/300"
})
var onsuccess = function(data) {
};
var onerror = function(){ };
View gist:2853982
var i = new Intent({
"action": "http://webintents.org/save",
"type": "image/*",
"extras": { "url": "http://placekitten.com/g/200/300" }
})
var onsuccess = function(data) {
var img1 = document.getElementById("img1");
if(data instanceof Blob) {
img1.src = URL.createObjectURL(data);
You can’t perform that action at this time.