This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT TABLE_NAME,SUM(TABLE_ROWS) | |
| FROM INFORMATION_SCHEMA.TABLES | |
| WHERE TABLE_SCHEMA = 'database_name' | |
| GROUP BY TABLE_NAME; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| TABLE_NAME AS `Table`, | |
| ROUND(((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024),2) AS `Size (MB)` | |
| FROM | |
| information_schema.TABLES | |
| WHERE | |
| TABLE_SCHEMA = "database_name" | |
| #AND | |
| # TABLE_NAME = "table_name" | |
| ORDER BY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| trait TraitA { | |
| public function show() { | |
| return 123; | |
| } | |
| } | |
| trait TraitB { | |
| public function show() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git branch -m old_branch new_branch # Rename branch locally | |
| git push origin :old_branch # Delete the old branch | |
| git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mysqldump --opt --where="1 limit 10" [DATABASE] > dump.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # To run the MySQL container: | |
| docker-compose exec [container] bash | |
| # Export | |
| # Inside the container: | |
| mysqldump -u [username] -p [database] | gzip -c > [filename].sql.gz | |
| exit | |
| # Local Terminal: | |
| docker cp [container]:/[filename].sql.gz [filename].sql.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function down() | |
| { | |
| (new AnotherMigration)->up(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Current extends Model | |
| { | |
| public function final() | |
| { | |
| $this->belongsToMany( | |
| 'pivot_model', | |
| 'pivot_table', | |
| 'current_id', | |
| 'final_ID' | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from urllib.request import urlopen | |
| link = 'https://example.net' | |
| f = urlopen(link) | |
| output = f.read() | |
| print(output) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ln -s /Applications/MySQLWorkbench.app/Contents/MacOS/mysql /usr/local/bin/mysql | |
| ln -s /Applications/MySQLWorkbench.app/Contents/MacOS/mysqldump /usr/local/bin/mysqldump |