Skip to content

Instantly share code, notes, and snippets.

View wilmersondasilva's full-sized avatar

Wilmerson da Silva wilmersondasilva

  • Fortaleza
View GitHub Profile
# An very simple example of CRUD using Django + Django Rest Framework
# models.py file
from django.db import models
from django.contrib.auth.models import User
class Position(models.Model):
latitude = models.TextField()
longitude = models.TextField()
user = models.ForeingKey(User)
import datetime
keys = ['id', 'usuario_id', 'operador_id', 'nome', 'descricao', 'imagem_documento', 'orgao', 'data_criacao', 'data_emissao', 'data_validade', 'validado', 'notificacao', 'dias_aviso']
tupla_exemplo = (40, None, 45, 'MTR', 'Trecho de c\xc3\xb3digo retirado da aplica\xc3\xa7\xc3\xa3o Source Tree.', 'MTR1458151222193', 'Minist\xc3\xa9rio do Meio Ambiente', datetime.datetime(2016, 3, 16, 15, 0, 22), datetime.datetime(2016, 3, 14, 15, 0, 22), datetime.datetime(2016, 3, 23, 15, 0, 22), None, True, 5)
lista_fake_do_banco = [tupla_exemplo, tupla_exemplo, tupla_exemplo]
lista_desejada = []
@wilmersondasilva
wilmersondasilva / gist:2ecbc083570651c7119e
Created January 29, 2016 04:50 — forked from Bouke/gist:11261620
Multiple Python installations on OS X

Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv instead. If you are looking for the previous version of this document, see the revision history.

$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10

$ pyenv install 2.6.9

// Não vamos colocar meta. Vamos deixar a meta aberta e quando atingirmos a meta, vamos dobrar a meta.
function metaCtrl($scope) {
$scope.$watch(
function($scope) {
return $scope.meta;
},
function() {
if ($scope.meta) {
$scope.meta *= 2;
}