This file contains 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
#!/usr/bin/env python | |
import sys | |
import operator | |
from collections import Counter | |
def highess_likeness(words): | |
letter_count = Counter(''.join(words)) | |
word_score = [ |
This file contains 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
date | commits | |
---|---|---|
2014-08-29 | 7 | |
2013-07-21 | 1 | |
2013-02-08 | 2 | |
2015-05-14 | 12 | |
2013-10-09 | 3 | |
2013-04-29 | 4 | |
2014-05-27 | 18 | |
2014-11-05 | 3 | |
2013-04-05 | 44 |
This file contains 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 os | |
from distutils.sysconfig import get_python_lib | |
from distutils.dir_util import copy_tree | |
def resolve_pip_data_files(fix_packages=None): | |
""" | |
See http://stackoverflow.com/questions/20298729/pip-installing-data-files-to-the-wrong-place/20370738#20370738 # noqa | |
and http://stackoverflow.com/questions/30980682/djangos-locale-files-installed-in-weird-place # noqa |
This file contains 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
def get_context_data(self, search_term, **kwargs): | |
kwargs['search_term'] = search_term.strip() | |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<opml version="1.0"> | |
<head> | |
<title>Visgean subscriptions in feedly Cloud</title> | |
</head> | |
<body> | |
<outline text="IT" title="IT"> | |
<outline type="rss" text="Ars Technica" title="Ars Technica" xmlUrl="http://feeds.arstechnica.com/arstechnica/index/" htmlUrl="http://arstechnica.com"/> | |
<outline type="rss" text="hexadecimální doupě" title="hexadecimální doupě" xmlUrl="http://dex.bloguje.cz/rss.xml"/> |
This file contains 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 datetime import timedelta, datetime | |
from dateutil.relativedelta import relativedelta | |
def get_months_range(base_date=None, months_back=0): | |
""" | |
Returns calendar month for given date | |
Args: | |
base_date: date to be used, date.today is default |
This file contains 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 os | |
def get_block_range (filename, lookupValue): | |
""" | |
Returns the index of the first line that contain ``lookupValue`` | |
and end of the file | |
# here the value was at line 941 and the file had 1000 lines. | |
>>> get_block_range('example.txt', 'example') | |
(941, 1000) |
This file contains 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
def date_range(first_date, second_date): | |
""" | |
Returns range of dates between first and second date | |
:type first_date: datetime.date | |
:type second_date: datetime.date | |
:return: list of dates | |
""" | |
if first_date == second_date: | |
return [] | |
elif first_date > second_date: |
This file contains 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
def date_range(first_date, second_date): | |
""" | |
Returns range of dates between first and second date | |
:type first_date: datetime.date | |
:type second_date: datetime.date | |
:return: list of dates | |
""" | |
if first_date == second_date: | |
return [] | |
elif first_date > second_date: |
This file contains 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
>>> voting_round_instance = models.VotingRound.objects.first() | |
>>> voting_round_instance.vote_set.values('vote').annotate(count=Count('vote')).distinct() | |
[{'vote': u'decline', 'count': 1}, {'vote': u'neutral', 'count': 1}, {'vote': u'decline', 'count': 1}, {'vote': u'approve', 'count': 1}, {'vote': u'approve', 'count': 1}] |