Skip to content

Instantly share code, notes, and snippets.

View olivx's full-sized avatar

Thiago Oliveira olivx

  • Tivit
  • Sao Paulo
View GitHub Profile
@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

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);
}
};
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();
}
});
}
@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>
@echo off
cmd /k "cd /d C:\Users\Admin\Desktop\venv\Scripts & activate & cd /d C:\Users\Admin\Desktop\helloworld & python manage.py runserver"
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)
# weasyprint
from weasyprint import HTML
context = {}
html_string = render_to_string('template.html', context=context, request=request)
html = HTML(string=html_string)
file_name = '%s.pdf' % obj.pk
pdf_path = os.path.join(settings.MEDIA_ROOT, 'resumes', file_name)
html.write_pdf(target=pdf_path)
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
def attach_to_job(request, items, job_id, company, _candi_type='candidate'):
if items:
if not job_id:
messages.error(request, _('Selecione ao menos uma vaga.'))
else:
job = Job.objects.get(id=job_id)
job_stage = JobStages.objects.get(
job=job,
order=1
)
''' lasts jobs for each candidate '''
_model = Candidate.objects.values('candidate').annotate(max_date=Max('apply_date')).order_by()
q_object = Q()
for last in _model:
q_object |= (Q(candidate=last['candidate']) & Q(apply_date=last['max_date']))
candidates = Candidate.objects.filter(q_object)