Skip to content

Instantly share code, notes, and snippets.

View ryross's full-sized avatar

Ryder Ross ryross

View GitHub Profile
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "An auto-generated nested stack.",
"Metadata": {},
"Parameters": {
"AppSyncApiId": {
"Type": "String",
"Description": "The id of the AppSync API associated with this project."
},
"AppSyncApiName": {
@tortuetorche
tortuetorche / FiniteAuditTrailTrait.php
Created July 12, 2016 15:32
FiniteStateMachine and FiniteAuditTrail Traits for Laravel 5.1 (WIP)
<?php namespace App\Finite;
/**
* The FiniteAuditTrail Trait.
* This plugin, for the Finite package (see https://github.com/yohang/Finite), adds support for keeping an audit trail for any state machine.
* Having an audit trail gives you a complete history of the state changes in your stateful model.
* Prerequisites:
* 1. Install Finite package (https://github.com/yohang/Finite#readme)
* 2. Use FiniteStateMachine in your model (https://gist.github.com/tortuetorche/6365575)
* Usage: in your Stateful Class use this trait after FiniteStateMachine trait, like this "use FiniteAuditTrailTrait;".
# supervisor
#
# Author: Günter Grodotzki <gunter@grodotzki.co.za>
# Version: 2015-04-25
#
# - set param "SUPERVISE=enable" to activate
# - chmod +x supervise.sh
#
packages:
yum:
@sisou
sisou / CronRunCommand.php
Last active June 18, 2022 10:29
Cron job command for Laravel 4.2
<?php
# Cron job command for Laravel 4.2
# Inspired by Laravel 5's new upcoming scheduler (https://laravel-news.com/2014/11/laravel-5-scheduler)
#
# Author: Soren Schwert (GitHub: sisou)
#
# Requirements:
# =============
# PHP 5.4
@ken-muturi
ken-muturi / woocommerce_checkout_update_order_meta
Last active January 22, 2024 15:33 — forked from mikejolley/gist:1604009
woocommerce_checkout_update_order_meta
<?php
/**
* Add the field to the checkout
**/
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field');
function my_custom_checkout_field( $checkout ) {
echo '<div id="my_custom_checkout_field"><h3>'.__('My Field').'</h3>';
@imath
imath / bpgmq.php
Created November 4, 2013 03:39
This is the complete class for the BuddyPress Codex article : Group Meta Queries: Usage Example. You can test it copying it in the functions.php of your active theme
<?php
/* you can copy & paste from here */
//it's important to check the BP_Group_Extension is available
if( class_exists( 'BP_Group_Extension' ) ) :
/**
* This is a quick and dirty class to illustrate "bpgmq"
* bpgmq stands for BuddyPress Group Meta Query...
* The goal is to store a groupmeta in order to let the community administrator
@tortuetorche
tortuetorche / 01.FiniteAuditTrail.README.md
Last active May 28, 2022 03:39
FiniteAuditTrail Trait For Laravel 4 with Example. Support for keeping an audit trail for any state machine, borrowed from the Ruby StateMachine audit trail gem.

FiniteAuditTrail Trait

Support for keeping an audit trail for any state machine, borrowed from the Ruby StateMachine audit trail gem. Having an audit trail gives you a complete history of the state changes in your model. This history allows you to investigate incidents or perform analytics, like: “How long does it take on average to go from state a to state b?”, or “What percentage of cases goes from state a to b via state c?”

Requirements

  1. PHP >= 5.4
  2. Laravel 4 framework
@tortuetorche
tortuetorche / 01.FiniteStateMachine.README.md
Last active October 12, 2017 23:06
FiniteStateMachine Trait with Example.Add a DSL to the PHP Finite package, borrowed from the Ruby StateMachine gem.

FiniteStateMachine Trait

Add a DSL to the PHP Finite package, borrowed from the Ruby StateMachine gem.

Usage

In your Stateful Class, add the stateMachineConfig() method and call initStateMachine() method at initialization (__contruct() method).

Example

@Ikke
Ikke / MethodDelegator.php
Created November 14, 2012 22:22
DCI using php
<?php
Trait MethodDelegator
{
private $roles = array();
private $method_map = array();
public function delegate($class)
{
@scribu
scribu / php-init.sh
Created November 12, 2012 16:35
Ubuntu PHP Dev Setup
#!/bin/bash
# LEMP
apt-get -y install nginx mysql-server php5-mysql php5-fpm
# extra php packages
apt-get -y install php5-cli php5-gd php5-curl php5-xdebug
# change user from www-data to scribu
sed -i 's/www-data/scribu/g' /etc/nginx/nginx.conf /etc/php5/fpm/pool.d/www.conf