Skip to content

Instantly share code, notes, and snippets.

@rzzo
rzzo / gulpfile.js
Created October 13, 2017 21:03
Gulp-svg-sprite config template to generate svg sprites
'use-strict';
var gulp = require('gulp'),
svgSprite = require('gulp-svg-sprite'),
path = require('path'),
// SVG Config
config = {
shape : {
id : {
@rzzo
rzzo / dynamic_title_rails.html.erb
Last active February 1, 2024 08:34
Simple to set a page title dynamically Ruby on Rails. Set page title with ternary operator
<!-- Set page title with ternary operator -->
<!-- application layout -->
<title><%= content_for?(:page_title) ? yield(:page_title) : default_page_title %></title>
<!-- view -->
<% set_page_title(@page_title) %>
<!-- application helper -->
def set_page_title(title)
@rzzo
rzzo / hover_active_focus.scss
Created July 16, 2015 18:04
Scss mixin - hover active focus
//=== hover active focus
//=== Use: @include hoverActiveFocus('opacity', 0.5)
@mixin hoverActiveFocus($property, $value) {
&:hover, &:active, &:focus {
#{$property}: $value;
}
}
@rzzo
rzzo / clearfix.scss
Created July 16, 2015 18:02
Scss mixin - clearfix
//=== Clearfix
//=== Use @extend %clearfix;
%clearfix {
&:after {
content: "";
display: table;
clear: both;
}
}
@rzzo
rzzo / px_to_rem.scss
Created July 16, 2015 18:00
Scss mixin - px to rem
//=== px -> rem USE: @include rem('padding',18px 0 20px 5px);
//=== Thanks to the tons of posts that I put this together with.
$baseline-px: 16px;
@mixin rem($property, $px-values) {
// Convert the baseline into rems
$baseline-rem: $baseline-px / 1rem * 1;
// Print the first line in pixel values
#{$property}: $px-values;