Last active
August 29, 2015 14:27
-
-
Save michaelhoang/d7d98144e0902be71741 to your computer and use it in GitHub Desktop.
Debug: log infomation to file
This file contains 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 | |
final class Debug | |
{ | |
public static function log($message, $file = 'system.log') | |
{ | |
try { | |
$logDir = 'log'; | |
$logFile = $logDir . '/' . $file; | |
if (!is_dir($logDir)) { | |
mkdir($logDir); | |
chmod($logDir, 0750); | |
} | |
if (!file_exists($logFile)) { | |
file_put_contents($logFile, ''); | |
chmod($logFile, 0640); | |
} | |
$message = print_r($message, true); | |
file_put_contents($logFile, $message, FILE_APPEND); | |
file_put_contents($logFile, "\n", FILE_APPEND); | |
} catch (Exception $e) { | |
} | |
} | |
} |
This file contains 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
/*Common Style*/ | |
/* Extra small devices (tablets, 480px and up) */ | |
@media (min-width: 480px) { | |
} | |
/* Small devices (tablets, 768px and up) */ | |
@media (min-width: 768px) { | |
} | |
/* Medium devices (desktops, 992px and up) */ | |
@media (min-width: 992px) { | |
} | |
/* Large devices (large desktops, 1200px and up) */ | |
@media (min-width: 1200px) { | |
} |
This file contains 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
-- Drop database | |
-- DROP DATABASE statement is used to delete a database. | |
DROP DATABASE database_name | |
-- delete the data inside the table, and not the table itself | |
TRUNCATE TABLE table_name | |
-- Export database | |
mysqldump -u root -p database_name > wantedsqlfile.sql | |
mysqldump -u [user] -p [db_name] | gzip > [filename_to_compress.sql.gz] | |
mysqldump -u root -p --all-databases > alldb_backup.sql | |
-- Import database | |
mysql -u root -p database_name < tut_backup.sql | |
gunzip < [backupfile.sql.gz] | mysql -u [uname] -p[pass] [dbname] | |
mysqlimport -u [uname] -p[pass] [dbname] [backupfile.sql] | |
-- Repair database | |
mysqlcheck --repair --databases db_name ... | |
mysqlcheck --repair --all-databases |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment