Skip to content

Instantly share code, notes, and snippets.

Avatar
😴
Sleeping

Eric McWinNEr EricMcWinNer

😴
Sleeping
View GitHub Profile
@EricMcWinNer
EricMcWinNer / main.js
Last active Apr 1, 2022
Storybook configuration
View main.js
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;
},
};
View database.php
<?php
use Illuminate\Support\Str;
return [
// Other settings we don't care about.
'connections' => [
@EricMcWinNer
EricMcWinNer / CreateUserMigration.php
Created Nov 29, 2021
Explains how to change the engine in a Laravel migration
View CreateUserMigration.php
<?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 Nov 28, 2021
A simple migration that allows us convert all the tables in our database to the InnoDB engine.
View EngineMigrationCoversionDemo.php
<?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 Nov 28, 2021
Basic code snippet setting up a database transaction using DB facade methods
View ExampleController.php
<?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 Nov 28, 2021
Simple Code using laravel transactions closure in DB facade
View ExampleController.php
<?php
namespace App\Controllers;
use App\Models\User;
use App\Models\Verification;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
View Example.php
<?php
class A {
public static function iAm() {
return "A";
}
}
// echo A::iAm(); // "A"
View Example.php
<?php
class A {
private function foo() {
echo "success!\n";
}
public function test() {
static::foo();
}
}
View Example.php
<?php
class Animal {
public static function makeSound(){
echo "Animal";
}
public static function vocalize() {
echo static::makeSound();
}
View Example.php
<?php
class Animal {
public static function makeSound(){
echo "Animal";
}
public static function vocalize() {
echo self::makeSound();
}