Skip to content

Instantly share code, notes, and snippets.

@weerd
Forked from Snugug/SassMeister-input.scss
Created December 23, 2013 05:10
Show Gist options
  • Save weerd/8091949 to your computer and use it in GitHub Desktop.
Save weerd/8091949 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
@function quicksort($list) {
$QS-Less: ();
$QS-Equal: ();
$QS-Large: ();
$QS-Length: length($list);
$QS-Seed: if(function-exists(random), random($QS-Length), $QS-Length / 2);
@if $QS-Seed == 0 {
$QS-Seed: 1;
}
@if $QS-Length > 1 {
$QS-Seed: nth($list, $QS-Seed);
@each $Item in $list {
@if $Item < $QS-Seed {
$QS-Less: append($QS-Less, $Item);
}
@else if $Item == $QS-Seed {
$QS-Equal: append($QS-Equal, $Item);
}
@else {
$QS-Large: append($QS-Large, $Item);
}
}
$QS-Less: quicksort($QS-Less);
$QS-Large: quicksort($QS-Large);
$QS-Return: join($QS-Less, $QS-Equal);
$QS-Return: join($QS-Return, $QS-Large);
@return $QS-Return;
}
@return $list;
}
$list: -1px 400px 900px 800px 300px;
.quicksort-love {
content: quicksort($list);
}
.quicksort-love {
content: -1px 300px 400px 800px 900px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment