Skip to content

Instantly share code, notes, and snippets.

@mootari
mootari / profile.rb
Last active August 29, 2015 14:05
profile: Sass extension to profile execution times during compilation. #sass #ruby #extension
module Sass::Script::Functions
@@timeStart = Time.now
@@timeLast = Time.now
def profileRender(timeLast)
diff = Time.now - timeLast
return Sass::Script::String.new(diff * 1000.0)
end
@mootari
mootari / SassMeister-input.scss
Last active August 29, 2015 14:06
Mixin that allows declarations to be shared between selectors. #sassmeister
// ----
// Sass (v3.3.14)
// Compass (v1.0.1)
// ----
$registry: ();
@mixin common($key, $value) {
$prefix: "%common-style";
$index: false;
@mootari
mootari / SassMeister-input.scss
Created October 9, 2014 11:24
Demonstration of using maps as map keys. #sassmeister
// ----
// Sass (v3.3.14)
// Compass (v1.0.1)
// Breakpoint (v2.5.0)
// Singularity.gs (v1.4.0)
// ----
@import "breakpoint";
@import "singularitygs";
@mootari
mootari / SassMeister-input.scss
Created October 9, 2014 18:18
followed-by: Apply content to adjacent siblings. #sassmeister #mixin
// ----
// Sass (v3.4.4)
// Compass (v1.0.1)
// ----
@mixin followed-by($selectors...) {
$placeholder: "%#{unique_id()}";
@at-root #{$placeholder} {
@content;
}
@mootari
mootari / SassMeister-input-HTML.html
Last active August 29, 2015 14:07
compensate-gutter: Creates an asymmetric grid to negate a parent container's gutter. #sassmeister #function #singularitygs
<h3>Problem: Redefining a singularity grid to compensate for parent gutter</h3>
<p>.element defines a custom grid with calculated alpha/omega columns to make columns "snap" back into the global grid.</p>
<div id="c1" class="container">
<div class="element">Redefined grid, center columns, no gutter</div>
</div>
<div class="match"></div>
<div class="grid"><div></div><div></div><div></div> <div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div> <div></div><div></div><div></div><div></div><div></div></div>
@mootari
mootari / SassMeister-input.scss
Created October 15, 2014 15:46
Generated by SassMeister.com.
// ----
// Sass (v3.4.5)
// Compass (v1.0.1)
// ----
.icons-bla {
min-height:16px;
padding-left:20px;
@at-root li a#{&} { // not working?
background-color:orange;
@mootari
mootari / SassMeister-input-HTML.html
Created October 17, 2014 16:30
Generated by SassMeister.com.
<div id="wrapper">
<div id="main">Main <span class="layout-breaker">Breaker</span></div>
<div id="left">Left <span class="layout-breaker">Breaker</span></div>
<div id="right">Right <span class="layout-breaker">Breaker</span></div>
</div>
@mootari
mootari / SassMeister-input-HTML.html
Created October 17, 2014 17:19
Generated by SassMeister.com.
<div id="wrapper">
<div id="main">Main <span class="layout-breaker">Breaker</span></div>
<div id="left">Left <span class="layout-breaker">Breaker</span></div>
<div id="right">Right <span class="layout-breaker">Breaker</span></div>
</div>
@mootari
mootari / get_view_count.php
Last active August 29, 2015 14:09
Count results for any view. #drupal #d7 #views
<?php
/**
* Returns the row count of a view.
*
* Disables user input and forces a count query.
* Code adapted from @see views_get_view_result().
*/
function EXAMPLE_get_view_count($name, $display_id = null) {
$args = func_get_args();
array_shift($args);
@mootari
mootari / concept.md
Last active August 29, 2015 14:09
Draft: features-revert-updated

We're not using the version here, as versions can be difficult to parse and compare. Instead we rely on an "iterator" key (working title) that gets incremented with each feature update. Except for initially adding the iterator to a feature's info file there are no further manual changes involved.

Updating a feature

  1. When a feature gets updated (todo: find hook), check if system info for the feature contains an "iterator" key.
  2. If "iterator" key exists, increment by one, and add to the info output.

Reverting features

  1. On drush command invocation ("features-revert-updated" or "fru"), find all features modules (todo: find hook) and check if system info for each feature contains an "iterator" key.