Skip to content

Instantly share code, notes, and snippets.

View hirozed's full-sized avatar

Jamie Reevior hirozed

View GitHub Profile
@hirozed
hirozed / sandbox-data.sh
Created February 7, 2023 20:25
BU Sandbox Data Dump
#!/usr/bin/env bash
# To the network id:
# - https://cms-devl.bu.edu/wp-admin/network/admin.php?page=networks&action=domains
# - Search for your sandbox name
# - Hover over the sandbox name, or click on it.
# - The end of the url will show your sandbox id.
SBNETWORK=###
@hirozed
hirozed / nvm-switch.sh
Created November 12, 2021 19:59
Auto NVM switch and install
#!/bin/bash
# place this after nvm initialization!
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
@hirozed
hirozed / hashnode-posts.js
Created October 26, 2021 15:50
Example script to pull Hashnode posts
const query = `
{
user(username: "hashnodeUser") {
publication {
posts(page: 0) {
slug
title
coverImage
}
}
@hirozed
hirozed / forloop.html
Last active September 3, 2021 15:59
PHP For Loop
<!--
To add or reduce the amount of markup that is repeated,
Change the number "10" in `$i >= 10`
-->
<div>
<?php for ( $i = 1; $i >= 10; $i ++ ) : ?>
<p>Here is where you can add your markup...</p>
<?php endfor; ?>
</div>
@hirozed
hirozed / cmb2-box.php
Last active September 10, 2021 16:43
WordPress CMB2 Terms as Options
<?php
$cmb2->add_field(
array(
'id' => '_[id]',
'name' => '',
'type' => '',
'options_cb' => __NAMESPACE__ . '\\get_term_options',
'get_term_args' => array(
'taxonomy' => '',
'hide_empty' => false,
@hirozed
hirozed / component.php
Last active January 25, 2021 21:01
BU Theme Component Structure
<?php
/**
* [Comonent Name]
*
* @package [changeme]
*/
namespace BU\Responsive\Theme\[theme_name]\[component name];
use function BU\Responsive\Theme\Diversity\trim_words;
@hirozed
hirozed / cmb2-image.php
Last active January 17, 2021 05:28
WordPress CMB2 Image
<?php
$cmb->add_field(
array(
'name' => __( '[CHANGEME-name]', '[CHANGEME-localization]' ),
'id' => '[CHANGEME-id]',
'desc' => __( '[CHANGEME-description]', '[CHANGEME-localization]' ),
'type' => 'file',
'options' => array(
'url' => false,
),
@hirozed
hirozed / wp-cli-skeleton.php
Last active January 17, 2021 05:29
WP CLI Skeleton
<?php
/**
* CLI commands
* https://make.wordpress.org/cli/handbook/guides/commands-cookbook/
*/
WP_CLI::add_command( '[command]', '[CLASS_NAME]' );
/**
* WP_CLI class
@hirozed
hirozed / wp-tax.php
Last active February 1, 2022 21:25
WordPress Taxonomy
<?php
/**
* Data and call to register the taxonomy.
*
* @param array $tax Data for the taxonomy.
*/
function build_taxonomy( $tax ) {
$labels = array(
'name' => $tax['plural'],