This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState, useRef } from "react"; | |
import ReactDOM from "react-dom"; | |
function App() { | |
// Store a reference to the input's DOM node | |
const inputRef = useRef(); | |
const [value, setValue] = useState(""); | |
useEffect( | |
() => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Convert a float to a string without locale formatting which PHP adds when changing floats to strings. | |
* | |
* @param float $float Float value to format. | |
* @return string | |
*/ | |
function prefix_float_to_string( $float ) { | |
if ( ! is_float( $float ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Explode a string into an array by $delimiter and remove empty values. | |
* | |
* @param string $string String to convert. | |
* @param string $delimiter Delimiter, defaults to ','. | |
* @return array | |
*/ | |
function prefix_string_to_array( $string, $delimiter = ',' ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<wpml-config> | |
<custom-fields> | |
<custom-field action="copy">quantity</custom-field> | |
<custom-field action="translate">custom-title</custom-field> | |
</custom-fields> | |
<custom-types> | |
<custom-type translate="1">book</custom-type> | |
<custom-type translate="1">DVD</custom-type> | |
</custom-types> | |
<taxonomies> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Converts a string (e.g. 'yes' or 'no') to a bool. | |
* | |
* @since 1.0.0 | |
* @param string $input String to convert. | |
* @return bool | |
*/ | |
function prefix_string_to_bool( $input ) { | |
return is_bool( $input ) ? $input : ( 'yes' === $input || 1 === $input || 'true' === $input || 'TRUE' === $input || '1' === $input ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Retrieve the next key in an array from given key. | |
* | |
* @since 1.0.0 | |
* @param array $arr List of items in a form of array. | |
* @param integer $key Key to search and find within the array. | |
* @return integer | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Handles JavaScript detection. | |
* Adds a `js` class to the root `<html>` element when JavaScript is detected. | |
* | |
* @link https://github.com/WordPress/twentyseventeen/blob/master/functions.php#L239 | |
* @return void | |
*/ | |
function prefix_javascript_detection() { | |
echo "<script>(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script>\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Move the comment text field to the bottom. | |
* | |
* @see https://developer.wordpress.org/reference/hooks/comment_form_fields/ | |
* @param array $fields The comment fields. | |
* @return array | |
*/ | |
function prefix_move_comment_field_to_bottom( $fields ) { | |
$comment_field = $fields['comment']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Sanitize multiple HTML classes in one pass. | |
* | |
* @param array $classes Classes to be sanitized. | |
* @param string $return_format The return format, 'input', 'string', or 'array'. | |
* @return array|string | |
*/ | |
function prefix_sanitize_html_classes( $classes, $return_format = 'input' ) { | |
if ( 'input' === $return_format ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const icons = [ | |
{ | |
className: 'fa fa-ad', | |
unicode: 'f641', | |
}, | |
{ | |
className: 'fa fa-address-book', | |
unicode: 'f2b9', | |
}, | |
{ |