Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Always coding...

Tiago S. P. Rodrigues TiagoSilvaPereira

💻
Always coding...
View GitHub Profile
@TiagoSilvaPereira
TiagoSilvaPereira / component02.js
Created Feb 13, 2021
Alpine.js image viewer with fileChosen method
View component02.js
function imageViewer() {
return {
imageUrl: '',
fileChosen(event) {
this.fileToDataUrl(event, src => this.imageUrl = src)
},
fileToDataUrl(event, callback) {
if (! event.target.files.length) return
@TiagoSilvaPereira
TiagoSilvaPereira / index.html
Created Feb 13, 2021
Alpine.js Image Viewer template
View index.html
<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 / component01.js
Created Feb 13, 2021
Alpine.js Image Preview tutorial
View component01.js
function imageViewer() {
return {
imageUrl: '',
}
}
@TiagoSilvaPereira
TiagoSilvaPereira / UserController.php
Last active Dec 3, 2020
Laravel Controller generated with Vemto Code Generator
View UserController.php
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Spatie\Permission\Models\Role;
use Illuminate\Support\Facades\Hash;
use App\Http\Requests\UserStoreRequest;
use Illuminate\Support\Facades\Storage;
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@TiagoSilvaPereira
TiagoSilvaPereira / CrudController.php
Last active Apr 18, 2020
AbstractCrudController 02
View CrudController.php
<?php
namespace App\Http\Controllers\Base;
use ReflectionClass;
use Illuminate\Support\Str;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
View CrudController.php
<?php
namespace App\Http\Controllers\Base;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
abstract class CrudController extends BaseController
View UserController.php
<?php
namespace App\Http\Controllers;
use App\User;
use Illuminate\Http\Request;
class UserController extends Controller
{
public function index()
View index.blade.php
@extends('layouts.app')
@section('content')
<table class="table">
<tr>
<th>Name</th>
<th>Email</th>
</tr>
@foreach ($users as $user)
@TiagoSilvaPereira
TiagoSilvaPereira / app.js
Created Oct 24, 2019
BabylonJs Scene - PBR - Example
View app.js
var app = {
init() {
this.createScene();
},
createScene() {
this.scene = new BABYLON.Scene(this.engine);
this.scene.clearColor = new BABYLON.Color4(0, 0, 0, 0);