Ben Leeth

Graduated high school in 2003 and pursued local jobs of warehouse and manufacturing. Worked at Fleetwood/Fleetwood RV (now REV Group, Inc.) in Decatur, IN from 2004 - 2010 as electrician and Asst. Group Leader. I moved to Indianapolis in September of 2012 to pursue development/programming. Got my feet wet in front-end development and steadily grew into a full-stack developer and team leader/mentor.

My biggest strengths are in JS, PHP, and MySQL but I love to learn anything and everything. Whether that's a new language or a new way for something I can already do. Embrace challenges as they promote growth!

I've been married since 2016 and a father since 2020. Engineering Manager @ Dotdash Meredith since July 2022.

Qualifications

Portfolio

Code Examples

MySQL Examples

SELECT JSON_QUERY(meta_value, '$.users') AS users FROM wp_postmeta WHERE meta_key = '_facility_meta'
SELECT post_id FROM wp_postmeta WHERE meta_key = '_facility_meta' AND JSON_CONTAINS(meta_value, 2, '$.users');

Shell Examples

for i in **/*.mp4; do eval $(ffprobe -v quiet -show_format -of flat=s=_ -show_entries stream=duration $i); echo $i,$streams_stream_0_duration >> ~/Downloads/videos.csv; done;

PHP Examples

class VideosController extends Controller
{

    public function create(Request $request)
    {
        $page = ($request->page) ? (int) $request->page : 1;
        $skip = ($page * 100) - 100;
        return View::make('admin.videos', [
            'pages' => ceil(count(Videos::whereNull('deleted_at')->get()) / 100),
            'page' => $page,
            'videos' => Videos::whereNull('deleted_at')->orderBy('path')->skip($skip)->take(100)->get(),
            'ratings' => Ratings::all(),
            'genres' => Genres::all()
        ]);
    }

    public function store(Request $request)
    {
        $names = $request->names;
        $ratings = $request->ratings;
        $lengths = $request->lengths;
        $genres = $request->genres;
        foreach($names as $id => $name) {
            $arr = [];
            $arr['name'] = $name;
            if($lengths[$id]) $arr['length'] = $lengths[$id];
            if($ratings[$id]) $arr['rating_id'] = $ratings[$id];
            if($genres[$id]) $arr['genre_id'] = $genres[$id];
            Videos::find($id)->update($arr);
        }
        return redirect(route('admin.videos') . '?page=' . $request->page);
    }

}

JavaScript Examples

export default class Timer {

    constructor(element, direction) {
        this.element = element;
        this.direction = direction;

        this.init();
    }

    getTotalSeconds(startDate) {
        let startDatetime = new Date(startDate);
        let totalStartSeconds = startDatetime.getTime() / 1000;
        let nowDatetime = new Date();

        nowDatetime.setTime(nowDatetime.setTime(nowDatetime.getTime() + nowDatetime.getTimezoneOffset() * 60 * 1000));

        let totalNowSeconds = new Date(nowDatetime.getTime() + -300 * 60 * 1000).getTime() / 1000;

        return {
            'startSeconds': totalStartSeconds,
            'nowSeconds': totalNowSeconds
        };
    }

    getTotalSecondsSince() {
        let totalSecondsObj = this.getTotalSeconds(this.element.dataset.startDate);
        let totalSeconds = totalSecondsObj.nowSeconds - totalSecondsObj.startSeconds;

        return totalSeconds;
    }

    getTotalSecondsUntil() {
        let totalSecondsObj = this.getTotalSeconds();
        let totalSeconds = totalSecondsObj.startSeconds - totalSecondsObj.nowSeconds;

        return totalSeconds;
    }

    convertDateToValues() {
        let totalSeconds = 0;

        if (this.direction == 'up') {
            totalSeconds = this.getTotalSecondsSince();
        } else {
            totalSeconds = this.getTotalSecondsUntil();
        }

        let years, days, hours, minutes, seconds;
        years = days = hours = minutes = seconds = 0;

        if (totalSeconds >= 31536000) {
            years = parseInt(totalSeconds / 31536000);
        }

        days =  parseInt((totalSeconds - (years * 31536000)) / 86400);
        hours = parseInt((totalSeconds - (days * 86400) - (years * 31536000)) / 3600);
        minutes = parseInt((totalSeconds - (hours * 3600) - (days * 86400) - (years * 31536000)) / 60);
        seconds = parseInt((totalSeconds - (minutes * 60) - (hours * 3600) - (days * 86400) - (years * 31536000)) % 60);

        return {
            'years': years,
            'days': days,
            'hours': hours,
            'minutes': minutes,
            'seconds': seconds
        };
    };

    setTimes() {
        let values = this.convertDateToValues();
        let yearsSpan = this.element.querySelector('.timer__years');
        let daysSpan = this.element.querySelector('.timer__days');
        let hoursSpan = this.element.querySelector('.timer__hours');
        let minutesSpan = this.element.querySelector('.timer__minutes');
        let secondsSpan = this.element.querySelector('.timer__seconds');

        yearsSpan.innerHTML = values.years;
        daysSpan.innerHTML = values.days;
        hoursSpan.innerHTML = values.hours;
        minutesSpan.innerHTML = values.minutes;
        secondsSpan.innerHTML = values.seconds;
    }

    init() {
        this.setTimes(this.element, this.direction)

        setInterval(() => {
            this.setTimes(this.element, this.direction);
        }, 1000);
    }
}

SCSS Examples

.about {
    padding: 20px 0;

    @media screen and (min-width: 1020px) {
        padding: 32px 0;
    }

    &.media--left {

        .about__media {
            order: 1;
            margin-bottom: 24px;

            @media screen and (min-width: 1020px) {
                margin-bottom: 0;
            }
        }

        .about__notes {
            order: 2;
        }
    }

    &.media--right {

        .about__media {
            order: 2;
        }

        .about__notes {
            order: 1;
            margin-bottom: 24px;

            @media screen and (min-width: 1020px) {
                margin-bottom: 0;
            }
        }
    }

    &__notes {

        p {
            margin: 0 0 18px;
            font-size: 18px;
            line-height: 1.6;
            letter-spacing: 1px;
            word-spacing: 8px;
        }
    }
}

GraphQL Examples

{
  strapiHomePage {
    id
    modules {
      ... on STRAPI__COMPONENT_MODULES_PORTFOLIO {
        strapi_component
        strapi_id
        sectionTitle
        portfolioItems {
          title
          slug
          url
          featuredImage {
            alternativeText
            caption
            localFile {
              childImageSharp {
                gatsbyImageData(
                  width: 300
                  height: 300
                  placeholder: BLURRED
                  formats: [AUTO, WEBP, AVIF]
                  transformOptions: {
                    cropFocus: CENTER
                  }
                )
              }
            }
          }
        }
      }
    }
  }
}

Résumé

Since Packers Lost to Bears

0 years 0 days 0 hours 0 minutes 0 seconds

Contact Me