Skip to content

Instantly share code, notes, and snippets.

View johanguse's full-sized avatar
🏠
Working from home

Johan Guse johanguse

🏠
Working from home
View GitHub Profile
@johanguse
johanguse / debug_rewrite_rules_wp
Last active January 6, 2022 12:52
Debug rewrite rules on Wordpress
// Debug Rewrite Rules in Wordpress
function debug_rewrite_rules() {
global $wp, $template, $wp_rewrite;
echo '<pre>';
echo 'Request: ';
echo empty($wp->request) ? "None" : esc_html($wp->request) . PHP_EOL;
echo 'Matched Rewrite Rule: ';
echo empty($wp->matched_rule) ? None : esc_html($wp->matched_rule) . PHP_EOL;
echo 'Matched Rewrite Query: ';
@johanguse
johanguse / grid.scss
Created November 18, 2018 19:46
Simple SASS Grid - webdesign.tutsplus.com/pt/tutorials/a-simple-responsive-grid-made-even-better-with-sass--cms-21540
@import "variables";
@import "mixins";
*, *:after, *:before {
margin: 0;
padding: 0;
@include border-box;
}
img {
@johanguse
johanguse / _base_mixin.scss
Last active January 20, 2019 18:34
The Best SASS mixing
///
/// Generates `opacity` output for a given element and adds a filter for old IE.
///
/// @author bartveneman
///
/// @link http://caniuse.com/css-opacity caniuse
/// @link http://www.w3.org/TR/css3-color/#transparency spec
///
/// @param {Number} $value [0]
///
@johanguse
johanguse / wp-config.php
Last active December 20, 2020 22:23
WP-config Hooks
/* Disable WP-Cron */
define('DISABLE_WP_CRON', true);
/* WP auto save posts timer */
define('AUTOSAVE_INTERVAL', 300); // seconds
/* Reduce post revision to clean db */
define( 'WP_POST_REVISIONS', 5 );
define( 'EMPTY_TRASH_DAYS', 7 );
@johanguse
johanguse / Multiple_Slickslider.js
Created March 11, 2019 19:49
Multiple Slickslider on same page
$('.slider').each(function(){
var slickInduvidual = $(this);
slickInduvidual.slick({
nextArrow: slickInduvidual.next().find('.right'),
prevArrow: slickInduvidual.next().find('.left'),
arrows: true,
dots: false
});
})
@johanguse
johanguse / translate_pagination.php
Last active January 6, 2022 12:51
Translate pagination base slug url on WordPress
//https://wordpress.stackexchange.com/questions/57070/change-the-page-slug-in-pagination
function re_rewrite_rules() {
global $wp_rewrite;
$wp_rewrite->author_base = 'autor';
$wp_rewrite->search_base = 'buscar';
$wp_rewrite->comments_base = 'comentarios';
$wp_rewrite->pagination_base = 'pagina';
$wp_rewrite->flush_rules();
}
add_action('init', 're_rewrite_rules');
@johanguse
johanguse / remove_edit_button
Last active January 6, 2022 12:50
WordPress Remove EDIT button from Media Side on imagens
/**
* Add if you want to EDIT image edit option from Media Manager.
*/
foreach( array( 'post.php', 'post-new.php' ) as $hook )
add_action( "admin_print_styles-$hook", 'admin_styles_so_25894288');
function admin_styles_so_25894288() {
?>
<style>
.attachment-info .edit-attachment
@johanguse
johanguse / .gitlab-ci.yml
Created May 9, 2019 13:44
error on gitlab pipeline
#image: keymetrics/pm2:latest-alpine
image: node:alpine
variables:
SCRIPTS_REPO: https://gitlab.com/cavalo-trucado/api
KEYPAIR: "/home/johan/.ssh/id_rsa.pub"
stages:
- build
- deploy
@johanguse
johanguse / index.js
Created July 23, 2019 00:06
Test for Firebase Push Notification
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View } from 'react-native';
@johanguse
johanguse / gist:84c2d34a0d684a9ac369befbeb7147eb
Created September 14, 2019 14:29
A problem occurred evaluating project ':app'.
* Error running Gradle:
ProcessException: Process "complete_flutter_ecommerce-master\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file 'complete_flutter_ecommerce-master\android\app\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating project ':app'.