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
| #include <MicroView.h> // include MicroView library | |
| int buttonPin = A0; // push button pin | |
| int buttonState = 0; // variable to store the pushbutton status | |
| int counter = 0; // counts the number of clicks | |
| int current = 0; // holds the current state | |
| int ticks = 0; // cycle counter | |
| int current_ticks = 0; // Last ticks when the button was released | |
| int doubleclick_max = 50; // topmost double click, if you can't do better call someone younger :P | |
| int difference = 0; // Your record in double click |
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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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.utils.hashcompat import md5_constructor | |
| # Replace by | |
| from hashlib import md5 as md5_constructor | |
| # Even better, take a look at | |
| # https://github.com/justquick/django-native-tags/pull/13/files |
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
| #!/bin/bash | |
| # This script will compile the translation messages of all translatable django applications | |
| # Author: AxiaCore S.A.S. http://axiacore.com | |
| langs="es" | |
| a=`ls -l | grep ^d | awk '{print $9}'`; | |
| curdir=`pwd` | |
| for i in $a | |
| do |
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
| CartSale.objects.annotate(Count('products'),Sum('products__quantity')) |
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
| #Para contar la cantidad de ventas que se han efectuado: | |
| Cartsale.objects.count() | |
| #Para contar el precio promedio del valor de los artículos vendidos: | |
| CartProduct.objects.aggregate(Avg('price')) | |
| #Para obtener la cantidad de productos que se han vendido: | |
| CartProduct.objects.aggregate(Sum('quantity')) | |
| #Para obtener la cantidad de compras registradas a nombre de un mismo correo: |
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
| class CartSale(models.Model): | |
| first_name = models.CharField( | |
| max_length=100, | |
| ) | |
| last_name = models.CharField( | |
| max_length=100, | |
| ) | |
| date_sale = models.DateTimeField( | |
| auto_now_add=True, | |
| ) |
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 | |
| import autocomplete_light | |
| from models import Address | |
| class AddressAdmin(admin.ModelAdmin): | |
| form = autocomplete_light.modelform_factory(Address) | |
| admin.site.register(Address, AddressAdmin) |
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
| import autocomplete_light | |
| from cities_light.models import City | |
| autocomplete_light.register(City, search_fields=('search_names',), | |
| autocomplete_js_attributes={'placeholder': 'city name ..'}) |
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
| {% extends "admin/base.html" %} | |
| {% block extrahead %} | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script> | |
| {% include 'autocomplete_light/static.html' %} | |
| {% endblock %} |