Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Working

Kevin Ruscoe kevinruscoe

💻
Working
View GitHub Profile
View ArrayUserProvider.2.php
<?php
namespace App;
use App\Models\User;
use Exception;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Contracts\Auth\UserProvider;
class ArrayUserProvider implements UserProvider
@kevinruscoe
kevinruscoe / ResponseMacros.php
Last active Jun 14, 2020
A few handy response macros
View ResponseMacros.php
<?php
Request::macro('startsWith', function(string $needle) {
return collect(array_filter(
$this->all(),
fn($key) => str_starts_with($key, $needle),
ARRAY_FILTER_USE_KEY
));
});
View raspberry-pi-vpn-router.md

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

View sortWithPreference.php
Collection::macro(
'sortWithPreference',
function ($preference = [], $key = 'id') {
return $this->sort(
function ($a, $b) use ($preference, $key) {
$a = array_search(is_array($a) ? $a[$key] : $a->$key, $preference);
$b = array_search(is_array($b) ? $b[$key] : $b->$key, $preference);
if ($a === false && $b === false) {
@kevinruscoe
kevinruscoe / Remove _notes directories
Created Jul 29, 2019 — forked from pcmccull/Remove _notes directories
Remove all _notes directories from a project that has been 'touched' by Dreamweaver
View Remove _notes directories
find . -name _notes -type d -exec rm -rf {} \;
View MethodLink.vue
View ConnectToCorrectDatabase.php
<?php
namespace App\Http\Middleware;
use Closure;
use Config;
class ConnectToCorrectDatabase
{
/**
View thing.php
<?php
// Assuming the field name is 'url'.
// Don't forget to URL encode
$url = sprintf("http://www.facebook.com/share/dialog/app_id=xxxxxx%s&redirecht_uri=myurl.com", get_field('url'));
// Or use http_build_query
$url = sprintf('http://www.facebook.com/share/dialog/%s', http_build_query([
'app_id' => 'xxxxxx',
View gist:ec83313d5713bb0dd19a8828c6e0cf4e
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
View registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
'frontend/MyTheme/Theme',
__DIR__
);
You can’t perform that action at this time.