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 | |
$pdo = false; | |
function load_database() { | |
global $pdo; | |
try { | |
$options = array(); | |
$options[PDO::ATTR_PERSISTENT] = true; | |
$options[PDO::MYSQL_ATTR_USE_BUFFERED_QUERY] = true; | |
$options[PDO::ATTR_EMULATE_PREPARES] = true; |
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 | |
$errno = 1; | |
$bool = $errno == E_CORE_ERROR || $errno == E_ERROR || $errno == E_USER_WARNING || $errno == E_COMPILE_ERROR; | |
var_dump($bool); | |
$bool = $errno == x(E_CORE_ERROR || E_ERROR || E_USER_WARNING || E_COMPILE_ERROR); | |
$bool = $errno == ||(E_CORE_ERROR, E_ERROR, E_USER_WARNING, E_COMPILE_ERROR); |
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 | |
$str = '[0710:020602938:7041]'; | |
switch(true) { | |
case preg_match('/^(\[)[A-Z0-9]{4}:(' . rand(10000,29999) . '|' . rand(50000,99999) . '):[A-z]{3}(\])(.*)+/', $str); | |
echo 'a'; | |
break; | |
case preg_match('/^(\[)[A-Z0-9]{4}:[0-9]{9}:[0-9]{4}(\])+/', $str); | |
echo 'b'; | |
break; |
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 | |
$str = '[0710:020602938:7041]'; | |
preg_switch($str) { | |
case '/^(\[)[A-Z0-9]{4}:(' . rand(10000,29999) . '|' . rand(50000,99999) . '):[A-z]{3}(\])(.*)+/': | |
/* ... */ | |
break; | |
case '/^(\[)[A-Z0-9]{4}:[0-9]{9}:[0-9]{4}(\])+/': | |
/* ... */ | |
break; |
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 | |
// como é atualmente | |
$a = ['um', 'dois', 'tres', 'quatro']; | |
echo implode (',', $a); | |
// Conceito 1 | |
// $params = new paramClass(); |
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
RewriteEngine On | |
RewriteCond %{HTTPS} !=on | |
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] |
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 | |
function __autoload($classe) | |
{ | |
if(file_exists(APP_PATH.'/core/classes'.$classe.'.php')) | |
{ | |
require(APP_PATH.'/core/classes'.$classe.'.php'); | |
add_log_event(SUCCESS, 'Classe '.$classe.' instanciada com sucesso pelo core'); | |
} | |
else if(file_exists(APP_PATH.'/libs/'.$classe.'.php')) |
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
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^example.com [NC,OR] | |
RewriteCond %{HTTP_HOST} ^www.example.com [NC] | |
RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC] |
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 | |
/** | |
* Simple pageview class. | |
* | |
* Usage: | |
* \Counter::register(); | |
* \Counter::getStatus(); | |
* | |
* @author Joubert <[email protected]> | |
*/ |
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
015-01-07 01:03:12.611+0000: starting up | |
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -name instance-00000003 -S -machine pc-i440fx-rhel7.0.0,accel=kvm,usb=off -cpu SandyBridge,+erms,+smep,+fsgsbase,+rdrand,+f16c,+osxsave,+pcid,+pdcm,+xtpr,+tm2,+est,+smx,+vmx,+ds_cpl,+monitor,+dtes64,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme -m 512 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 87f92892-e39c-4c3a-a0e6-f38d2546b6f0 -smbios type=1,manufacturer=Fedora Project,product=OpenStack Nova,version=2014.2.1-1.el7.centos,serial=2d406ad2-c45e-4e1b-86f1-1fa56e394d32,uuid=87f92892-e39c-4c3a-a0e6-f38d2546b6f0 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/instance-00000003.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -no-kvm-pit-reinjection -no-hpet -no-shutdown -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/var/lib/nova/instances/87f92 |
OlderNewer