Another test.
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 | |
// Setting the document header | |
header('content-type: application/xml; charset=UTF-8'); | |
// Instantiating a new DomDoc obj. | |
$xml = new DomDocument('1.0','UTF-8'); | |
$xml->formatOutput = true; | |
// Creating a root element and assigning it to $xmlRoot variable |
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 | |
/** | |
* Checks if an email is a valid RFC 2822 email address | |
* | |
* Examples: | |
* <code> | |
* <?php | |
* validate_email('dev@felds.com.br'); // returns true | |
* validate_email('Felds Liscia <dev@felds.com.br>'); // returns false |
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 | |
/** | |
* Escapes scalar values deeply | |
* | |
* Examples: | |
* <code> | |
* var_export(mysql_real_escape_string_deep(1)); | |
* // outputs '1' | |
* |
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 | |
/** | |
* Checks if this is an AJAX request | |
* | |
* @author Luiz "Felds" Liscia <dev@felds.com.br> | |
* return bool | |
*/ | |
function is_ajax() | |
{ |
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
// ==UserScript== | |
// @name FB Cleanup | |
// @namespace https://gist.github.com/1235475 | |
// @description Removes live feed ticker from Facebook (Sep 2011 update) | |
// @include *facebook.com/* | |
// @version 1.0b | |
// @author Felds Liscia (@felds) | |
// ==/UserScript== | |
!function() { |
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 | |
/** | |
* Creates an Excel column label from an integer where 0 = A, | |
* 25 = Z, 26 = AA and so on. | |
* | |
* Examples: | |
* <code> | |
* <?php | |
* echo column_label(0); // A |
Para criar um validador personalizado, devemos criar as seguintes classes:
- Constraint, responsável por configurar o comando
Esta classe vai expor a configuração do comando, seja por Annotation, YAML, etc. - Validator, que executa todo o processo de validação
Antes de mais nada, é importante avisar que esta não é uma documentação detalhada e, por isso, não substitui a [documentação oficial][symfony-doc-translations].
O ideal é que todos os textos estáticos (ou seja: que forem criados pelo usuário) sejam traduzíveis.
Esta é uma prática que parece sem sentido em sistemas com um único idioma, porém economiza muito tempo na hora de fazer alterações.
OlderNewer