In VIM there is a command for char search:
f. After first use it can be repeated with
;. I like to navigate in line with it. You see that you need to go to bracket in a middle of a line - you press
f( and one-two
; and you are there. There's no such command in Emacs, so I had to write my own. I've managed even to implement repetition with
(setq last-search-forward-char nil)
(defun search-forward-char-continue ()
(if (and last-search-forward-char (or (eq (symbol-function last-command) (symbol-function 'search-forward-char))
(eq last-command this-command)))
(setq last-search-forward-char nil))))
(global-set-key (kbd "M-s") 'search-forward-char)
(global-set-key (kbd ";") 'search-forward-char-continue)
Key word here is
last-command. Using the same principle other commands also can be assigned to same key.
In my current project I had a task to use twitter API. Twitter uses OAuth for authentication, which is pretty dreary. To avoid fiddling with it all the time, I've moved authentication to decorator. If key is available - nothing happens, just view is launched as usual. It's convenient that there's no need for additional twitter settings in user profile. Code is in article.
Django ORM is a very abstract and flexible API. But if you do not know exactly how it works, you will likely end up with slow and heavy views, if you have not already. So, this article provides practical solutions to N+1 and high loading time issues. For clarity, I will create a simple view that demonstrates common ORM query problems and shows frequently used practices.