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
jQuery('.s-item__seller-info-text') | |
.filter(function() { | |
let s = $(this).text(); | |
let re = /\((.*)\) (.*)%/g; | |
do { | |
m = re.exec(s); | |
if (m) { | |
feedback_score = parseInt(m[1].replace(',', '')); | |
positive_feedback = parseFloat(m[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
#!/bin/sh | |
## Cleanup | |
rm -f palette.png video.gif | |
## Make palette | |
# --ss stop at seconds | |
# --t duration | |
ffmpeg -ss 10 -t 4 -i video.mp4 -vf fps=15,scale=800:-1:flags=lanczos,palettegen palette.png |
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 | |
/** | |
* WooCommerce Bookings - Get Bookings for Product. | |
* @param int $product_id Product ID. | |
* @return array Bookings IDs. | |
*/ | |
function wc_bookings_get_booking_ids_by_product_id( $product_id ) { | |
return WC_Booking_Data_Store::get_booking_ids_by( [ | |
'object_id' => $product_id, |
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 | |
/** | |
* WooCommere Bookings - Check if current page is a bookable product. | |
* @return boolean True for bookable products, false otherwise | |
*/ | |
function is_bookable_product() { | |
return is_product() && wc_get_product() instanceof WC_Product_Booking; | |
} |
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 | |
/** | |
* Example Usage. | |
*/ | |
add_action( 'sportspress_after_event_template', function( $elements ) { | |
$elements['performance']['action'] = function() { | |
sp_event_players_2d_positions( | |
[ 'team-1', 'team-2', 'team-3', 'team-4' ], | |
[ 'lead', 'second', 'third', 'skipper' ], |
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 | |
/** | |
* Example Usage. | |
*/ | |
sp_event_list_players_by_position( 'team-1', 'Team 1' ); | |
sp_event_list_players_by_position( 'team-2', 'Team 2' ); | |
sp_event_list_players_by_position( 'team-3', 'Team 3' ); | |
sp_event_list_players_by_position( 'team-4', 'Team 4' ); |
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 | |
// Add this code to your custom template event-results.php, after $data has been filled | |
$orderBy = 'goals'; | |
$order = 'ASC'; // Or DESC | |
uasort( $data, function( $a, $b ) use ( $orderBy, $order ) { | |
return $order === 'DESC' | |
? $a[ $orderBy ] < $b [ $orderBy ] |
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 | |
/** | |
* Get player performance for event. | |
* | |
* @param int $player_id Player ID. | |
* @param int $team_id Team ID. | |
* @param int $event_id Event ID. | |
* @return array|false Array of player performance or false | |
* if one of the parameters is not valid. |
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 | |
/** | |
* Add this code to your website, I recommend adding it using the plugin Code Snippets. | |
* Disable or delete the snippet as soon as you finish importing players. | |
* `$treshold_in_seconds` should be a little higher than the import duration in seconds. | |
* | |
* @author Nabil Kadimi | |
* @link https://themeboy.com | |
*/ |
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
youtube-dl -o '%(uploader)s - %(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' |