Skip to content

Instantly share code, notes, and snippets.

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

Lívio Cunha liviocunha

🏠
Working from home
View GitHub Profile
@liviocunha
liviocunha / settings.py
Created August 17, 2014 22:58
eventex-wttd-alexfalcucci / eventex / settings.py
"""
Django settings for eventex project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
--- a/eventex/settings.py
+++ b/eventex/settings.py
@@ -8,9 +8,8 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
<script>
$('select').on('change', inicio);
function inicio(){
var id = $(this).val();
var cat = {{pk}};
dados = {'id':id, 'cat':cat};
$.ajax({
data : dados,
@liviocunha
liviocunha / boilerplatesimple.sh
Last active February 28, 2021 04:45
django boilerplate simple
# V 0.0.1
# 2021-02-28
# Inspired by Regis do Python - https://github.com/rg3915
# Shell script to create a very simple Django project.
# This script require Python 3.x and pyenv
# Settings.py is config to Django 2.2.19
# The project contains:
@liviocunha
liviocunha / count_words.py
Created March 10, 2021 13:45
Desafio: Criar um método que conte vogais e consoantes numa frase
class Word(object):
def __init__(self):
self.vowels = ["A", "a", "á", "ã", "â", "à", "E", "e", "é", "ê", "I", "i", "í", "O", "o", "ó", "õ", "ô", "U", "u", "ú", "Y", "y"]
self.others_char = [" ", ",", ".", ";", "!", "?", "-", "_", "'", '"', "*", "+", "/"]
def vowels_count(self, phrase):
''' Percorre a frase e conta somente as vogais. '''
count_vowels = 0
for char in phrase:
@liviocunha
liviocunha / data_finder.py
Created March 25, 2021 03:24
Challenge DataFinder
def solver(lista_entrada, int_a, int_b):
# Variáveis auxiliares que serão usadas nas iterações
contador_strings = 0
repeticoes_de_a = 0
repeticoes_de_b = 0
# Início do 1º while
# len(lista_entrada) é a quantidade de elementos que possui a lista de strings e o contador_strings iniciou no 0 e na linha 41
# é feito a incrementação. Portanto o while irá ser executado até iterar por todos os elementos/strings da lista_entrada
while contador_strings < len(lista_entrada):
@liviocunha
liviocunha / boilerplatesimpledjangoninja.sh
Last active August 26, 2023 16:01
Boilerplate Simple Django Ninja
# V 0.0.3
# 2021-05-05
# Shell script to create a very simple Django Ninja project.
# This script require Python 3.x and pyenv
# Settings.py is config to Django 3.1.5 and Django Ninja 0.12.1
# The project contains:
# Settings config
# Admin config