Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Coding

Daniel Tompkins dwtompkins

💭
Coding
View GitHub Profile
View .bashrc
# 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
@dwtompkins
dwtompkins / block.js
Created May 13, 2021
First Gutenberg Block. Need a hand
View block.js
/**
* 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';
View error_log.txt
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 / functions.php
Last active May 13, 2022
Genesis Framework - Breadcrumbs (functions.php)
View 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 "|" */
@dwtompkins
dwtompkins / comment.js
Created Jun 21, 2022
React Component, Comment
View comment.js
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 / comments.js
Created Jun 21, 2022
React Component, Comments
View comments.js
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);