View devicelab.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
View RGBtoHSL.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const RGBToHSL = (r,g,b) => { | |
// Algo http://www.rapidtables.com/convert/color/rgb-to-hsl.htm | |
const [r1,g1,b1] = [r/255, g/255, b/255]; | |
const [cmax, cmin] = [Math.max(r1,g1,b1), Math.min(r1,g1,b1)]; | |
const d = (cmax - cmin); | |
const L = (cmax + cmin) / 2; | |
const S = d == 0 ? 0 : (d / ( 1 - Math.abs(2*L-1))); | |
const H = d == 0 ? 0 : |
View HSLToRGB.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const HSLToRBG = (H, S, L) => { | |
// algo http://www.rapidtables.com/convert/color/hsl-to-rgb.htm | |
const C = (1 - Math.abs(2*L - 1)) * S; | |
const X = C * (1 - Math.abs(((H / 60) % 2)-1)); | |
const m = L - C/2; | |
const [r1, g1, b1] = H >= 0 && H < 60 ? [C, X, 0] : | |
H >= 60 && H < 120 ? [X, C, 0] : | |
H >= 120 && H < 180 ? [0, C, X] : | |
H >= 180 && H < 240 ? [0, X, C] : |
View dataUriForStylesheet.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var toDataURI = function(datatype, data) { | |
return "data:" + datatype +";base64," + window.btoa(data); | |
}; | |
var renderStyleSheet = function() { | |
var link = document.createElement("link"); | |
link.rel = "stylesheet"; | |
link.href = toDataUri("text/css", "body { background-color: red;}" ); | |
document.head.appendChild(link); | |
}; |
View unregister-service-worker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) |
View designer.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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" |
View dabblet.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
min-height: 100%; |
View gist:2854138
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
View gist:2853874
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener("load", function() { | |
if(window.intent && window.intent.action === "http://webintents.org/save") { | |
var data = window.intent.data; | |
if(data instanceof Blob) { | |
// do something with the blob. | |
} | |
else { | |
// do something with the object. |
OlderNewer