Skip to content

Instantly share code, notes, and snippets.

View aidenvalentine's full-sized avatar
🏠
Working from home

Aiden Valentine aidenvalentine

🏠
Working from home
View GitHub Profile
@aprakasa
aprakasa / WooCommerce - Display Category Image
Created December 2, 2012 09:10
WooCommerce - Display Category Image
// 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
@mickaelandrieu
mickaelandrieu / quotes_json.js
Created November 26, 2013 12:50
Scrap a website with CasperJs, JSON output.
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;
@bwbaugh
bwbaugh / server-name-wordlist-mnemonic.txt
Last active October 31, 2024 01:13
Server name wordlist (mnemonic)
# 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
@BySayko
BySayko / bot.user.js
Last active February 12, 2017 14:54
bot.user.js BoomBap
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) {
@andrewmwilson
andrewmwilson / gmail_to_slack.js
Last active May 31, 2023 13:02
Google Apps Script: Send Gmail emails to Slack
// 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())
@MikeNGarrett
MikeNGarrett / wp-config.php
Last active November 7, 2024 08:58
All those damned wp-config constants you can never remember.
<?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
@odan
odan / xampp_php7_xdebug.md
Last active October 19, 2024 04:15
Installing Xdebug for XAMPP
@jawinn
jawinn / primary_category.php
Last active December 8, 2022 21:42
Display Primary Category (Yoast's WordPress SEO)
<?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 ) {
@ofernandolopes
ofernandolopes / functions.php
Last active November 23, 2017 00:07
Hide WooCommerce product images
//Hide WooCommerce product images
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
@jbanquo
jbanquo / xvideos_dl.py
Created October 22, 2017 13:02
xvideos downloader, place the urls in a file called 'url.txt' and run it!
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()