O JavaScript possui uma série de curiosidades em relação a algumas instruções. Portanto, tome cuidado se precisar utilizar qualquer uma dessas instruções listadas abaixo.
0.1 + 0.2 == 0.3 // false
1 / 0 // Infinity| <?php | |
| function translate_similar_chars($buffer) { | |
| $single_double = array( | |
| 'Æ' => 'AE', | |
| 'æ' => 'ae' | |
| ); | |
| $buffer = strtr( | |
| $buffer, |
| <?php | |
| function get_week_by_date($date) { | |
| $date = strtotime($date); | |
| $week_position = date('w', $date); | |
| // Seeking sunday | |
| $sunday = ($week_position == 0) ? $date : strtotime('last sunday', $date); |
| DELIMITER $$ | |
| USE `database` $$ | |
| DROP TRIGGER IF EXISTS `set_uuid` $$ | |
| CREATE DEFINER = CURRENT_USER | |
| TRIGGER `set_uuid` | |
| BEFORE INSERT ON `table` | |
| FOR EACH ROW | |
| BEGIN |
| $('#percent').mask('P', { | |
| translation: { | |
| 'P': { | |
| pattern: /[\d\.,]/, | |
| recursive: true | |
| } | |
| }, | |
| onKeyPress: function(val, e, field, options) { | |
| var old_value = $(field).data('oldValue') || ''; |
| String.prototype.limit = function(size, cutWord, suspensionPoints) { | |
| var str = this; | |
| cutWord = typeof cutWord == "undefined" ? true : cutWord; | |
| if (typeof size == "number" && size > 0 && str.length >= size) { | |
| str = str.substr(0, size); | |
| if (!cutWord) { | |
| str = str.substr(0, Math.min(str.length, str.lastIndexOf(" "))); |
| <?php | |
| function merge_white_spaces($string) { | |
| // Remove multiple line breaks | |
| $string = preg_replace("/[\n\r]{3,}|[\r\n]{3,}|[\n]{3,}|[\r]{3,}/", PHP_EOL . PHP_EOL, $description); | |
| // Remove tabs | |
| $string = preg_replace("/\t+/", "", $description); | |
| // Remove multiple spaces (the character " " is used instead \s because the second removes line breaks too) |
| Declaração de variáveis | |
| LIP: Largura da imagem principal | |
| AIP: Altura da imagem principal | |
| MIP: Margem da imagem principal | |
| LMI: Largura da miniatura | |
| AMI: Altura da miniatura | |
| MMI: Margem da miniatura | |
| NMI: Número de miniaturas | |
| NMA: Número de margens de miniaturas |
| SET @@session.foreign_key_checks = 0; | |
| SET @@global.connect_timeout = 200; | |
| SET @@session.max_allowed_packet = 16M; | |
| SET @@session.wait_timeout = 200; | |
| SET @@session.interactive_timeout = 200; | |
| SET @@session.net_read_timeout = 200; | |
| SET @@session.net_write_timeout = 200; |
| É interessante: | |
| • Considerar itens frágeis | |
| • Considerar posição item (quando precisar) | |
| • O objeto possuir medidas específicas para envio. Por exemplo: o objeto dobra ou é flexível, como no caso de tecidos | |
| • Empacotar objetos maiores primeiro | |
| • Posicionar ao lado dos itens já empacotados anteriormente, se couber | |
| • Não permitir saliências para que não haja dobras/quebras durante o trânsito (lados lisos) | |
| • Balancear caixas para que não haja muita discrepância de tamanho e peso. Por exemplo: Três caixas médias, são melhores do que 1 caixa pequena e 2 grandes, por exemplo | |
| • Exibir modelo 3D com o resultado |