Skip to content

Instantly share code, notes, and snippets.

View harikt's full-sized avatar
⛱️
Tanvish Technologies

Hari K T harikt

⛱️
Tanvish Technologies
View GitHub Profile
<?php
// include auto-loader class
require_once 'Zend/Loader/Autoloader.php';
//register auto-loader
$loader = Zend_Loader_Autoloader::getInstance();
//setView
$view = new Zend_View();
$view->setEncoding("ISO-8859-1");
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
<?php
/*
* There may be always a better solution than this .
* Problem : Some discussion in ipgofkerala group regarding http://bit.ly/d2ihwR ( Eulers problem http://projecteuler.net/ ) . 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 harikt.com
* Hari K T
*/
@harikt
harikt / doctrine.php
Created August 28, 2010 19:21
To create models specifically for the doctrine for each specific module for the videos of zendcasts.com . Keep this file in <project dir>/application/scriptsdoctrine.php Eg: $./doctrine < arguments for doctrine > module <module name > If no module is
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/..'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'doctrineCLI'));
@harikt
harikt / gist:656142
Last active September 24, 2015 02:47
Virtual host
Replace the blog and public directory according to the names .
Sample which Ryan Mauger http://www.rmauger.co.uk/ helped me on #zf-talk .
<Bittarman> open your terminal, and type this,
sudo echo "127.0.0.1 blog.local www.blog.local" >> /etc/hosts
<Bittarman> then, sudo vim /etc/apache2/sites-available/blog.local
<Bittarman> and paste this into it http://pastie.org/1112846
<VirtualHost *:80>
@harikt
harikt / gist:656157
Created October 31, 2010 05:06
Creating your Lithium Project
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
<?php
/*
Going through the slides of phparch OOP THE PHP 5.3 Way
http://www.phparch.com/2010/11/29/codeworks-2010-slides/
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
harikt / SearchesController.php
Created January 20, 2011 17:05
Located at controllers
<?php
namespace app\controllers;
use \app\models\Search,
\Zend_Search_Lucene;
class SearchesController extends \lithium\action\Controller {
/*
@harikt
harikt / Search.php
Created January 20, 2011 17:08
Located at models
<?php
namespace app\models;
use \Zend_Search_Lucene,
\Zend_Search_Lucene_Document,
\Zend_Search_Lucene_Field;
class Search extends \lithium\data\Model {
@harikt
harikt / index.html.php
Created January 20, 2011 17:09
located at views/searches
Search for <?= $query; ?> returned <?= count($searches)?> hits <br />
<ul>
<?php foreach ($searches as $hit) { ?>
<li><?= $this->html->link( $hit->url , $hit->url );?></li>
<?php } ?>
</ul>
@harikt
harikt / Comments.php
Created March 9, 2011 16:45
Table Structure
<?php
namespace app\models;
class Comments extends \lithium\data\Model {
public $validates = array();
public $belongsTo = array('Posts','Users');