Skip to content

Instantly share code, notes, and snippets.

View PaulKinlan's full-sized avatar

Paul Kinlan PaulKinlan

View GitHub Profile
var i = new Intent({
"action": "http://webintents.org/save",
"type": "image/*",
"data": blob
})
var onsuccess = function(data) {
var img1 = document.getElementById("img1");
img1.src = URL.createObjectURL(data);
};
<intent
action="http://webintents.org/edit"
type="image/*"
href="edit.html"
/>
@PaulKinlan
PaulKinlan / subscribe.html
Created October 12, 2011 13:22
Subscribe Intent
<!doctype html>
<html>
<head>
<intent action="http://webintents.org/subscribe" type="application/atom+xml" />
<script src="http://webintents.org/webintents.min.js"></script>
</head>
<body>
<button id="go">Go</button>
</body>
@PaulKinlan
PaulKinlan / gist:1222849
Created September 16, 2011 19:05 — forked from ianb/gist:1222633
Web Intent use case brainstorm

Use Cases

Screen scrape microdata:

  • grab an ical event (send)
  • grab an hcard
  • atom feed
  • make note of an hreview (actually I can't think of what you'd do with an hreview)
  • ? generic grabbing, or we specifically figure out support for particular kinds of data (i.e., microformats.org specs)
@PaulKinlan
PaulKinlan / bookmark.js
Last active June 27, 2016 05:03
Progressive Web App Checklist
(function() {
var ManifestParser = (function() {
'use strict';
var _jsonInput = {};
var _manifest = {};
var _logs = [];
var _tips = [];
var _success = true;
@PaulKinlan
PaulKinlan / install.js
Last active September 9, 2016 20:32
window.install
(function() {
var deferredInstall;
var promptTriggered = false;
// The resolve function that will be called when we know we can prompt.
var canPromptPromiseResolved;
var canPromptPromise = new Promise(function(resolve, reject) {
// The resolve will be called later when we know the prompt has been shown.
// We might want to reject after a timeout of a couple of seconds.
canPromptPromiseResolved = resolve;
@PaulKinlan
PaulKinlan / range.js
Created July 11, 2017 20:13
range.js
const range = (stop) => { stop = stop || 0; const shouldStop = (n) => stop >= 0 ? (n < stop) : (n > stop); const interval = (n) => stop >= 0 ? n + 1 : n - 1; let itr = {}; itr[Symbol.iterator] = function* () { let i = 0; while(shouldStop(i)) { yield i; i = interval(i);}}; return itr; };
for(let i of range(100))
console.log(i)
for(let i of range(-100))
console.log(i)
@PaulKinlan
PaulKinlan / index.js
Created July 31, 2017 11:05
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
require('xmldom-alpha')
@PaulKinlan
PaulKinlan / range.js
Last active August 2, 2017 23:30
range.js
const range = function* (stop = 0, step = 1) {
const shouldStop = (n)=>stop >= 0 ? (n < stop) : (n > stop);
const interval = (n)=>stop >= 0 ? n + step : n - step;
let itr = function*() {
let i = 0;
while (shouldStop(i)) {
yield i;
i = interval(i);
}
};
@PaulKinlan
PaulKinlan / console.help.js
Last active September 13, 2017 20:48
console.help
console.help = function(arg) {
if(arg === null || arg === undefined) return console.log(arg);
if(typeof(arg) === 'string') return console.log(arg);
if('__help' in arg) { console.log(arg.__help); }
if('__help' in arg.constructor) { console.log(arg.constructor.__help); }
console.log(arg);
}
.bind(console);