Laravel 5.5 permissions based on user id

For a Laravel 5.5 project I solved a permission problem that I’d like to share in case someone else can benefit.


The structure of our urls look like this:


Which will show all the companies for user 5. I however wanted to limit it so that only user 5 may see user/5 company listings. User/4 or another use should see access denied when viewing /users/5/companies.

My current route was defined this way in routes/web.php:


Partition a Linked List by Value X (part 2)

To expand on the problem here Partition Linked List Based on value x

I now asked this question.

Partition a Linked List by a value x, so that values less than x come first, values equal to x come next, and values greater than x come last. Note: Retain relative order.

Unlike the previous question, this one has no shortcuts that were obvious to me.


Partition Linked List Based on value x

During my algorithm review I came across this problem.

Write an algorithm to partition a linked list around a value, x, so that all nodes less than x comes before all nodes greater than or equal to x.

I really like this problem, because it is being very generous and allows you to be very efficient. Here are some tips that will help you with getting  a full solution.

Tip 1 – A complete sort is not necessary. (smile) (more…)

Most Useful Linux Commands

This is a lit of commands that I find found very useful on linux and related technologies.

Command 1

sudo apachectl configtest

This command can prevent you from having a crisis.


Site blocked from McAfee Web Gateway

Have you seen this before?

Warning message about blocked site

You may be trying to access a site from inside of a firewall and you get a scary message like this. What’s even worse is if it’s your own site and makes you wonder what in the world is going on. The message you may see is: (more…)

Compass file not found error in sass cache

Recently, I was working on a sass project and then started to get strange errors about a file not being found. The error referenced a non-existent file in the sass cache folder. I wasn’t sure why the file was not being generated, I had never seen this before.

The error came in two forms:


Fixing Website Blocked. Category None

Seen this before?

Stop sign with a hand
You shall not pass

You may have received an error that says content blocked with category “none” when you try to access a certain website from within a firewall. I have seen this happen with BlueCoat firewall which is often used by very large companies to limit the sites that their computers can visit. (more…)

Better Organization with Sass Media Queries

Using media queries can get confusing and overlapping especially when structure is lacking. With sass css compiler and mixins we can structure our media queries and use them far more elegantly.


Getting Selected Option From PHP Select List


Let’s say you have a php select box that is dynamically generated through your php loop. You want to make sure that the selected option is always displayed even after reload.

Here is an example of a basic dynamic list:


$colors = fetchColors() //return array of colors array ("red","blue","green","purple")
$selected_color = fetSelectedColor(); //returns string of selected color

<select name="selectColor">
  <?php foreach ($colors as $color): ?> <option value="<?php echo $color;?>"> <?php echo $color; ?> </option> <?php endforeach ?>

However, when the page loads, you cannot tell which color was selected and aren’t sure where to put the html ‘selected’ value because the code simply ran through the colors loop.

Solution: (more…)

Deploying WordPress via Bash Script


Deploying your site should be easy. There are many ways to accomplish this, and I decided to take a bash script approach for one project. This will appeal to the more hands-on developers, but don’t worry everything has been explained here.