Skip to content

Instantly share code, notes, and snippets.

View chukShirley's full-sized avatar

Chuk Shirley chukShirley

  • Sure Consulting LLC
  • Alabama
View GitHub Profile
Class CustomerRepository
{
private $customerTable;
private $customerMapper;
public function __construct(CustomerTable $customerTable, CustomerMapper $customerMapper)
{
$this->customerTable = $customerTable;
$this->CustomerMapper = $customerMapper;
}
<?php
namespace RPG\Service\Factory;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use ToolkitApi\Toolkit;
/**
* Class ToolkitFactory
* @package RPG\Service\Factory
*/
@chukShirley
chukShirley / FetchAllUnpaidLoadsQueryHandler.php
Created July 22, 2016 20:30
Mocking Zend Db Table Gateway
<?php
namespace Load\Service\Query;
use Load\Infrastructure\Persistence\LoadTable;
use ServiceBus\Query\QueryHandlerInterface;
use Zend\Db\Sql\Predicate\Operator;
use Zend\Db\Sql\Select;
/**
* Class FetchAllUnpaidLoadsQueryHandler
<?php
call_user_func(function () {
$phpBinary = '/usr/local/zendsvr6/bin/php-cli';
$baseDirectory = getenv('ZS_APPLICATION_BASE_DIR');
$migrationLogFile = getenv('ZS_MIGRATION_LOG_FILE');
//foreach (['migrations:migrate', 'orm:generate-proxies', 'app:clear-cache'] as $operation) {
foreach (['migrations:migrate', 'app:clear-cache'] as $operation) {
$command = sprintf(
@chukShirley
chukShirley / IBMiToolkitAdapter.php
Last active August 5, 2016 15:30
Mocking the IBM i Toolkit
<?php
namespace Application;
use ToolkitApi\Toolkit;
/**
* Class IbmiToolkitAdapter
* @package Application
*/
class IbmiToolkitAdapter extends Toolkit implements IbmiToolkitInterface
<?php
class GeneratePdfController extends AbstractActionController
{
public function indexAction()
{
$filename = '/path/to/myFile.pdf';
$response = new Stream();
$headers = new Headers();
$headers
->addHeaderLine('Pragma', 'public')
@chukShirley
chukShirley / index.js
Created January 18, 2017 15:43
Programmatically focus on select 2
$(document).ready(function(){
$('#mySelect2').select2('open')
});
@chukShirley
chukShirley / index.js
Created January 18, 2017 16:02
Select2 on change event
$(document).ready(function() {
$('#mySelect2').select2({
// properties
}).on('change', function (e, added) {
// If an option has been selected
if (e.val !== '') {
}
});
});

php2rpg

Guide showing you PHP and RPG differences

  • RPG is strongly typed.
  • RPG indexes start at 1, where PHP starts at 0.
  • Variables in PHP start with a Dollar sign. ($)

Typing

@chukShirley
chukShirley / SearchTestReports.js
Last active June 13, 2017 14:35
Chained select boxes populated from AJAX results
var SearchTestReports = (function () {
var changeProductGroup = function (event) {
_getItemCodesByProductGroup(event.target.value).done(function (response) {
// populate item code select box
};
};
var _getItemCodesByProductGroup = function (productGroup) {
return $.ajax({