Skip to content

Instantly share code, notes, and snippets.


Hari K T harikt

View GitHub Profile
View Zend_Form_Sample
// include auto-loader class
require_once 'Zend/Loader/Autoloader.php';
//register auto-loader
$loader = Zend_Loader_Autoloader::getInstance();
$view = new Zend_View();
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
View Euler
* There may be always a better solution than this .
* Problem : Some discussion in ipgofkerala group regarding ( Eulers problem ) . Many of them came with C#, Clojure, Ruby, Python.. more??
* So I Just made some changes made by Sujeeth Nair in C++ to port to PHP
* I don't want PHP to miss this game :P
* Catch me at
* Hari K T
harikt / doctrine.php
Created Aug 28, 2010
To create models specifically for the doctrine for each specific module for the videos of . Keep this file in <project dir>/application/scriptsdoctrine.php Eg: $./doctrine < arguments for doctrine > module <module name > If no module is
View doctrine.php
// Define path to application directory
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/..'));
// Define application environment
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'doctrineCLI'));
harikt / gist:656142
Last active Sep 24, 2015
Virtual host
View gist:656142
Replace the blog and public directory according to the names .
Sample which Ryan Mauger helped me on #zf-talk .
<Bittarman> open your terminal, and type this,
sudo echo " blog.local" >> /etc/hosts
<Bittarman> then, sudo vim /etc/apache2/sites-available/blog.local
<Bittarman> and paste this into it
<VirtualHost *:80>
harikt / gist:656157
Created Oct 31, 2010
Creating your Lithium Project
View gist:656157
hari@hari-laptop:/var/www$ li3 library extract hellolithium
hellolithium created in /var/www from /var/www/lithium/libraries/lithium/console/command/create/template/app.phar.gz
hari@hari-laptop:/var/www$ cd hellolithium/
Lets see how it looks ;)
hari@hari-laptop:/var/www/hellolithium$ tree
|-- config
View example.php
Going through the slides of phparch OOP THE PHP 5.3 Way
A try at the example given by Marco Tabini. Some corrections was needed, just updated it ;) .
namespace Blueparabola;
class example {
public function sayHello() {
echo 'I am from ' . __CLASS__ . " . Yes namespace \n";
harikt / SearchesController.php
Created Jan 20, 2011
Located at controllers
View SearchesController.php
namespace app\controllers;
use \app\models\Search,
class SearchesController extends \lithium\action\Controller {
harikt / Search.php
Created Jan 20, 2011
Located at models
View Search.php
namespace app\models;
use \Zend_Search_Lucene,
class Search extends \lithium\data\Model {
harikt / index.html.php
Created Jan 20, 2011
located at views/searches
View index.html.php
Search for <?= $query; ?> returned <?= count($searches)?> hits <br />
<?php foreach ($searches as $hit) { ?>
<li><?= $this->html->link( $hit->url , $hit->url );?></li>
<?php } ?>
View Comments.php
namespace app\models;
class Comments extends \lithium\data\Model {
public $validates = array();
public $belongsTo = array('Posts','Users');