Skip to content

Instantly share code, notes, and snippets.

View nandomoreirame's full-sized avatar
🎧
Working from home

Fernando Moreira nandomoreirame

🎧
Working from home
View GitHub Profile
@nandomoreirame
nandomoreirame / convert-scss-to-sass.bash
Last active May 4, 2017 08:19
Convert all files scss to .sass extension
for file in path-to-scss/**/*.scss; do sass-convert $file ${file%scss}sass && rm $file; done
@nandomoreirame
nandomoreirame / gist:ada7d4ca279dab7350b7ae4fc37c4b1e
Created July 18, 2016 22:46
Update all permalinks in WordPress
UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_links SET link_url = replace(link_url, 'http://olddomain.com','http://newdomain.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com','http://newdomain.com');
UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');
@nandomoreirame
nandomoreirame / mixins.scss
Last active November 6, 2017 12:46
SASS Mixins utils
@mixin responsive-ratio($x,$y, $pseudo: false) {
$padding: unquote( ( $y / $x ) * 100 + '%' );
@if $pseudo {
&:before {
@include pseudo($pos: relative);
width: 100%;
padding-top: $padding;
}
} @else {
$default-feature: min-width
=media($query: $feature $value)
@if length($query) == 1
@media screen and ($default-feature: nth($query, 1))
@content
@else
$loop-to: length($query)
$media-query: "screen and "
@nandomoreirame
nandomoreirame / Rakefile
Created September 16, 2016 17:36
deploy to aws s3 with Rake tasks
require 'aws-sdk'
require 'pathname'
require 'yaml'
CONFIG = {
"distPath" => "public/dist",
"stylesheetsPath" => "public/dist/stylesheets",
"javascriptsPath" => "public/dist/javascripts",
"fontsPath" => "public/dist/fonts"
}
@nandomoreirame
nandomoreirame / breakpoints.css
Last active September 28, 2021 00:09
media query breakpoints
/* Smartphones (portrait and landscape) ----------- */
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) { /* Styles */ }
/* Smartphones (landscape) ----------- */
@media only screen and (min-width: 321px) { /* Styles */ }
/* Smartphones (portrait) ----------- */
@media only screen and (max-width: 320px) { /* Styles */ }
/* iPads (portrait and landscape) ----------- */
@nandomoreirame
nandomoreirame / app.js
Created June 22, 2017 00:07
Data cache with service worker
(function () {
'use strict';
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/assets/javascripts/service-worker.js')
.then(function (registration) {
console.info('Service Worker Registered');
}).catch(function (e) {
console.error('Error during service worker registration:', e);
});
my closeNotif()
on closeNotif()
tell application "System Events"
tell process "Notification Center"
set theWindows to every window
repeat with i from 1 to number of items in theWindows
set this_item to item i of theWindows
try
click button 1 of this_item
@nandomoreirame
nandomoreirame / pxToRem.sass
Created September 3, 2017 16:30
pxToRem.sass
/// @argument {number (with unit)} $px
///
/// @access public
@function pxToRem($px)
@return (round(remove-unitless($px)) / remove-unitless($font-size-base-px))+rem
<?php
$products_args = array(
'post_type' => 'products',
'posts_per_page' => 10
);
$products_query = new WP_Query($products_args);
?>
<?php if ($products_query->have_posts()): ?>
<?php while ($products_query->have_posts()): $products_query->the_post(); ?>