Skip to content

Instantly share code, notes, and snippets.

View Volker-E's full-sized avatar

Volker E. Volker-E

View GitHub Profile
@Volker-E
Volker-E / WP-Hinder-Network-Access.php
Created April 10, 2014 05:12
WP Hinder-Network-Access
/* http://posteed.com/internetzugriffe-von-wordpress-blocken/ */
define( 'WP_HTTP_BLOCK_EXTERNAL', true );
@Volker-E
Volker-E / HTML5-smallest-valid-page.html
Created April 26, 2014 02:16
Smallest valid HTML5 page
<!DOCTYPE html>
<title>!</title>
@Volker-E
Volker-E / CSS-center-horizontally-vertically.css
Last active August 29, 2015 14:00
CSS center horizontally + vertically undefined height
// Translate mixin
// ------------------------------
.translate(@x; @y) {
-webkit-transform: translate(@x, @y);
-ms-transform: translate(@x, @y);
-o-transform: translate(@x, @y);
transform: translate(@x, @y);
}
// Center-align mixin
@Volker-E
Volker-E / CSS-3D-emboss-text-shadow.css
Created May 19, 2014 12:23
Extra-3D-emboss-text-shadow (reveal.js)
.text-embossed {
text-shadow: 0 1px 0 #CCCCCC, 0 2px 0 #C9C9C9, 0 3px 0 #BBBBBB, 0 4px 0 #B9B9B9, 0 5px 0 #AAAAAA, 0 6px 1px rgba(0, 0, 0, 0.1), 0 0 5px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.3), 0 3px 5px rgba(0, 0, 0, 0.2), 0 5px 10px rgba(0, 0, 0, 0.25), 0 20px 20px rgba(0, 0, 0, 0.15);
}
@Volker-E
Volker-E / CSS-box-shadow-at-page-top.css
Last active August 29, 2015 14:02
CSS Box-Shadow at top of page
body:before {
content: "";
position: fixed;
top: -10px;
left: 0;
width: 100%;
height: 10px;
-webkit-box-shadow: 0 0 10px rgba( 0, 0, 0, .8 );
-moz-box-shadow: 0 0 10px rgba( 0, 0, 0, .8 );
box-shadow: 0 0 10px rgba( 0, 0, 0, .8 );
@Volker-E
Volker-E / CSS-target-selector.css
Created June 3, 2014 15:06
CSS :target selector for changing design on internal link
#g:target body {
columns: 15em;
column-gap: 0;
}
// added 2014-10-30, taken from http://toddmotto.com/mastering-svg-use-for-a-retina-web-fallbacks-with-png-script/
function supportsSVG() {
return !! document.createElementNS && !! document.createElementNS('http://www.w3.org/2000/svg','svg').createSVGRect;
}
if (supportsSVG()) {
document.documentElement.className += ' svg';
} else {
document.documentElement.className += ' svg-off';
var imgs = document.getElementsByTagName('img');
var dotSVG = /.*\.svg$/;
@Volker-E
Volker-E / is_blog.php
Last active August 29, 2015 14:14 — forked from jjeaton/is_blog.php
/**
* WordPress' missing is_blog() function. Determines if the currently viewed page is
* one of the blog pages, including the blog home page, archive, category/tag, author, or single
* post pages.
*
* Doesn't include is_search(), if you only use search for the blog, then add that in or test separately
*
* @props grantnorwood @wesbos @toscho @jjeaton
* @return bool
*/

Pure SASS-adaption of Lea Verou's contrast-ratio javascript. Can be useful when eg. generating colored buttons from a single supplied color as you can then check which out of a couple of text colors would give the best contrast.

This script currently lacks the support for alpha-transparency that Lea supports in her script though.

In addition to the color-contrast adaption there's also some math methods that were needed to be able to calculate the exponent of a number and especially so when the exponent is a decimal number. A 2.4 exponent is used to calculate the luminance of a color and calculating such a thing is not something that SASS supports out of the box and not something I found a good pure-SASS script for calculating and I much prefer pure-SASS over ruby extensions. The math methods might perhaps be unecessary though if you're running Compass or similar as they may provide compatible math methods themselves.

Normal usage: `color: pick_best_color(#f00