Skip to content

Instantly share code, notes, and snippets.

View chrismcintosh's full-sized avatar

Chris Mcintosh chrismcintosh

View GitHub Profile
@chrismcintosh
chrismcintosh / post.php
Created January 13, 2024 20:01
Laravel Corcel default post query to trim down irrelevant data
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Corcel\Model\Post as Corcel;
class Post extends Corcel
{
use HasFactory;
<?php
/******************************************************************************************************
* Job Event Listeners
* https://github.com/laravel/framework/tree/10.x/src/Illuminate/Queue/Events
*/
Event::listen(function (JobTimedOut $event) {
Log::warning("Job Timed Out: {$event->job->resolveName()}", [
'job_uuid' => $event->job->uuid(),
'attempts' => $event->job->attempts(),
@chrismcintosh
chrismcintosh / 20-xdebug.ini
Last active July 12, 2022 00:22
Homestead 2022 - X Debug 3 - PHP 8 working (July 11, 2022) config
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.discover_client_host=1
xdebug.client_port = 9003
xdebug.max_nesting_level = 512
xdebug.idekey=VSCODE
xdebug.client_host=10.0.2.2
xdebug.start_with_request=yes
# This is a basic workflow to help you get started with Actions
name: Deploy Production
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore
@chrismcintosh
chrismcintosh / manual-gravity-forms
Created April 20, 2020 15:39 — forked from keithdevon/manual-gravity-forms
Manually create entries and send notifications with Gravity Forms
<?php
// Manually create entries and send notifications with Gravity Forms
$form_id = 10;
// add entry
$entry = array(
"form_id" => $form_id,
"1" => "Entry for field ID 1",
import Bowser from "bowser"
const bowser = Bowser.parse(window.navigator.userAgent)
document.addEventListener("DOMContentLoaded", function(){
document.body.classList.add(`browser-${bowser.browser.name.toLowerCase()}`)
document.body.classList.add(`os-${bowser.os.name.toLowerCase()}`)
document.body.classList.add(`platform-${bowser.platform.type.toLowerCase()}`)
});
dig +short myip.opendns.com @resolver1.opendns.com
// get all instances of a form on the post
const matches = document.querySelectorAll(".gform_wrapper form")
// we are using vue.js here with the slug of the current post in state
const slug = store.state.currentPost.slug
// loop through each form on the post
matches.forEach(function(match) {
// get the value of the id of the form
let gformID = match.getAttribute("id")
// get only the form number off the gravity form using regex
let isolatedID = /([1-9][0-9]*)/.exec(gformID)
function toggle(id) {
var e = document.getElementById(id);
if( e.style.display == 'block' || getComputedStyle(e, null).display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}