Skip to content

Instantly share code, notes, and snippets.

View statickidz's full-sized avatar
💯
Focusing

Adrián Barrio Andrés statickidz

💯
Focusing
View GitHub Profile
@statickidz
statickidz / replace_emails_sql_txt_csv
Created November 2, 2020 15:06
Replace emails in Visual Studio Code
Search: \b[A-Z0-9._%-]+@
Replace: staging_$0
@statickidz
statickidz / search_replace.php
Last active May 19, 2022 10:32
Search and replace files recursive PHP script
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow"/>
<title>Search and replace files</title>
</head>
<body style="margin: 0; padding: 0;">
<?php
$err_arr = array(0 => '', 1 => '');
1 - Go to https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewiso
2 - Open Chrome console (F12)
3 - Paste this
var _0x5c09=["product-edition","getElementById","innerHTML","<option value='' selected='selected'>Select edition</option><option value='2'>Windows 7 Home Basic SP1 </option><option value='4'>Windows 7 Professional SP1 </option><option value='6'>Windows 7 Home Premium SP1 </option><option value='8'>Windows 7 Ultimate SP1 </option><option value='10'>Windows 7 Home Premium N SP1 </option><option value='12'>Windows 7 Professional N SP1 </option><option value='14'>Windows 7 Ultimate N SP1 </option><option value='16'>Windows 7 Professional K SP1 </option><option value='18'>Windows 7 Professional KN SP1 </option><option value='20'>Windows 7 Home Premium K SP1 </option><option value='22'>Windows 7 Home Premium KN SP1 </option><option value='24'>Windows 7 Ultimate KN SP1 </option><option value='26'>Windows 7 Ultimate K SP1 </option><option value='28'>Windows 7 Starter SP1 </option><opti
@statickidz
statickidz / nearby-coordinates.sql
Last active January 31, 2024 20:31
Ordering with SQL by nearest latitude & longitude coordinates (MySQL & SQLite)
---
METHOD 1
This should roughly sort the items on distance in MySQL, and should work in SQLite.
If you need to sort them preciser, you could try using the Pythagorean theorem (a^2 + b^2 = c^2) to get the exact distance.
---
SELECT *
FROM table
ORDER BY ((lat-$user_lat)*(lat-$user_lat)) + ((lng - $user_lng)*(lng - $user_lng)) ASC
@statickidz
statickidz / functions.php
Last active February 24, 2024 04:35
Woocommerce - Show Custom Filter and Admin Column for Catalog Visibility
<?php
/**
* @snippet Show Custom Filter and Admin Column for Catalog Visibility @ WooCommerce Products Admin
* @sourcecode https://gist.github.com/statickidz/6a539550d8e0d13d2c3d12318672e816
* @author Adrián Barrio Andrés (statickidz.com)
*/
add_filter('woocommerce_product_filters', 'skidz_filter_by_catalog_visibility_dashboard_products');