This is an adaptation of the Sass/Less comparison document.
Not a comprehensive overview of features of either library but a comparison of commonalities.
Sass | Crush
<?php | |
function named_args($required, $options = []) | |
{ | |
extract($options + [ | |
'option_one' => false, | |
'option_two' => true, | |
'option_three' => 100, | |
]); |
This is an adaptation of the Sass/Less comparison document.
Not a comprehensive overview of features of either library but a comparison of commonalities.
Sass | Crush
<?php | |
/* | |
theme_image() override. | |
*/ | |
function THEME_image($vars) | |
{ | |
// [Accessibility] Images must always have an alt attribute. | |
if (! isset($vars['alt'])) { | |
$vars['alt'] = ''; |
Avoid console
errors in browsers that lack a console.
Excerpted from HTML5 boilerplate:
# | |
# Utilities for working with svgs | |
# | |
# svg2png - Create png file from source svg using inkscape | |
# svg2pngr - Create png file from source svg using inkscape recursively | |
# svgz - Create svgz file from source svg | |
# svgzr - Create svgz file from source svg recursively | |
# | |
/* | |
* Equalise the height of boxes (uses min-height). | |
*/ | |
jQuery.fn.balanceHeights = function() { | |
// Get max height from list then apply to all. | |
var heights = []; | |
this.each( function () { | |
heights.push(jQuery(this).outerHeight()); | |
}); | |
return this.css('min-height', Math.max.apply({}, heights)); |
/** | |
* Watermark background with CSS3 multiple-backgrounds, element() and linear-gradient() | |
*/ | |
h1 { | |
font:italic 4em Georgia,serif; | |
text-align:center; | |
padding: 1em 0 0; | |
margin:0 0 .3em; | |
} |
/** | |
* jQuery alterClass plugin | |
* | |
* Remove element classes with wildcard matching. Optionally add classes: | |
* $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' ) | |
* | |
* Copyright (c) 2011 Pete Boere (the-echoplex.net) | |
* Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php | |
* | |
*/ |
var prettyNumber = function ( number ) { | |
var number = ( number ).toString(), | |
point = number.indexOf( '.' ), | |
floatPart = '', | |
out = [], | |
stream; | |
if ( -1 !== point ) { | |
floatPart = number.substring( point ); | |
number = number.substring( 0, point ); | |
} |
# | |
# Bash function for 'cd'ing up the directory tree | |
# | |
# Example use: | |
# Move working directory up 5 levels | |
# $> up 5 | |
# Equivalent to | |
# $> cd ../../../../../ | |
# |