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 / code.html
Created July 20, 2018 04:06
Arrow code html
A. Left: ←
A. Right: →
@lenivene
lenivene / no-js.js
Created October 26, 2018 12:40
Remove class no-js
(function() {
var docElement = document.documentElement;
var classRE = new RegExp('(^|\\s)no-js(\\s|$)');
var className = docElement.className;
docElement.className = className.replace(classRE, '$1js$2');
})();
@lenivene
lenivene / function.php
Last active March 16, 2019 15:38
Função para verificar se é servidor de teste (localhost)
<?php
/**
* Verificar servidor
* @return null Retorna se tiver erro, se preferir troque para class Exception.
* @return true | false Retorna true para localhost e false para servidor
*
* @version 1.0
* @author Lenivene Bezerra
*/
function isServerLocal(){
@lenivene
lenivene / array_keys_exist-function.php
Last active March 16, 2019 15:47
Checks if multiple keys exist in an array
<?php
/**
* Checks if multiple keys exist in an array
*
* @param array $array
* @param array|string $keys
*
* @author Lenivene Bezerra
* @return bool
@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]-->
<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 / 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;
@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 / 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 );
const list_names = [
"Hello",
"World",
"Lenivene",
"Bezerra",
"Lenivene",
"Enevinel",
"World"
];