Skip to content

Instantly share code, notes, and snippets.

View paydana's full-sized avatar

ANTONIO SILVA paydana

View GitHub Profile
function telefone_validation(telefone) {
//retira todos os caracteres menos os numeros
telefone = telefone.replace(/\D/g, '');
//verifica se tem a qtde de numero correto
if (!(telefone.length >= 10 && telefone.length <= 11)) return false;
//Se tiver 11 caracteres, verificar se começa com 9 o celular
if (telefone.length == 11 && parseInt(telefone.substring(2, 3)) != 9) return false;
@GaryLee
GaryLee / RunAsAdmin.py
Last active March 22, 2024 21:52
Elevate the privilege to Admin. Support both python script and pyinstaller wrapped program. Need ctypes only.
#!python
# coding: utf-8
import sys
import ctypes
def run_as_admin(argv=None, debug=False):
shell32 = ctypes.windll.shell32
if argv is None and shell32.IsUserAnAdmin():
return True
@abelsonlive
abelsonlive / wait_browser.py
Last active June 18, 2019 16:12
Waiting For responses in selenium
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
class WaitBrowser(object):
def __init__(self, **kw):
self.browser = webdriver.PhantomJS()
def readystate_complete(self):
@arturfsousa
arturfsousa / barcode_template.html
Created September 13, 2012 18:56 — forked from seocam/barcode_template.html
Generate a interleaved 2 of 5 barcode in pure HTML and CSS (tested only in Firefox and Chrome)
<html>
<head>
<style>
#barcode {height: 60px;}
#barcode span {margin: 0;padding-bottom: 34px;height: 16px;}
.n {border-left: 1px solid;}
.w {border-left: 3px solid;}
.n, .w {border-color: #000;}
.s {border-color: #fff;}
</style>