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 | |
/** | |
* Checks if multiple keys exist in an array | |
* | |
* @param array $array | |
* @param array|string $keys | |
* | |
* @author Lenivene Bezerra | |
* @return bool |
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 | |
/** | |
* 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(){ |
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
(function() { | |
var docElement = document.documentElement; | |
var classRE = new RegExp('(^|\\s)no-js(\\s|$)'); | |
var className = docElement.className; | |
docElement.className = className.replace(classRE, '$1js$2'); | |
})(); |
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
A. Left: ← | |
A. Right: → |
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 get_ip(){ | |
if( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ){ | |
$ip = $_SERVER['HTTP_CLIENT_IP']; | |
} | |
elseif( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ){ | |
$ip = $_SERVER['HTTP_X_FORWARDED_FOR']; | |
} | |
else{ | |
$ip = $_SERVER['REMOTE_ADDR']; |
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
var win = window, | |
lockOrientation = win.screen.lockOrientation || win.screen.mozLockOrientation || win.screen.msLockOrientation || function(){ | |
return null; | |
} | |
if( lockOrientation ){ | |
/** | |
* Parameters | |
* [ portrait-primary, portrait-secondary, landscape-primary, landscape-secondary, portrait, landscape, default ] | |
*/ |
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 | |
preg_match_all("/\b(?:(?:https?|ftp|mailto|tel):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/m", $urls, $callback); |
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 dias_feriados( $year = null ){ | |
if( $year === null ){ | |
$year = intval( date( 'Y' ) ); | |
} | |
/** | |
* easter_date() will generate a warning | |
* if the year is outside of the range | |
* for Unix timestamps (i.e. before 1970 or after 2037). |
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
function getOffset( element ){ | |
var rect = element.getBoundingClientRect(); | |
return { | |
top: rect.top + window.pageYOffset, | |
left: rect.left + window.pageXOffset, | |
}; | |
} |
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
window.requestAnimFrame = function(){ | |
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || | |
function( callback ){ | |
window.setTimeout( callback, 1000 / 60 ); | |
}; | |
}; | |
// main function | |
function scrollToY( scrollTargetY, speed, easing ){ | |
/** |