Some useful code snippets