Skip to content

Instantly share code, notes, and snippets.

View oneblackcrayon's full-sized avatar

Frederick Polk oneblackcrayon

View GitHub Profile
# brew "node@10"
# brew "node@12"
# brew "node@14"
# brew "php@7.4"
tap "buo/cask-upgrade"
tap "dart-lang/dart"
tap "hacker1024/hacker1024"
tap "heroku/brew"
tap "homebrew-ffmpeg/ffmpeg"
tap "homebrew/bundle"
@oneblackcrayon
oneblackcrayon / stripe_copy.php
Created July 16, 2024 00:12 — forked from mrubiosan/stripe_copy.php
Migrate Stripe Products and Plans
<?php
$fromToken = 'rk_live_abc';
$toToken = 'rk_test_def';
$prodContext = stream_context_create([
'http' => [
'header' => "Authorization: Bearer $fromToken\r\n"
]
]);
$testContext = stream_context_create([
<?php
/**
* Plugin Name: WooCommerce Custom Account Tabs
* Plugin URI: https://www.example.com/
* description: PHP Class to generate new account tabs for WooCommerce My Account page
* Version: 1.0
* Author:
* Author URI: https://gist.github.com/JiveDig/0d3658676127f30a098859228fc5d8eb
* License: GPL2
@oneblackcrayon
oneblackcrayon / Use JQuery to show and hide elements based on data attributes.md
Last active November 22, 2023 03:40
Use JQuery to show and hide elements based on data attributes.

Use Jquery to show and hide elements with data-attributes

I needed to show and hide a list of posts on a page when clicking on links.

<main role="main">
  <nav role="navigation">
    <a href="javascript.void(0);" data-slug="slug-1">Link 1</a>
    <a href="javascript.void(0);" data-slug="slug-2">Link 2</a>
 <a href="javascript.void(0);" data-slug="slug-3">Link 3</a>
@oneblackcrayon
oneblackcrayon / mu-woo.php
Last active July 5, 2023 01:28
Must Use Plugin for Woocommerce not working
<?php
/*
Plugin Name: MU Woo Snippets
Plugin URI: https://gist.github.com/oneblackcrayon
Description:
Version: 1.0.0
Author: OneBlackCrayon
Author URI: https://gist.github.com/oneblackcrayon
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html
@oneblackcrayon
oneblackcrayon / rss-email.txt
Created March 26, 2023 04:06 — forked from robincornett/rss-email.txt
MailChimp RSS email template
*|RSSITEMS:|*
<h2 class="mc-toc-title"><a href="*|RSSITEM:URL|*" target="_blank">*|RSSITEM:TITLE|*</a></h2>
*|RSSITEM:CONTENT_FULL|*<br />
<a href="*|RSSITEM:URL|*" target="_blank">Read in browser &raquo;</a><br />
*|RSSITEM:TWITTER|* *|RSSITEM:LIKE|*<br />
<br />
*|END:RSSITEMS|*
@oneblackcrayon
oneblackcrayon / mail.php
Created March 26, 2023 04:06 — forked from Archie22is/mail.php
Filters images for RSS feed (Erik Teichmann)
/**
* Filters images for RSS feed--makes thumbs go through large; large images resize down to MailChimp friendly width.
* Add this to your functions.php file WITHOUT the opening php
*
* Author: Erik Teichmann, minor tweaks by Robin Cornett
* Author URI: http://www.eriktdesign.com/
*/
// Add filters for RSS
add_filter('the_excerpt_rss', 'et_change_thumbs', 20); // changes the excerpt for rss
@oneblackcrayon
oneblackcrayon / coundown.html
Last active February 27, 2023 20:06
Countdown timer with a weekly reset
<!-- @link: https://stackoverflow.com/questions/35587387/javascript-countdown-clock-every-saturday-at-11am#answer-35588057 -->
<div class="has-time">
<div id="clockdiv" class="is-time simply-countdown">
<div class="simply-section">
<span class="days simply-amount"></span>
<div class="smalltext simply-word">Days</div>
</div>
<div class="simply-section">
<span class="hours simply-amount"></span>
<div class="smalltext simply-word">Hours</div>
@oneblackcrayon
oneblackcrayon / 0-Using two loops on a home.php with pagination on the second loop.md
Last active October 19, 2022 02:42
Using two loops on a home.php with pagination on the second loop.

Wordpress - Using two loops on a home.php with pagination on the second loop notes & examples

Problem

I have a layout where I need to show the most recent post in a different layout/design component and remaining posts, needed to have a separate layout/design. I also wanted to use pagination to show other posts instead of infinite scrolling because I do not prefer infinite scrolling. Using the count modulus was not going to be a viable option due to how the design needed to be implemented but I think it could work for someone with experience in PHP. When using the offset in the loop, it was changing on pagination so each page after the first page had different recent post.

This was troublesome but I think I have a solid working solution for having multiple loops it works for my needs.

@oneblackcrayon
oneblackcrayon / functions.php
Created October 17, 2022 22:07 — forked from r4nd1/functions.php
Test #1
<?php
/*
Author: Zhen Huang
URL: http://themefortress.com/
This place is much cleaner. Put your theme specific codes here,
anything else you may want to use plugins to keep things tidy.
*/