Skip to content

Instantly share code, notes, and snippets.

View rg3915's full-sized avatar
🏠
Working from home

Regis Santos rg3915

🏠
Working from home
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

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();
}
});
}
# https://github.com/aykut/django-bulk-update
from django_bulk_update.helper import bulk_update
from minhaapp.models import MeuModelo
queryset_meumodelo = MeuModelo.objects.all()
# limpa os dados
for meumodelo_obj in queryset_meumodelo:
@dunossauro
dunossauro / methods.py
Last active May 26, 2018 00:01
Exemplo de como funcionam os decoradores de classe para o @rg3915
"""
Respondendo a questões feitas no grupo da live de Python.
"""
class Teste:
bananas_cls = 5 # Variável de classe
def __init__(self):
"""Método que inicia a instância."""
self.bananas_self = 10 # Variável de instância
@luzfcb
luzfcb / installing_pyenv_on_ubuntu_based_distros.md
Last active April 18, 2025 22:04
Quick install pyenv and Python

Tested only on Ubuntu 24.04, KDE Neon User Edition (based on Ubuntu 24.04) and OSX Mojave or higher.

will probably work on other newer versions, with no changes, or with few changes in non-python dependencies (apt-get packages)

NOTE: Don't create a .sh file and run it all at once. It may will not work. Copy, paste, and execute each command below manually. :-)

Ubuntu

# DO NOT RUN THIS AS A ROOT USER
// Bootstrap datepicker
$('.input-daterange input').each(function() {
$(this).datepicker('clearDates');
});
// Set up your table
table = $('#my-table').DataTable({
paging: false,
info: false
});
@dunossauro
dunossauro / convert_string_types.py
Last active December 14, 2018 18:21
Conversão de strings em tipos válidos do python usando literal_eval
from ast import literal_eval
def convert_to_type(input_data):
try:
return literal_eval(input_data)
except (ValueError, SyntaxError):
return input_data
@kevinbreaker
kevinbreaker / Slides.md
Last active September 3, 2018 05:22
Slides dos palestrantes do Vuejs Summit 2018
@olivx
olivx / filter_applicants.py
Last active September 22, 2018 00:11
filter_applicants multiples elements separator per ', ' example with Q() object
def add_q_object(self, keyword, q_object, query_parm):
for key in keyword:
kwargs = {query_parm: key.strip()}
q_object.add(Q(**kwargs), q_object.OR)
def filter_applicants(self, _queryset=None):
my_applicants = _queryset
"""
Django ORM Optimization Tips
Caveats:
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
"""
# ---------------------------------------------------------------------------