Skip to content

Instantly share code, notes, and snippets.

View olivx's full-sized avatar

Thiago Oliveira olivx

  • Tivit
  • Sao Paulo
View GitHub Profile
from django.core.mail import get_connection, EmailMultiAlternatives
from django.template.loader import render_to_string
connection = get_connection()
connection.open()
context = {'object': object }
html_string = render_to_string('template.html',context=context, request=request)
@echo off
cmd /k "cd /d C:\Users\Admin\Desktop\venv\Scripts & activate & cd /d C:\Users\Admin\Desktop\helloworld & python manage.py runserver"
@olivx
olivx / pagination.html
Last active March 28, 2018 22:04
create pagination
<div class="text-center">
{% if object_list.has_other_pages %}
<ul class="pagination">
{% if object_list.has_previous %}
<li>
<a href="?page={{ object_list.previous_page_number }}{% querystring request %}">&laquo;</a>
</li>
{% else %}
<li class="disabled">
<span>&laquo;</span>
function filter(element, selector) {
var value = $(element).val().toUpperCase();
$(selector +" li").each(function () {
if ($(this).text().toUpperCase().indexOf(value)> -1) {
$(this).show();
} else {
$(this).hide();
}
});
}
var phone_mask = function (val) {
return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009';
},
phone_option = {
onKeyPress: function (val, e, field, options) {
field.mask(phone_mask.apply({}, arguments), options);
}
};
@olivx
olivx / docker_basic.md
Last active November 1, 2018 02:26
basico docker

Manual Docker LinuxTip

instalação

curl -fsSL https://get.docker.com/ | sh

primieiro docker container

sudo docker run hello-world

visualizar o container em execução

sudo docker ps