Skip to content

Instantly share code, notes, and snippets.

DELETE bad_rows.* from wp_posts as bad_rows inner join ( select post_title, MIN(id) as min_id from wp_posts group by post_title having count(*) > 1 ) as good_rows on good_rows.post_title = bad_rows.post_title and good_rows.min_id <> bad_rows.id
@man-oi
man-oi / jquery-plugin.js
Created April 29, 2019 12:56
jquery plugin template
(function () {
var pluginName = "pluginName",
defaults = {
propertyName: "value"
};
// The actual plugin constructor
function Plugin(element, options) {
this.element = element;
// jQuery has an extend method which merges the contents of two or
// more objects, storing the result in the first object. The first object
@man-oi
man-oi / getCookie.js
Created May 14, 2019 09:54
function to get Cookie
export default function (cname) {
const name = `${cname}=`;
const decodedCookie = decodeURIComponent(document.cookie);
const ca = decodedCookie.split(';');
for (let i = 0; i < ca.length; i += 1) {
let c = ca[i];
while (c.charAt(0) === ' ') {
c = c.substring(1);
}
if (c.indexOf(name) === 0) {
@man-oi
man-oi / .htaccess
Created January 22, 2020 20:12
htpasswd
AuthType Basic
AuthName "only for valid users"
AuthUserFile /full/path/.htpasswd
Require valid-user
#php full path: echo realpath('./') . PHP_EOL;
# get external ip address
(Invoke-WebRequest ifconfig.me/ip).Content.Trim()
@man-oi
man-oi / gigya.css
Created July 18, 2022 11:45
gigya styles
.gigya-consent-title {
font-weight: bold;
display: block;
font-weight: 700;
font-size: 15px;
font-family: arial;
}
.gigya-consent-subtitle {
font-weight: bold;
display: block;