Skip to content

Instantly share code, notes, and snippets.

View sohelrana820's full-sized avatar
💭
I may be slow to respond.

Sohel Rana sohelrana820

💭
I may be slow to respond.
View GitHub Profile
<?php
App::import('Vendor','tcpdf/tcpdf');
class XTCPDF extends TCPDF
{
var $xheadertext = null;
var $xheadercolor = array(255, 255, 255);
var $xfootertext = null;
var $xfooterfont = PDF_FONT_NAME_MAIN ;
@sohelrana820
sohelrana820 / basic_ubuntu_commends.shell
Last active August 29, 2015 14:05
Basic Ubuntu Commend
sudo apt-get install APPLICATION_NAME //Install an application
sudo apt-get remove APPLICATION_NAME //Remove an application
sudo apt-get update //Update the system
sudo apt-get upgrade //Upgrade the system
killall APPLICATION_NAME //terminates an application
@sohelrana820
sohelrana820 / Singleton.php
Last active August 29, 2015 14:05
Singleton Design Pattern
<?php
class Singleton
{
public static function classInstance()
{
static $instance = null;
if (null === $instance) {
$instance = new static();
}
@sohelrana820
sohelrana820 / setter_and_getter_in_php.php
Created September 10, 2014 12:26
Setter and Getter in PHP
<?php
class MagicClass
{
/**
* @var
*
* Declaring two private variable.
*/
private $myName;
@sohelrana820
sohelrana820 / sort_multidimensional_array.php
Last active August 29, 2015 14:06
Sort multidimensional array by given key (Ascending and Descending order)
<?php
/**
* @return mixed
*
* This is array will output array (ascending and descending order) according to KEY
*/
function sortArray()
{
$funcArgument = func_get_args();
array (size=5)
0 =>
array (size=2)
'name' => string 'Orange' (length=6)
'price' => string '12' (length=2)
1 =>
array (size=2)
'name' => string 'Mango' (length=5)
'price' => string '10' (length=2)
2 =>
<?php
class MagicClass
{
public $classDetails = 'This is simple basic class for magic to understand magic method';
public $yourID;
public $yourName;
protected $isDBConnected;
protected $isDataStored;
@sohelrana820
sohelrana820 / index.html
Created November 9, 2014 15:57
News Scroller
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.li.scroller.js"></script>
<style type="text/css">
ul.newsticker {
position: relative;
left: 750px;
font: bold 10px Verdana;
@sohelrana820
sohelrana820 / nginx_enable.php
Created November 16, 2014 14:06
Ngnig Sites Enable
# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts to this file
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
@sohelrana820
sohelrana820 / Lesson.php
Created December 13, 2014 06:06
Count with Group By query in CakePHP
public function userCountByLesson()
{
$lesson = $this->find(
'all',
array(
'recursive' => -1,
'fields' => array('COUNT(`id`) AS lessonTaken', 'created_for', 'created_by'),
'group' => 'Lesson.created_for'
)