Skip to content

Instantly share code, notes, and snippets.

@rtfpessoa
rtfpessoa / nextdns.js
Last active January 14, 2024 02:05
nextdns.io Block Youtube Ads
// ID of the config, e.g. A1234BCD.
const configID = "A1234BCD";
// API key, found at the bottom of your account page in https://my.nextdns.io/account
const APIKey = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
// Mark true or false. If true, failed links will be retried 3 times at progressively increasing intervals.
// If false, failed links will not be retried.
const retryFailedLinks = true;
// Time delay between requests in milliseconds.
// 800 seems to not give any errors but is rather slow while anything faster will give errors (in limited testing).
// If you want to go lower, it is recommended that "retryFailedLinks" is true
@calebporzio
calebporzio / error_blade_directive.php
Created March 28, 2019 20:34
A little Blade directive to make working with validation errors a bit nicer.
<?php
// Usage:
// Before
@if ($errors->has('email'))
<span>{{ $errors->first('email') }}</span>
@endif
// After:
@davidpiesse
davidpiesse / Schedulable.php
Last active September 7, 2023 15:22
Laravel Custom Class/Model Scheduling
<?php
//Don't forget to change the namespace!
namespace App\Traits;
use Cron\CronExpression;
use Illuminate\Support\Carbon;
use Illuminate\Console\Scheduling\ManagesFrequencies;
trait Schedulable{
@paulredmond
paulredmond / ValidateMailgunWebhook.php
Created April 24, 2017 21:55
Laravel Middleware to Validate a signed Mailgun webhook
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Response;
/**
* Validate Mailgun Webhooks
* @see https://documentation.mailgun.com/user_manual.html#securing-webhooks
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Subscriptions - freek@spatie.be</title>
</head>
<body>
<outline text="PHP" title="PHP">
<outline htmlUrl="http://frederickvanbrabant.com" title="frederickvanbrabant.com" xmlUrl="http://frederickvanbrabant.com/feed.xml" type="rss" text="frederickvanbrabant.com"/>
<outline htmlUrl="http://mattallan.org" title="mattallan.org" xmlUrl="http://mattallan.org/feed.xml" type="rss" text="mattallan.org"/>
<outline title="asked.io" xmlUrl="https://asked.io/rss" type="rss" text="asked.io"/>
@werkkrew
werkkrew / filebot-process.sh
Last active April 2, 2021 13:10
Filebot Process
#!/bin/bash
#### Media file processing script for Filebot
# This script gets triggered by some means (inotify, auditd, cron, etc.) and processes media files in some locations.
# It will run the filebot amc.groovy script against these files and output them into user defined locations for HTPC use.
#
# Known Limitations:
# Not dealing with music files, just video files. I use beets for music tagging.
# Not dealing with unique video types just yet, such as comedy specials, concerts, etc. Filebot might match it okay but I am not confident about it.
@jalogisch
jalogisch / Netflix - Unitymedia | Customer Hell!
Last active May 15, 2016 09:45
I have since last Monday(2016-02-22) - first day i notice - problems getting Netflix Content into my home. - Lost in a Customer Hell between Netflix and Unitymedia
2016-02-22
During the Day (2016-01-22) i notice that Netflix is not working on my TV. I tried other Devices but always getting an Error pointing me to http://netflix.com/proxy.
I called netflix (Germany) and over 30 min the agent followed his script what need to be done (reboot the modem, change devices and use mobile data) to show me that netflix does not have a problem and i should call my ISP.
Short after that, i called my ISP. The Agent told me that this morning they got notified by the tech department that unitymedia tech is working with netflix tech on this issue.
If i use another connection - a VPN to my Server, mobile data - connection is possible. Netflix relax and say "look your ISP has an issue"
Detailed Information are written down as note to my Account.
@bkuhl
bkuhl / ClasspathToClassConstants.md
Last active February 20, 2016 16:08
Find/replace full classpaths to use php ::class constants

Purpose: Replaces all ::mock and ::make instances with PHP class constants.

This is useful when upgrading Laravel 4 projects to Laravel 5.

Note: This find/replace assumes all mock/make instances utilize full classpaths (e.g. App::make('My\Project\Namespace\MyClass'))

Text to find:

\:\:(mock|make)\('(.+?)'\)
@JonoB
JonoB / gist:de0af1bfb34666e887d6
Last active August 29, 2015 14:22
Laravel Upgrade Form helpers from L4 to L5
Regex search and replace for form helpers as follows:
Search:
\{\{ (Form\:\:.+) \}\}
Replace:
{!! $1 !!}
@Ingramz
Ingramz / app\Http\Kernel.php
Last active November 3, 2020 05:59
Laravel 5 CloudFlare Proxy Middleware Compatibility
<?php
// ...
protected $middleware = [
// ...
'App\Http\Middleware\CloudFlareProxies',
];
// ...