^ Matches at the start of string or start of line if multi-line mode is
enabled. Many regex implementations have multi-line mode enabled by
default.
$ Matches at the end of string or end of line if multi-line mode is enabled.
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
| // "{0} is dead, but {1} is alive! {0} {2}".format("ASP", "ASP.NET") | |
| if (!String.prototype.format) { | |
| String.prototype.format = function() { | |
| var args = arguments; | |
| return this.replace(/{(\d+)}/g, function(match, number) { | |
| return typeof args[number] != 'undefined' | |
| ? args[number] | |
| : match | |
| ; | |
| }); |
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 validar_cnpj($cnpj) | |
| { | |
| $cnpj = preg_replace('/[^0-9]/', '', (string) $cnpj); | |
| // Valida tamanho | |
| if (strlen($cnpj) != 14) | |
| return false; |
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 | |
| /** | |
| * Download a large distant file to a local destination. | |
| * | |
| * This method is very memory efficient :-) | |
| * The file can be huge, PHP doesn't load it in memory. | |
| * | |
| * /!\ Warning, the return value is always true, you must use === to test the response type too. | |
| * | |
| * @author dalexandre |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
| <meta charset=utf-8 /> | |
| <title>Chrome File API tester</title> | |
| <script> | |
| window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; |
NewerOlder