Skip to content

Instantly share code, notes, and snippets.

View shahariaazam's full-sized avatar
:octocat:
Helping engineers to be more efficient everyday

Shaharia Azam shahariaazam

:octocat:
Helping engineers to be more efficient everyday
View GitHub Profile
<?php
class ArticlesController extends AppController
{
public $components = array('Paginator');
public function test()
{
$this->Paginator->settings['Article'] = array(
'contain' => array('Category' => array(
'conditions' => array('Category.id' => 2)
<?php
// model/Article.php
App::uses('AppModel', 'Model');
class Article extends AppModel
{
public $hasAndBelongsToMany = array(
'Category' =>
array(

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this-&gt;anything()
@shahariaazam
shahariaazam / phpFile.php
Created January 25, 2014 13:23
A test script referencing the twitter conversation: https://twitter.com/SaraMG/status/427054675536277505
<?php
class Foo {}
$a = null;
$f = new Foo($a = 123);
var_dump($a);
// NULL
class Foo { function __constructor(){} }
$a = null;
$f = new Foo($a = 123);
@shahariaazam
shahariaazam / Colorful-Cli-PHP.php
Created January 20, 2014 17:38
Display colorful output in command line by PHP
<?php
/**
* Cli class to work with PHP command line
*
* @Author Shaharia Azam
* @URI http://www.shahariaazam.com
*/
class Cli
{
@shahariaazam
shahariaazam / Slim_RoutesTest.php
Last active August 26, 2016 06:49
Slim Test class
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use Slim\Environment;
class RoutesTest extends PHPUnit_Framework_TestCase
{
<?php
class ColorCLI {
static $foreground_colors = array(
'bold' => '1', 'dim' => '2',
'black' => '0;30', 'dark_gray' => '1;30',
'blue' => '0;34', 'light_blue' => '1;34',
'green' => '0;32', 'light_green' => '1;32',
'cyan' => '0;36', 'light_cyan' => '1;36',
# Apache config
<FilesMatch ".(eot|ttf|otf|woff)">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
@shahariaazam
shahariaazam / GitHub-bulk-issue-import.php
Created December 3, 2013 01:12
Bulk Issue create or Import from a Json files
<?php
// This file is generated by Composer
require_once 'vendor/autoload.php';
$client = new \Github\Client();
$client->authenticate('githubusername', 'githubpassword', Github\Client::AUTH_HTTP_PASSWORD);
/*$repositories = $issue = $client->api('issue')->all('shahariaazam', 'cakephp-quick-start');
//var_dump($repositories); die();*/
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset='UTF-8'>
<title>Simple Loader</title>
<style>
/* This only works with JavaScript,