See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope> is optional
| from django import forms | |
| from django.contrib.postgres.fields import ArrayField | |
| class ChoiceArrayField(ArrayField): | |
| """ | |
| A field that allows us to store an array of choices. | |
| Uses Django 1.9's postgres ArrayField | |
| and a MultipleChoiceField for its formfield. |
| # Here's your list of choices that would be displayed in a drop-down | |
| # element on the web. It needs to be a tuple, and we define this | |
| # as a variable just for readability/convenience. | |
| # | |
| # This example has 3 choices, each of which consists of two parts: | |
| # 1. the thing that get strored in your database | |
| # 2. the thing that you see in a dropdown list | |
| LABEL_CHOICES = ( | |
| ('this gets stored in your database', 'This item is what you see in the drop-down'), | |
| ('django', 'Django'), |
| from django.db import models | |
| # para todos los ejemplos de este gist, vamos a utilizar el modelo "Human" | |
| class Human(models.Model): | |
| '''Modelo de ejemplo que representa | |
| un humano y sus atributos. | |
| ''' | |
| first_name = models.CharField(max_length=30) | |
| last_name = models.CharField(max_length=30) | |
| birth_date = models.DateField() |
| Es necesario usar un viartualenv para poder manejar varios proyectos con diferentes versiones de paquetes como por ejemplo usar python7 | |
| en un proyecto de django o tener otro proyecto de django con python3 | |
| 1 - Es necesario instalar pip | |
| https://pip.pypa.io/en/stable/installing/ | |
| 2 - Se instala en virtualenv. Para crear un proyecto solo es necesario ejecutar el comando virtualenv [paht name] si se quiere usar | |
| una versión de python en especial solo se necesita usar el comando virtualenv -p /usr/bin/python2.7 [path name] | |
| después de esto se crea el proyecto y solo hace falta activarlo source [path name]/bin/activate | |
| http://virtualenv.readthedocs.org/en/latest/installation.html |
| # coding: utf-8 | |
| """ | |
| Draw a minimalist Christmas tree with Python and their awesome libraries. | |
| Code inspired by a StackEchange post and the Christmas spirit. | |
| http://codegolf.stackexchange.com/questions/15860/make-a-scalable-christmas-tree/16358#16358 | |
| Author: Franz Navarro - CAChemE.org | |
| License: MIT | |
| Dependencies: Python, NumPy, matplotlib | |
| """ |
| // Reference: http://lea.verou.me/2011/10/easily-keep-gh-pages-in-sync-with-master/ | |
| $ git add . | |
| $ git status // to see what changes are going to be commited | |
| $ git commit -m 'Some descriptive commit message' | |
| $ git push origin master | |
| $ git checkout gh-pages // go to the gh-pages branch | |
| $ git rebase master // bring gh-pages up to date with master | |
| $ git push origin gh-pages // commit the changes |