This file contains hidden or 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 { Dimensions } from "react-native"; | |
const { width, height } = Dimensions.get("window"); | |
const Constants = { | |
useReactotron: true, // Debug | |
Language: "en", | |
fontFamily: "system font", // Default font | |
WordPress: { // No required | |
defaultDateFormat: "YYYY-MM-DD HH:mm:ss" |
This file contains hidden or 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 | |
/** | |
* Verifies that an email is valid. | |
* | |
* @param $email (string) (Required) Email address to verify. | |
* @return (string|bool) Either false or the valid email address. | |
*/ | |
function is_email( $email ){ | |
// Test for the minimum length the email can be | |
if ( mb_strlen( $email ) < 6 ) { |
This file contains hidden or 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 | |
/** | |
* Validate Date | |
* | |
* @return boolean Returns TRUE if the date given is valid; otherwise returns FALSE. | |
*/ | |
function is_date_valid( $date, $format = 'Y-m-d H:i:s'){ | |
if( ! isset( $date ) || isset( $date ) && ! is_string( $date ) ) | |
return false; |
This file contains hidden or 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 | |
/** | |
* Function in order to support previous versions of WordPress | |
*/ | |
if ( ! function_exists( 'wp_body_open' ) ) { | |
function wp_body_open() { | |
do_action( 'wp_body_open' ); | |
} | |
} |
This file contains hidden or 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 | |
function count_months_in_time( $timestamp ){ | |
$time_now = time(); | |
$months = ( ( ( date( 'Y', $timestamp ) - date( 'Y', $time_now ) ) * 12 ) + ( date( 'm', $timestamp ) - date( 'm', $time_now ) ) ); | |
return $months; | |
} | |
echo count_months_in_time( strtotime( date( '09/08/2019' ) ) ); |
This file contains hidden or 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
module.exports = (object, ...keys) => { | |
const newObject = {}; | |
keys.forEach(key => newObject[key] = object[key]) | |
return newObject; | |
} |
This file contains hidden or 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 | |
/** | |
* Create a array tree from array list | |
* | |
* @param array ( Required ) The list to create tree | |
* @param string The name key parent. Ex: parent_id | |
* @param string The key to check child. Ex: ID | |
* | |
* @return array|false Returns array if the date given is not empty; otherwise returns FALSE. | |
*/ |
This file contains hidden or 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 | |
/** | |
* Array sort by column | |
* | |
* @author Lenivene | |
* @param array List | |
* @param string|array Columns name or single column | |
* @param int Order BY ASC|DESC. | |
* I recommend you use constant, Ex: SORT_ASC = 4 ( int ) | SORT_DESC = 3 ( int ) | |
*/ |
This file contains hidden or 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 | |
if( ! defined( 'FILTER_VALIDATE_BOOLEAN' ) ){ | |
define( 'FILTER_VALIDATE_BOOLEAN', 258 ); | |
} | |
$db_value = 1; | |
$bool_value = filter_var( $db_value, FILTER_VALIDATE_BOOLEAN ); | |
var_dump( $bool_value ); |
This file contains hidden or 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
<div class="components__Loader"></div> |