Category Archive: Uncategorized

Sep
24

So you want to mock python’s open.

It’s kind of silly. You can’t use the decorator form of mock.patch since this version doesn’t return anything, so you have to use the context manager version. mock_open = mock.mock_open() with mock.patch(‘your.module.path.open’, mock_open, create=True): thing.you_are_testing_that_uses_open(your, params, here) mock_open.assert…

Feb
29

Must Read This Later

A comparison of scripting languages.

Aug
29

Bad Error Message is Unhelpful

So, I’m still learning Django and have a long ways to go, but the following error is extremely unhelpful: “TemplateSyntaxError: Invalid block tag: ‘else’, expected ‘else’ or ‘endif’” The problem is, Django doesn’t do else if, but my editor does highlight it as if it’s correct. You then get this error message, but have to …

Continue reading »

Jul
21

__new__ vs. __init__

While running around debugging some timeouts with a coworker we came across __new__. Of course we were then curious as to what __new__ was and how it was different than __init__.  There was a good explanation on StackOverflow.  Although I understand it now, I’m not sure when I would need to subclass an immutable type.  …

Continue reading »

Jul
06

I’m going to waste so much time with this

http://www.incredibox.fr/bigbox_en.swf IT MAKES MUSIC!!!

Jul
06

The Balloonist

Not my joke, but hilarious: A woman in a hot air balloon realized she was lost. She reduced altitude and spotted a man below. She descended a bit more and shouted: ‘Excuse me, can you help me? I promised a friend I would meet him an hour ago but I don’t know where I am..’ …

Continue reading »

May
31

MacVim BClose

There are two ways to close buffers in MacVim: 1) :bd (Buffer Delete) This deletes one buffer, but the problem is, it won’t open it again during that session. 2) :q (quit) This closes ALL the buffers and the app. Neither does what I want most of the time, but I found this: http://vim.wikia.com/wiki/Deleting_a_buffer_without_closing_the_window It’s …

Continue reading »

May
16

Git Is Finicky

So, we have a release happening soon, and I needed to cherry-pick a few essential changes into the release candidate and upon trying to push them, I was told everything was up to date. ORLY NAO? Apparently, every now and again Git decides it wants to mess with me, and today is one of those …

Continue reading »

Apr
05

MacVim PEP-8 Helper

To follow along with PEP-0008 standards, there is a command that will highlight any characters beyond the 79 char limit.  It’s a useful little reminder that you’ve reached your limit. :match ErrorMsg ‘\%>79v.\+’

Mar
23

Captcha Quirk

So, it’s come to my attention that when you enter a captcha, the only thing that has to actually match character for character is the first word. The second one just has to match in length, but as far as I can tell, it can be any mix of characters. I heard a rumor that …

Continue reading »

Older posts «