Skip to content

Instantly share code, notes, and snippets.

View Yame-'s full-sized avatar

Yannick Van Meerbeeck Yame-

View GitHub Profile
<?php
/**
* Push data to a Mautic form
*
* @param array $data The data submitted by your form
* @param integer $formId Mautic Form ID
* @param string $ip IP address of the lead
* @return boolean
*/
@JamesMessinger
JamesMessinger / IndexedDB101.js
Last active May 19, 2024 18:56
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});
@davidpaulsson
davidpaulsson / wp-get_id_by_slug
Created February 26, 2014 06:20
WordPress: Get page ID from slug
// Usage:
// get_id_by_slug('any-page-slug');
function get_id_by_slug($page_slug) {
$page = get_page_by_path($page_slug);
if ($page) {
return $page->ID;
} else {
return null;
}
@pmgarman
pmgarman / delete.sql
Created August 1, 2013 22:35
How to find and delete orphaned product variations from WooCommerce sites.
DELETE o FROM `wp_posts` o
LEFT OUTER JOIN `wp_posts` r
ON o.post_parent = r.ID
WHERE r.id IS null AND o.post_type = 'product_variation'