Skip to content

Instantly share code, notes, and snippets.

View eduardopintor's full-sized avatar

Eduardo Pintor eduardopintor

View GitHub Profile
@eduardopintor
eduardopintor / 01_Laravel 5 Simple ACL manager_Readme.md
Created May 8, 2016 17:28 — forked from amochohan/01_Laravel 5 Simple ACL manager_Readme.md
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

@eduardopintor
eduardopintor / countries.sql
Created June 6, 2016 15:28 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@eduardopintor
eduardopintor / README.md
Created August 29, 2016 22:02 — forked from oodavid/README.md
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

@eduardopintor
eduardopintor / gist:fec999ca2a34296038692852aac84349
Created November 23, 2016 17:49 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@eduardopintor
eduardopintor / functions.php
Created December 24, 2016 21:32
Filter Wordpress Posts by User Meta (Custom Post Type Taxonomy)
add_filter( 'posts_where' , 'me_posts_where' );
function me_posts_where( $where ) {
if( is_admin() ) {
global $wpdb;
// Get Current Page
global $pagenow;
// Get Current Logged In User
global $current_user;
@eduardopintor
eduardopintor / add-term-to-post-tag.php
Created July 5, 2017 17:10 — forked from algmelo/add-term-to-post-tag.php
add term metabox to post_tag taxonomy - using WP 4.4 term meta functions
<?php
// source: http://wordpress.stackexchange.com/questions/211703/need-a-simple-but-complete-example-of-adding-metabox-to-taxonomy
// code authored by jgraup - http://wordpress.stackexchange.com/users/84219/jgraup
// REGISTER TERM META
add_action( 'init', '___register_term_meta_text' );
function ___register_term_meta_text() {
@eduardopintor
eduardopintor / add-several-term-meta-fields-to-custom-taxonomy.php
Created July 5, 2017 17:13 — forked from ms-studio/add-several-term-meta-fields-to-custom-taxonomy.php
A variation on the previous gists, this time we add *several* term meta fields
<?php
// source: http://wordpress.stackexchange.com/questions/211703/need-a-simple-but-complete-example-of-adding-metabox-to-taxonomy
// original code authored by jgraup - http://wordpress.stackexchange.com/users/84219/jgraup
/*
* NOTE:
* We are registering the fields for a custom taxonomy, called "user-logement".
*/
@eduardopintor
eduardopintor / bitbucket-webhook.php
Created November 7, 2017 16:33 — forked from maztch/bitbucket-webhook.php
A simple php script for deploy using bitbucket webhook
<?php
//edit with your data
$repo_dir = '~/repository.git';
$web_root_dir = '~/project';
$post_script = '~/project/scripts/post_deploy.sh';
$onbranch = 'master';
// A simple php script for deploy using bitbucket webhook
// Remember to use the correct user:group permisions and ssh keys for apache user!!
// Dirs used here must exists on server and have owner permisions to www-data
@eduardopintor
eduardopintor / documentation and installation
Created February 2, 2018 19:08 — forked from maliMirkec/documentation and installation
Batch scripts for image optimization
http://www.tecmint.com/optimize-and-compress-jpeg-or-png-batch-images-linux-commandline/
https://blarg.co.uk/blog/recursively-optimize-png-files
# install jpegoptim
apt-get update
apt-get install jpegoptim
# install optipng
apt-get update
apt-get install optipng
@eduardopintor
eduardopintor / gist:62a78048d866fb8241ed3b1847183113
Created February 5, 2018 22:30 — forked from corsonr/gist:6138666
WooCommerce - List products by attribute (multiple values), ex: [woo_products_by_attributes attribute="colour" values="red,black" per_page="5"]
<?php
/**
* Plugin Name: WooCommerce - List Products by Attributes
* Plugin URI: http://www.remicorson.com/list-woocommerce-products-by-attributes/
* Description: List WooCommerce products by attributes using a shortcode, ex: [woo_products_by_attributes attribute="colour" values="red,black" per_page="5"]
* Version: 1.0
* Author: Remi Corson
* Author URI: http://remicorson.com
* Requires at least: 3.5
* Tested up to: 3.5