Wednesday, July 20, 2016

TIP: kill service on port in macOS

Example: Postgres, which runs on port 5432:

lsof -Pn | awk '/:5432..LISTEN/ {print $2}' | xargs -t kill

Does anyone know if Brew or something has the equivalent of good old Linux fuser -k 5432 ?

Tuesday, July 12, 2016

TIP: edit files with Git merge conflicts

subl $(git diff --name-only --diff-filter=U)

This is even easier if you have a Git alias:

subl $(git unmerged)

In both cases it uses the Sublime text editor to open any file that has a Git merge conflict.

Monday, July 4, 2016

TIP: Git Grep searches your project really fast

Searching inside a large project of source code can be a challenge

In my codebase there's lots of "delete" methods, but only a few "_delete_" methods. If I search for "delete", I'll get zillions of false positives. By using the super-fast Git Grep and also "\W" for matching non-word-characters, I can find all references of the target string "_delete_":

$ git grep '\W_delete_\W'
app/        order._delete_()
app/    def _delete_(self, **kwargs):

talk: Functional Programming and Django QuerySets

I'll be giving this talk Tuesday!  As this is the Django Meetup, I'm expanding the Django section and adding more general testing tips.

I'll post a link on this site and the twitters when the slides and video are available.