Skip to content

Instantly share code, notes, and snippets.

View nilovelez's full-sized avatar

Nilo Velez nilovelez

View GitHub Profile
<?php
// en un tema o un plugin, no cargues siempre todos los ficheros
// incluye los ficheros sólo donde hacen falta
if ( is_admin() ) {
require_once('codigo_para_admin.php');
}else{
require_once('codigo_para_frontend.php');
}
<?php
/*
Plugin Name: Parches Woo Nelson
*/
add_filter( 'woocommerce_thankyou_order_received_text', 'nelson_custom_gracias' );
function nelson_custom_gracias ( $msg_gracias ) {
return 'Nuevo mensaje de gracias';
@nilovelez
nilovelez / borrar_idiomas.sh
Created December 29, 2016 17:37
Borrar idiomas innecesarios de WordPress
ls -p | grep -v 'es_ES' | grep -v / | xargs rm -f
@nilovelez
nilovelez / nginx_config
Created December 29, 2016 18:41
configuración de NGinx optimizada para pagespeed
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon font/woff2;

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@nilovelez
nilovelez / .htaccess
Created May 4, 2017 07:11
.htaccess GZIP + browser cache
# ———————————————————————
# Force Cache
# ———————————————————————
<IfModule mod_expires.c>
<FilesMatch "\.(jpe?g|png|gif|js|css|ico)$">
ExpiresActive On
ExpiresDefault "access plus 1 year"
</FilesMatch>
</IfModule>
#!/bin/bash
mkdir -p out
cd in/
while IFS= read -d '' -r file; do
file="${file#./}"
cp "$file" ../out/"${file//\//-}"
done < <(find . -type f -print0)
@nilovelez
nilovelez / pi_mount_usb.md
Created December 30, 2017 15:54 — forked from etes/pi_mount_usb.md
How to setup mount / auto-mount USB Hard Drive on Raspberry Pi

How to setup mount / auto-mount USB Hard Drive on Raspberry Pi

Follow the simple steps in the order mentioned below to have your USB drive mounted on your Raspberry Pi every time you boot it.

These steps are required especially if your are setting up a Samba share, or a 24x7 torrent downloader, or alike where your Raspberry Pi must have your external storage already mounted and ready for access by the services / daemons.

Step 0. Plug in your USB HDD / Drive to Raspberry Pi If you are using a NTFS formatted drive, install the following

@nilovelez
nilovelez / docker-compose.yml
Last active June 13, 2022 17:59
Fichero de docker-compose para entorno de WordPress en Raspberry Pi
version: '2'
services:
wordpress:
image: arm32v7/wordpress
restart: always
ports:
- 80:80
environment:
@nilovelez
nilovelez / gist:9d06a8863f83d4bf75f3277f73a17b1b
Created February 4, 2018 15:10
Remove Raspberry bloatware
$ sudo apt-get remove --purge libreoffice* minecraft-pi wolfram-engine scratch sonic-pi dillo gpicview penguinspuzzle oracle-java8-jdk openjdk-7-jre oracle-java7-jdk openjdk-8-jre -y
$ sudo apt-get clean
$ sudo apt-get autoremove