Skip to content

Instantly share code, notes, and snippets.

View IlanVivanco's full-sized avatar
💡
Coding!

Ilán Vivanco IlanVivanco

💡
Coding!
View GitHub Profile
@IlanVivanco
IlanVivanco / apache.conf
Last active August 1, 2024 23:17
Apache config for external assets on local
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^example\.test$
RewriteRule ^wp-content/uploads/(.*)$ https://example.com/wp-content/uploads/$1 [NC,L]
</IfModule>
@IlanVivanco
IlanVivanco / nginx.conf.hbs
Last active August 2, 2024 12:06
nginx config for external assets on local
http {
# (...)
# Define the cache path
proxy_cache_path "{{root}}\\wp-content\\cache" levels=1:2 keys_zone=nginx_cache:10m max_size=1g inactive=60m use_temp_path=off;
# Log errors in debug mode
# error_log "{{logs.errorLog}}" debug;
# (...)
@IlanVivanco
IlanVivanco / get-posts.php
Last active June 12, 2024 19:12
Get post data from DB
<?php
// Hook into the admin menu action to add the options page.
add_action( 'admin_menu', 'epic_add_admin_page' );
function epic_add_admin_page() {
// Add a new submenu page under Settings tab
add_submenu_page(
'options-general.php',
'Epic Posts Listing',
@IlanVivanco
IlanVivanco / wp-redirects.php
Last active February 13, 2024 22:41
WP Redirect Log
<?php
/**
* Plugin Name: Debug - WP Redirect
* Description: Adds debugging output to the HTTP header response to find out which file/function triggered a redirect.
* Author: Philipp Stracker
* Author URI: http://www.stracker.net/
* Created: 15.09.2015
* Version: 1.0.0
*
* Simply activate the plugin and it will add debugging information to all
@IlanVivanco
IlanVivanco / instrctuvo.md
Last active January 17, 2024 02:59
Musihaks CSS hacks

Pequeños hacks CSS para Musihacks

Pueden aplicar los estilos que vaya recopilando en style.css utilizando alguna extensión del navegador que permita agregar estilos personalizados. En mi caso, estoy utilizando User CSS para Edge/Chorme.

Cualquier recomendación o comentario es más que bienvenido.

while read line; do awk '{print $2}' <(curl -ISs $line | grep location) >> headers.txt; done < urls.txt
@IlanVivanco
IlanVivanco / cache.php
Last active February 5, 2024 16:08
Clear all possible WP cache systems
<?php
if ( ! function_exists( 'lets_clear_cache' ) ) {
function lets_clear_cache() {
// WP Rocket
if ( function_exists( 'rocket_clean_domain' ) ) {
rocket_clean_domain();
}
// W3 Total Cache : w3tc
@IlanVivanco
IlanVivanco / commands.md
Last active November 1, 2021 19:57
Util git scripts

Remove dead branches

Removes merged branches that are already deleted from the remote repository, but they are still on your local machine.

git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d

Add this command as git alias

@IlanVivanco
IlanVivanco / config.md
Last active September 3, 2021 13:48
Xdebug config for Devilbox

Extracted from cytopia/devilbox#718 issue

  • ~/.zshrc or ~/.bashrc
export IP=$(hostname -I)
  • _~/.devilbox/.env
PROJECTS_PATH=~/code
@IlanVivanco
IlanVivanco / devilbox.sh
Last active September 3, 2021 13:53
Utils function for managing Devilbox's virtual hosts
dvb-create-host() {
# Vars
BASE_DIR="~/www/$1/htdocs"
DB_NAME="$1_db"
DB_HOST="mysql"
DB_USER="root"
DB_PASS=""
WP_URL="$1.local"
WP_USER="ilan"