Skip to content

Instantly share code, notes, and snippets.

@Crocoblock
Crocoblock / get-user-data-callback.php
Last active November 11, 2024 23:03
JetEngine. Dynamic Field callback to get selected user data (display name, login, email etc) by given user ID
<?php
/**
* Add following code into funcitons.php file of your active theme or with any code snippets plugin
*/
add_filter( 'jet-engine/listings/allowed-callbacks', function( $callbacks ) {
$callbacks['my_jet_engine_get_user_data'] = __( 'Get user data by ID' );
return $callbacks;
} );
add_filter( 'jet-engine/listings/allowed-callbacks-args', function( $args ) {
@Crocoblock
Crocoblock / macro-example.php
Last active February 22, 2025 12:53
Add custom macro for JetEngine. Example - get the current user property, such as ID, user_email, etc.
<?php
/**
* Note!
* Register macros on jet-engine/register-macros action only,
* as the base macro class \Jet_Engine_Base_Macros is not available before that action;
* after it - all macros are registered already
*/
add_action( 'jet-engine/register-macros', function(){

Domain-Driven Design with Laravel - Table Of Contents

Basic Concepts - 49 pages

  • What is Domain-Driven Design?
  • Working With Data
  • Value Objects
  • Data Transfer Objects
  • Repositories
  • Services
  • Actions
@JustinByrne
JustinByrne / laravel-ci-cd-workflow.yml
Last active May 29, 2024 21:09
Github Action to test laravel and then compile the assets to a production branch
name: CI/CD workflow
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
testing:
@elijahcruz12
elijahcruz12 / sail-aliases
Last active November 22, 2024 23:51
Laravel Sail Aliases
alias sail='bash vendor/bin/sail'
alias sdown='bash vendor/bin/sail down'
alias sa='bash vendor/bin/sail artisan'
alias sup='bash vendor/bin/sail up -d'
alias sdown='bash vendor/bin/sail down'
alias snpm='bash vendor/bin/sail npm'
alias sdev='bash vendor/bin/sail npm run development'
alias sprod='bash vendor/bin/sail npm run production'
alias snpmi='bash vendor/bin/sail npm install'
alias snpmu='bash vendor/bin/sail npm update'
@bagerathan
bagerathan / woo-events.js
Last active April 11, 2025 17:46
[Woocommerce Javascript events] #woo
//Woocommerce Checkout JS events
$( document.body ).trigger( 'init_checkout' );
$( document.body ).trigger( 'payment_method_selected' );
$( document.body ).trigger( 'update_checkout' );
$( document.body ).trigger( 'updated_checkout' );
$( document.body ).trigger( 'checkout_error' );
//Woocommerce cart page JS events
$( document.body ).trigger( 'wc_cart_emptied' );
$( document.body ).trigger( 'update_checkout' );
@NorthTexasCreative
NorthTexasCreative / wp-cli.txt
Created July 15, 2019 23:03
WP CLI on Laragon
curl -L -O https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && echo @ECHO OFF > wp.bat && echo php "%~dp0wp-cli.phar" %* >> wp.bat

Learning Plan for Test Driven Development (TDD)

These learning resources primarily focus on Test Driven Development (TDD).

  • There is an emphasis on learning using PHP, Laravel and PHPUnit.
  • All these resources are free (at the time of writing)
@ashokmhrj
ashokmhrj / custom-template-plugin.php
Last active October 21, 2023 13:36
Get Template Part From plugin directory
<?php
/**
* The below function will help to load template file from plugin directory of wordpress
* Extracted from : http://wordpress.stackexchange.com/questions/94343/get-template-part-from-plugin
*/
define('PLUGIN_DIR_PATH','Your-plugin-directory-path');
function ccm_get_template_part($slug, $name = null) {
do_action("ccm_get_template_part_{$slug}", $slug, $name);
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE