Skip to content

Instantly share code, notes, and snippets.

View prodeveloper's full-sized avatar

Jacob Chencha prodeveloper

View GitHub Profile
@prodeveloper
prodeveloper / controller.php
Last active December 20, 2015 16:58
Controller for long running process blog.
<?php
/**
* @author Chencha Jacob Gisore
* @link www.chenchatech.com
*/
require_once 'queue_manager.php';
require_once 'helpers.php';
$controller = new Controller();
@prodeveloper
prodeveloper / array_map_version
Created October 10, 2013 18:45
Snapshot showing use of array_map and foreach in a project that capitalizes strings.
<?php
/**
* Loops array using array walk/ map
*/
class LoopMap extends Loops {
function __construct($array) {
$this -> array = $array;
}
@prodeveloper
prodeveloper / install_laravel.txt
Created January 26, 2014 19:27
HMVC in Laravel
composer create-project laravel/laravel --prefer-dist
@prodeveloper
prodeveloper / final_composer.json
Last active January 4, 2016 14:59
Configuring Composer HMVC Laravel
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"require": {
"laravel/framework": "4.0.*"
},
"autoload": {
"classmap": [
"app/commands",
@prodeveloper
prodeveloper / global.php
Created January 26, 2014 20:04
Editing Start PHP File HMVC
<?php
/*
|--------------------------------------------------------------------------
| Register The Laravel Class Loader
|--------------------------------------------------------------------------
|
| In addition to using Composer, you may use the Laravel class loader to
| load your controllers and models. This is useful for keeping all of
| your classes in the "global" namespace without Composer updating.
@prodeveloper
prodeveloper / Customer.php
Created September 3, 2014 22:49
Introduce Parameter Object Refactor | Before Refactor
<?php
/**
* Hard to read the data
* Repeated values
* Lacks intent
*/
class Customer {
function amountInvoicedIn($start_date, $end_date) {
@prodeveloper
prodeveloper / CustomerRefactored.php
Last active August 29, 2015 14:06
Introduce Parameter Object Refactor | After Refactor
<?php
use DateRange;
/**
* Easy to read
* Easy to refactor
* Easy to mock and test
*/
class Customer {
@prodeveloper
prodeveloper / final_users.sql
Created September 11, 2014 00:10
Users Table Structure
CREATE TABLE'users' (
'id' int(10) unsigned NOT NULL AUTO_INCREMENT,
'password' text COLLATE utf8_unicode_ci NOT NULL,
'email' varchar(45) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY ('id')
)
@prodeveloper
prodeveloper / SentryUserAction.php
Created September 16, 2014 21:38
sentry_to_native
<?php
/**
*
*/
namespace Events;
use User;
class SentryUserAction {
/**
@prodeveloper
prodeveloper / SimpleTitleParse.php
Last active August 29, 2015 14:06
Retrieving Post Id From Link
class SimpleTitleParse implements TitleParserInterface {
function getTitle($url)
{
$url_parts=explode('/',$url);
$title=array_pop($url_parts);
return $title;
}
}