I learned a hard lesson today: to make Swift really fast you have to know what you’re doing. You can’t just slap some code together and expect it to be zippy without understanding some of how Swift was designed and how it works. There is a very good presentation by some of the team members that built Swift here. My initial takeaway was that it was important to finalize any classes you didn’t plan on subclassing, incrementally check the timing analyzer, and finally, employ whole module optimization.
Monthly Archives: December 2015
Running Nosetests with Multiple Versions of Python
This is a short post–just a TIL sort of thing. I had an issue today where the system Python was 2.6, but I needed to run a test on some code that used Python 2.7. After some jiggering I figured out how to test my Python 2.7 code. Rather that simply running,
nosetests tests.py
I ran, instead,
/usr/local/bin/python2.7 /usr/bin/nosetests tests.py
Boom. Now we’re testing.
Cocoa REST Client
Here’s an awesome thing: an easy-to-use, free, open-source, native OS X app for testing HTTP/REST endpoints. You can even save common calls for future reference. Check out mmattozzi‘s cocoa-rest-client right now. (Seriously, stop what you’re doing.)
Pretty-printing JSON in the Terminal
I use cURL quite a bit when debugging APIs and I found this neat trick for pretty-printing JSON output. Add the following line to your .bashrc
or .zshrc
file,
alias json="python -m json.tool"
Then you can pipe your cURL output through your new json
tool and print everything nicely,
curl -g http://some.domain/api/call | json