Raymond Hettinger gives a great, concise and immediately useful examples of idiomatic Python.
Raymond Hettinger gives a great, concise and immediately useful examples of idiomatic Python.
Interesting proposition: how do you report 1.2k crashes at once?
One of the less serious, but still very interesting (and insightful) talks from 29c3.
I just felt the need for a script that could extract the audio track of a video, transcode it and save it as an mp3 file … 2 hours later I was finished (get the Gist). 😀 It uses VLC to do hard work. 😉
Thanks to Kris Hom for the inspiration. 🙂
Update 2014-03-01:
Update 2014-11-05:
Update 2016-03-05
Two great talks from RubyConf 2012:
You can find more talks from that conference on YouTube … one I already mentioned. 😉
I take my head off to Jim, that’s a great way to approach a weird intersection of mathematics and programming. 😉 For those who are curious … he uses a very simple mathematical algorithm to explore how you can express recursions in Lambda calculus and thus “derives” the Y combinator.
Totally useless, but worth every minute. 😉
My patch for revamping the comments and adding proper discussion threads has been accepted and will be in GitLab 4.1 (due next week). 😀
Craig Dennis has an interesting blog post why and how you should design empty states in your apps.
Let’s say you read settings from a YAML file and have some sort of settings object. Then you check if certain options are set with custom values or you have to set default/fall-back values on them. If you are dealing with Boolean options you have to be careful … as I had to find out myself.
Initially you would probably do something like the following to set a default value on a Boolean option:
settings[:some_option] ||= true # set default value if nothing set
Do you see the problem? What happens if the option was deliberately set to
false
? You would overwrite it because both cases
nil
(i.e. nothing set) and
false
would evaluate to
false
in the context of the
||=
operator and you would in both cases assign the right hand value (and overriding an explicit user choice in one case) … *ouch*.
So the correct solution is something like the following:
settings[:some_option] = true if settings[:some_option].nil?
Just be careful … 😀
Yay … GitLab 3.1 is out. 😀