Skip to content

Instantly share code, notes, and snippets.

View lenivene's full-sized avatar
🖖
Full-stack dev

Lenivene Bezerra lenivene

🖖
Full-stack dev
View GitHub Profile
@lenivene
lenivene / functions.php
Created May 21, 2019 18:16
Function in order to support previous versions of WordPress < 5.2
<?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' );
}
}
@lenivene
lenivene / is_date_valid.php
Last active June 11, 2019 16:41
Function PHP - Validate Date, returns TRUE if the date given is valid; otherwise returns FALSE.
<?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;
@lenivene
lenivene / functions.php
Created May 8, 2019 07:59
'recode' WordPress function - is_email()
<?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 ) {
@lenivene
lenivene / Constants.js
Created April 24, 2019 04:40
Constants React Native
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"
const list_names = [
"Hello",
"World",
"Lenivene",
"Bezerra",
"Lenivene",
"Enevinel",
"World"
];
@lenivene
lenivene / line-to-json.php
Last active August 22, 2020 03:15
TEXT LINE TO JSON PHP FUNCTION
<?php
function text_line_json_encode( $value, $options = 0, $depth = 512 ){
$to_json = $value;
if( ! is_array( $value ) || ! is_object( $value ) ){
$to_json = preg_split("/\r\n|\n|\r/", (string) $value );
}
return json_encode( $to_json, $options, $depth );
@lenivene
lenivene / is_cnpj-function.php
Created March 26, 2019 16:11
Verificar se o CNPJ ( Cadastro nacional de pessoas Jurídicas ) é um número valido.
<?php
/**
* Verificar se o CNPJ ( Cadastro nacional de pessoas Jurídicas ) é um número valido.
*
* @author Lenvene Bezerra
* @return true | false
*/
function is_cnpj( $cnpj ){
if( ! isset( $cnpj ) || isset( $cnpj ) && empty( $cnpj ) )
return false;
@lenivene
lenivene / is_cpf-funciton.php
Last active March 26, 2019 16:05
Verificar se o CPF ( Cadastro de pessoas físicas ) é um número valido. - Via: PHP
<?php
/**
* Verificar se o CPF ( Cadastro de pessoas físicas ) é um número valido.
*
* @author Lenvene Bezerra
* @return true | false
*/
function is_cpf( $cpf ){
if( ! isset( $cpf ) || isset( $cpf ) && empty( $cpf ) )
return false;
<p style="line-height: 18px; font-size: 18px; font-family: times;">
<script>
for (var line=1; line<60; line++) {
for(var i=1;i<29;i++) {
var s = (Math.floor((Math.random()*2)%2)) ? "╱" : "╲";
document.write(s);
}
document.writeln("<br>");
}
</script>
@lenivene
lenivene / page.html
Created March 23, 2019 14:42
IE Conditional Comment - HTML5 Shim
<!--[if lte IE 8]><script>(function(){var e="abbr,article,aside,audio,canvas,datalist,details,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(','),i=e.length;while(i--){document.createElement(e[i]);}}());</script><![endif]-->