Table of Contents generated with DocToc
- https://www.omg.org/cloud/deliverables/CSCC-Practical-Guide-to-PaaS.pdf
- https://www.freecodecamp.org/news/how-to-build-your-first-saas/
- https://www.cloudways.com/blog/laravel-saas/
- https://stackoverflow.com/questions/2202049/how-to-design-a-saas-database
- https://medium.com/@dk_55214/database-design-for-saas-applications-ce92278b8836 (Important)
- https://laravel.io/forum/09-13-2014-create-new-database-and-tables-on-the-fly
- https://devops.com/best-practices-for-your-saas-laravel-application-on-aws/
- https://usersnap.com/blog/building-web-applications-cloud/
- https://medium.com/@bkintanar/eb4e8c5b5cc2
- https://tenancy.dev/docs
A simple way to detect unused files in a project using git
After finding that we had a few images checked into our project’s repository but that were not referenced in the project, I wanted to write a script to quickly see if there were any other unused assets.
This was a one-off script, so it probably won’t suit everyone’s needs, but here’s how we approached the problem:
First, we needed to get a list of the files that git was tracking in our image directory. While you could use ls for that, I wanted to be sure that we weren’t going to list any files that git was ignoring, so we started with git ls-files, whose output will look something like this if called as git ls-files ./img:
img/foo.png img/bar.png
<?php | |
/** | |
* @file | |
* Basic demonstration of how to do parallel threads in PHP. | |
*/ | |
// This array of "tasks" could be anything. For demonstration purposes | |
// these are just strings, but they could be a callback, class or | |
// include file (hell, even code-as-a-string to pass to eval()). |
cat
Used for viewing files that are not very long; it does not provide any scroll-back.
tac
Used to look at a file backwards, starting with the last line.
less
Used to view larger files because it is a paging program. It pauses at each screen full of text, provides scroll-back capabilities, and lets you search and navigate within the file. Note: Use / to search for a pattern in the forward direction and ? for a pattern in the backward direction. An older program named more is still used, but has fewer capabilities: "less is more".
SET @oldUrl = "Existing URL" COLLATE utf8mb4_unicode_520_ci; | |
SET @newUrl = "New URL" COLLATE utf8mb4_unicode_520_ci; | |
UPDATE wp_options SET option_value = replace(option_value, @oldUrl, @newUrl) WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET post_content = replace(post_content, @oldUrl, @newUrl); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value,@oldUrl, @newUrl); | |
UPDATE wp_usermeta SET meta_value = replace(meta_value, @oldUrl, @newUrl); |
This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} -d [OR] | |
RewriteCond %{REQUEST_FILENAME} -f | |
RewriteRule ^ ^$1 [N] | |
RewriteCond %{REQUEST_URI} (\.\w+$) [NC] | |
RewriteRule ^(.*)$ public/$1 | |
assuming www-data (it could be something else) is your webserver user.
sudo chown -R www-data:www-data /path/to/your/laravel/root/directory
if you do that, the webserver owns all the files, and is also the group, and you will have some problems uploading files or working with files via FTP, because your FTP client will be logged in as you, not your webserver, so add your user to the webserver user group:
<?php | |
// This can be found in the Symfony\Component\HttpFoundation\Response class | |
const HTTP_CONTINUE = 100; | |
const HTTP_SWITCHING_PROTOCOLS = 101; | |
const HTTP_PROCESSING = 102; // RFC2518 | |
const HTTP_OK = 200; | |
const HTTP_CREATED = 201; | |
const HTTP_ACCEPTED = 202; |