Skip to content

Instantly share code, notes, and snippets.

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

Edir Pedro edirpedro

🏠
Working from home
View GitHub Profile
@edirpedro
edirpedro / wp-view-tables.php
Last active February 7, 2021 20:06
Some ideias to create Views Tables from WordPress data in case you need to make custom queries in the database.
<?php
function _create_views() {
global $wpdb;
/*
* Post Type book and its ACF custom fields
*/
@edirpedro
edirpedro / _temporizador.ino
Last active June 22, 2018 14:01
Classe Temporizador para Arduino, substitui o uso da função delay()
/*
* Temporizador
* Executa funções após um determinado período de tempo,
* o mesmo que usar delay(), porém sem interromper o fluxo do programa
* Autor: Edir Pedro
* Website: https://gist.github.com/edirpedro/15afd9681c7cb6a0a8fd537f02cb3434
*/
class Temporizador {
@edirpedro
edirpedro / s3.sh
Created January 16, 2018 13:38
Automate uploading backups to S3 with AWS CLI
#!/bin/bash
# Automate uploading backups to S3 with AWS CLI
# Go to AWS Console and create an user with access to your bucket and a single permission to the action "PutObject"
# Sample policy: {"Version": "2018-01-15","Statement": [{"Effect": "Allow","Action": "s3:PutObject","Resource": ["arn:aws:s3:::BUCKETNAME/*","arn:aws:s3:::BUCKETNAME"]}]}
# Login to SSH as root
# sudo apt-get install python-pip
# sudo pip install awscli
@edirpedro
edirpedro / customtable-wp-usermeta.php
Created September 23, 2017 00:08
A solution if you need to separate some custom fields data from the table wp_usermeta for any reason.
<?php
/*
* Custom WP Usermeta Table
*
* Version: 1.0
* Author: Edir Pedro
* Website: https://gist.github.com/edirpedro/528c671b31557be8769620337e2b44a0
*
* How to use?
@edirpedro
edirpedro / deploy.php
Last active November 13, 2017 22:34
Git Deploy via Webhook
<?php
/*
*
* Lista de checagem para fazer Deploy via Webhook
* = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*
* Coloque este arquivo na pasta ./public_html
*
* O servidor possui acesso via SSH?
@edirpedro
edirpedro / gulp.tool
Last active September 18, 2017 19:16
Gulp Quick Start Tool
#!/bin/bash
# Gulp Quick Start Tool
#
# Starts a gulp watch checking if NPM and dependencies are installed.
# Just put this file next to package.json and gulpfile.js, then double click on it to run.
# This file has to be executable: chown +x gulp.tool
#
# author: Edir Pedro
# email: edirps@gmail.com
@edirpedro
edirpedro / gulpfile.js
Last active September 15, 2017 22:21
My Gulp Workflow for WP Themes
/*
@author: Edir Pedro
@website: http://edirpedro.com.br
@version: 1.1.0
## Install Node LTS version to avoid incompatibilities
https://nodejs.org
## Creating NPM package.json
@edirpedro
edirpedro / estados-brasil.php
Last active April 22, 2024 12:12
Estados do Brasil (Lista, Array)
// Lista
AC, Acre
AL, Alagoas
AP, Amapá
AM, Amazonas
BA, Bahia
CE, Ceará
DF, Distrito Federal
ES, Espirito Santo
@edirpedro
edirpedro / wp_instagram_feed.php
Last active July 18, 2023 17:07
Function to get Instagram feed and cache it on WordPress
/*
* WP Instagram Feed
*
* To get a new Access Token, change the [], put it in the browser and it will return with your token in the next URL.
* https://instagram.com/oauth/authorize/?client_id=[CLIENT_ID]&redirect_uri=[REDIRECT_URL]&response_type=token
*********************************************************************/
function wp_instagram_feed($count = 20) {
$slug = "instagram_feed_self";
$access_token = '[ACCESS_TOKEN_HERE]';
@edirpedro
edirpedro / gravityforms-full-width.css
Created November 10, 2015 18:27
Gravity Forms Full Width
.gform_wrapper {
width: 100%;
max-width: 100%;
}
.gform_wrapper form {
width: 105%;
padding-left: 2.5%;
margin-left: -2.5%;
}