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
@TiagoSilvaPereira
TiagoSilvaPereira / Template.php
Created February 27, 2018 19:31
PWC Template Engine Example
<?php
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;
class RolesAndPermissionsSeeder extends Seeder
{
public function run()
{
@TiagoSilvaPereira
TiagoSilvaPereira / Cendi.php
Created February 27, 2018 18:13
Cendi Example
<?php
use Cendi\App;
$app = new App();
$app->setTitle('Cadastro de Pessoas');
$app->addInput('nome');
$app->addInput('tipo', 'select', ['fisica' => 'Pessoa Física', 'juridica' => 'Pessoa Jurídica']);
$app->addInput('descricao', 'text');
@TiagoSilvaPereira
TiagoSilvaPereira / removeDir.php
Created February 16, 2018 02:04
PHP - Removing a folder and all sub folders and files (including hidden files) - this method is better than using glob
<?php
function removeDirectory($dirPath) {
if (! is_dir($dirPath)) {
return false;
}
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
$dirPath .= '/';
}
@TiagoSilvaPereira
TiagoSilvaPereira / GoogleApiWrapper.php
Last active November 29, 2017 21:15
Get an access_token with the Google API Client to authenticate your PHP Backend with google services, like Firebase, Cloud Storage, etc
public function getServiceAccountAccessToken() {
// put the serviceAccount credentials in the env variable
putenv('GOOGLE_APPLICATION_CREDENTIALS=../resources/json/serviceAccount.json');
// Add the scopes (here are the scopes to Firebase Auth)
$scopes = [
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/firebase.database"
];
@TiagoSilvaPereira
TiagoSilvaPereira / BukCalendarComponent.vue
Created October 26, 2017 21:27
Problema, quando adiciono qualquer File Picker dentro do BukCalendar ou de algum componente dentro dele, o FullCalendar não funciona corretamente
<template>
<div>
<buk-event-modal @save-event="sendEvent" v-if="buildModal"></buk-event-modal>
<full-calendar ref="calendar" :config="config" :events="events" :editable="false"></full-calendar>
</div>
</template>
<script>
import BukEventModal from './BukEventModalComponent.vue';