Skip to content

Instantly share code, notes, and snippets.

View Delete Duplicate Posts in Wordpress
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 Apr 29, 2019
jquery plugin template
View jquery-plugin.js
(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
function to get Cookie
View getCookie.js
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) {
View .htaccess
AuthType Basic
AuthName "only for valid users"
AuthUserFile /full/path/.htpasswd
Require valid-user
#php full path: echo realpath('./') . PHP_EOL;
View gist:223c1d3b241033f82946e87dcd888b2d
# get external ip address
(Invoke-WebRequest ifconfig.me/ip).Content.Trim()
You can’t perform that action at this time.