Skip to content

Instantly share code, notes, and snippets.

View TiagoSilvaPereira's full-sized avatar
💻
Always coding...

Tiago S. P. Rodrigues TiagoSilvaPereira

💻
Always coding...
View GitHub Profile
<?php
// ...
public function up()
{
Schema::create('recipes', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
@TiagoSilvaPereira
TiagoSilvaPereira / create_recipe_items_table.php
Last active July 14, 2021 17:24
Receipe items migration
<?php
// ...
public function up()
{
Schema::create('recipe_items', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->integer('quantity');
@TiagoSilvaPereira
TiagoSilvaPereira / Handler.php
Created October 14, 2021 18:05
Laravel Exception Handler for API
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Arr;
use Throwable;
class Handler extends ExceptionHandler
@TiagoSilvaPereira
TiagoSilvaPereira / index.html
Created February 13, 2021 18:13
Alpine.js Image Viewer template
<div x-data="imageViewer()">
<div class="mb-2">
<!-- Show the image -->
<template x-if="imageUrl">
<img :src="imageUrl"
class="object-cover rounded border border-gray-200"
style="width: 100px; height: 100px;"
>
</template>
@TiagoSilvaPereira
TiagoSilvaPereira / app.js
Created October 24, 2019 20:55
BabylonJs Scene - PBR - Example
var app = {
init() {
this.createScene();
},
createScene() {
this.scene = new BABYLON.Scene(this.engine);
this.scene.clearColor = new BABYLON.Color4(0, 0, 0, 0);