Skip to content

Instantly share code, notes, and snippets.

@donut
donut / 0-Instructions.markdown
Last active August 29, 2015 14:04
How to get Compass like sprites with Stylus and SVG

Using the grunt-dr-svg-sprites GruntJS plugin and a custom Handlebars template (below) I was able to get the basic functionality that Compass provides for PNG sprites but for SVGs.

Note that the below template is not generalized and will not work for all dr-svg-sprites configurations. It works for my setup and would probably be a good base for others.

I've included the relevant portions of my Gruntfile as well.

This is a test.

  • test
  • test
<?php
/**
* @file
* Date forms and form themes and validation.
*
* All code used in form editing and processing is in this file,
* included only during form editing.
*/
/**
// Adapted from [mbilalsiddique1]'s comment on this gist:
// https://gist.github.com/alanhogan/2878758
//
// Note that sprites are ordered for first by file size (ascendingly) and then
// by name.
// https://github.com/chriseppstein/compass/issues/690#issuecomment-3729204
@import "compass/utilities/sprites"
@import "compass/css3/background-size"
<p>this is a test</p>
@donut
donut / gist:4948472
Last active December 13, 2015 17:29
<?php
/**
* Retrieves hipsteripsum for use as dummy text.
*
* Source: http://hipsterjesus.com/
*
* @return string
* @author Donovan Mueller
**/
function beer_me($paragraph_count, $character_limit)
@donut
donut / donutScroll.jquery.js
Created February 22, 2012 16:32
A scroll to jQuery plugin
/** A "scroll to" plugin.
Scrolls to the first element in the jQuery object or to the passed
position.
@author Donovan Mueller (zotobi@gmail.com)
@url https://gist.github.com/1885908
------------------------------------------------------------------------ */
;(function donutScrollPlugin($) {
var viewport = ($.browser.opera) ? 'html' : 'html, body'
// Opera jumps to the top when 'html,body' is used.
@donut
donut / functions.php
Last active September 28, 2015 03:58
Fix WordPress asset URLs when a non-absolute base URL is given
<?php
/**
* Fixes URLs to asset files.
*
* If SITE_URL is left blank then WordPress will assume that the SITE_URL is
* the current URL which causes problems when the current URL is not the root
* page. So, instead of linking to
* /wp-content/themes/themename/js/main.js it would link to
* /some-page-name/a-child-page/wp-content/themes/themename/js/main.js which
* breaks things. This attemps to fix this.
@donut
donut / DD_belatedPNG_0.0.8a.js
Created October 27, 2011 18:30
DD_belatedPNG IE <= 7 PNG fix (VML solution)
/**
* DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>.
* Author: Drew Diller
* Email: drew.diller@gmail.com
* URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/
* Version: 0.0.8a
* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license
*
* Example usage:
* DD_belatedPNG.fix('.png_bg'); // argument is a CSS selector
@donut
donut / DD_belatedPNG.js
Created October 26, 2011 23:38
Fix PNGs in IE < 9 jQuery plugin
/* The code below should be included in a separate file using IE conditional comments
as it causes errors in IE8(+?) */
/**
* DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>.
* Author: Drew Diller
* Email: drew.diller@gmail.com
* URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/
* Version: 0.0.8a
* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license