This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- @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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 (){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'after_setup_theme', 'bootstrap_setup' ); | |
if ( ! function_exists( 'bootstrap_setup' ) ): | |
function bootstrap_setup(){ | |
add_action( 'init', 'register_menu' ); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO zones (zone_id, zone_country_id, zone_code, zone_name) VALUES | |
(1, 1, 'BDS', 'Badakhshan'), | |
(2, 1, 'BDG', 'Badghis'), | |
(3, 1, 'BGL', 'Baghlan'), | |
(4, 1, 'BAL', 'Balkh'), | |
(5, 1, 'BAM', 'Bamian'), | |
(6, 1, 'FRA', 'Farah'), | |
(7, 1, 'FYB', 'Faryab'), | |
(8, 1, 'GHA', 'Ghazni'), | |
(9, 1, 'GHO', 'Ghowr'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function createDateRangeArray($strDateFrom,$strDateTo) | |
{ | |
// takes two dates formatted as YYYY-MM-DD and creates an | |
// inclusive array of the dates between the from and to dates. | |
// could test validity of dates here but I'm already doing | |
// that in the main script | |
$aryRange=array(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
DATA ARRAY EXAMPLE | |
$form_data = array( | |
'first_name' => $first_name, | |
'last_name' => $last_name, | |
'email' => $email, | |
'address1' => $address1, | |
'address2' => $address2, | |
'address3' => $address3, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
preg_match('/\<div id\=[\"]{0,1}ad_content[\"]{0,1}\>(.*?)\<\/div\>/s', $content['content_body'], $matches); | |
$content['content_body'] = $matches[1]; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function restafechas($startDate,$endDate){ | |
list($year, $month, $day) = explode("-", $startDate); | |
$startDate = mktime(0, 0, 0, $month, $day, $year); | |
list($year, $month, $day) = explode("-", $endDate); | |
$endDate = mktime(0, 0, 0, $month, $day, $year); | |
$totalDays = ($endDate - $startDate)/(60 * 60 * 24); |
NewerOlder