Skip to content

Instantly share code, notes, and snippets.

View edoardo-mb's full-sized avatar
🎯
Focusing

Edoardo Armandi M&B edoardo-mb

🎯
Focusing
View GitHub Profile

#Introduction If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with php. This is for a developer machine and not for a live environment!

I hope it helps you too!

fyi @mheiniger and me started with an installer here: https://github.com/mheiniger/webdev-setup

@edoardo-mb
edoardo-mb / province.txt
Created March 21, 2018 14:11 — forked from iamlucamilan/province.txt
Lista province italiane
Agrigento
Alessandria
Ancona
Aosta
Arezzo
Ascoli Piceno
Asti
Avellino
Bari
Barletta-Andria-Trani
@edoardo-mb
edoardo-mb / fix-wordpress-permissions.sh
Created June 4, 2018 08:53 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
sudo find . -type f -exec chmod 644 {} +
sudo find . -type d -exec chmod 755 {} +
sudo chown -R testuser:testuser /var/www/test/public_html
sudo chmod -R 777 /var/www/test/public_html
@edoardo-mb
edoardo-mb / wordpress-escaping.md
Created November 5, 2018 14:58 — forked from windyjonas/wordpress-escaping.md
Most of the escaping functions in WordPress, with a short explanation and example.

WordPress escaping functions

By: Jonas Nordström, @windyjonas
Date: 2013-04-16

esc_attr( $text );
Encodes the <, >, &, " and ' (less than, greater than, ampersand, double quote and single quote) characters. Will never double encode entities.
Example:

@edoardo-mb
edoardo-mb / edit-woocommerce-checkout-template.php
Created December 6, 2018 15:42 — forked from bekarice/edit-woocommerce-checkout-template.php
Add content and notices to the WooCommerce checkout - sample code
/**
* Each of these samples can be used - note that you should pick one rather than add them all.
*
* How to use WC notices: https://github.com/woothemes/woocommerce/blob/master/includes/wc-notice-functions.php#L96
* Tutorial: http://www.skyverge.com/blog/edit-woocommerce-templates/
**/
/**
* Add a content block after all notices, such as the login and coupon notices.
*
@edoardo-mb
edoardo-mb / functions.php
Created December 20, 2018 13:13
Add custom message to cart and checkout
// Add custom message to cart and checkout
add_action('woocommerce_before_cart', 'mb_add_cart_checkout_message');
add_action( 'woocommerce_before_checkout_form', 'mb_add_cart_checkout_message', 12 );
function mb_add_cart_checkout_message() {
echo '<div style="border-color: #000000;border-radius: 4px;border-width: 2px;border-style: solid;padding: 30px 20px 20px 20px;margin: 0 0 2em;background: #000;color: #fff;">
<h4 style=" text-align: center; font-weight: 700; color: #fff;">Gli ordini ricevuti dal 22 dicembre 2018 al 2 gennaio 2019 saranno spediti dal 3 gennaio 2019.</h4></div>';
}
@edoardo-mb
edoardo-mb / functions.php
Created January 22, 2019 11:45 — forked from lmartins/functions.php
By default WooCommerce redirects the user to the My Account page after a successful login. You may change this and use a custom URL based on the user role, like the Dashboard for admins and My Account page for customers. To do this, add this code at the end of the file functions.php located in wp-content/themes/your-theme-name/ https://support.w…
<?php
/**
* Redirect users to custom URL based on their role after login
*
* @param string $redirect
* @param object $user
* @return string
*/
function wc_custom_user_redirect( $redirect, $user ) {
// Get the first of all the roles assigned to the user
//to debug php in console
<script>console.log(<?= json_encode($languages); ?>);</script>
@edoardo-mb
edoardo-mb / laravellocal.md
Created June 29, 2019 08:37 — forked from hootlex/laravellocal.md
Run laravel project locally

##Windows users:

cmder will be refered as console

##Mac Os, Ubuntu and windows users continue here:

  • Create a database locally named homestead utf8_general_ci