Skip to content

Instantly share code, notes, and snippets.

View gavinblair's full-sized avatar

Gavin Blair gavinblair

View GitHub Profile
View Random Movie Screencap
This bookmarklet takes you to a random screen grab of a random movie.
Press it once to go to the movie listing.
Press it a second time to go to a random movie.
Press it a third time to go to a random part of the movie.
Press it one last time to go to a random screencap of that part of the movie.
To install, add a bookmark and use the following as the URL:
javascript: if(!window.location.href.startsWith("https://movie-screencaps.com/")) { window.location = "https://movie-screencaps.com/movie-directory/"; } if(window.location.href == "https://movie-screencaps.com/movie-directory/") { var movies = jQuery('.links a'); var movie = movies[Math.round(Math.random() * (movies.length + 1))]; movie.click(); } var parts = window.location.href.split('/'); if(window.location.href != "https://movie-screencaps.com/movie-directory/" && window.location.href.startsWith("https://movie-screencaps.com/") && parts[4] == "") { var page = jQuery('.paginate:first option[value='+Math.round(Math.random() * jQuery('.paginate:first opt
@gavinblair
gavinblair / gist:a0760c778c43e6318a3c
Last active February 25, 2016 19:48
Bookmarklet: Random Character Design References board on Pinterest
View gist:a0760c778c43e6318a3c
javascript:var urls = ["https://www.pinterest.com/characterdesigh/character-design-references","https://www.pinterest.com/characterdesigh/character-design-challenge","https://www.pinterest.com/characterdesigh/character-anatomy","https://www.pinterest.com/characterdesigh/character-anatomy-ratio","https://www.pinterest.com/characterdesigh/character-anatomy-bones","https://www.pinterest.com/characterdesigh/character-anatomy-organs","https://www.pinterest.com/characterdesigh/character-anatomy-male","https://www.pinterest.com/characterdesigh/character-anatomy-female","https://www.pinterest.com/characterdesigh/character-anatomy-skin","https://www.pinterest.com/characterdesigh/character-anatomy-head","https://www.pinterest.com/characterdesigh/character-anatomy-hair","https://www.pinterest.com/characterdesigh/character-anatomy-eyes","https://www.pinterest.com/characterdesigh/character-anatomy-nose","https://www.pinterest.com/characterdesigh/character-anatomy-ears","https://www.pinterest.com/characterdesigh/character-
View gist:939d066fece9e8e05465
while :; do cat /System/Library/Accessibility/AccessibilityDefinitions.plist | say -v Whisper; sleep 1; done
View 2x-mixin.scss
div {
@include image-2x("logo.png", "logo2x.png");
}
@mixin image-2x($image1, $image2) {
background-image: url($image);
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
background-image: url($image2);
background-size: image-width($image1) image-height($image1);
}
@gavinblair
gavinblair / setTimeout.js
Last active August 29, 2015 14:04
Pass arguments to setTimeout
View setTimeout.js
setTimeout(
(function(el){
return function(){
el.hide();
};
}($(this))), 2000);
View designer.html
<link rel="import" href="../core-animated-pages/core-animated-pages.html">
<link rel="import" href="../core-animated-pages/transitions/hero-transition.html">
<link rel="import" href="../core-animated-pages/transitions/cross-fade.html">
<link rel="import" href="../core-animated-pages/transitions/slide-down.html">
<link rel="import" href="../core-animated-pages/transitions/slide-up.html">
<link rel="import" href="../core-animated-pages/transitions/tile-cascade.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<polymer-element name="my-element">
View designer.html
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">
View designer.html
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<polymer-element name="my-element">
@gavinblair
gavinblair / post.md
Last active August 29, 2015 14:03
Grooveshark Machine
View post.md

Getting children to sleep can be... challenging. Our oldest is almost at the point where she can put herself to sleep, and music really helps relax her. We typically leave a phone in her room, playing her favourite playlist (currently the Wizard of Oz soundtrack).

This is working really well, but sometimes it feels like my (or my wife's) phone is being held hostage. That's why I developed the Grooveshark Machine, a headless device (that is really an old computer or a Raspberry Pi) that can be controlled with the phone.

Grooveshark Machine Controller Interface

Just enter your Grooveshark Playlist ID and press Play, and the machine will start playing.

Check out Grooveshark Machine

View .htaccess
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
Order allow,deny
</FilesMatch>
# Don't show directory listings for URLs which map to a directory.