forgotten labs

Author: Artur Czepiel (page 1 of 4)

Python: random datetime from given range

start =
end = start + timedelta(seconds=60*15) # 15 minutes

random_unixtime = random.randrange(

# or
import time
random_unixtime = random.randrange(


Django tests: self.assertEqual(foo, bar) vs assert foo == bar

Why does self.assertEqual from django.test.TestCase is better than using assert foo == bar?

assert foo == bar

 line 117, in test_speaking_category
    assert == "Speaking"

self.assertEqual(foo, bar)

line 118, in test_speaking_category
    self.assertEqual(, "Speaking")
AssertionError: u'Random Questions' != u'Speaking'
- Random Questions
+ Speaking

Creating Child Theme in WordPress (aka how this theme was made)

It’s really easy to build a WordPress theme based on some other one. Nowadays you can use a thing called Child Themes which simplifies development a lot.

Let’s say you have a nice theme, such as a new default one, but you want to modify it a bit. Let’s say you just want to change some colors. And paddings.

You can do that by creating child theme, which can override things you want, but leave rest of the theme unchanged. That’s how current theme for this site was built.

All it took was to create a new directory in wp-content/themes/ and adding style.css inside:

Theme Name: FLv2013
Theme URI:
Author: Artur
Author URI:
Version: 0.1
License URI: 
Template: twentythirteen

@import url("../twentythirteen/style.css");
.site-title { text-align: center; color: #444}
.site-title:hover { text-decoration: none !important; }
.site-description { text-align: center;}
#navbar { display: none; }
body { border-left: .5em solid #bc360a; }
.entry-title { font-size: 38px }
.newsletter-email { width: 100%; }

(important part was bolded, rest is optional).

If you won’t add @import url(old/path/goes/here) you’ll overwrite all style.css files.

You can do exactly the same for each *.php files, (except for functions.php which works on a bit different rules)

Older posts
bbw indian
desi porn hub videos