Skip to content

Instantly share code, notes, and snippets.


Caleb Porzio calebporzio

View GitHub Profile
calebporzio / karabiner_vim_mode.json
Created Mar 27, 2020
A backup of the ideal vim mode karabiner plugin
View karabiner_vim_mode.json
"title": "Caleb's Vim Mode",
"author": "Caleb Porzio(",
"rules": [
"description": "Vim Mode [D as Trigger Key]",
"manipulators": [
"from": {
"key_code": "d",
calebporzio / caps_lock_to_command_escape.json
Last active Apr 29, 2020
A Karabiner-Elements complex modification rule
View caps_lock_to_command_escape.json
"title": "Caps Lock To Command/Escape",
"author": "Caleb Porzio(",
"homepage": "",
"import_url": "karabiner://karabiner/assets/complex_modifications/import?url=",
"rules": [
"description": "Caps Lock to Command/Escape",
"manipulators": [
calebporzio / artisan_db_open.php
Last active Aug 4, 2020
An artisan command for opening the project's database in TablePlus
View artisan_db_open.php
Artisan::command('db:open {connection?}', function ($connection = null) {
if (! file_exists('/Applications/')) {
$this->warn('This command uses TablePlus, are you sure it\'s installed?');
$this->line("Install here:\n");
$driver = $connection ?: config('database.default');
$host = config("database.connections.{$driver}.host");
View LivewireLoginTest.php
namespace Tests\Feature;
use App\User;
use Tests\TestCase;
use Livewire\Livewire;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Testing\RefreshDatabase;
View RouteDirectives.php
// Register these inside a service provider:
Blade::directive('route', function ($expression) {
return "<?php echo route({$expression}) ?>";
Blade::directive('routeIs', function ($expression) {
return "<?php if (request()->routeIs({$expression})) : ?>";
calebporzio / laracasts_refactoring_to_lookup_tables.php
Created Dec 17, 2019
Laracasts: Refactoring To Lookup Tables
View laracasts_refactoring_to_lookup_tables.php
* Refactor #1:
// Before
if ($user->type === 'admin' || $user->type === 'mod' || $user->type === 'author') {
// Do something.
calebporzio / pure_html_css_modal.css
Last active Aug 10, 2020
The CSS for the pure HTML/CSS modal I tweeted about.
View pure_html_css_modal.css
details summary {
cursor: pointer;
outline: none !important;
display: inline-block;
padding: 8px 12px;
padding-top: 10px;
border-radius: 4px;
overflow: hidden;
background: #F09825;
color: white;
View eloquent_search.php
// Add this to the "boot()" method of your "AppServiceProvider"
\Illuminate\Database\Eloquent\Builder::macro('search', function ($name, $search) {
return $this->where($name, 'LIKE', $search ? '%'.$search.'%' : '');
calebporzio / error_blade_directive.php
Created Mar 28, 2019
A little Blade directive to make working with validation errors a bit nicer.
View error_blade_directive.php
// Usage:
// Before
@if ($errors->has('email'))
<span>{{ $errors->first('email') }}</span>
// After:
View hyper.js
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
You can’t perform that action at this time.