Skip to content

Instantly share code, notes, and snippets.

View Cannonb4ll's full-sized avatar
🏠

Dennis Smink Cannonb4ll

🏠
View GitHub Profile
@Cannonb4ll
Cannonb4ll / Demo.php
Created July 31, 2020 11:40
Demo a Laravel application
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class Demo
{
protected $safeRoutes = [
<?php
namespace App\Http\Middleware\Api;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redis;
class TrackApiStatistics
{
@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.$$
@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
// 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 / 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>
@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 / 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 / order-pdf.blade.php
Created September 3, 2018 10:01
Laravel DomPDF Invoice Design
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Invoice - #123</title>
<style type="text/css">
@page {
margin: 0px;
}
@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;