Skip to content

Instantly share code, notes, and snippets.

@SteAllan
SteAllan / BG-Image-Function.markdown
Last active December 28, 2015 19:19
A Pen by Ste Allan.

BG Image Function

A SASS function which lets you specify just a filename and outputs that prefixed with a consistent path.

A Pen by Ste Allan on CodePen.

License.

@SteAllan
SteAllan / gif
Created November 14, 2013 15:19
1px transparent gif
data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==
@SteAllan
SteAllan / drupal-meta-tag.php
Created October 30, 2013 15:59
Add additional meta tags to the <head> in Drupal 7 (from http://pastie.org/private/npzlsszuoqlopyyjkr0qw)
/**
* Preprocesses the wrapping HTML.
*
* @param array &$variables
* Template variables.
*/
function sintillate_preprocess_html(&$vars) {
// Setup IE meta tag to force IE rendering mode
$meta_ie_render_engine = array(
'#type' => 'html_tag',
@SteAllan
SteAllan / _mq.scss
Created October 14, 2013 12:39
mq.scss
// A mixin which creates a media query, turns your pixel value into ems and will spit out the code for old IE if you choose.
// $type = the type of media query e.g. min-width
// $pxbp = your breakpoint in px (you can use the px unit for verbosity)
// $legacy = true/false, whether you want the code to be seen by old IE
@mixin mq($type, $pxbp, $legacy) {
$bp: strip-unit($pxbp);
// Calculate the em value of the desired breakpoint.
@SteAllan
SteAllan / _rem-fallback.scss
Created September 7, 2013 14:59
Pixel to REM Fallback Mixin
// My modified version of Karl Merkli's rem mixin from http://css-tricks.com/snippets/css/less-mixin-for-rem-font-sizing/.
// Pass in a property name and the target pixel values and the mixin will spit out the pixel fallback version and the rem version.
@function strip-unit($num) {
@return $num / ($num * 0 + 1);
}
@mixin rem-fallback($property, $values...) {
$max: length($values);
@SteAllan
SteAllan / _responsive-grid-extender.scss
Created August 21, 2013 20:55
A little bit of SASS that lets you define a new breakpoint and will automatically generate a new grid for that breakpoint.
// As used by Compass.
// Used to calculate the em value for the media queries.
// If you're not using ems for your media queries, why the hell not?
$browser-default-font-size: 16px;
// Define your breakpoints by supplying a name and a pixel value. Units will get stripped so you can add 'px' for clarity if you prefer.
$breakpoints: false !default;
$breakpoints: small 480px, medium 768, large 960;
// Strip units from values so we can do maths and shit.
@SteAllan
SteAllan / _hide-elements.scss
Last active December 17, 2015 14:39
Hide elements from screen readers and/or everyone else.
// Hide elements from visual users but not from screen readers
.visually-hidden,
%visually-hidden {
position: absolute !important;
clip: rect(1px, 1px, 1px, 1px);
padding:0 !important;
border:0 !important;
height: 1px !important;
width: 1px !important;
@SteAllan
SteAllan / _text-replacement.scss
Last active December 17, 2015 14:39
Replace text with a background image
// Replace text with a background image.
.replace-text,
%replace-text {
text-indent: 110%;
white-space: nowrap;
overflow: hidden;
@if $ltie9 == true {
border: 0;
@SteAllan
SteAllan / media-queries.css
Last active December 17, 2015 14:39
A collection of useful media queries
@media (-webkit-min-device-pixel-ratio: 1.3),
(min-resolution: 124.8dpi) {
/* Hi-res screen stuff here */
}