Skip to content

Instantly share code, notes, and snippets.

View ptimson's full-sized avatar

Peter Timson ptimson

  • [Stealth Mode]
  • London, UK
View GitHub Profile
#!/usr/bin/env python3
"""
Extract transparency from two images with black and white backgrounds.
Install dependencies:
pip install Pillow numpy
Usage:
python bg_to_transparent.py black_bg.jpg white_bg.jpg output.png
"""
@ptimson
ptimson / gist:2a70f7db99a6a55aaff8
Created May 10, 2015 23:45
Bootstrap Sticky Footer SCSS
@import "compass";
@import "../bower_components/bootstrap-sass/assets/stylesheets/bootstrap/variables";
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
@ptimson
ptimson / gist:6067124
Created July 23, 2013 23:54
WP Custom URL
// Do this on change then comment out
function handle_custompage_route()
{
add_rewrite_rule('custompage/([^/]+)/?', 'index.php?custompage_var=$matches[1]', 'top');
flush_rewrite_rules();
}
add_action('admin_init', 'handle_custompage_route');
function declare_custompage_vars()
{
@ptimson
ptimson / gist:6061723
Created July 23, 2013 11:37
CSS3 Grayscale
filter: url("data:image/svg+xml;utf8,<svg%20xmlns='http://www.w3.org/2000/svg'><filter%20id='grayscale'><feColorMatrix%20type='matrix'%20values='0.3333%200.3333%200.3333%200%200%200.3333%200.3333%200.3333%200%200%200.3333%200.3333%200.3333%200%200%200%200%200%201%200'/></filter></svg>#grayscale"); /* Firefox 3.5+ & IE 10 */
filter: gray; /* IE6 - IE 9 */
filter: grayscale(100%); /* Current draft standard */
-webkit-filter: grayscale(100%); /* New WebKit */
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);