Skip to content

Instantly share code, notes, and snippets.

View NekoTashi's full-sized avatar

Christopher Rubio Márquez NekoTashi

View GitHub Profile
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</head>
<body>
<form action="http://localhost:8000/api/carga/" method="post" id="uploadForm" name="form" enctype="multipart/form-data">
<input id="fileInput" class="input-file" name="file" type="file">
<input type="submit" value="Post Images/Files" />
</form>
<script>
results = [{
"pk": 10,
"cliente": 437,
"factura": 13592,
"monto_pagado": 1000,
"tipo_pago": "1",
"comentario": "wea",
"create_date": "2016-01-20T21:36:03.743930Z",
"fecha_pago": null,
"patente": "abcd14"
$scope.$on('eventGetPatsPagosDeHoy', function(event, data) {
var patentes = [];
var total_recaudado = 0;
var t = 0;
var fecha_p = '';
var results = data.results;
var patents = results.map(function(item) {
return item.patente;
});
@NekoTashi
NekoTashi / algoritmo_pareamiento.js
Created February 1, 2016 19:16
Algoritmo para el pareamiento de jugadores.
var registration = ['Tashi', 'Peter', 'Weye', 'Pacheco', 'Diego', 'Javier', 'Wamemi'];
console.log(registration);
// arrays que contendran el pareamiento de los jugadores
var pairing_1 = [];
var pairing_2 = [];
// variable que verifica si registration esta vacio
var is_registration_empty = false;
from rest_framework import filters
from rest_framework import pagination
from rest_framework import mixins
from rest_framework.authentication import TokenAuthentication
from rest_framework.authentication import SessionAuthentication
from .permissions import IsAuthorized
from .filters import ExampleFilter
{% for auto in queryset_auto %}
{% for caracteristicas in auto.caracteristicas_set %}
...
{% endfor %}
{% endfor %}

Python 2.7

Windows

  • https://www.python.org/downloads/

Sublime Text 3

  • https://www.sublimetext.com/3
@NekoTashi
NekoTashi / filters.py
Last active April 12, 2016 06:03
Ejemplo DRF filter con django_filters.
class GatoFilter(django_filters.FilterSet):
class Meta:
model = Gato
fields = ['user__pk', ]
@NekoTashi
NekoTashi / map_y_filter.js
Created June 2, 2016 21:05
Ejemplo simple de .map() y .filter().
// función map
var numeros = [1, 4, 9];
var sumarUno = function(elemento) {
return elemento + 1;
};
resultado = numeros.map(sumarUno);
console.log(resultado);
// [ 2, 5, 10 ]

Problema DST Time Zone

Buenas, tengo una duda con respecto al cambio de hora en django. Resulta que hace unos meses atrás actualicé la hora del servidor. Al consultar la hora, me muestra la hora actual (UTC y el local time) de manera correcta. Pero al hacer la misma consulta dentro de la shell de django, me muestra el local time antiguo (UTC me lo muestra correcto). Entonces las dudas serían: De dónde saca django el tzdata para manipular las fechas locales y cómo podría cambiar este comportamiento. Mandaré una muestra de los logs:

$ python manage.py shell_plus

In [1]: timezone.localtime(timezone.now())
Out[1]: datetime.datetime(2016, 7, 14, 2, 29, 27, 639950, tzinfo=<DstTzInfo 'America/Santiago' CLT-1 day, 21:00:00 STD>)