Skip to content

Instantly share code, notes, and snippets.

View italoveloso's full-sized avatar

Italo Veloso italoveloso

  • Brasil
View GitHub Profile
@italoveloso
italoveloso / gist:5638262
Created May 23, 2013 18:23
Recaptcha Zend
$recaptcha = new Zend_Service_ReCaptcha('6Ldxo8YSAAAAAD2Q1bc5PCqYA2TPef_wj1JDpmm0','6Ldxo8YSAAAAAOxFKB3hwN1f_3cEaeyMT646RL5X');
$recaptcha->setOption('theme', 'clean');
$captcha = new Zend_Form_Element_Captcha('captcha',
array('captcha' => 'ReCaptcha',
'captchaOptions' => array('captcha' => 'ReCaptcha',
'service' => $recaptcha)));
# Install Dependencies
# sudo apt-get install build-essential
# sudo apt-get build-dep php5
sudo apt-get install libmysqlclient-dev mysql-client libcurl4-openssl-dev libgd2-xpm-dev libjpeg-dev libpng3-dev libxpm-dev libfreetype6-dev libt1-dev libmcrypt-dev libxslt1-dev bzip2 libbz2-dev libxml2-dev libevent-dev libltdl-dev libmagickwand-dev libmagickcore-dev imagemagick libreadline-dev libc-client-dev libsnmp-dev snmpd snmp libvpx-dev libxpm-dev libgmp3-dev libicu-dev libpspell-dev libtidy-dev freetds-dev unixodbc-dev librecode-dev libglib2.0-dev libsasl2-dev libgeoip-dev imagemagick libmagickcore-dev libmagickwand-dev
# Stop Apache
sudo service apache2 stop
# Cleanup Packages
sudo apt-get autoremove
function Imprimir(array $values){
foreach($values as $value){
echo $value['id'].' - '.$value['label'];
echo '<br />';
}
}
function Sort_Array(array &$values, $field=NULL){
if (is_null($field) === false){
for($i = 0; $i < sizeof($values); $i++){

Segurança da informação

  • Princípios básicos
  • Tipos de ameaças
  • Tipos de ataques
  • Proteção
  • Serviços

Teste de invasão

@italoveloso
italoveloso / gist:7935044
Created December 12, 2013 20:40
utf8 to latin1
convert(cast(convert(titulo using latin1) as binary) using utf8)
@italoveloso
italoveloso / gist:8182045
Created December 30, 2013 13:22
Count hits with memcached
$key = 'count_news_'.$id;
if(!$this->memcache->get($key))
$this->memcache->set($key, 0);
$this->memcache->increment($key);
@italoveloso
italoveloso / gist:8218567
Created January 2, 2014 12:32
Diff between dates - MySQL
TIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2)
Returns datetime_expr2 – datetime_expr1, where datetime_expr1 and datetime_expr2 are date or datetime expressions. One expression may be a date and the other a datetime; a date value is treated as a datetime having the time part '00:00:00' where necessary. The unit for the result (an integer) is given by the unit argument.
The unit argument can be: MICROSECOND (microseconds), SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.
@italoveloso
italoveloso / gist:8400504
Created January 13, 2014 13:46
* Translated default messages for the jQuery validation plugin. * Locale: PT_BR
/*
* Translated default messages for the jQuery validation plugin.
* Locale: PT_BR
*/
jQuery.extend(jQuery.validator.messages, {
required: "Este campo &eacute; requerido.",
remote: "Por favor, corrija este campo.",
email: "Por favor, forne&ccedil;a um endere&ccedil;o eletr&ocirc;nico v&aacute;lido.",
url: "Por favor, forne&ccedil;a uma URL v&aacute;lida.",
date: "Por favor, forne&ccedil;a uma data v&aacute;lida.",
@italoveloso
italoveloso / gist:8680798
Created January 29, 2014 02:36
zend-form-custom-attribute-in-select-option
http://stackoverflow.com/questions/5401412/zend-form-custom-attribute-in-select-option
<?php
/*
* A mathematical decimal difference between two informed dates
*
* Author: Sergio Abreu
* Website: http://sites.sitesbr.net
*
* Features:
* Automatic conversion on dates informed as string.
* Possibility of absolute values (always +) or relative (-/+)