Categories
Fixing Stuff Samuel

Show Unread Emails In Primary Gmail Inbox

There was an annoying issue happening in my gmail inbox today, I had 4 unread messages but 3 of them ended up being very old and I could not find them easily. When I tried to find the unread emails in my gmail primary inbox I tried typing “filter: unread” in the top search box but that search included all of the unread emails in the promotions tab and the social tab which made it impossible to find the truly unread messages in my primary gmail inbox. To find just the primary inbox messages you can copy the code below into the search box at the top of the gmail page:

label:unread in:inbox -category:social -category:promotions -category:updates -category:forums

Once you copy that code above into the top search box in your gmail account, it will run and find only the unread messages in your primary gmail inbox. From there you can mark the individual messages as read or delete them, and if you are anything like me then your mail notifications icon will go away on your phone and you can get back to your regular life without being nagged by the little unread email icon every time you open your phone 🙂

Categories
Laravel Mac Samuel

Setting Up Local Environment For Laravel Dev On Mac

There has been quite a bit of change lately, and one of the biggest changes relates to my work and the computer system that work is being done one. I recently made the transition to a new office that has the policy of all work being done on a Mac. Which so far has actually been smoother than I thought, and I’ve started to enjoy the Mac. The first thing I did in this transition to Mac (well maybe not the very first thing, but close to it) was to get a local dev environment setup on the new Mac that would allow me to work with Laravel. I wrote down detailed notes in case anyone out there is struggling with the same setup you are in luck, just follow the steps below:

1.) Install MAMP. This one is pretty straight forward. Simply go to the MAMP website and download your version then follow the installer.

2.) Now that you have MAMP installed the first step is navigating to the htdocs directory and install Composer. This proved to be a funny challenge for me. The easiest way I’ve found (so far) to get to htdocs and install composer is:

-Open Up Mac terminal by going to the search icon in the top right of the Mac and type in Terminal, then follow these commands:

cd /

This will take us to the actual root directory. Now type:

ls

we should see the full list of folders, including application folder, now type:

cd /Applications/MAMP/htdocs

We should now be in htdocs folder.

3.) Next lets install composer, to do this go to composer website (https://getcomposer.org/download/)and then copy the following code into your terminal:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');"

Assuming composer installs correctly, lets now move it into global directory:

mv composer.phar /usr/local/bin/composer

Now any projects in the MAMP htdocs folder should be able to utilize composer. Test this buy running:

Composer help

4.) Ok now lets install our first Laravel project. Our first step on this is to try and run:

Laravel new folder-name (replacing folder name with our project name)

At this point we should most likely get an error message of “command not found”. This is fine, lets circle back and run the following command in termianl:

global require "laravel/installer"

This should load laravel dependencies, and we should see a list of them as they load in. Now we can try to run our laravel command again:

Laravel new folder-name

Again we should have the same error message pop up “command not found”. This is due to us needing to add our environment variables so the laravel installer commands can be executed. So lets run:

echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bash_profile

This should add our path variable to our profile. To double check this lets run:

Vim ~/.bash_profile

The environment variable we just added in the previous step should be there: export PATH=”$PATH:$HOME/.composer/vendor/bin”

Now lets close the document:

Hit ESC, Type :wq, and hit Enter

Now we are ready to circle back and run our laravel install again:

Laravel new folder-name

Hopefully you get the success message this time ☺. If you are like me and Laravel installed but you got a message about needing to update PHP versions then hit the Link below to go to the next page that lists the steps to update the version of PHP composer is using. By default it appears composer uses the system version of PHP not the version that ships with MAMP.

Categories
Laravel Samuel Test Driven Laravel Series

Setting up phpstorm to run unit tests

In This post we will go through the process of setting up phpstorm to run our tests.

Step 1:

Our first step is to get to the phpunit settings portion of phpstorm, to do this we can type control + shift + a or we can type “shift shift” and then type phpunit. The easier method is to hit control + shift + a, type phpunit and select the first option with the “settings” next to it.

Step 2:

Once the settings screen pulls up we should already be at the phpunit section. If not just type phpunit in the search bar at the top left. On this screen you will need to input 2 variables to get your tests working:

C:\wamp64\www\project-name\vendor\autoload.php

C:\wamp64\www\project-name\phpunit.xml

The final result should look like the snapshot below:

phpstorm-tests

Step 3:

Now we are ready to run our tests. To do this you can hit shift + f10 or you can go to the top nav bar and select “run > run all”.

Other helpful notes:

-control f5 will run the most recent test again
-alt + shift + f10 will run all the tests. This is helpful if you have only been running one specific test and would like to go back to running all tests

Categories
Laravel Samuel Test Driven Laravel Series

Third Hard Stop

Now when Adam runs this test he is getting updated errors that are created by adding the “formatted_date” variable to the blade file and then building out his second test. To fix this issue it actually ends up being really simple. All that we had wrong was the following code:

/**@test */

function can_get_formatted_date ()

This needed to be updated to add a space in between the ** and the @ symbol, so it looks like:

/** @test */

function can_get_formatted_date ()

If the ** is connected to the @ symbol then the test will not work. Once updated we can run the test and start following along with Adams errors.

Categories
Samuel Test Driven Laravel Series

Second Test Driven Laravel Hard Stop

The steps to fix this second Hard stop

1.) Open up ConcertsController.php and find the line: $concert = Concert::find($id);

2.) Hover over the class name, which is Concert::. Once your mouse is hovering over this hold down Alt and right click. In php storm this will bring up a new window that says “import this class”. Click to import the class. Alternatively if you are not using PHPstorm you can import the class by copying the code below:

use App\Concert; This goes at the top of the ConcertsController.php document.

Categories
Fixing Stuff Samuel

Fixing Internet Connection when connected to VPN

We were having an issue with our VPN setup and just wanted to document the fix. When working remotely we preferred to VPN back to the office from time to time but we were running into an issue where when connected to the office VPN we could not browse the internet. Everything else worked fine, our file share on the office network, we could send/receive email, print at the office ect… the only thing that was not working was actual internet browsing. To fix the issue we found a great piece of helpful information on Stack Overflow. The info is copied below for easy access and there is also a link to the stack overflow thread:

Link to thread: Here

Working steps to take:

uncheck “Use default gateway on remote network” in the TCP/IPv4 advanced settings for the VPN connection.

nbiwl