Skip to content

Instantly share code, notes, and snippets.

View nunomorgadinho's full-sized avatar

Nuno Morgadinho nunomorgadinho

View GitHub Profile
@nunomorgadinho
nunomorgadinho / gist:3868800
Created October 10, 2012 22:09
WordPress-GitHub-Plugin-Updater
if (is_admin()) { // note the use of is_admin() to double check that this is happening in the admin
$config = array(
'slug' => plugin_basename(__FILE__), // this is the slug of your plugin
'proper_folder_name' => 'plugin-name', // this is the name of the folder your plugin lives in
'api_url' => 'https://api.github.com/repos/username/repository-name', // the github API url of your github repo
'raw_url' => 'https://raw.github.com/username/repository-name/master', // the github raw url of your github repo
'github_url' => 'https://github.com/username/repository-name', // the github url of your github repo
'zip_url' => 'https://github.com/username/repository-name/zipball/master', // the zip url of the github repo
'sslverify' => true // wether WP should check the validity of the SSL cert when getting an update, see https://github.com/jkudish/WordPress-GitHub-Plugin-Updater/issues/2 and https://github.com/jkudish/WordPress-GitHub-Plugin-Updater/issues/4 for
@nunomorgadinho
nunomorgadinho / gist:4098988
Created November 17, 2012 19:11
Integração PHP-InvoiceXpress Exemplo
$data = array(
'client' => array(
'name' => $client_name,
'email' => $order->billing_email,
'phone' => $order->billing_phone,
'address' => $order->billing_address,
'postal_code' => $order->billing_postcode,
),
);
@nunomorgadinho
nunomorgadinho / le-renew-webroot.ini
Last active July 19, 2022 09:55
Install PHP56-FPM, Nginx, MySQL on EC2 with Amazon Linux AMI and SSL with letsencrypt
# adduser nginx
adduser nginx
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and PHP-FPM
sudo yum install -y nginx php56-fpm
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@nunomorgadinho
nunomorgadinho / gist:b2d8e5b8f5fec5b0ed946b24fa288a91
Created February 10, 2017 13:30
PHPCS + WordPress Coding Standards
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install composer
brew install homebrew/php/composer
### PHPCS
composer global require "squizlabs/php_codesniffer=*"
# Add to your .bash_profile
@nunomorgadinho
nunomorgadinho / steps
Last active March 14, 2017 18:25
Rollback para um determinado commit
# 1-Check out the branch you made the mistake on
# 2- Right click on the commit you want to reset the branch to
# 3- Click "Reset current branch to this commit"
# 4- Select "Hard" mode and click "OK"
# 5- Unfortunately you need terminal to do this bit. Type git push origin name_of_branch --force into terminal (you may need to enter your git repo username and password for it to accept the command)
git checkout staging
git pull origin staging
# identificar o commit para o qual se quer voltar:
@nunomorgadinho
nunomorgadinho / wl_weekday_repeat_schedule.php
Created June 12, 2017 11:18
A filter to add weekdays as a schedule for the repeatable posts plugin by Human Made
/*
Plugin Name: Weekdays repeatable posts
Plugin URI: http://wordpress.org/plugins/wl_weekday_repeat_schedule
Description: A filter to add weekdays as a schedule for the repeatable posts plugin
Author: WidgiLabs
Version: 0.1
Author URI: http://widgilabs.com/
*/
add_filter( 'hm_post_repeat_schedules', 'wl_weekday_repeat_schedule', 10, 1);

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

yum update
yum install php71-fpm.x86_64 php71-mysqlnd.x86_64 php71-devel.x86_64 php71-pdo.x86_64 php71-mbstring.x86_64 php71-cli.x86_64 php71-odbc.x86_64 php71-gd.x86_64 php71-imap.x86_64 php71-xml.x86_64 php71-soap.x86_64
@nunomorgadinho
nunomorgadinho / macos-setup.md
Last active February 15, 2021 16:01
Clean Install – macOS

macOS

Custom recipe to get macOS running from scratch, setup applications and (WordPress) developer environment. I use this gist to keep the steps required to have a functioning system after a semi-annual fresh install.

Software

Browsers

System