Skip to content

Instantly share code, notes, and snippets.

View Cannonb4ll's full-sized avatar
🏠

Dennis Smink Cannonb4ll

🏠
View GitHub Profile
<?php
function canonical()
{
$route = Route::current();
if (!$route) {
return false;
}
$action = $route->getAction();
if (!$action) {
@Cannonb4ll
Cannonb4ll / GoogleDriveServiceProvider.php
Created April 30, 2018 17:39 — forked from sergomet/GoogleDriveServiceProvider.php
Setup a Laravel Storage driver with Google Drive API
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class GoogleDriveServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
@Cannonb4ll
Cannonb4ll / Pagination.vue
Created June 4, 2018 06:47
Vue Pagination Laravel
<template>
<ul class="pagination" v-if="data.total > data.per_page">
<li class="page-item pagination-prev-nav" v-if="data.prev_page_url">
<a class="page-link" href="#" aria-label="Previous" @click.prevent="selectPage(--data.current_page)">
<slot name="prev-nav">
<span aria-hidden="true">&laquo;</span>
<span class="sr-only">Previous</span>
</slot>
</a>
</li>
@Cannonb4ll
Cannonb4ll / GetSiteScreenshot.php
Created August 27, 2018 11:43
Laravel Get ScreenshotJob
<?php
namespace App\Jobs\Projects;
use App\Models\Project;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
@Cannonb4ll
Cannonb4ll / ReCaptcha.php
Created November 15, 2018 13:55
ReCaptcha Laravel Google
<?php
namespace App\Validators;
use GuzzleHttp\Client;
class ReCaptcha
{
public function validate($attribute, $value, $parameters, $validator)
{
@Cannonb4ll
Cannonb4ll / mysqldump-ignore-multiple-tables
Created December 29, 2018 14:12 — forked from insytes/mysqldump-ignore-multiple-tables
mysqldump ignore multiple tables
mysqldump -u root -p database --ignore-table=database.table1 --ignore-table=database.table2 > dump.sql
@Cannonb4ll
Cannonb4ll / Pagination.vue
Created May 27, 2019 09:25
VueJS pagination
<template>
<renderless-pagination :data="data" :limit="limit" v-on:pagination-change-page="onPaginationChangePage">
<ul class="pagination" v-if="computed.total > computed.perPage" slot-scope="{ data, limit, computed, prevButtonEvents, nextButtonEvents, pageButtonEvents }">
<li class="page-item pagination-prev-nav" v-if="computed.prevPageUrl">
<a class="page-link" href="#" aria-label="Previous" v-on="prevButtonEvents">
<slot name="prev-nav">
<span aria-hidden="true">&laquo;</span>
<span class="sr-only">Previous</span>
</slot>
</a>
// Inside appserviceprovider:
private function bootPloiSocialite()
{
$socialite = $this->app->make('Laravel\Socialite\Contracts\Factory');
$socialite->extend(
'ploi',
function ($app) use ($socialite) {
$config = $app['config']['services.ploi'];
return $socialite->buildProvider(PloiProvider::class, $config);
}
@Cannonb4ll
Cannonb4ll / Discord.php
Created October 13, 2019 13:45
Laravel Discord Notification Channel
<?php
namespace App\Utilities\Discord;
use Exception;
use GuzzleHttp\Client as HttpClient;
use GuzzleHttp\Exception\RequestException;
use App\Exceptions\CouldNotSendNotification;
class Discord
@Cannonb4ll
Cannonb4ll / ftpbackup.sh
Created November 28, 2019 08:16 — forked from Glennmen/ftpbackup.sh
System + MySQL backup script
#!/bin/sh
# System + MySQL backup script
# Full backup day - Sun (rest of the day do incremental backup)
# Copyright (c) 2005-2006 nixCraft <http://www.cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# Automatically generated by http://bash.cyberciti.biz/backup/wizard-ftp-script.php
# ---------------------------------------------------------------------
### System Setup ###
DIRS="/home /etc /var/www"
BACKUP=/tmp/backup.$$