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
<?php
// config/application.config.php
$env = getenv('APPLICATION_ENV');
return [
'appVersion' => '1.2.9',
'modules' => [
'Application',
'Scrap'
],
'module_listener_options' => [
@chukShirley
chukShirley / test.php
Last active August 29, 2015 14:23
Library list mixup
<?php
// Simulate connections to production applications
$db = connectToProduction('ADAM','MYPASS');
$db = connectToProduction('AS400','MYPASS');
$db = connectToProduction('CHIP','MYPASS');
$db = connectToProduction('WEBUSER','WEBUSER');
$i = 0;
while($i <= 5) {
@chukShirley
chukShirley / myFile.js
Created May 21, 2015 13:28
Treat $.ajax() calls as promises
function saveNewCustomer(customerData){
return $.ajax({
type:'POST',
url:'myUrl',
data:customerData,
dataType:'json'
});
}
saveNewCustomer.done(function(response){
@chukShirley
chukShirley / MyController.php
Last active August 29, 2015 14:20
Value Objects
<?php
namespace Sabel;
class MyController
{
public function myMethod($data)
{
SysemReferenceNumberValue::fromString($data['systemReferenceNumber']);
// Use SystemReferenceNumber value object from here on out
SELECT a.*, b.NumberOfRows
FROM MYTABLE a
CROSS JOIN (SELECT COUNT(*) AS NumberOfRows FROM MYTABLE) b
@chukShirley
chukShirley / ToolkitService.php
Last active August 29, 2015 14:20
Proposed code for automatically generating toolkit service params from RPG D specs
<?php
$toolkit = new ToolkitService();
// Data to be passed to toolkit call
$data = array(
'testLabel' => 'testValue',
//...
);
<?php
abstract class AbstractValue
{
protected $value;
private function __construct(){}
protected function filter()
{
@chukShirley
chukShirley / AbstractController.php
Last active August 29, 2015 14:18
Pagination and Filtering for OO PHP
<?php
namespace Sabel;
abstract class AbstractController
{
protected $diContainer;
public function __construct(DiContainer $diContainer){
$this->diContainer = $diContainer;
}
@chukShirley
chukShirley / CustomerCollection.php
Created February 9, 2015 14:02
Domain Design for Apigility on IBM i
<?php
// module/Acme/src/Acme/V1/Rest/Customer/CustomerCollection.php
namespace Acme\V1\Rest\PeddlerPricingFormula;
use Zend\Paginator\Paginator;
class CustomerCollection extends Paginator
{
}
@chukShirley
chukShirley / PLRFMLCRTC.CLLE
Last active December 17, 2015 20:29
Handling Integer Data Types
*************** Beginning of data *************************************
PGM PARM(&PED) //other params
DCL VAR(&PED) TYPE(*INT) LEN(4)
// other params
CALL PGM(SCRAPNEW/PLRFMLCRTR) PARM(&PED) //other params
ENDPGM
****************** End of data ****************************************