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
import requests | |
import argparse | |
import json | |
my_parser = argparse.ArgumentParser() | |
my_parser.add_argument('-id', '--id', help='ID of the book (https://archive.org/details/XXXX).', type=str) | |
args = my_parser.parse_args() | |
book_id = args.id | |
url = "https://archive.org/details/"+book_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
import img2pdf | |
import argparse | |
import os | |
def process_images(min_range, max_range, img_path, prefix, suffix, out_file): | |
images = [] | |
for i in range(min_range,max_range): | |
fname = img_path + prefix + '%0.3d' % i + '.' + suffix | |
print("adding img: " + fname) | |
images.append(fname) |
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_action( 'pre_get_posts', array( $this, 'search_metadata' ), 9 ); | |
function search_metadata() { | |
if ( ! is_main_query() || ! is_search() ) { | |
return; | |
} | |
add_filter( 'posts_join', function( $join ) { | |
global $wpdb; |
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 // do not use this line. Add below to functions.php | |
add_action( 'wp_footer', 'list_hooked_filters_and_actions' ); | |
add_action( 'login_footer', 'list_hooked_filters_and_actions' ); | |
add_action( 'admin_footer', 'list_hooked_filters_and_actions' ); | |
function list_hooked_filters_and_actions() { | |
global $wp_filter; |
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 | |
/** | |
* Plugin Name: WooCommerce Settings Tab Demo | |
* Plugin URI: https://gist.github.com/BFTrick/b5e3afa6f4f83ba2e54a | |
* Description: A plugin demonstrating how to add a WooCommerce settings tab. | |
* Author: Patrick Rauland | |
* Author URI: http://speakinginbytes.com/ | |
* Version: 1.0 | |
* | |
* This program is free software: you can redistribute it and/or modify |
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 // DO NOT include this line. Add below to your theme functions.php | |
/** | |
* Add bcc address to email based on contents | |
* of the email subject line. | |
* | |
* Set email address and content of the subject | |
* line for the email being filtered. | |
*/ | |
add_filter( 'wp_mail', 'custom_mails' ); |
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 | |
/** | |
* @package Custom_queries | |
* @version 1.0 | |
*/ | |
/* | |
Plugin Name: Custom queries | |
Plugin URI: http://wordpress.org/extend/plugins/# | |
Description: This is an example plugin | |
Author: Carlo Daniele |
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
/* Column Classes | |
Link: http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css | |
--------------------------------------------- */ | |
.five-sixths, | |
.four-sixths, | |
.one-fourth, | |
.one-half, | |
.one-sixth, | |
.one-third, |
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 | |
/** | |
* This gist is example code that goes with an article on how (and why/when) to use | |
* PHP anonymous functions. To view the entire post, go to: | |
* https://rocketgeek.com/basics/using-anonymous-functions-for-filters-and-actions/ | |
*/ |
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 | |
/** | |
* Utility function to subscribe a user to a MailChimp | |
* list using the MC API 3.0 | |
* | |
* @param array $args { | |
* Array of settings. | |
* | |
* @type string $api_key Your MailChimp API key. |
NewerOlder