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
// verify that this is a product category page | |
if (is_product_category()){ | |
global $wp_query; | |
// get the query object | |
$cat = $wp_query->get_queried_object(); | |
// get the thumbnail id user the term_id | |
$thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true ); | |
// get the image URL | |
$image = wp_get_attachment_url( $thumbnail_id ); | |
// print the IMG HTML |
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
var links = []; | |
var quotes = []; | |
var tempUrl = []; | |
var infos = []; | |
var maxLinks = 10; | |
var firstUrl = 'http://www.imdb.com/search/title?at=0&num_votes=5000,&sort=user_rating,desc&start=1&title_type=tv_infoss'; | |
var newUrl; | |
var x = require('casper').selectXPath; |
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
# Original blog post: <https://mnx.io/blog/a-proper-server-naming-scheme/> | |
# Original word list: <http://web.archive.org/web/20091003023412/http://tothink.com/mnemonic/wordlist.txt> | |
# Sample usage: `curl <gist> | tail --lines +4 | shuf | head --lines 1` | |
acrobat | |
africa | |
alaska | |
albert | |
albino | |
album | |
alcohol |
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
Number.prototype.mod = function(n) { | |
return ((this % n) + n) % n; | |
}; | |
Array.prototype.peek = function() { | |
return this[this.length - 1]; | |
}; | |
$.get('https://raw.githubusercontent.com/Apostolique/Agar.io-bot/master/bot.user.js?1', function(data) { |
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
// You will also need to create a gmail filter to add the 'send-to-slack' label | |
// to any emails you want sent to slack | |
function sendEmailsToSlack() { | |
var label = GmailApp.getUserLabelByName('send-to-slack'); | |
var messages = []; | |
var threads = label.getThreads(); | |
for (var i = 0; i < threads.length; i++) { | |
messages = messages.concat(threads[i].getMessages()) |
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 | |
// PHP memory limit for this site | |
define( 'WP_MEMORY_LIMIT', '128M' ); | |
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit. | |
// Database | |
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database. | |
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users) | |
// Explicitely setting url |
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 the Yoast primary category from its post meta value, and displays it, with HTML markup. | |
* If there is no primary category set, it displays the first assigned category. | |
* | |
* @param boolean $useCatLink Whether to link the category, if it exists | |
* @return void | |
*/ | |
function yourtheme_display_yoast_primary_category( $useCatLink = 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
//Hide WooCommerce product images | |
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 ); |
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 re | |
import requests | |
import urllib3 | |
def download_src(url, chunk_size=1024): | |
req = urllib3.PoolManager().request('GET', url, preload_content=False) | |
src = req.data.decode('utf-8') | |
req.release_conn() |
OlderNewer