Skip to content

Instantly share code, notes, and snippets.

View StefanoRausch's full-sized avatar

Stefano F. Rausch StefanoRausch

  • Johannesburg - RSA
View GitHub Profile
// strip-units required by spread mixin
// http://stackoverflow.com/questions/12328259/how-do-you-strip-the-unit-from-any-number-in-sass
@function strip-units($number)
@return $number / ($number * 0 + 1)
// pow and sqrt required by ease function
// adapted from https://github.com/at-import/Sassy-math/blob/master/sass/math.scss
@function pow($base, $exponent)
$value: $base
@StefanoRausch
StefanoRausch / Gruntfile.js.md
Last active December 25, 2015 11:08
Literate Source Code : LSC

Gruntfile.js for Literate Source Code : LSC

Jeremy Ashkenas has introduced [Literate CoffeeScript][1], having been inspired by Donald Knuth's early work on [Literate Programming][2].

According to Knuth, literate programming provides higher-quality programs, since it forces programmers to explicitly state the thoughts behind the program, making poorly thought-out design decisions more obvious. Knuth also claims that literate programming provides a first-rate documentation system, which is not an add-on, but is grown naturally in the process of exposition of one's thoughts during a program's creation. The resulting documentation allows authors to restart their own thought processes at any later time, and allows other programmers to understand the construction of the program more easily.

Literate Source Code takes Jeremy's idea ( of using John Gruber's [Markdown][3] for writing the documentation ) and applies it — without any restrictions — to any programming language with a little help from [Grunt][4].

@StefanoRausch
StefanoRausch / include-once.scss
Created September 28, 2013 17:51
Import Once Feature Implemented in Sass.
$is-included : () !default;
@mixin once( $name ) {
@if include-once( $name ) {
@content;
}
}
@function include-once( $name ) {
@if index( $is-included, $name ) {
@StefanoRausch
StefanoRausch / template-file-silent.sublime-snippet
Created February 26, 2013 08:46
SCSS : template file silent
<snippet>
<content><![CDATA[
// **
// * ${1:file-name}.scss
// *
// * CSS version 3
// *
// * LICENSE : MIT - Copyright (C) ${2:2013} ${3:Stefano F. Rausch < stefano@rausch-e.net >}
// *
// * package : ${4:Kit Framework}${5:/${6:sub-package}}
<snippet>
<content><![CDATA[
@for \$${1:i} from ${2:start} to ${3:end} {
${4:code}
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>for-from-to</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.scss</scope>
<snippet>
<content><![CDATA[
@return ${1:\$${2:value}};$0
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>return-function-value</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.scss</scope>
<!-- Optional: Set a description to override the snippet's name -->
<description>@return funcion value</description>
<snippet>
<content><![CDATA[
@mixin ${1:name}${2:( ${3:\$${4:parameters}} )}
{
${5:code}
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>define-mixin</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<snippet>
<content><![CDATA[
@function ${1:name}( ${2:\$${3:parameters}} )
{
${4:code}
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>define-function</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
@StefanoRausch
StefanoRausch / php-template-file.sublime-snippet
Created February 18, 2013 07:56
CodeKit : php template file
<snippet>
<content><![CDATA[
<?php
/**
* ${1:file-name}.php
*
* PHP version 5
*
* LICENSE : MIT - Copyright (C) ${2:2013} ${3:Stefano F. Rausch < stefano@rausch-e.net >}
*
@StefanoRausch
StefanoRausch / use-variable.sublime-snippet
Last active December 13, 2015 21:18
CodeKit : use $variable
<snippet>
<content><![CDATA[
<!-- \$${1:variable-name} -->
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>use-variable</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.kit</scope>
<!-- Optional: Set a description to override the snippet's name -->
<description>$variable usage</description>