- Remove all untracked git files
$ git clean -fd
- View all tags
$ git tag
- Undo last commit
$ git clean -fd
$ git tag
| // sleep using promise | |
| function sleep(ms) { | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| } |
class One(models.Model):
pass
class Many(models.Model):
$ createdb -O <owner> -T database_to_copy new_database
$ createdb -O <owner> database_name
python manage.py makemigrations --empty yourappname
python manage.py showmigrations <app_name>
| # Shortcuts for doing stuff in gametraka_project_v3 | |
| .PHONY : clean help build redisq gui devdeps dev clean run requirements test | |
| help: | |
| @echo "lint - check style with flake8 and isort" | |
| @echo "devdeps - runs rqworker and gui front-end" | |
| @echo "dev - runs gametraka on localhost" | |
| @echo "test - runs test suite" | |
| @echo "clean - deletes temporary files" |
| -- get the 10 most recent sold listings for the specific agency | |
| SELECT id, status, sold_price, sold_date | |
| FROM listings_listing | |
| WHERE agency_id = '3ab9adc2-7fd2-4b24-8cd0-d0cc69270fbf' AND status = 'S' | |
| ORDER BY sold_date DESC LIMIT 10; | |
| -- modify the query set to a new date somewhere between now and four weeks ago | |
| UPDATE listings_listing | |
| SET sold_date = now(), | |
| source_type = 'M' |
The main thing here is the bit where you rename the table to something shorter: cd.members > mem. However this site clearly doesn't do that.
The concept is simple enough, you just have to join two tables that are related via a foreign key. When you join them together, you get a more detailed row.
| function deepCopy(obj) { | |
| return new Promise(resolve => { | |
| const {send, recv} = new MessageChannel(); | |
| recv.onmessage = ev => resolve(ev.data); | |
| send.postMessage(obj); | |
| }); | |
| } | |
| const obj = /* object to copy */; | |
| const clone = await deepCopy(obj); |