I want to know how to make static files show up when developing locally.
- Think of some search terms that might describe what you're looking for. Let's go with django static files runserver
""" | |
Programming interview practice of the week (2013-02-20) | |
Problem of the week - Singletons considered okay | |
1. Write a simple singleton class in your favorite programming language with an example usage. | |
2. Solve the Sorted array binary search problem: | |
Given a sorted array of integers array and an integer key, return the index of the first instance of key in the array. If key is not present in array, you should return -1. |
>>> from time import mktime | |
>>> from datetime import datetime | |
>>> mktime(datetime(2038, 1, 18, 19, 14, 30).timetuple()) | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
OverflowError: mktime argument out of range |
#!/usr/bin/env python | |
from unittest import TestCase, main | |
from turn_picker import score | |
class TurnPickerTest(TestCase): | |
def test_score_low_vs_high_attendance(self): | |
self.assertGreater(score(2, 10, 0), score(50, 200, 12)) |
$ python setup.py test | |
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'mantainer' | |
warnings.warn(msg) | |
running test | |
running egg_info | |
writing django_simple_history.egg-info/PKG-INFO | |
writing top-level names to django_simple_history.egg-info/top_level.txt | |
writing dependency_links to django_simple_history.egg-info/dependency_links.txt | |
reading manifest file 'django_simple_history.egg-info/SOURCES.txt' | |
reading manifest template 'MANIFEST.in' |
import datetime as dt | |
class datetime(dt.datetime): | |
def __divmod__(self, delta): | |
seconds = int((self - dt.datetime.min).total_seconds()) | |
remainder = dt.timedelta( | |
seconds=seconds % delta.total_seconds(), | |
microseconds=self.microsecond, | |
) |
from decimal import Decimal | |
from json_singledispatch import encode | |
@encode.register(set) | |
def encode_set(obj): | |
return encode(list(obj)) | |
#!/usr/bin/env python | |
""" | |
Find Creative Commons Music | |
Provide names of musical artists and the script returns any relevant URLs for | |
FreeMusicArchive.org, Jamendo.com, and Magnatune.com. | |
Usage:: | |
$ ./findccmusic.py <artist name>... |
#!/usr/bin/env python | |
""" | |
Search downpour.com and emusic.com for DRM-free audiobooks | |
Usage:: | |
./find_audiobooks.py <title>... | |
File released to the public domain under CC0 license: | |
http://creativecommons.org/publicdomain/zero/1.0/deed |
var some_variable = some_function(an_argument, | |
another_argument); | |
var soome_variable = some_function( | |
an_argument, | |
another_argument | |
); |