Skip to content

Instantly share code, notes, and snippets.

View UVLabs's full-sized avatar
🏠
Probably coding

Uriahs Victor UVLabs

🏠
Probably coding
View GitHub Profile
@brokensandals
brokensandals / GoogleDocsBackup.gs
Last active November 6, 2022 09:33
Google Docs/Sheets/Slides automated backups script
var BACKUP_FOLDER_ID = 'INSERT_FOLDER_ID_HERE';
var NATIVE_MIME_TYPES = {};
NATIVE_MIME_TYPES[MimeType.GOOGLE_DOCS] = MimeType.MICROSOFT_WORD;
NATIVE_MIME_TYPES[MimeType.GOOGLE_SHEETS] = MimeType.MICROSOFT_EXCEL;
NATIVE_MIME_TYPES[MimeType.GOOGLE_SLIDES] = MimeType.MICROSOFT_POWERPOINT;
var NATIVE_EXTENSIONS = {};
NATIVE_EXTENSIONS[MimeType.GOOGLE_DOCS] = '.docx';
NATIVE_EXTENSIONS[MimeType.GOOGLE_SHEETS] = '.xlsx';
@HoldOffHunger
HoldOffHunger / bradvin.social.share.urls.txt
Last active April 18, 2024 13:41
Social Share URL's (Summary)
https://www.facebook.com/sharer.php?u={url}
https://www.facebook.com/dialog/share?app_id={app_id}&display={page_type}&href={url}&redirect_uri={redirect_url}
https://reddit.com/submit?url={url}&title={title}
https://twitter.com/intent/tweet?url={url}&text={title}&via={user_id}&hashtags={hash_tags}
https://www.linkedin.com/sharing/share-offsite/?url={url}
https://api.whatsapp.com/send?phone={phone_number}&text={title}%20{url}
https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}&caption={text}&tags={hash_tags}
http://pinterest.com/pin/create/button/?url={url}
https://www.blogger.com/blog-this.g?u={url}&n={title}&t={text}
https://www.evernote.com/clip.action?url={url}&title={title}

The PATH is an important concept when working on the command line. It's a list of directories that tell your operating system where to look for programs, so that you can just write script instead of /home/me/bin/script or C:\Users\Me\bin\script. But different operating systems have different ways to add a new directory to it:

Windows

  1. The first step depends which version of Windows you're using:
  • If you're using Windows 8 or 10, press the Windows key, then search for and
@bdaley
bdaley / wc-regenerate-and-notify.php
Last active July 28, 2021 00:02
Adds an action to the order page that allows you to regenerate download permissions AND extends the expiration date for WooCommerce downloads.
<?php
add_filter('woocommerce_order_actions', 'wc_regenerate_and_notify_custom_order_action');
function wc_regenerate_and_notify_custom_order_action( $actions ) {
// Remove the woocommerce option to regenerate to avoid confusion
unset($actions['regenerate_download_permissions']);
// Add our new action (executed below)
$actions['wc_regenerate_and_notify'] = __('Regenerate permissions & send link to customer', 'wc-regenerate-and-notify');
return $actions;

WP All Import - IF/ELSE statement examples

Here are some example WP All Import [IF] statements. The criteria for an IF statment is written in XPath 1.0 syntax and can use XPath functions. Although powerful, XPath syntax can be quite complex. In many cases it might be easier to use a PHP function as shown here.

Note: The [ELSE]<something> part is optional

Number is equal to:

[IF({price[.=0]})]Zero[ELSE]Not Zero[ENDIF]

@champsupertramp
champsupertramp / Ultimate Member - adding custom fields in account page and tab
Last active October 14, 2023 19:18
Ultimate Member - adding custom fields in account page and tab
<?php
/* Add fields to account page */
add_action('um_after_account_general', 'showExtraFields', 100);
function showExtraFields()
{
$custom_fields = [
"alternate_email" => "Permanent E-mail Address",
"major" => "Major",
"minor" => "Minor",
"gpa" => "GPA",
@johnregan3
johnregan3 / wp-amp-tutorial-strip-shortcodes.php
Last active October 20, 2021 17:43
Strip out all Shortcodes for a WordPress AMP template.
<?php
/**
* Strip out all shortcode content.
*
* This is a quick and dirty way
* to ensure no shortcodes introduce
* invalid markup into an amp template.
*
* @param string $content WP Post content.
*
@johnregan3
johnregan3 / wp-amp-tutorial-menu.php
Last active December 31, 2019 03:01
Creating a Menu using amp-sidebar in WordPress
<?php
/**
* Render the Primary Nav Menu
*
* Uses amp-sidebar to handle
* slideout animation.
*
* Be sure to include the amp-sidebar component script.
* Also, rememeber that the amp-sidebar element must be
* a direct child of the <body>.
@johnregan3
johnregan3 / wp-amp-tutorial-filter-shortcode-podcast.php
Last active December 25, 2019 13:06
Filtering WP Shortcodes to comply with AMP standards.
<?php
/**
* Hijack a hypothetical [podcast] custom shortcode for AMP.
*
* Replaces [podcast] output with amp-audio.
*
* Be sure you've added the amp-audio component script to the template.
*
* @filter the_content
*
@tbreuss
tbreuss / dnsbl.php
Last active December 21, 2023 20:29
IP Blacklist Check Script - This is a simple PHP script to lookup for blacklisted IP against multiple DNSBLs at once.
<?php // Simple PHP script to lookup for blacklisted IP against multiple DNSBLs at once. ?>
<html>
<head>
<title>DNSBL Lookup Tool - IP Blacklist Check Script</title>
</head>
<body>
<h2>IP Blacklist Check Script</h2>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
<input type="text" value="" name="ip"/>
<input type="submit" value="LOOKUP"/>