Skip to content

Instantly share code, notes, and snippets.

👮
this is the police

Mike Taylor miketaylr

👮
this is the police
Block or report user

Report or block miketaylr

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
View README
This script updates to Chromium nightly. You can run it manually, but I run it using cron.
If you run it using cron remember that it _will quit_ your running Chromium so make sure you have it set to save tabs if you want them.
In order to install it with cron run:
crontab -e
Add the line:
View Modernizr.fillText.js
Modernizr.addTest('canvas-strokeText', function(){
var ctx = document.createElement('canvas').getContext('2d');
return typeof ctx.strokeText == 'function';
});
View gist:301921
// Assumes jQ 1.4+
function preload(file) {
return jQuery('<link/>', {
href: file,
rel: 'stylesheet',
media: 'print',
load: function() {
jQuery(this).remove();
}
View demostuffs.js
//lines
var ctx = $('#c')[0].getContext('2d');
ctx.lineWidth = 20;
ctx.lineCap = 'square';
ctx.lineJoin = 'round';
ctx.strokeStyle = 'rgb(247, 63, 20)';
ctx.beginPath();
ctx.moveTo(15,15);
ctx.lineTo(163,140);
View canvas_support.js
var _canvas = (function(){
var cv = document.createElement('canvas'),
c = cv.getContext('2d');
cv.setAttribute('height', 1);
cv.setAttribute('width', 1);
var canvas = {}, methods = {}, attributes = {};
//stolen from Modernizr 1.2dev : http://github.com/Modernizr/Modernizr/blob/master/modernizr.js#L248
canvas['WebGL'] = (function(){
View formsuitest.js
//http://miketaylr.com/code/html5-forms-ui-support.html
testSupport: function(){
var frowny = ":("; //no support frowny!
var inputs = $('input');
inputs.each(function(){
var $this = $(this);
$this.val(frowny)
.closest('td').next().text(
View gist:360287
if (!window.localStorage || !window.sessionStorage) (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
View print_shim.css
@media print { /* bummer, this doesn't seem to work at all*/
zoom: expression(document.createElement('footer'));
footer {font-size:30px;color:blue;}
}
View html5-data.js
(function (undefined) {
function detectMutation() {
mutationSupported = true;
this.removeEventListener('DOMAttrModified', detectMutation, false);
}
var forEach = [].forEach,
regex = /^data-(.+)/,
el = document.createElement('div'),
mutationSupported = false,
View gist:364237
<input type="search" autofocus list="suggestions">
<datalist id="suggestions">
<option label="DM" value="Depeche Mode">
<option label="Moz" value="Morrissey">
<option label="NO" value="New Order">
<option label="TC" value="The Cure">
</datalist>
You can’t perform that action at this time.