Skip to content

Instantly share code, notes, and snippets.

View EncryptCookies.php
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
View gist:e46b1d3a90b3d967dc92ff8c97d7f11e
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"PUT",
"POST",
"GET",
"HEAD",
View Kernel.php
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
@whobutsb
whobutsb / CloudFrontCookie.php
Last active Mar 11, 2022
CloudFrontCookie.php
View CloudFrontCookie.php
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Aws\CloudFront\CloudFrontClient;
use Illuminate\Support\Facades\Cookie;
class CloudFrontCookie
View laravel-extended-enums.php
<?php
namespace App\Enums;
use Illuminate\Support\Collection;
enum DeclineCodes: string
{
case CALL_ISSUER = 'call_issuer';
case CARD_NOT_SUPPORTED = 'card_not_supported';
@whobutsb
whobutsb / NewRelicLogger.php
Last active Oct 15, 2020
Custom New Relic Logger for Laravel that includes extra Metadata.
View NewRelicLogger.php
<?php
namespace App\Logging;
use Auth;
use Monolog\Logger;
use Illuminate\Http\Request;
use Monolog\Handler\BufferHandler;
use NewRelic\Monolog\Enricher\{Handler, Processor};
@whobutsb
whobutsb / osascript
Created Nov 21, 2019
Play/Pause SoundCloud
View osascript
chrome = Application("Google Chrome");
windows = chrome.windows;
for(i = 0; i < windows.length; i++){
tabs = windows[i].tabs;
for(j = 0; j < tabs.length; j++){
url = tabs[j].url();
if(url.match(/soundcloud.com/)){
tabs[j].execute({ javascript: "document.querySelector('.playControl').click();" });
@whobutsb
whobutsb / playpause-youtube.js
Created Oct 19, 2018
Play and Pause YouTube from JXA
View playpause-youtube.js
var chrome = Application("Google Chrome");
var windows = chrome.windows;
for(i = 0; i < windows.length; i++){
var tabs = windows[i].tabs;
for(j = 0; j < tabs.length; j++){
var url = tabs[j].url();
if(url.match(/youtube.com/)){
tabs[j].execute({ javascript: "document.querySelector('.ytp-play-button').click();" });
@whobutsb
whobutsb / playpause-soundcloud.js
Created Oct 19, 2018
Play and Pause SoundCloud with JXA
View playpause-soundcloud.js
// grab the chrome object
var chrome = Application("Google Chrome");
// grab all of the chrome windows
var windows = chrome.windows;
// loop through the chrome windows
for(i = 0; i < windows.length; i++){
// grab all of the tabs for the window
@whobutsb
whobutsb / chrome-tabs.js
Created Oct 19, 2018
Opening Chrome Tabs in JXA
View chrome-tabs.js
// grab the chrome object
var chrome = Application('Google Chrome');
// create a new chrome window
var window = chrome.Window().make();
// set the links you want to open
var links = [
"https://gmail.com",
"https://soundcloud.com",