Skip to content

Instantly share code, notes, and snippets.

View pedrorvidal's full-sized avatar

Pedro Vidal pedrorvidal

  • Porto Alegre, Brazil.
View GitHub Profile
@pedrorvidal
pedrorvidal / functions.php
Created November 19, 2024 01:22
Convert images to .webp
<?php
add_filter('wp_handle_upload', 'convert_to_webp', 10, 2);
function convert_to_webp($upload, $context) {
$file_path = $upload['file'];
$file_info = pathinfo($file_path);
$extension = strtolower($file_info['extension']);
$allowed_extensions = ['jpeg', 'jpg', 'png', 'gif'];
if (in_array($extension, $allowed_extensions)) {
@pedrorvidal
pedrorvidal / work-with-multiple-github-accounts.md
Created February 14, 2024 15:50 — forked from rahularity/work-with-multiple-github-accounts.md
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@pedrorvidal
pedrorvidal / related.php
Created February 28, 2023 21:37
Related Posts Wordpress by Category
###############################################################################
# Generated on phpdocker.io #
###############################################################################
version: '3.1'
services:
memcached:
image: 'memcached:alpine'
mailhog:
image: 'mailhog/mailhog:latest'
@pedrorvidal
pedrorvidal / multiple_ssh_setting.md
Created August 10, 2022 14:53 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
// wordpress function to debug menu (and use remove_menu_page)
add_action( 'admin_init', 'the_dramatist_debug_admin_menu' );
function the_dramatist_debug_admin_menu() {
echo '<pre>' . print_r( $GLOBALS[ 'menu' ], TRUE) . '</pre>';
}
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cidade por Estado</title>
</head>
<body>
<select name="estados" id="estados"></select>
@pedrorvidal
pedrorvidal / .htaccess
Created April 13, 2021 18:18 — forked from RafaelFunchal/.htaccess
Exclude the files ajax, upload and WP CRON scripts from authentication
# Exclude the files ajax, upload and WP CRON scripts from authentication
<FilesMatch "(admin-ajax\.php|media-upload\.php|async-upload\.php|wp-cron\.php|xmlrpc\.php)$">
Order allow,deny
Allow from all
Satisfy any
</FilesMatch>
import { src, dest, watch, series, parallel } from 'gulp';
import yargs from 'yargs';
import sass from 'gulp-sass';
import cleanCss from 'gulp-clean-css';
import gulpif from 'gulp-if';
import postcss from 'gulp-postcss';
import sourcemaps from 'gulp-sourcemaps';
import autoprefixer from 'autoprefixer';
import imagemin from 'gulp-imagemin';
import del from 'del';
// import { src, dest, watch, series, parallel } from 'gulp';
const { src, dest, watch, series, parallel } = pkg;
import pkg from 'gulp';
import yargs from 'yargs';
import sass from 'gulp-sass';
import cleanCss from 'gulp-clean-css';
import gulpif from 'gulp-if';
import postcss from 'gulp-postcss';
import sourcemaps from 'gulp-sourcemaps';