Skip to content

Instantly share code, notes, and snippets.

View drocarmo's full-sized avatar

Pedro Carmo drocarmo

View GitHub Profile
@drocarmo
drocarmo / background-opacity.scss
Last active August 29, 2015 14:05
Mixin that adds opacity to a HEX value variable in a project
@mixin background-opacity($color, $opacity: .3) {
background: $color;
background: rgba($color, $opacity);
}
// Use case
@include background-opacity($color-white, .7);
@drocarmo
drocarmo / font-smoothing.scss
Created July 18, 2014 19:45
font rendering in OSX
// Mixin
@mixin font-smoothing($value: on) {
@if $value == on {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@else {
-webkit-font-smoothing: subpixel-antialiased;
-moz-osx-font-smoothing: auto;
@drocarmo
drocarmo / framer.js
Created April 29, 2014 21:41
Framer.js barebone starter-template file.
/* Require Framer.js import = http://www.framerjs.com/static/js/framer.js */
/* Also, add a little css, so you can see the view's contents properly:
.framer{
background: black;
}
*/
view = new ImageView({
x:20,
y:20,
@drocarmo
drocarmo / sticky-nav.js
Last active August 29, 2015 14:00
Adds 'sticky' class to HTML nav tag in the DOM
/* Requires latest JQuery lib */
var win = $(window),
nav = $('nav'),
pos = nav.offset().top,
sticky = function(){
if(win.scrollTop() > pos){
nav.addClass('sticky')
} else {
@drocarmo
drocarmo / shapes.scss
Created April 29, 2014 21:15
Sass shape mixin
// Sass Shape Mixin
// http://css-tricks.com/examples/ShapesOfCSS/
@mixin shape($shape, $size, $color){
@if $shape == square {
width: $size;
height: $size;
background-color: $color;
}
// From @chriscoyier
// http://css-tricks.com/snippets/css/a-guide-to-flexbox/
@mixin flexbox() {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
@drocarmo
drocarmo / social.css
Last active August 29, 2015 13:57
Simple mixin to spits out specific social platform link styles. Just tie the class name to the markup. (example: http://drocarmo.com/)
/* Use-case output */
a.github {
color: #333333;
}
a.github:hover, a.github:active {
color: #1a1a1a;
}
a.rdio {
color: #006ed2;
@drocarmo
drocarmo / clearfix.scss
Created January 24, 2014 06:13
Bourbbbbbbbbb
// Bourbon's clear-anything mixin
@mixin clearfix {
&:after {
content:"";
display:table;
clear:both;
}
}
@drocarmo
drocarmo / vertical_align.scss
Created January 24, 2014 06:11
Vertically align anythinggggg
// blog link: http://zerosixthree.se/vertical-align-anything-with-just-3-lines-of-css/
@mixin vertical-align {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
@drocarmo
drocarmo / yeezy.js
Created January 24, 2014 06:06
Toggle Kanye West
$(".kanye").on("click", function() {
$(this).toggleClass("west");
});