Skip to content

Instantly share code, notes, and snippets.

View ricardodani's full-sized avatar
🐍
Coding python

Ricardo L. Dani ricardodani

🐍
Coding python
View GitHub Profile
@ricardodani
ricardodani / messages.html
Created March 25, 2022 21:59 — forked from dimitrov/messages.html
Bootstrap Alerts for Django
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{ message.tags }} alert-dismissible text-center" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<strong>{% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %}Error{% else %}{{ message.tags|title }}{% endif %}!</strong> {{ message }}
</div>
{% endfor %}
{% endif %}
@ricardodani
ricardodani / test_client_fake_server.py
Created July 11, 2020 20:52 — forked from ambivalentno/test_client_fake_server.py
pytest-asyncio aiohttp client testing with fake server
import asyncio
import pathlib
import socket
import ssl
import pytest
import aiohttp
from aiohttp import web
from aiohttp.resolver import DefaultResolver
@ricardodani
ricardodani / tmux-cheatsheet.markdown
Created July 1, 2019 17:48 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@ricardodani
ricardodani / factorial.py
Created September 12, 2012 21:00 — forked from ghoseb/factorial.py
The evolution of a Python Programmer
# TESTING
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
@ricardodani
ricardodani / Geolocalizacao_Python
Created August 25, 2011 18:46 — forked from bragil/geolocalizacao.py
Dado o endereço, obter localização, latitude e longitude
def dados_do_local(endereco):
"""
Dado o endereco, retorna o endereco processado, a latitude e a longitude do local.
Exemplo:
place, (lat, lng) = dados_do_local(endereco)
"""
from geopy import geocoders
if hasattr(settings, "EASY_MAPS_GOOGLE_KEY") and settings.EASY_MAPS_GOOGLE_KEY:
g = geocoders.Google(settings.EASY_MAPS_GOOGLE_KEY)
else: