Skip to content

Instantly share code, notes, and snippets.

View dspangenberg's full-sized avatar

Danny Spangenberg dspangenberg

View GitHub Profile

Tappable Scopes in Laravel

The Problem

  • Laravel's model scopes don't work with Scout (search).
  • Reusing scopes across models means copying code OR using traits (but Scout still breaks).
  • Leads to duplicate query logic.

The Solution: Tappable Scopes

Instead of defining scopes inside models, create scope classes that can be used in both Eloquent & Scout queries!

You are tasked with analyzing a merged PDF containing multiple documents in German and creating a bash script to split and rename these documents. Follow these instructions carefully:
First, carefully examine the content of the merged PDF.
Now, follow these steps:
1. Analyze the PDF:
- Identify all distinct documents within the merged PDF.
- Ignore any blank pages (pages that contain no letters).
- Determine the page range for each document.
@mshoaibdev
mshoaibdev / reverb-instructions.md
Created June 30, 2024 10:34 — forked from lewislarsen/reverb-instructions.md
Instructions for how to setup Laravel Reverb in Production.

Reverb Walkthrough

This is a walkthrough of how to configure Laravel Reverb for production using services like Laravel Forge or Ploi. The first step is nginx configuration changes, then .env changes and finally spinning up your Reverb server.

1. Configuring Nginx

Ensure your nginx site configuration has the following inside the server block:

 location /app {
@davestewart
davestewart / estimation.md
Last active April 16, 2026 16:01
Things to think about when estimating frontend projects

Estimation

This document is an attempt to pin down all the things you don't think about when quoting for a project, and hopefully provide a starting point for some kind of framework to make quoting, working and delivering small-medium jobs more predictable and less stressful.

Contents

@u1i
u1i / doit.txt
Created June 21, 2021 11:28
pdftk MacOs M1
https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_server-2.02-mac_osx-10.11-setup.pkg
@thetutlage
thetutlage / .adonisrc.json
Last active November 30, 2023 16:57
Creating and register custom hash driver in AdonisJS v5
{
"preloads": [
"./start/hashDriver",
"./start/routes",
"./start/kernel"
],
}
@danilofreire
danilofreire / docker-rm-images.md
Created December 1, 2019 04:32 — forked from alferov/docker-rm-images.md
Remove all (untagged) images and containers from Docker
# Delete all containers
docker rm $(docker ps -aq)
# Delete all images
docker rmi $(docker images -q)
# Delete all untagged images
docker rmi $(docker images -q --filter "dangling=true")

References:

@lon-io
lon-io / db_backup.sh
Created July 15, 2019 07:41 — forked from NARKOZ/db_backup.sh
MySQL backup shell script
#!/bin/bash
# Shell script to backup MySQL database
# Set these variables
MyUSER="" # DB_USERNAME
MyPASS="" # DB_PASSWORD
MyHOST="" # DB_HOSTNAME
# Backup Dest directory
DEST="" # /home/username/backups/DB
@jugyo
jugyo / Main.js
Last active July 19, 2019 18:57
Model class with PouchDB
export default class User extends Model {
static className = 'User'
}
await User._put({id: 1, name: 'Jugyo'})
await User.get(1) // {className: "User", id: 1, name: "Jugyo", _id: "User-1", _rev: "1-b2d6c93292974cd1b14a786f7576ec53"}
@devinsays
devinsays / example-ajax-enqueue.php
Last active September 14, 2026 13:43
Simple WordPress Ajax Example
<?php
function example_ajax_enqueue() {
// Enqueue javascript on the frontend.
wp_enqueue_script(
'example-ajax-script',
get_template_directory_uri() . '/js/simple-ajax-example.js',
array( 'jquery' )
);