Install Python
$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7
Symlinks...
| /* | |
| This script attempts to identify all CSS classes mentioned in HTML but not defined in the stylesheets. | |
| In order to use it, just run it in the DevTools console (or add it to DevTools Snippets and run it from there). | |
| Note that this script requires browser to support `fetch` and some ES6 features (fat arrow, Promises, Array.from, Set). You can transpile it to ES5 here: https://babeljs.io/repl/ . | |
| Known limitations: | |
| - it won't be able to take into account some external stylesheets (if CORS isn't set up) | |
| - it will produce false negatives for classes that are mentioned in the comments. |
| #!/usr/bin/python3 | |
| """ | |
| This script adds on_delete to Django migrations. It works on multi-line | |
| definitions of ForeignKey/OneToOneField which may be in your codebase if you | |
| have black'ened the migration files. | |
| It's not perfect, but it doesn't create syntax errors and you can run black on | |
| the code again afterwards. | |
| First version: |
| def get_count(q): | |
| count_q = q.statement.with_only_columns([func.count()]).order_by(None) | |
| count = q.session.execute(count_q).scalar() | |
| return count | |
| q = session.query(TestModel).filter(...).order_by(...) | |
| # Slow: SELECT COUNT(*) FROM (SELECT ... FROM TestModel WHERE ...) ... | |
| print q.count() |
Install Python
$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7
Symlinks...