This file contains 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
/* WC HPD */ | |
//manage_product_posts_custom_column | |
add_filter( 'manage_edit-product_columns', 'products_customcol_fn' ); | |
function products_customcol_fn($columns){ | |
$new_columns = (is_array($columns)) ? $columns : array(); | |
$new_columns['HPD'] = 'hpd'; | |
return $new_columns; | |
} | |
add_action( 'manage_product_posts_custom_column', 'products_customcol_value_fn', 2 ); |
This file contains 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 | |
/* | |
* WC - add new orders status | |
************************************************ */ | |
function register_custom_order_statuses() { | |
register_post_status( 'wc-jv-recibido', array( | |
'label' => 'JV recibido', | |
'public' => true, | |
'exclude_from_search' => false, | |
'show_in_admin_all_list' => true, |
This file contains 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
/* iphone 3 */ | |
@media only screen and (min-device-width: 320px) and (max-device-height: 480px) and (-webkit-device-pixel-ratio: 1) { | |
// whatever | |
} | |
/* iphone 4 */ | |
@media only screen and (min-device-width: 320px) and (max-device-height: 480px) and (-webkit-device-pixel-ratio: 2) { | |
// whatever | |
} |
This file contains 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
geolocateUser() { | |
return new Promise((resolve, reject) => { | |
if (navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition(position => { | |
let coordinates = {}; | |
coordinates.lat = position.coords.latitude; | |
coordinates.long = position.coords.longitude |
This file contains 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
<select name="month" id="month" class="select_month"> | |
<?php | |
for ($i = 1; $i <= 12; $i++){ | |
$monthNumber = ($i < 10) ? '0'.$i : $i; | |
$monthStr = date('F', strtotime("$currentYear-$monthNumber")); | |
echo '<option value="'.$monthNumber.'"'; | |
if ($i == $currentMonth){ | |
echo ' selected="selected"'; | |
} | |
echo '>'.$monthStr.'</option>'; |
This file contains 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 boldText($text){ | |
$regxpattern = '#\|(.*?)\|#'; | |
$html = preg_replace($regxpattern, '<strong>$1</strong>', $text); | |
return $html; | |
} | |
$str = 'lorem ipsum |dolor| sit amet'; | |
echo boldText($str); |
This file contains 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 boldText(text){ | |
var regxpattern = /\|(\S(.*?\S)?)\|/gm; | |
var html = text.replace(regxpattern, '<strong>$1</strong>'); | |
return html; | |
} | |
document.body.innerHTML = boldText('testing |bold| via regex'); |
This file contains 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
<input type="file" name="file" id="file"> | |
<input type="submit" id="submit" name="Upload" onclick="upload();return false;"> | |
<script type="text/javascript"> | |
function upload(){ | |
var formData = new FormData(); | |
formData.append("action", "upload-attachment"); | |
var fileInputElement = document.getElementById("file"); | |
formData.append("async-upload", fileInputElement.files[0]); |
This file contains 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
<div id="collapseDVR3" class="panel-collapse collapse in"> | |
<div class="tree "> | |
<ul> | |
<li> <span><i class="fa fa-folder-open"></i> Менюшка</span> | |
<ul> | |
<li> <span><i class="fa fa-minus-square"></i> другая Менюшка</span> | |
<ul> | |
<li> <span> ещё одна Менюшка </span> </li> | |
</ul> |
This file contains 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
// fetch value between # | |
var string = "Chapter #1.0# and \r\n"; | |
var regexChapter = new RegExp(/\#(.*?)\#/g); | |
var regexResult = regexChapter.exec(string) | |
console.log( regexResult ); | |
if( regexResult != null ){ | |
var chapterNumber = regexResult[1]; | |
console.log("Chapter: "+chapterNumber); |
NewerOlder