Skip to content

Instantly share code, notes, and snippets.

Loïc Goyet LoicGoyet

Block or report user

Report or block LoicGoyet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@LoicGoyet
LoicGoyet / get-hypotenuse.scss
Created Mar 10, 2016
The get-hypotenuse() is a sass function to calc the hypotenuse width on a triangle rectangle
View get-hypotenuse.scss
// http://www.antimath.info/css/sass-sqrt-function/
@function sqrt($r) {
$x0: 1;
$x1: $x0;
@for $i from 1 through 10 {
$x1: $x0 - ($x0 * $x0 - abs($r)) / (2 * $x0);
$x0: $x1;
}
@LoicGoyet
LoicGoyet / get-diff-to-align.scss
Last active Mar 8, 2016
A sass function that returns a value to apply to a margin in order to vertically or horizontally align two elements.
View get-diff-to-align.scss
/// Contexts
/// @author Loïc Goyet
/// @param {Unit} $element1
/// @param {Unit} $element2
/// @param {Bool} $invert
/// @warn the params $big-element & $small-element must share the same type of
/// unit
@function get-diff-to-align($element1, $element2, $invert: true) {
$big-element: if($element1 > $element2, $element1, $element2);
$small-element: if($element1 > $element2, $element2, $element1);
@LoicGoyet
LoicGoyet / gulpfile.js
Last active Jan 14, 2016
Basic usage of gulp-inject plugin
View gulpfile.js
var gulp = require('gulp');
var inject = require('gulp-inject');
gulp.task('inject', function () {
var target = gulp.src('index.html');
// It's not necessary to read the files (will speed up things), we're only after their paths:
var sources = gulp.src(['style.css', 'script.js'], {read: false});
return target.pipe(inject(sources))
.pipe(gulp.dest('result.html'));
You can’t perform that action at this time.