Skip to content

Instantly share code, notes, and snippets.

View gamerwalt's full-sized avatar
🏠
Working from home

Olawale Adewoyin gamerwalt

🏠
Working from home
  • Saskatoon, Canada
View GitHub Profile
@gamerwalt
gamerwalt / System Design.md
Created October 9, 2022 13:21 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@gamerwalt
gamerwalt / grokking_to_leetcode.md
Created June 27, 2022 12:00 — forked from tykurtz/grokking_to_leetcode.md
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@gamerwalt
gamerwalt / Laravel PHP7 LEMP AWS.md
Created July 8, 2017 13:05 — forked from santoshachari/Laravel PHP7 LEMP AWS.md
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
@gamerwalt
gamerwalt / UserModel
Created October 24, 2015 03:55
UserModel
class User extends BaseModel implements Authenticatable, CanResetPassword, IAggregateRoot
{
use DomainEvents;
protected $connection = 'benta';
protected $table = 'users';
protected $primaryKey = 'user_id';
@gamerwalt
gamerwalt / SampleModel
Created October 24, 2015 03:53
Sample Model
<?php
class StatusGroup extends BaseModel
{
protected $connection = 'benta_tenant';
protected $table = 'db_status_groups';
protected $primaryKey = 'status_group_id';
@gamerwalt
gamerwalt / TenantBaseController
Created October 24, 2015 03:42
TenantBaseController
abstract class TenantBaseController extends Controller
{
/**
* @var CommandBus
*/
public $commandBus;
/**
* @param \BentaCore\Infrastructure\Common\Commanding\CommandBus $commandBus
*/
@gamerwalt
gamerwalt / ConnectTenant
Created October 24, 2015 03:40
ConnectTenant Middleware
if ($this->auth->guest()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest('signin');
}
}
//get the current user
$this->user = $this->auth->user();
@gamerwalt
gamerwalt / create_user_script
Created October 11, 2015 21:46
Create_User method
private function createUser($host, $databaseName, $username, $password)
{
$createUserQuery = "CREATE USER '$username'@'$host' IDENTIFIED BY '$password'";
$this->runStatement($createUserQuery);
$grantUserQuery = "GRANT SELECT, INSERT, UPDATE, EXECUTE, DELETE ON $databaseName.* TO '$username'@'$host' IDENTIFIED BY '$password'";
$this->runStatement($grantUserQuery);
}
@gamerwalt
gamerwalt / gist:22c4a389552b93e25e1f
Last active February 4, 2016 09:13
MySqlDatabaseProvisioner
<?php
namespace BentaCore\Services\Provisioners;
use BentaCore\Services\Provisioners\IDatabaseProvisioner;
use Carbon\Carbon;
use DB;
use Exception;
use Illuminate\Contracts\Console\Kernel;
use PDO;
@gamerwalt
gamerwalt / db_provisioner
Created October 2, 2015 19:40
db_provisioner
/**
* Handle the event.
*
* @param TenantRegisteredEvent $event
* @return void
*/
public function handle(TenantRegisteredEvent $event)
{
$migrate = '1';