Seja um vetor declarado por:
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
#!/usr/bin/env python | |
# -*- coding: utf8 -*- | |
import argparse, re | |
from os import path, getcwd, mkdir, listdir, devnull | |
from subprocess import Popen | |
# valida se 'string' segue o padrão de resolução de tela. 9999x9999 ou 9999X9999 | |
def isScreenSize(string): | |
regex = re.compile(r"^\d+x\d+$", re.IGNORECASE) |
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
// moment.js locale configuration | |
// locale : brazilian portuguese (pt-br) | |
// author : Caio Ribeiro Pereira : https://github.com/caio-ribeiro-pereira | |
(function (factory) { | |
if (typeof define === 'function' && define.amd) { | |
define(['moment'], factory); // AMD | |
} else if (typeof exports === 'object') { | |
module.exports = factory(require('../moment')); // Node | |
} else { |
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
/** | |
* An array forEach with a delay between steps. | |
* | |
* @param {Function} callback Function to execute for each element. It receives three arguments, the element value, the element index and the array being traversed, respectivily. | |
* @param {Number} timeout Number of milliseconds that the function call should be delayed by. | |
* @param {Object} thisArg Object to use as this when executing callback. | |
* @this {Array} | |
* @return {undefined} | |
*/ | |
Array.prototype.delayedForEach = function(callback, timeout, thisArg){ |
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 | |
class Gtin | |
{ | |
/** | |
* Testa se a string é um GTIN válido nos seguintes termos: | |
* - É uma string | |
* - Contém apenas dígitos numéricos | |
* - Possui 8, 12, 13 ou 14 dígitos | |
* |
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
import socket, subprocess | |
def connect(): | |
ip = "192.168.0.100" | |
port = 6000 | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
while True: | |
command = s.recv(1024) | |
Foram feitos 2 scripts para a raspagem de dados. Um síncrono e outro assíncrono.
- Síncrono: foram utilizadas as bibliotecas [requests] e [BeautifulSoup];
- Assíncrono: foram utilizadas as bibliotecas [aiohttp], [BeautifulSoup] e [asyncio] ([corrotinas] e [filas]).
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
function html_decode(text){ | |
var div = document.createElement("div"); | |
div.innerHTML = text; | |
return ("textContent" in div) ? div.textContent : div.innerText ; | |
} | |
function html_encode(str){ | |
var div = document.createElement("div"); | |
div[("textContent" in div) ? "textContent" : "innerText"] = str; | |
return div.innerHTML; |
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
/** | |
* === Scroller === | |
* Basta adicionar a classe "scroller" para algum elemento e atribuir o seletor ao atributo href ou data-target; | |
* Exemplos: | |
* <a href="#wrapper" class="scroller">Topo</a> | |
* <span class="scroller" data-target="#wrapper">Topo</span> | |
*/ | |
jQuery(document).ready(function(){ | |
var screen = $('html, window, body'), | |
regex = /.*(?=#[^\s]+$)/; //strip for ie7 |
NewerOlder