Marty Thomas

by Marty Thomas

Hi. I’m Marty. Founder @Purlem. Co-Founder @Tend_io. This is my blog about bootstrapping business, software and life.

Read this first

OOP Basics

I’ve been a self-taught “developer” for 8 years now, and I realized that I still don’t have a very good grasp of OOP. I find myself just floundering around OOP frameworks, trying different things until something works. Probably not the best approach. So I decided to take some time to learn the Basics of OOP. These are my notes…


 Procedural vs OOP

The idea behind OOP is to make code that is both easy to understand and maintain. Based on the principal that you should avoid repeating the same code, OOP splits the code up into chunks that can be re-used in multiple parts of an application.

Let’s say you want to create a website, that displays the contacts in a database. With a procedural approach, you might do something like this…

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>

<?php
//Define the contacts in the header
//Normally this data

Continue reading →


Twilio Click-to-Call in Laravel

Twilio is a pretty powerful tool for making calls and sending SMS messages. When integrating into your marketing efforts, it’s just short of magic.

I recently had a project, built on Laravel, where I needed to create a click-to-call functionality. Basically, we display phone numbers as a link. When the user clicks on a phone number, the user first receives a call, and then connects to user to the selected phone number. Here’s how I did it….

First install via composer.

composer require twilio/sdk

Then create two routes to handle the call and dial requests

Route::get('call', 'TwilioController@call');
Route::get('dial', 'TwilioController@dial');

Create our TwilioController

<?php

namespace App\Http\Controllers\Dash;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class TwilioController extends Controller
{

    public function call(Request $request)
    {

Continue reading →


Difference between what is and what you want.

I get very anxious when I have two people that want something done at the same time. I think many people would laugh at that - those that have dozens of people that need something done now. But it only takes two for me.

I think a part of it is that I’ve gotten into the “inbox zero” habit over the years. I hate to have things pile up. I want to address things immediately. And when I can’t, because of other stuff going on with work or family, I get stressed.

Today, my good buddy Andy from Headspace (we’ve actually never met before, but I feel like he’s my best friend), defined stress as the difference between what is and what you want. I suppose that want I “want” is for nobody to demand things from me, ever. And the difference is that people need to have things done, at a specific time.

I’m also reminded of a classic mom quote - “We can only ask that you do your best.” So I

Continue reading →


Iron.io Queues for Laravel 5.1

I wrote a post about using Iron.io’s Push Queues with Laravel 4.2, and of course it became obsolete a couple weeks after upgrading to Laravel 5.1.

Since Iron.io were the only ones to be using “Push” queues, it added complexity to the other queue types, and the Laravel gods decided to give it the ax.

A “Push” queue was essentially a queue job, that would then get a ping back from Iron.io to a queue worker that would handle the queued job. Laravel would accept the ping from Iron.io, and handled accordingly with the Queue::marshal() command (deprecated in Laravel 5.1)

So here is how we re-setup Iron.io Queues in Laravel 5.1.

 Sign up for a free Iron.io account

 Create a new Iron.io Queue

Click on the credentials icon. This will show you your Project ID and Token.

Screen Shot 2015-08-05 at 1.19.26 PM.png

 Create a new Iron.io Queue

Within your Iron.io account, create a new Queue.

2015-11-17_10-17-12.png

Select “pull” as the Queue Type.

2015-11-17_10-18-34.png

Continue reading →


The Entrepreneurial Cook

I was listening to Little Bets by Peter Sims this morning on my run with the kids. Peter mentions a study by Saras Sarasvathy that I found quite interesting.

The study titled What makes entrepreneurs entrepreneurial?, examined how entrepreneurs make decisions.

Entrepreneurs and MBA students use two completely different approaches when performing a new task. To illustrate this point, Saras used an example of cooking a meal. MBA students did better when given a menu, ingredients and a fully stocked kitchen. On the flip side, entrepreneurs thrived when sent into an unfamiliar kitchen, where they had to explore the cupboards and decide on something to make.

Cooking-Disaster.jpg

The MBA cook’s meal would be more predictable, and probably tasty. The entrepreneur’s meal could be a flop, or it could be a run away success.

This reminds me of my Dad’s cooking style. “Let’s see what we got in the kitchen” he’d

Continue reading →


Minivan

Yep, I did it. I’m officially a minivan owner.

There was a time, not too long ago, where the words came out of my mouth - “I will never drive a minivan.” Here I am, however, driving around the Chicago suburbs in a minivan. All I’m missing is that stupid family sticker on the back window.

family_car_sticker.png

Unfortunately, minivans are just too freakin convenient. The turning point came on our vacation to Maui a few months back. We rented a minivan, and I was surprised at just how much easier it was to get around. The thing is, it wasn’t just a little bit easier, it was an order of magnitude easier. A 10x improvement over the SUV. It’s obvious why the minivan has a near monopoly on the transporting-a-bunch-of-kids market. So I had no choice. The minivan it is.

Anyways, the purpose of the post is to rant about how horrible the car buying experience still is. With all of the advancements in

Continue reading →


The Cloud

Yesterday my computer decided to stop working. Today, I’m up and running with a new one.

For the past couple of years I’ve been entirely “in the cloud.” No, not my head, well - maybe sometimes. Rather, all of my data is saved through Dropbox/Drive/iCloud.

the-cloud.jpg
All of this paid off yesterday when my computer decided to stop working. Of-course it wasn’t ideal. But there was no sweating/swearing. And it was a good excuse for me to go out and buy the new Macbook :)

If even the thought of loosing your computer makes your cringe, I suggest moving everything to the cloud. It’s really quite easy. Here’s how I do it:

  1. Sign up for Dropbox. I’d opt for Dropbox pro as it will even keep a backup of deleted files for you.

  2. Move all of your documents, into Dropbox. This is really easy. Literally, all of the files from your documents folder into your dropbox folder. I’m also using Dropbox Carousel to

Continue reading →


Mcrypt PHP extension required

If your using MAMP and try to run a Laravel command, you may run into the error:

Mcrypt PHP extension required

Solution is quite easy:

1) Find what version of PHP your using in MAMP

2015-06-05_12-19-03.png

2) Add/Update .bash_profile file

cd ~/
vi .bash_profile

And add the following (while appending the PHP version found in Step 1)

export PATH=/Applications/MAMP/bin/php/php5.6.7/bin:$PATH

3) Save and Restart Terminal

Should be good to go then!

Continue reading →


Custom Data Placement for Bootstrap Popovers

I recently needed to define a unique position for only certain bootstrap popovers.

If you don’t have multiple popovers on the same page, this is easy accomplished through CSS:

.popover.bottom {
  margin-top: 30px;
}
.popover {
  left: 100px !important;
}

However, this will effect all popovers on the page. I needed this to only be applied to popovers that resided in our sidebar. To pull this off, the trick was to update the popover’s template.

By default, Bootstrap defines the popover template as so:

<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>

Here we can add a unique css class to the popover:

<div class="popover popover-sidebar" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>

And place this new template into the

Continue reading →


Using Laravel with Travis CI for Automated Testing

As I mentioned in our post about Growing Pains, it’s time for us to start building some serious automated testing into Tend. What I needed was a simple way to not only create tests, but to also run them automatically whenever changes are pushed to our Github repo.

First I’ll cover how I setup some basic testing in Laravel, then I’ll jump into show how I used Travis CI to automate the testing.

Creating Tests in Laravel 5.1*
As part of our infrastructure updates, we moved Tend to Larvel 5.1, which has PHPunit built in. To get started, use artisan to create a new test from the project root…

php artisan make:test UserTest

Which will create new UserTest class within the tests directory.

<?php

use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;

class UserTest extends

Continue reading →

Subscribe to Marty Thomas

Don’t worry; we hate spam with a passion.
You can unsubscribe with one click.

2WVKG6oIIo0RjlMm80QK