Skip to content

Instantly share code, notes, and snippets.

View eddiesigner's full-sized avatar
🤘
~ whoami

Eduardo Gómez eddiesigner

🤘
~ whoami
View GitHub Profile
@eddiesigner
eddiesigner / postcss-simple-media-queries-setup.js
Created May 14, 2017 14:21
PostCSS Simple Media Queries Example
var fs = require('fs');
var postcss = require('postcss'); // Load PostCSS
var postcss_nested = require('postcss-nested'); // Load the postcss-nested plugin
var simple_media_queries = require('postcss-simple-media-queries'); // Load the postcss-simple-media-queries
var css = fs.readFileSync('input.css', 'utf8'); // Your stylesheet
var output = postcss([simple_media_queries, postcss_nested]) // The order is important because this plugin depends on nesting capabilities
.process(css)
.css;
@eddiesigner
eddiesigner / gulp-simple-media-queries-setup.js
Created May 14, 2017 14:24
Gulp Simple Media Queries Example
var gulp = require('gulp');
var postcss = require('gulp-postcss'); // Load PostCSS
var postcss_nested = require('postcss-nested'); // Load the postcss-nested plugin
var simple_media_queries = require('postcss-simple-media-queries'); // Load the postcss-simple-media-queries plugin
gulp.task('css', function () {
var processors = [ // The order is important because this plugin depends on nesting capabilities
simple_media_queries,
postcss_nested
];
@eddiesigner
eddiesigner / simple-media-queries-source.css
Created May 14, 2017 14:31
Simple Media Queries Source Example
p {
margin: 0;
@media (mq('medium')) {
margin: 25px 0;
}
}
@eddiesigner
eddiesigner / simple-media-queries-destination.css
Created May 14, 2017 14:32
Simple Media Queries Destination Example
p {
margin: 0;
}
@media only screen and ( min-width: 42em ) {
p {
margin: 25px 0;
}
}
@eddiesigner
eddiesigner / simple-media-queries-default.js
Created May 14, 2017 14:34
Simple Media Queries Default Configuration
{
'initialize': '1px',
'small': '35.5em', // >= 568px @ 16px
'medium': '48em', // >= 768px @ 16px
'large': '64em', // >= 1024px @ 16px
'extra-large': '80em' // >= 1280px @ 16px
}
@eddiesigner
eddiesigner / simple-media-queries-override.js
Created May 14, 2017 14:36
Simple Media Queries Override Configuration
...
var processors = [
simple_media_queries({
'mobile': '32em',
'tablet': '45em',
'desktop': '64em',
'extra-large': '80em',
'super-large': '96em'
}),
postcss_nested
@eddiesigner
eddiesigner / Card.js
Created September 1, 2018 16:15
Recreating the Airbnb scaling effect on components with React native
import React, { PureComponent } from 'react';
import { Dimensions, Animated, TouchableWithoutFeedback } from 'react-native';
import styled from 'styled-components';
// I use these values because I have two columns of cards with some space and because
// I want to keep a vertical ratio.
// You can change them for some fixed values or anything else, it depends of your needs
const cardWidth = (Dimensions.get('window').width / 2) - 30;
const cardHeight = cardWidth * 1.4
@eddiesigner
eddiesigner / _mixins.scss
Last active January 22, 2019 00:18
Useful Sass mixins
/* Media queries breakpoints */
$break-small: 35.5rem; // >= 568px @ 16px
$break-medium: 48rem; // >= 768px @ 16px
$break-large: 64rem; // >= 1024px @ 16px
$break-extra-large: 80rem; // >= 1280px @ 16px
$break-largest: 90rem; // >= 1440px @ 16px
/* Media query mixin */
@mixin respond-to( $condition ) {
@if $condition == 'initialize' { @media only screen and (min-width: 1px) { @content; } }
@eddiesigner
eddiesigner / liebling-light-mode.css
Last active July 7, 2020 08:43
Liebling Ghost theme - Force light mode
:root,
[data-theme="light"],
[data-theme="dark"],
:root:not([data-theme="light"]) {
--background-color: #fff;
--primary-foreground-color: #4a4a4a;
--secondary-foreground-color: #000;
--primary-subtle-color: #04aeee;
--secondary-subtle-color: #f4f8fd;
--titles-color: #333;
@eddiesigner
eddiesigner / weiss-pro-logo-filter.html
Last active February 26, 2020 20:19
Weiss Pro logo filter for dark mode
<style>
[data-theme="dark"] .m-logo.in-desktop-topbar img,
[data-theme="dark"] .m-logo.in-mobile-topbar img {
filter: invert();
}
@media (prefers-color-scheme: dark) {
.m-logo.in-desktop-topbar img,
.m-logo.in-mobile-topbar img {
filter: invert();