Skip to content

Instantly share code, notes, and snippets.

View oneblackcrayon's full-sized avatar

Frederick Polk oneblackcrayon

View GitHub Profile
@JiveDig
JiveDig / class-woocommerce-account-tab.php
Last active July 4, 2024 03:15
A PHP class to create new WooCommerce account tabs.
<?php
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'Mai_WooCommerce_Account_Tab' ) ):
/**
* A class to create new WooCommerce account tabs.
*
* @version 0.1.0
@vicradon
vicradon / adding-stuff-to-path.md
Last active August 11, 2024 21:01
Adding Stuff to Path

Adding Stuff to Path

Welcome to another episode of Linux notes. Today, I'll briefly talk about adding stuff to Path on POSIX[1] systems.

So the PATH is a very long colon delimited string that gets extended whenever you add a new directory to it. It looks something like this:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/bin:/usr/local/sbin
@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.

@iamsaief
iamsaief / README-Fluid-Typography.md
Last active November 30, 2022 04:05
Fluid Typography Utility Classes

🎯  Fluid Typography Utility Classes SASS mixin

✨ The idea of fluid typography has been around in application development for a while, but to make this work in the browser, developers had to use a variety of solutions. 

👨‍💻 Depending on the viewport width, fluid typography adjusts nicely between the minimum and maximum value. Typically, it starts at a minimum value and stays constant until a certain screen width point, at which time it starts to rise. When it hits a maximum value at a different screen width, it keeps going with that maximum value.

👨‍🏫  For instance, if we wanted our font size to be between 2em and 3em, where 2em is the minimum size at the smallest viewport width of 320px and 3em is the maximum size at the highest viewport width of 1366px. Then our equation will look like this - font-size: calc(2em + 1 * (100vw - 320px) / 1046);

@megclaypool
megclaypool / fluid-headers.scss
Last active November 30, 2022 04:06
[Fluid Type Sass Mixin and Headers with Modular Scale] Reference: - [Fluid Typography | CSS-Tricks - CSS-Tricks](https://css-tricks.com/snippets/css/fluid-typography/) - [Complete Guide To Fluid Typography With CSS Clamp](https://www.lambdatest.com
$small-ratio: 1.2; // mobile
$large-ratio: 1.5; // desktop
h1 {
$small: $small-ratio * $small-ratio * $small-ratio * $small-ratio * 1rem;
$large: $large-ratio * $large-ratio * $large-ratio * $large-ratio * 1rem;
font-size: fluid($small, $large);
}
h2 {
@feroze-m
feroze-m / Let's Encrypt + Certbot -- Quickread
Last active August 6, 2023 05:04
Let’s Encrypt + Certbot
Some findings related to usage of Let's Encrypt and Certbot:
- Certs are valid for 90 days.
- Can be generated with cli with challenges like DNS (TXT Records), HTTP (/.well-known/acme-challenge/<TOKEN>)
- Wildcard certs can be generated with DNS challenge, but for auto-renew to work with this wildcard, DNS provider must have a certbot DNS plugin.
- Refer: https://eff-certbot.readthedocs.io/en/stable/using.html#dns-plugins
- Docker images: https://hub.docker.com/u/certbot
- Example.com using godaddy dns plugin (Not official - https://github.com/miigotu/certbot-dns-godaddy)
@extratone
extratone / draftsredirection.md
Last active November 6, 2024 05:33
Index of davidblue.wtf redirects.
@meg-gutshall
meg-gutshall / .asdfrc
Last active November 18, 2022 21:19
Config Files
legacy_version_file = yes
@Treast
Treast / _fonts.scss
Created November 26, 2021 08:40
WordPress snippets
$fontPath: '../../fonts';
@mixin fonts($name, $file, $fontWeight) {
@font-face {
font-family: $name;
src: url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.eot');
src: url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.eot?#iefix') format('embedded-opentype'),
url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.woff2') format('woff2'),
url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.woff') format('woff'),
url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.ttf') format('truetype'),
@mike-at-redspace
mike-at-redspace / custom-post-type.php
Created June 24, 2021 09:50
Register Custom Post Type
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public