Skip to content

Instantly share code, notes, and snippets.

View EricMcWinNer's full-sized avatar
😴
Sleeping... Dream it to me if it's important

Eric Aprioku (Eric McWinNEr) EricMcWinNer

😴
Sleeping... Dream it to me if it's important
View GitHub Profile
@EricMcWinNer
EricMcWinNer / main.js
Last active April 1, 2022 21:47
Storybook configuration
module.exports = {
// ... other settings we don't care about now
async viteFinal(config, { configType }) {
config.base = ''; // './' also works, but i like "assets/.." urls better than "./assets/..." urls.
return config;
},
};
<?php
use Illuminate\Support\Str;
return [
// Other settings we don't care about.
'connections' => [
@EricMcWinNer
EricMcWinNer / CreateUserMigration.php
Created November 29, 2021 12:22
Explains how to change the engine in a Laravel migration
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
@EricMcWinNer
EricMcWinNer / EngineMigrationCoversionDemo.php
Last active November 28, 2021 23:22
A simple migration that allows us convert all the tables in our database to the InnoDB engine.
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CovertAllTablesEngineToInnodb extends Migration
{
/**
* Run the migrations.
@EricMcWinNer
EricMcWinNer / ExampleController.php
Last active November 28, 2021 23:58
Basic code snippet setting up a database transaction using DB facade methods
<?php
namespace App\Controllers;
use App\Models\User;
use App\Models\Verification;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
@EricMcWinNer
EricMcWinNer / ExampleController.php
Created November 28, 2021 22:53
Simple Code using laravel transactions closure in DB facade
<?php
namespace App\Controllers;
use App\Models\User;
use App\Models\Verification;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
<?php
class A {
public static function iAm() {
return "A";
}
}
// echo A::iAm(); // "A"
<?php
class A {
private function foo() {
echo "success!\n";
}
public function test() {
static::foo();
}
}
<?php
class Animal {
public static function makeSound(){
echo "Animal";
}
public static function vocalize() {
echo static::makeSound();
}
<?php
class Animal {
public static function makeSound(){
echo "Animal";
}
public static function vocalize() {
echo self::makeSound();
}