Skip to content

Instantly share code, notes, and snippets.

View oneblackcrayon's full-sized avatar

Frederick Polk oneblackcrayon

View GitHub Profile
@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.
*/
@oneblackcrayon
oneblackcrayon / gsutil_cron_example.sh
Created October 13, 2022 21:20 — forked from nazroll/gsutil_cron_example.sh
A shell script example to run "gsutil" as a cronjob
#! /bin/bash
# Replace "/path/to/gsutil/" with the path of your gsutil installation.
PATH="$PATH":/path/to/gsutil/
# Replace "/home/username/" with the path of your home directory in Linux/Mac.
# The ".boto" file contains the settings that helps you connect to Google Cloud Storage.
export BOTO_CONFIG="/home/username/.boto"
# A simple gsutil command that returns a list of files/folders in your bucket.
@oneblackcrayon
oneblackcrayon / index.php
Created June 5, 2022 03:10 — forked from lepittenger/index.php
Check if the_content is empty
<?php
if ( $post->post_content=="" ) {
// do something for posts without content
} else {
// do something for posts with content
};
// OR
@oneblackcrayon
oneblackcrayon / opencl-amd_aur_ubuntu.bash
Created April 23, 2022 20:50 — forked from nottux/opencl-amd_aur_ubuntu.bash
bash implementation of opencl-amd AUR package, Install opencl amdgpu amdgpu-pro opencl only. Supports ubuntu and others with standard prefix
#!/bin/bash
# DO NOT run the line 167 standalone. It will remove the necessary files besides the junk!
if echo $@|grep -q "\-\-help\|\-help\|\-h\|help\|\-\-h\|\-\-no\-deb\|\-\-no\-install\|\-\-no\-cleaning\|\-\-assume\-debian"
then :
else echo wrong entry\(ies\) !
help=yes
fi
if echo $@|grep -q "\-\-help\|\-help\|\-h\|help\|\-\-h" || [ "$help" = yes ]
@oneblackcrayon
oneblackcrayon / widths.sass
Created January 4, 2022 23:26
Bulma CSS Framework Widths.
// Requires Bulma CSS Framework
// I have no idea where I found this file nor remember if I actually made it
// by extracting the code from the Grid>columns.sass file
// I believe it was a file in a previous release of Bulma called block.sass.
// If you know, please comment.
// Thanks.
@charset "utf8"
// Import the Bulma Mixins file
@import "../utilities/mixins"
// Utilities
@import "../../node_modules/bulma/sass/utilities/functions";
@import "../../node_modules/bulma/sass/utilities/derived-variables";
@import "../../node_modules/bulma/sass/utilities/mixins";
@import "../../node_modules/bulma/sass/utilities/controls";
// Base
@import "../../node_modules/bulma/sass/base/minireset";
@import "../../node_modules/bulma/sass/base/generic";

** WP - Optimizations and Cleanup **

Here you can find a a list of WP optimization and cleanup functions and methodology.

  1. .htaccess
  • Force https to your site.
  • Enable Browser Cache for your static files. This will fix the "Leverage Browser Caching" in the google pagespeed results.
  • Enable file compreassion for faster page load.
  1. wp-config.php
@oneblackcrayon
oneblackcrayon / functions.php
Created January 2, 2022 01:51 — forked from ellenbauer/functions.php
Aino functions.php with Custom Woo Login shortcodes
<?php
if ( ! function_exists( 'aino_setup' ) ) :
function aino_setup() {
// Adding support for featured images.
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 1800, 99999 );
// Adds custom image sizes.
add_image_size( 'aino-thumb', 1800, 1012, true ); // Image Ratio 16:9.