See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope> is optional
| <?php | |
| /** | |
| * Get primary taxonomy term (YoastSEO). | |
| * | |
| * @param mixed $taxonomy Taxonomy to check for. | |
| * @param boolean $term_as_obj Whether to return an object or the term name. | |
| * @param int $post_id Post ID. | |
| * @return mixed The primary term. | |
| */ | |
| function xx_get_primary_tax_term( $taxonomy = 'category', $term_as_obj = true, $post_id = 0 ) { |
| INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`) | |
| VALUES ('chance', MD5('Password123'), 'Chance Strickland', '[email protected]', '0'); | |
| INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) | |
| VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}'); | |
| INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) | |
| VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10'); |
| <?php | |
| /** | |
| * Truncate a string to a maximum number of characters to the nearest complete word. | |
| * | |
| * @param string $string String to truncate. | |
| * @param int $max_char_width Maximum number of characters. | |
| * @param string $append New string to append at the end of the truncated string. | |
| * @return string Truncated string. | |
| */ | |
| function truncate_string( $string = '', $max_char_width = 200, $append = '' ) { |
| // Camel case a thing! | |
| export const camelCase = str => `${str.charAt( 0 ).toLowerCase()}${str.replace( /[\W_]/g, '|' ).split( '|' ) | |
| .map( part => `${part.charAt( 0 ).toUpperCase()}${part.slice( 1 )}` ) | |
| .join( '' ) | |
| .slice( 1 )}`; | |
| // Debounce a thing! | |
| export const debounce = ( func, wait, immediate ) => { | |
| let timeout; | |
| return function() { |
| /** | |
| * Each version gets a directory where I copy over all of the old block files, | |
| * then export them from here for use in your main block file. | |
| */ | |
| export { default as v1 } from './v1'; | |
| export { default as v1_01 } from './v1_01'; |
| import React from 'react'; | |
| import flattenInput from './utils/flattenInput'; | |
| /** | |
| * Store a component's previous value in a ref for use after the value changes. | |
| * | |
| * const prevProps = usePrevious(props); | |
| * const { children: prevChildren } = usePrevious(props) || {}; | |
| * const prevState = usePrevious(state); | |
| */ |
| import React from 'react'; | |
| import { | |
| Formik, | |
| FormikProps, | |
| Form, | |
| Field, | |
| FieldProps, | |
| ErrorMessage, | |
| } from 'formik'; | |
| import * as Yup from 'yup'; |
| export function Example({ audioFile, ...props }) { | |
| return ( | |
| <div> | |
| {/* basic auidio player with normal HTML5 controls */} | |
| <RePlays src={audioFile} {...props} /> | |
| {/* basic auidio player; pick and choose your controls */} | |
| <RePlays src={audioFile}> | |
| <Scrubber /> |