Skip to content

Instantly share code, notes, and snippets.

View crishnakh's full-sized avatar
💻
Ey! Listen!

Francisco Gálvez crishnakh

💻
Ey! Listen!
View GitHub Profile
@crishnakh
crishnakh / woocommerce_category_list.sql
Created January 25, 2024 21:36 — forked from tivnet/woocommerce_category_list.sql
WooCommerce category list SQL query
--
-- @author Gregory Karpinsky, http://www.tiv.net/
-- @version 14.05.28
--
SELECT
tp.name Cat,
t.name Subcat
FROM
wp_term_taxonomy tt,
wp_terms t,
@crishnakh
crishnakh / upload.js
Created November 21, 2019 11:51 — forked from iamaddy/upload.js
ajax upload base64 image
function dataURItoBlob(dataURI) {
var byteString = atob(dataURI.split(',')[1]);
var ab = new ArrayBuffer(byteString.length);
var ia = new Uint8Array(ab);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
return new Blob([ab], { type: 'image/jpeg' });
}
function supportFile (){
# Create background noise profile from mp3
/usr/bin/sox noise.mp3 -n noiseprof noise.prof
# Remove noise from mp3 using profile
/usr/bin/sox input.mp3 output.mp3 noisered noise.prof 0.21
# Remove silence from mp3
/usr/bin/sox input.mp3 output.mp3 silence -l 1 0.3 5% -1 2.0 5%
# Remove noise and silence in a single command
<?php
add_action( 'after_setup_theme', 'bootstrap_setup' );
if ( ! function_exists( 'bootstrap_setup' ) ):
function bootstrap_setup(){
add_action( 'init', 'register_menu' );
@crishnakh
crishnakh / gist:4648032
Created January 27, 2013 11:52 — forked from anonymous/gist:4648031
Check email function
<?php
function check_email_address($email) {
// First, we check that there's one @ symbol, and that the lengths are right
if (!preg_match("/^[^@]{1,64}@[^@]{1,255}$/", $email)) {
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return false;
}
// Split it into sections to make life easier
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);