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 / responsivel_table.css
Created July 28, 2018 14:47
responsivel table
/*
Max width before this PARTICULAR table gets nasty. This query will take effect for any screen smaller than 760px and also iPads specifically.
*/
@media
only screen
and (max-width: 760px), (min-device-width: 768px)
and (max-device-width: 1024px) {
/* Force table to not be like tables anymore */
table, thead, tbody, th, td, tr {
@olivx
olivx / change_select_feed.js
Created July 27, 2018 19:08
Feed when change the value
$('#id_job_department').change(function(event) {
var department_pk = $(this).val()
url = "{% url 'json_sub_department' %}"
if ($(this).children('option:first-child').is(':selected')) {
$('#id_job_sub_department').children('option:not(:first)').remove();
}else{
$.ajax({
dataType:'json',
data: {'pk': department_pk},
@olivx
olivx / cropper.min.css
Created June 15, 2018 17:17
Crop Image user profile django & jquery
/*!
* Cropper v3.0.0-beta
* https://github.com/fengyuanchen/cropper
*
* Copyright (c) 2017 Fengyuan Chen
* Released under the MIT license
*
* Date: 2017-02-25T07:44:44.656Z
*/
@olivx
olivx / style.css
Created May 23, 2018 14:00
css utils
.boxfilters {
padding:13px 20px;
background-color:#fff;
border:1px #ddd solid;
max-height:150px;
overflow: auto;
margin-bottom:10px;
}
.badge-unemp {
background-color: rgba(247, 226, 197, 0.49);
@olivx
olivx / comandos-docker
Created May 20, 2018 02:36 — forked from geiltonxavier/comandos-docker
Comandos do Docker
Segue a lista de comandos docker e sua utilidade:
docker attach – Acessar dentro do container e trabalhar a partir dele.
docker build – A partir de instruções de um arquivo Dockerfile eu possa criar uma imagem.
docker commit – Cria uma imagem a partir de um container.
docker cp – Copia arquivos ou diretórios do container para o host.
docker create – Cria um novo container.
docker diff – Exibe as alterações feitas no filesystem do container.
docker events – Exibe os eventos do container em tempo real.
docker exec – Executa uma instrução dentro do container que está rodando sem precisar atachar nele.
@olivx
olivx / switch.html
Last active May 22, 2018 22:41
switch_button
<label class="switch">
<input type="checkbox" class="switch_btn" name="apply_cv_no_file" data-btn="apply_no_cv_btn" checked >
<span class="slider round"></span>
</label>
''' 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)
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
)
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
# 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)