sudo update-alternatives --config phphttps://vitux.com/how-to-install-php5-and-php7-on-ubuntu-18-04-lts/
sudo update-alternatives --config phphttps://vitux.com/how-to-install-php5-and-php7-on-ubuntu-18-04-lts/
| // delete branch locally | |
| git branch -d localBranchName | |
| // delete branch remotely | |
| git push origin --delete remoteBranchName |
Cherry pick multiple commits from a remote or upstream branch into your local branch.
Saw this from a comment on an answer on Stack Overflow
git fetch upstream
git cherry-pick A^..BFWIW: I'm not the author of the content presented here (which is an outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.
| <?php | |
| require_once 'Container.php'; | |
| class UserController | |
| { | |
| public $repository; | |
| public function __construct(Repository $repository) | |
| { |
Picking the right architecture = Picking the right battles + Managing trade-offs
| <?php | |
| // check from cache, if not exist get using closure, | |
| // then save to cache | |
| $value = Cache::remember('users', $seconds, function () { | |
| return DB::table('users')->get(); | |
| }); | |
| // wrap closure using transaction from DB facade | |
| use Illuminate\Support\Facades\DB; |
| <?php | |
| public function cacheOrDatabase(string $cacheKey, callable $callable) | |
| { | |
| if ($this->cache->has($cacheKey)) { | |
| return $this->cache->get($cacheKey); | |
| } | |
| $fromDatabase = $callable(); | |
| if ($dataFromDatabase === null || empty($dataFromDatabase)) { |