Skip to content

Instantly share code, notes, and snippets.

View tomayac's full-sized avatar

Thomas Steiner tomayac

View GitHub Profile
@tomayac
tomayac / manifest-polyfill.html
Last active June 17, 2016 21:53 — forked from PaulKinlan/manifest-polyfill.html
Web App Manifest Polyfill for iOS
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="manifest" href="https://jsbin-user-assets.s3.amazonaws.com/kinlan/manifest.json">
<title>iOS Manifest Polyfill</title>
</head>
<body>
@tomayac
tomayac / barcelona.js
Last active December 16, 2015 21:59
Sample app created for Barcelona.js
var irc = require('irc');
var request = require('request');
var express = require('express');
var http = require('http');
var app = express();
var server = http.createServer(app);
// IRC details for the recent changes live updates
var IRC_SERVER = 'irc.wikimedia.org';
var IRC_NICK = 'YOUR_APP_NAME_HERE';
@tomayac
tomayac / getUserMedia.html
Created December 6, 2011 16:44
navigator.getUserMedia Test
<html>
<head>
<title>navigator.getUserMedia() Demo</title>
</head>
<body>
<h1>See yourself?</h1>
If your browser supports
<span style="font-family:monospace;">navigator.getUserMedia()</span>
you should see yourself below. If you don't see yourself, try
downloading the
@tomayac
tomayac / content_script.js
Created April 18, 2011 14:46
The core "magic" of the Creative Commons Laser Highlighter Chrome extension (https://chrome.google.com/extensions/detail/iceopjodmdipccjbknbjolkfogkgloei)
// namespaced my implementation of the RDFa
// API using "LinkedData.API" to avoid confusion
// with real (and correcter) implementations.
LinkedData.API.data.setMapping(
'cc',
'http://creativecommons.org/ns#');
// capture @rel="license"...
var licensedElements = LinkedData.API.getElementsByProperty('license');
// ...and @rel="cc:license"
'use strict';
var async = require('async');
var request = require('request');
var ExpontentialSmoothingStream = require('exponential-smoothing-stream');
var numbers = require('numbers');
var geolib = require('geolib');
var util = require ('./util.js');
@tomayac
tomayac / lucky-winner.js
Created May 29, 2015 12:41
Highlights a lucky random attendant who RSVP'ed to a meetup organized via www.meetup.com
// Test at http://www.meetup.com/Google-Developer-Group-Hamburg/events/222392017/
document.querySelector('#rsvp-list').querySelectorAll('li')
[
Math.floor(
Math.random() *
document.querySelector('#rsvp-list').querySelectorAll('li').length
) + 1
].style.backgroundColor =
'rgb(' +
(Math.floor(Math.random() * 256)) + ',' +

Keybase proof

I hereby claim:

  • I am tomayac on github.
  • I am tomayac (https://keybase.io/tomayac) on keybase.
  • I have a public key whose fingerprint is 6897 81EF 64CF F41E 7497 C1B4 5A9B C2AC 857C 0A63

To claim this, I am signing this object:

@tomayac
tomayac / avgWikipediaDeltas.js
Created November 25, 2014 08:20
Average Edit Length (Delta) for Wikipedias by Language
// Full source
var source = new EventSource('http://wikipedia-edits.herokuapp.com/sse');
var languages = {};
var avgDeltas = {};
source.addEventListener('message', function(e) {
var edit = JSON.parse(e.data);
if (!languages[edit.language]) {
languages[edit.language] = [];
}
@tomayac
tomayac / gist:c2358b1cbee764b679e9
Last active August 29, 2015 14:06
TwitPic backup script
// Browse through your photo collection page-by-page,
// each time pasting the script in the console.
// Then save images one-by-one, or just "Save as" > "Web page complete".
// The alt attribute contains the original tweet text.
// License: CC0. Author: Thomas Steiner (tomayac).
var images = [];
Array.prototype.forEach.call(document.querySelectorAll('div[class~="user-photo"] a img'), function(img, i) {
img.src = /.*?\/thumb\/.*?/g.test(img.src) ? img.src.replace('/thumb/', '/large/') : img.src;
images[i] = '<img src="' + img.src + '" alt="' + img.alt.replace(/"/g, '&quot;')+ '"/>';
});