This file contains 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
{{extend 'layout.html'}} | |
<h1 id=""> | |
Save a new post</h1> | |
{{=form}} |
This file contains 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
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/> | |
<title>{% block title %}Blog{% endblock %}</title> | |
</head> | |
<body id=""> | |
{% block content %} | |
{% endblock %} | |
</body> |
This file contains 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
{% extends "base.html" %} | |
{% block content %} | |
<ul> | |
{% for post in posts %} | |
<li> | |
{{ post.title }} (written by {{ post.author.nickname() }}) | |
{{ post.content }} | |
</li> |
This file contains 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
{% extends "base.html" %} | |
{% block content %} | |
<h1 id="">Write a post</h1> | |
<form action="{{ url_for('new_post') }}" method="post" accept-charset="utf-8"> | |
{{ form.csrf_token }} | |
<p> | |
<label for="title">{{ form.title.label }}</label> | |
{{ form.title|safe }} |
This file contains 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
@admin.route('/languages/<slug>', methods=['PUT']) | |
def update_language(slug): | |
return 'Hi' |
This file contains 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
# Push git changes. $1 = destination branch | |
function git_push() { | |
typeset current_branch=$(parse_git_branch) | |
typeset destination_branch="$1" | |
if [ "$destination_branch" = "" ] | |
then | |
typeset destination_branch="master" | |
fi | |
git checkout $destination_branch; git merge $current_branch; git pull origin $destination_branch; git push origin $destination_branch; git checkout $current_branch | |
} |
This file contains 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
def escreve_unidade(numero): | |
unidades = ('', 'um', 'dois', 'tres', 'quatro', 'cinco', 'seis', 'sete', 'oito', 'nove') | |
return unidades[numero] | |
def escreve_dezena(numero): | |
retorno = '' | |
valor = numero / 10 | |
dezenas10 = {10 :'dez', 11:'onze', 12:'doze', 13:'treze', 14:'quatorze', 15:'quinze', 16:'dezesseis', 17:'dezessete', 18:'dezoito', 19:'dezenove'} | |
dezenas = {2:'vinte', 3:'trinta', 4:'quarenta', 5:'cinquenta', 6:'sessenta', 7:'setenta', 8:'oitenta', 9:'noventa'} | |
resto = numero % 10 |
This file contains 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
def editar_pousada(request, id): | |
pousada = Pousada.objects.get(pk=id) | |
if request.method == 'POST': | |
form = PousadaForm(request.POST, instance = usuario) | |
if form.is_valid(): | |
form.save(request.user) | |
return HttpResponseRedirect(reverse('pousada.views.list_posts')) | |
else: | |
form = PousadaForm(instance = usuario) | |
return render_to_response('pousadas/editar.html', locals(), context_instance=RequestContext(request)) |
This file contains 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
#include <stdio.h> | |
#include <string.h> | |
int main () { | |
char onibus[4][9]; | |
int i, j, linha, coluna, opcao, fileira, na_janela = 0, no_corredor = 0, ocupadas = 0; | |
char lado[20], poltrona[20]; | |
for (i = 0; i < 4; i++) { | |
for (j = 0; j < 9; j++) { |
This file contains 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
#include <stdio.h> | |
#include <string.h> | |
int main () { | |
char *pais = "Brasil"; | |
int tamanho = strlen(pais), i; | |
printf("Ao contrário: "); | |
for (i = tamanho; i >= 0; i--) { | |
printf("%c", *(pais + i)); | |
} |