Skip to content

Instantly share code, notes, and snippets.

@jgrossi
jgrossi / AttachJwtToken.php
Last active August 14, 2021 18:14
AttachJwtToken.php
<?php
namespace Tests\Concerns;
use App\Models\User;
use Tymon\JWTAuth\Facades\JWTAuth;
trait AttachJwtToken
{
/**
@srsholmes
srsholmes / grecent.sh
Created November 23, 2023 15:58
Recent git branches
function grecent() {
local branches branch
branches=$(git branch --sort=-committerdate --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]') \
&& branch=$(echo "$branches" | fzf --ansi) \
&& branch=$(echo "$branch" | awk '{print $1}' | tr -d '*') \
&& git checkout "$branch"
}
@gerbenvandijk
gerbenvandijk / Mark parent navigation active when on custom post type single page
Last active January 1, 2024 21:22
Mark (highlight) custom post type parent as active item in Wordpress Navigation.When you visit a custom post type's single page, the parent menu item (the post type archive) isn't marked as active. This code solves it by comparing the slug of the current post type with the navigation items, and adds a class accordingly.
<?php
function add_current_nav_class($classes, $item) {
// Getting the current post details
global $post;
// Get post ID, if nothing found set to NULL
$id = ( isset( $post->ID ) ? get_the_ID() : NULL );
@kamilogorek
kamilogorek / _screenshot.md
Last active April 9, 2024 21:18
Clutter-free VS Code Setup
image