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:9841080
Created March 28, 2014 19:29
enable remove access mysql
GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'%' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

PHP 5.4 woes on Ubuntu 10.04 Lucid

So I was having an issue on a VPS I rent that it was on Ubuntu 10.04 LTS. They seem to have a different idea of what LTS means then what seems reasonable. Having your packages available for 5 years isn't something I'm waiting for, I can also still get Debian Buzz with no issues so that's not an argument. What I want is -support- for -updates- on an -existing- platform. Luckily, I don't have to travel far to the Ubuntu team to slap some sense in them because luckily people run their own PPA's that do compile software for existing OS installs.

However, I kept running into an issue that most posts and gists kept referring to PPA's that no longer supported Ubuntu 10.04 Lucid by now... Found a few PPA's but they named their packages like php54 and libapache2-mod-php54 which causes Ubuntu 10.04 Lucid with Plesk installed to throw you a giant headache cause it wants to remove Plesk specific packages (cause it's only compatible with libapache2-mod-php5 and php5)

Getting to i

<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8" />
<title dir="ltr">Portal O Dia - Últimas notícias sobre o Piauí, esportes e entretenimento</title>
<link rel="stylesheet" type="text/css" href="http://s.portalodia.com/min/?g=css" />
<script type="text/javascript" src="http://s.portalodia.com/min/?g=jquery"></script>
<script type="text/javascript">
PROGRAMADOR PHP
Salário: Negociável
Carga Horária: 40h / Semana
Requisitos:
- Bom conhecimento de HTML + CSS + JavaScript
- Bom conhecimento de PHP
- MySQL e Modelagem de Banco de Dados
@italoveloso
italoveloso / gist:8856525
Created February 7, 2014 02:35
add locale ubuntu
sudo locale-gen pt_BR
<?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 (-/+)
@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
@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: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: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);