Skip to content

Instantly share code, notes, and snippets.

View myalban's full-sized avatar
🤠
Available

Alban DOUSSAU de GUYONNET myalban

🤠
Available
View GitHub Profile
DELIMITER //
CREATE FUNCTION UUID_TO_BIN(uuid CHAR(36))
RETURNS BINARY(16) DETERMINISTIC
RETURN UNHEX(CONCAT(REPLACE(uuid, '-', ''))); //
DELIMITER ;
DELIMITER //
CREATE FUNCTION BIN_TO_UUID(bin BINARY(16))
RETURNS CHAR(36) DETERMINISTIC
BEGIN
DECLARE hex CHAR(32);
SET hex = HEX(bin);
RETURN LOWER(CONCAT(LEFT(hex, 8), '-', MID(hex, 9, 4), '-', MID(hex, 13, 4), '-', MID(hex, 17, 4), '-', RIGHT(hex, 12)));
END; //
@myalban
myalban / woocommerce-create-order.md
Created June 2, 2021 06:18 — forked from stormwild/woocommerce-create-order.md
WooCommerce Creating Order Programmatically

WooCommerce Creating Order Programmatically

WooCommerce Create Order

creating Woocommerce order with line_item programatically

// http://stackoverflow.com/questions/26581467/creating-woocommerce-order-with-line-item-programatically
$address = array(
            'first_name' => 'Fresher',
@myalban
myalban / Calendar.vue
Created December 16, 2020 23:51 — forked from Nicklas2751/Calendar.vue
The vuetify event calendar example with typescript
<template>
<v-row class="fill-height">
<v-col>
<v-sheet height="64">
<v-toolbar flat color="white">
<v-btn outlined class="mr-4" color="grey darken-2" @click="setToday">Today</v-btn>
<v-btn fab text small color="grey darken-2" @click="prev">
<v-icon small>mdi-chevron-left</v-icon>
</v-btn>
<v-btn fab text small color="grey darken-2" @click="next">
@myalban
myalban / custom-woocommerce-shop-loop-thumbnail-and-title.php
Created September 4, 2020 21:22 — forked from ben-heath/custom-woocommerce-shop-loop-thumbnail-and-title.php
Custom WooCommerce Shop Loop Product Thumbnail and Title
<?php
/**
* Check if WooCommerce is active
**/
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
// remove product thumbnail and title from the shop loop
remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
<?php
/*
Sometimes you need to do some kind of action to a custom post type after its saved.
In the case of this function my scenario is:
1. I have a custom post type registered called: clients
2. I want the url of their details page to be: /client-number-999/ (where 999 is the post_id - or client id)
Created by [email protected] on 16th of August 2017
<?php
/*
This script will allow you to send a custom email from anywhere within wordpress
but using the woocommerce template so that your emails look the same.
Created by [email protected] on 27th of July 2017
Put the script below into a function or anywhere you want to send a custom email
*/
<?php
/*
Created by: [email protected] 16/03/2014
Name of script: Create WordPress Admin User
Description: This script will create an admin user in wordpress
Usage: Create a new file in the root of the hosting account and drop this code into it then execute the script through the browser.
@myalban
myalban / capture.html
Created February 19, 2019 08:56 — forked from ajardin/capture.html
Capture a thumbnail from a video with JavaScript.
<!DOCTYPE html>
<head>
<script type='text/javascript'>
window.onload = function () {
var video = document.getElementById('videoId');
var canvas = document.getElementById('canvasId');
var img = document.getElementById('imgId');
video.addEventListener('play', function () {
canvas.style.display = 'none';
@myalban
myalban / download-file.js
Created February 7, 2019 23:09 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);