Skip to content

Instantly share code, notes, and snippets.

View kevinruscoe's full-sized avatar
💻
Working

Kevin Ruscoe kevinruscoe

💻
Working
View GitHub Profile
@kevinruscoe
kevinruscoe / wordpress-editor.scss
Last active November 2, 2023 18:55
Sass default WordPress editor styles.
/**
* WordPress WYSIWYG Editor Styles
*
* Some nice SCSS styles. Fixes the alignment left/right issues when using them in the editor.
* There's a load of more 'defaults' over at http://digwp.com/2010/05/default-wordpress-css-styles-hooks/
* which is where this was original 'borrowed' from. Cheers Jeff Starr (@perishable)!
*
* @author Kevin Ruscoe (@kevdotbadger)
* @link http://digwp.com/2010/05/default-wordpress-css-styles-hooks/ Original author
* @link https://twitter.com/perishable Twitter of original author
@kevinruscoe
kevinruscoe / fix.js
Last active November 7, 2021 02:53
Make Bootstrap 3 navigation hover on desktop, but click on mobile
jQuery(function($){
$("ul li").click(function(event){
if( $(window).width() > 768 && event.target.className == "dropdown-toggle" ){
return false;
}
});
$(window).resize(function(){
if( $(window).width() > 768 ){
@kevinruscoe
kevinruscoe / bower.json
Last active June 6, 2021 08:58
Compile SASS and Compress JS into single file
{
"name": "App",
"version": "1",
"authors": [
"Kevin Ruscoe <kevdotbadger@gmail.com>"
],
"moduleType": [
"node"
],
"license": "MIT",
@kevinruscoe
kevinruscoe / ArrayUserProvider.2.php
Last active January 1, 2021 15:23
Array User Provider
<?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 June 14, 2020 10:54
A few handy response macros
<?php
Request::macro('startsWith', function(string $needle) {
return collect(array_filter(
$this->all(),
fn($key) => str_starts_with($key, $needle),
ARRAY_FILTER_USE_KEY
));
});

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:

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 July 29, 2019 09:46 — forked from pcmccull/Remove _notes directories
Remove all _notes directories from a project that has been 'touched' by Dreamweaver
find . -name _notes -type d -exec rm -rf {} \;
<?php
namespace App\Http\Middleware;
use Closure;
use Config;
class ConnectToCorrectDatabase
{
/**