This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# listar bancos de dados | |
\list | |
# passa a usar o banco | |
\c <banco> | |
# sair do prompt | |
\q | |
# mostrar todas as tabelas |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysqldump -u <user> -p --host=<host> --port=<port> <database> > <filename>.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Teste em ambiente Windows | |
cls | |
python manage.py test %* --settings=app.settings.test | |
rd /S /q %~dp0\media_tests | |
# Teste em ambiente Unix | |
clear | |
python manage.py test $* --settings=app.settings.test | |
rm -rf $(dirname $0)/media_test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="/js/dojo.js" | |
data-dojo-config="'selectorEngine': 'sizzle/sizzle', 'packages': [{'name': 'sizzle', 'location': 'https://rawgithub.com/jquery/sizzle/master/dist/'}]" ></script> | |
<script src="my.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import floor | |
BASE62 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
def base_convert(src, from_base=10, to_base=16, alphabet=BASE62): | |
src = str(src) | |
from_alphabet = alphabet[:from_base] | |
to_alphabet = alphabet[:to_base] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from django.db import models | |
from django.utils.crypto import get_random_string | |
from django.utils.translation import ugettext_lazy as _ | |
class Discount(models.Model): | |
discount = models.FloatField(_('Discount Value')) | |
code = models.CharField(_("Discount code"), max_length=255, unique=True, default=get_random_string) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from django.contrib.auth.admin import UserAdmin | |
from django.contrib.auth.models import User | |
class UserAdmin(admin.ModelAdmin): | |
list_display = ('email', 'first_name', 'last_name') | |
list_filter = ('is_staff', 'is_superuser') | |
search_fields = ('email',) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from django.utils.translation import ugettext_lazy as _ | |
from atdfb.core.models import Complaint | |
class ComplaintAdmin(admin.ModelAdmin): | |
list_display = ('order_number', 'subject', 'message', 'created_at', 'solved_by', 'checked',) | |
def get_readonly_fields(self, request, obj=None): | |
if request.user.has_perm('core.can_edit_fields'): | |
readonly = ('solved_by',) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="container"> | |
<div id="i1"></div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function replace_accents($string) | |
{ | |
return str_replace( array('à','á','â','ã','ä', 'ç', 'è','é','ê','ë', 'ì','í','î','ï', 'ñ', 'ò','ó','ô','õ','ö', 'ù','ú','û','ü', 'ý','ÿ', 'À','Á','Â','Ã','Ä', 'Ç', 'È','É','Ê','Ë', 'Ì','Í','Î','Ï', 'Ñ', 'Ò','Ó','Ô','Õ','Ö', 'Ù','Ú','Û','Ü', 'Ý'), array('a','a','a','a','a', 'c', 'e','e','e','e', 'i','i','i','i', 'n', 'o','o','o','o','o', 'u','u','u','u', 'y','y', 'A','A','A','A','A', 'C', 'E','E','E','E', 'I','I','I','I', 'N', 'O','O','O','O','O', 'U','U','U','U', 'Y'), $string); | |
} |