Skip to content

Instantly share code, notes, and snippets.

View timothymarois's full-sized avatar

Timothy Marois timothymarois

View GitHub Profile
@timothymarois
timothymarois / assessment.md
Last active September 7, 2023 14:14
Laravel Test Assessment (1)

For this assessment, you can create a new laravel project and either post it on github or a local zip

1) Routes, Models, Controllers

  • Create a route for POST -> /api/campaign/create
  • Create a controller for CampaignController.php with the API resource methods
  • Create a model for campaigns table and update the campaign controller to create, update, and delete
  • Within CampaignController create method for index and query the campaign model for status = active return the results
  • Create a database migration for the campaigns table
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
#!/usr/bin/env bash
# Amazon Linux 2 EC2 to PHP 7.3
#
# Must be ran as sudo:
# sudo sh env-setup-AMI2.sh
#
# Install Git
sudo yum install -y git
@timothymarois
timothymarois / env-setup-AMI1.sh
Last active July 25, 2020 17:54
Amazon Linux EC2 Initial Setup (Install Git, Apache 2.4, PHP 7.3 and Composer)
#!/usr/bin/env bash
# Upgrade an Amazon Linux EC2 to PHP 7.3
#
# Must be ran as sudo:
# sudo sh env-setup.sh
#
# Install Git
yum install -y git
@timothymarois
timothymarois / install-php73.sh
Last active November 9, 2019 18:34
Remove PHP Versions
#!/usr/bin/env bash
# Upgrade an Amazon Linux EC2 to PHP 7.3
#
# Must be ran as sudo:
# sudo bash install-php73.sh
#
# Install Git
yum install -y git
@timothymarois
timothymarois / ipCalculateRange
Last active March 18, 2019 20:51
IP: Get IP Range based on CIDR Block
/**
* Get the IP range block based on CIDR
*
* @param string $cidr 127.0.0.1/28
* @return array
*/
function ipCalculateRange($cidr) {
$range = array();
$cidr = explode('/', $cidr);
$range[0] = long2ip((ip2long($cidr[0])) & ((-1 << (32 - (int)$cidr[1]))));
@timothymarois
timothymarois / filebase.php
Last active March 2, 2019 16:21
Filebase (V2) Proposal
<?php
$config = [];
$database = new Database($config);
// DATABASE TABLES
// -----------------------------------