Skip to content

Instantly share code, notes, and snippets.

Turtle hunting

Matijs Brinkhuis matijs

Turtle hunting
Block or report user

Report or block matijs

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 index.html
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Star rating</title>
html { background: slategrey; color: ivory; font-family: Helvetica, Arial, sans-serf; font-size: 16px; }
body { margin: 2em; }
.result { background: ivory; border-radius: 1em; border: 2px solid darkslategrey; color: darkslategrey; font-size: 1em; overflow: hidden; text-shadow: 0 1px 1px rgba(0,0,0,0.4); width: 6em; }
matijs /
Last active Dec 10, 2015
Useful command line stuff
# use `basename [suffix]` to do clever multiple renaming
for file in *.html.pdf; do \
mv "$file" "`basename $file .html.pdf`.pdf";
# remove "from" metadata from files on OS X
xattr -d "" file
# remove "quarantine" metadata from files on OS X
xattr -d "" file
matijs / reloadcss bookmarklet
Last active Dec 10, 2015
Bookmarklet to reload CSS without reloading the page… in modern browsers.
View reloadcss bookmarklet
javascript:void (function(){[]"link[rel=stylesheet][href]"),function(b){var a=b.href.replace(/(&|\??)reload=\d+/,"");b.href=a+(a.indexOf("?")>=0?"&":"?")+"reload="+(new Date().valueOf())})})();
matijs / reloadcss ie bookmarklet
Last active Dec 10, 2015
Bookmarklet to reload CSS without reloading the page… in old-fashioned browsers.
View reloadcss ie bookmarklet
javascript:void (function(){var c=document.getElementsByTagName("link");for(var d=0,a=c.length;d<a;d++){if(c[d].rel.toLowerCase().indexOf("stylesheet")>=0&&c[d].href){var b=c[d].href.replace(/(&|\??)reload=\d+/,"");c[d].href=b+(b.indexOf("?")>=0?"&":"?")+"reload="+(new Date().valueOf())}}})();
matijs / GoogleMapsLocateMe.js
Last active Dec 11, 2015
Bookmarklet to use the browser's geolocation
View GoogleMapsLocateMe.js
var f=document.forms[0],
matijs / .htaccess
Last active Dec 12, 2015
Poor man's php front controller example
View .htaccess
# mind the lowercase "on"
RewriteEngine on
# match all non existing file on the filesystem
RewriteCond %{REQUEST_FILENAME} !-f
# reroute everything that matches through index.php with `url` as the querystring
RewriteRule (.*) index.php?url=$1
matijs / scale-enable.js
Created Feb 20, 2013
Bookmarklet to enable scaling on pages that have disabled it.
View scale-enable.js
javascript:void(function() {
document.querySelector("meta[name=viewport]").setAttribute("content", "width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=1");
matijs / inline-svg-fallback.html
Last active Dec 16, 2015
Check for inline svg and provide a background image fallback
View inline-svg-fallback.html
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>Inline SVG fallback</title>
var div = document.createElement("div");
div.innerHTML = "<svg/>";
document.documentElement.className = (!!div.firstChild && div.firstChild.namespaceURI == "" ? "inline-svg" : "no-inline-svg");
matijs / generatedcontent.js
Last active Dec 17, 2015
Generated content feature detection
View generatedcontent.js
(function() {
var div = document.createElement("div");
var style = document.createElement("style"); = "d";
style.innerHTML = "#d{position:absolute;left:-999px}#d:before{content:'x';}";
if (div.clientWidth > 0)
document.documentElement.className += " generated-content";
matijs / transistionDetection.js
Last active Dec 18, 2015
Detect support for css transitions
View transistionDetection.js
var hasTransitions = (function() {
var propNames = ["transition", "MozTransition", "webkitTransition", "OTransition", "msTransition"];
var i = 0;
var length = propNames.length;
for (; i < length; i++) {
if (typeof[propNames[i]] === "string") return true;
return false;
You can’t perform that action at this time.