Skip to content

Instantly share code, notes, and snippets.

View nunomorgadinho's full-sized avatar

Nuno Morgadinho nunomorgadinho

View GitHub Profile
@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,
),
);
# 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 / 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
/*
Welcome to Custom CSS!
CSS (Cascading Style Sheets) is a kind of code that tells the browser how
to render a web page. You may delete these comments and get started with
your customizations.
By default, your stylesheet will be loaded after the theme stylesheets,
which means that your rules can take precedence and override the theme CSS
rules. Just write here what you want to change, you don't need to copy all
@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 / mysql
Last active September 27, 2019 13:48
setup new country
#create db user
CREATE USER 'idealbiz_za'@'localhost' IDENTIFIED BY '<PASSWORD>';
GRANT ALL PRIVILEGES ON idealbiz_za.* TO 'idealbiz_za'@'localhost' WITH GRANT OPTION;
flush privileges;
#mysql db import
mysql -u idealbiz_za -p'<PASSWORD>' idealbiz_za < idealbiz_fr_dump.sql
# to allow login and recover pass by the tech user
update wp_users set user_login="<EMAIL>" where user_login="<EMAIL>";
a {
text-decoration: underline overline dotted red;
}