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 / phpcs.xml
Last active March 8, 2024 17:09
PHPCS WordPress coding standards config file
<?xml version="1.0"?>
<ruleset name="WordPress Theme Coding Standards"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<description>A custom set of rules to check for a WPized WordPress project</description>
<!-- General PHPCS config. -->
<file>.</file>
<arg value="sp"/>
<arg name="extensions" value="php"/>
@IlanVivanco
IlanVivanco / get-posts.php
Last active March 7, 2024 20:20
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 / 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 / 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 / .htaccess
Last active March 20, 2023 17:07
Rewrite local images to remote server.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^camunda\.test$
RewriteRule ^wp-content/uploads/(.*)$ https://camunda.com/wp-content/uploads/$1 [NC,L]
</IfModule>
@IlanVivanco
IlanVivanco / db_clean_up.sql
Last active February 9, 2022 11:18
Wordpress DB clean up
-- Deletes old revisions
DELETE a,
b,
c
FROM
wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
LEFT JOIN wp_term_taxonomy d ON (b.term_taxonomy_id = d.term_taxonomy_id)
WHERE
@IlanVivanco
IlanVivanco / clean_slack.py
Last active January 27, 2022 08:18
Deletes files older than N days. You can also filter them by size. Forked from https://gist.github.com/jackcarter/d86808449f0d95060a40
# Idea taken from https://gist.github.com/jackcarter/d86808449f0d95060a40
import time
import codecs
import requests
reader = codecs.getreader("utf-8")
# Obtain your's by creating a Slack app on https://api.slack.com/apps?new_app=1 and assign that to your workspace.
# Within this new app, go to "OAuth & Permissions" and in the section "Scopes > User Token Scopes" add the "files:read" and "files:write" Oauth scopes.
# Finally, you can now go to the top of the page and install the app to the workspace. After that you'll get the User OAuth Token that you can use on the script.
@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