Skip to content

Instantly share code, notes, and snippets.

View sxslex's full-sized avatar

Alexandre Villela - SleX sxslex

View GitHub Profile
@sxslex
sxslex / assert_error_flask.py
Last active October 17, 2018 20:37
assert_error_flask.py
import json
import flask
from decorator import decorator
def assert_error():
@decorator
def _fn(f: callable, *args, **kwargs):
try:
return f(*args, **kwargs)
except Exception as exception:
@sxslex
sxslex / troca_texto.js
Last active March 14, 2019 22:16
Troca todo o texto de um site para outro texto passado
function dePara(de,para){var t=0;if(document.documentElement.innerText.indexOf(de)===-1)return t;Array.from(document.getElementsByTagName("*")).forEach(function(e){Array.from(e.attributes).forEach(function(f){if(['title','alt'].indexOf(f.name)>-1&&f.value){f.value=f.value.split(de).join(para);t++}});e.childNodes.forEach(function(f){if(f.nodeType===3&&f.nodeValue){f.nodeValue=f.nodeValue.split(de).join(para);t++}})});return t}
dePara('Compartilhe','Cadê DeDe???');
@sxslex
sxslex / separa_imagens_html.py
Last active March 27, 2019 14:59
separa do html os dados da imagem e deixa um marcador no local
import pprint
html = (
'<p>O <strong><a href="https://www.instagram.com/drviotto/">Dr. Viotto</a>'
'</strong> já se tornou referência na '
'<img src=http://slex.com.br/f1.jpg>'
'odontologia em nível nacional e um '
'dos mais <img src=\'http://slex.com.br/f2.jpg\' /> slex renomados '
'dentistas do Brasil. Conhecido não apenas dos '
'profissionais da área médica mas também do público em geral por ser o '
@sxslex
sxslex / ife.html
Created April 18, 2019 23:21
ife.html
<html>
<head>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/fixedcolumns/3.2.6/js/dataTables.fixedColumns.min.js"></script>
<script src="https://cdn.datatables.net/fixedheader/3.1.5/js/dataTables.fixedHeader.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap.min.css" />