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
# -*- coding: utf-8 -*- | |
def get_airports(): | |
airports = sorted(AIRPORTS, key=lambda airport: airport[0]) #sortear por el país | |
return [(a[2] , "%s - %s (%s)" % (a[0], a[1], a[2]) ) for a in airports] | |
AIRPORTS = [ | |
( "Denmark", "Aalborg", "AAL" ), | |
( "Norway", "Aalesund", "AES" ), | |
( "Denmark - Bus service", "Aarhus", "ZID" ), | |
( "Denmark - Tirstrup", "Aarhus", "AAR" ), |
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
# -*- coding: utf-8 -*- | |
LANGUAGES = { | |
"ab" : ["Abkhaz", u" аҧсуа бызшәа"], | |
"af" : ["Afrikaans", u"Afrikaans"], | |
"sq" : ["Albanian", u"shqip"], | |
"am" : ["Amharic", u" አማርኛ"], | |
"ar" : ["Arabic", u"العربية"], | |
"hy" : ["Armenian", u"Հայերեն"], | |
"az" : ["Azerbaijani", u"azərbaycan"], | |
"bm" : ["Bambara", u"Bamanankan"], |
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
These two files provide limited syntax highlighting using the most | |
excellent codemirror syntax highlighter. | |
See: | |
http://marijn.haverbeke.nl/codemirror/ | |
Stick the .js and .css files in the appropriate spots for your | |
codemirror installation. | |
You can enable it on a textarea using something like: |
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
# -*- coding: utf-8 -*- | |
from django.db.models.signals import post_save | |
#https://github.com/citylive/django-states2 | |
#inspired on http://stackoverflow.com/questions/110803/dirty-fields-in-django | |
class TrackStateMixin(object): | |
def __init__(self, *args, **kwargs): | |
super(TrackStateMixin, self).__init__(*args, **kwargs) | |
self._original_state = self._as_dict() |
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
""" | |
Basic script to scrap pages with selenium | |
requires: | |
- lxml | |
- selenium http://seleniumhq.org/download/ | |
execution: | |
1. start selenium server | |
$ java -jar selenium-server-standalone-2.16.jar |
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 | |
set -o errexit | |
# Author: David Underhill | |
# Script to permanently delete files/folders from your git repository. To use | |
# it, cd to your repository's root and then run the script with a list of paths | |
# you want to delete, e.g., git-delete-history path1 path2 | |
if [ $# -eq 0 ]; then | |
exit 0 |
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
#http://blog.gravatar.com/2008/01/17/gravatars-in-python-25/ | |
import urllib, hashlib | |
# Set your variables here | |
email = "[email protected]" | |
default = "http://www.somewhere.com/homsar.jpg" | |
size = 40 | |
def get_gravatar(email): | |
gravatar_url = "http://www.gravatar.com/avatar.php?" |
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 urllib | |
import os | |
IMG_DIR = "/Users/kamil/Desktop/PROJECTOS/webtenerife/scrap_actualidad-fr" | |
def download(url): | |
"""Copy the contents of a file from a given URL | |
to a local file. | |
""" | |
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
[core] | |
editor = mate -w | |
[user] | |
name = kamil | |
email = [email protected] | |
[color] | |
ui = auto | |
[alias] | |
ai = add --interactive |
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
/* | |
require: jquery | |
add: | |
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script> | |
*/ | |
var Mapper = function( map_canvas, options ){ | |
var map_canvas = document.getElementById(map_canvas || "map_canvas"); | |
this.markersArray = []; | |
this.infoWindow = new google.maps.InfoWindow(); |