Skip to content

Instantly share code, notes, and snippets.

View prodeveloper's full-sized avatar

Jacob Chencha prodeveloper

View GitHub Profile
@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;
}
}
@prodeveloper
prodeveloper / pspell.php
Created October 13, 2014 09:44
PSpell Configuration File
<?php
return [
/**
* his function determines whether run-together words will be treated as legal
* compounds. That is, "thecat" will be a legal compound, although there should be
* a space between the two words
*/
'run_together'=>false,
/**
* Set a file that contains replacement pairs.
@prodeveloper
prodeveloper / output.json
Created October 15, 2014 23:16
Laravel-4-Decorators-Tutorials
{
"0": {
"worker_details": {
"role": "quia",
"name": "Shaun Leuschke"
}
},
"1": {
"worker_details": {
"role": "quis",
/**
* Ofcos the classes should be in different files
* Assumes you are using a command bus to raise events I happen to love Jeff Way https://github.com/laracasts/Commander
*
* With this architecture you don't need to modify any existing classes for new headers just add a new class and should work
*
* More than one class can handle the requests
*/
class CommitComment extends GithubRequest {
<?php
namespace Chencha\Autosuggest\Validators;
use Chencha\Autosuggest\Exceptions\PspellIsNotInstalled;
class CheckPspellIsInstalled {
function __construct()
@prodeveloper
prodeveloper / GetAllColumns.php
Created November 7, 2014 09:48
Get All Columns
<?php
namespace Model\Processors;
use DB;
/**
* Class GetAllColumns
* @package Model\Processors
* - See more at: http://laravelsnippets.com/snippets/get-all-columns-names-from-a-eloquent-model#sthash.wgqPKvG9.dpuf
*/
trait GetAllColumns
{