Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
In Seville

Rafa Poveda bi0xid

🏠
In Seville
View GitHub Profile
View AMP discrimination
<?php if ( jetpack_is_mobile() ) // if is mobile ?>
<?php else :
if (function_exists('is_amp_endpoint')) : //if is AMP
if (is_amp_endpoint()) : ?>
<?php else : // !is_amp_endpoint() ?>
<!-- DESKTOP ADS -->
View clone wp vip
git clone https://github.com/wpcomvip/xxxxx.git www/xxxxx/public_html/wp-content
git clone git@github.com:Automattic/vip-go-mu-plugins.git --recursive www/xxxxx/public_html/wp-content/mu-plugins/
wp user create bi0xid raven@bi0xid.es --role=administrator
@bi0xid
bi0xid / get_user_data.sql
Created Jun 12, 2018
Get ID, user login, user email, first name and last name from WordPress via SQL
View get_user_data.sql
SELECT DISTINCT us.ID, us.user_login, us.user_email, umeta.meta_value, umeta2.meta_value FROM wparl_users as us, wparl_usermeta as umeta, wparl_usermeta as umeta2 WHERE umeta.meta_key = 'first_name' AND umeta2.meta_key = 'last_name' AND umeta.user_id = us.ID AND umeta2.user_id = us.ID AND ( user_email = 'xxxxxx'
OR user_email = 'xxxxxxx'
OR user_email = 'xxxxxxxx');
View buttons keydown for glotpress
var e = jQuery.Event("keydown");
e.which = 107; // # Some key code value
jQuery('.approve:visible').trigger(e, click);
jQuery('.approve:visible').click().trigger(e);
jQuery(".approve:visible").click(function(){
var e = jQuery.Event("keydown", { keyCode: 107, which: 107});
jQuery(".approve:visible").triggerHandler(e);
@bi0xid
bi0xid / cheatsheet.sql
Last active Dec 14, 2017
Cheatsheet for SQL creating a database
View cheatsheet.sql
select host, user, password from mysql.user;
create database **********;
show databases;
create user '*******'@'%' identified by '**********';
grant all privileges on *********.* to '**********'@'%' identified by '**********';
flush privileges;
mysqldump -u root -p database > database.sql
mysql -u root -p wp_users < wp_users.sql
@bi0xid
bi0xid / # mysql - 2017-03-08_13-44-23.txt
Created Mar 8, 2017
mysql on macOS 10.12.3 - Homebrew build logs
View # mysql - 2017-03-08_13-44-23.txt
Homebrew build logs for mysql on macOS 10.12.3
Build date: 2017-03-08 13:44:23
@bi0xid
bi0xid / prestashop_select.sql
Created Feb 17, 2017
Get list of prestashop users with emails
View prestashop_select.sql
SELECT SQL_CALC_FOUND_ROWS
a.`id_order`, `reference`, `total_paid_tax_incl`, `payment`, a.`date_add` AS `date_add`
,
a.id_currency,
a.id_order AS id_pdf,
CONCAT(c.`firstname`,' ', c.`lastname`) AS `customer`,
c.email as email,
osl.`name` AS `osname`,
os.`color`,
IF((SELECT so.id_order FROM `ps_orders` so WHERE so.id_customer = a.id_customer AND so.id_order < a.id_order LIMIT 1) > 0, 0, 1) as new,
@bi0xid
bi0xid / access.php
Created Nov 3, 2016
Create a backdoor to WP access (softaculous)
View access.php
<?php
@unlink(__FILE__);
// Validate if the request is from Softaculous
if($_REQUEST['pass'] != 'mv8gdj4ohqfxpu34yj5ursupfabcmvdm'){ // your password here
die("Unauthorized Access");
}
require('wp-blog-header.php');
require('wp-includes/pluggable.php');
@bi0xid
bi0xid / contribution-links.js
Created Apr 25, 2016
Quick way to open pending waiting strings when validating WordPress.org projects
View contribution-links.js
@bi0xid
bi0xid / countdown.html
Created Apr 12, 2016
Javascript countdown
View countdown.html
<script>
var end = new Date('02/19/2017 10:1 AM');
var _second = 1000;
var _minute = _second * 60;
var _hour = _minute * 60;
var _day = _hour * 24;
var timer;
function showRemaining() {