Skip to content

Instantly share code, notes, and snippets.

View dwtompkins's full-sized avatar
💭
Coding

Daniel Tompkins dwtompkins

💭
Coding
View GitHub Profile
@dwtompkins
dwtompkins / comments.js
Created June 21, 2022 12:34
React Component, Comments
import React, { useEffect, useState } from 'react'
import sanitize from '../utils/sanitize'
import useContructor from '../utils/constructor'
import comment_styles from '../styles/Comment.module.css'
import Comment from './comment'
export default function Comments(props) {
const [comments, setComments] = useState(props.comments);
const [meta, setMeta] = useState(props.meta);
@dwtompkins
dwtompkins / comment.js
Created June 21, 2022 12:34
React Component, Comment
import Link from 'next/link'
import React, { useState } from 'react'
import useConstructor from '../utils/constructor'
import Parse from '../utils/parser.js'
import sanitize from '../utils/sanitize'
import comment_styles from '../styles/Comment.module.css'
String.prototype.replaceArray = function(find, replace) {
let replaceString = this;
// Replace found strings (in array)
@dwtompkins
dwtompkins / functions.php
Last active May 13, 2022 14:02
Genesis Framework - Breadcrumbs (functions.php)
<?php // Don't include the opening PHP tag if you're already inside PHP tags!
/* Remove "You are here:" from breadcrumbs */
add_filter('genesis_breadcrumb_args', 'remove_breadcrumbs_yourarehere_text');
function remove_breadcrumbs_yourarehere_text( $args ) {
$args['labels']['prefix'] = '';
return $args;
}
/* Change breadcrumbs separator from "/" to "|" */
PHP Fatal error: Uncaught Error: Cannot use object of type Closure as array in /nas/content/live/pumpsite/wp-content/plugins/gravity-forms-salesforce/lib/gf-utility-functions.php:48
Stack trace:
#0 /nas/content/live/pumpsite/wp-content/plugins/gravity-forms-salesforce/lib/gf-utility-functions.php(66): rgar(Object(Closure), 'live')
#1 /nas/content/live/pumpsite/wp-content/plugins/gravityforms/includes/settings/class-settings.php(1114): rgars(Object(Gravity_Forms\\Gravity_Forms\\Settings\\Fields\\Text), 'dependency/live')
#2 /nas/content/live/pumpsite/wp-content/plugins/gravityforms/includes/settings/class-settings.php(1027): Gravity_Forms\\Gravity_Forms\\Settings\\Settings->get_live_dependencies_for_group(Array)
#3 /nas/content/live/pumpsite/wp-content/plugins/gravityforms/includes/settings/class-settings.php(352): Gravity_Forms\\Gravity_Forms\\Settings\\Settings->get_live_dependencies()
#4 [internal function]: Gravity_Forms\\Gravity_Forms\\Settings\\Settings->Gravity_Forms\\Gravity_Forms\\Settings\\{closure}(
@dwtompkins
dwtompkins / block.js
Created May 13, 2021 20:59
First Gutenberg Block. Need a hand
/**
* BLOCK: Card
*
* Registering a basic block with Gutenberg.
* Simple block, renders and saves the same content without any interactivity.
*/
// Import CSS.
import './editor.scss';
import './style.scss';
# Quick/easy prompt text decorations
ansi() { echo -e "\e[${1}m${*:2}\e[0m"; }
bold() { ansi 1 "$@"; }
italic() { ansi 3 "$@"; }
underline() { ansi 4 "$@"; }
strikethrough() { ansi 9 "$@"; }
# Change color of the PS1 prompt time bashed on bash output
__color_change() {
if [ $? == 0 ]; then
Gre