Skip to content

Instantly share code, notes, and snippets.

View nahidacm's full-sized avatar

Mahmudur Rahman nahidacm

  • Dhaka, Bangladesh
View GitHub Profile
<?php
if ( ! function_exists('ellipsize'))
{
/**
* Ellipsize String
*
* This function will strip tags from a string, split it at its max_length and ellipsize
*
* @param string string to ellipsize
@nahidacm
nahidacm / virtual-host-settings
Created August 8, 2012 03:22
Sample virtual host settings for localhost
#
#Added by NHD
#
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
DocumentRoot "D:\wamp\www"
</VirtualHost>
@nahidacm
nahidacm / notes
Created September 28, 2012 05:33
Some Notes
windows host file directory:
C:\Windows\System32\drivers\etc
@nahidacm
nahidacm / builder-pattern.php
Created October 3, 2012 18:03
Builder Design Pattern assignment
<?php
//Product
class Report {
private $header;
private $body;
private $footer;
//BaseUrl
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
//BasePath
Mage::getBaseDir('media')
@nahidacm
nahidacm / CitiesArray.php
Created November 13, 2012 04:31 — forked from jonathonbyrdziak/CitiesArray.php
Cities Array :: An array of USA cities, as of April 2010
array(
'ALABAMA'=>
array('ABBEVILLE','ADAMSVILLE','ADDISON','AKRON','ALABASTER','ALBERTVILLE','ALEXANDER CITY','ALEXANDRIA','ALICEVILLE','ALLGOOD','ALTOONA','ANDALUSIA','ANDERSON','ANNISTON','ARAB','ARDMORE','ARGO','ARITON','ARLEY','ASHFORD','ASHLAND','ASHVILLE','ATHENS','ATMORE','ATTALLA','AUBURN','AUTAUGAVILLE','AVON','BABBIE','BAILEYTON','BANKS','BAY MINETTE','BAYOU LA BATRE','BEAR CREEK','BEATRICE','BEAVERTON','BELK','BENTON','BERRY','BESSEMER','BILLINGSLEY','BIRMINGHAM','BLACK','BLOUNTSVILLE','BLUE MOUNTAIN','BLUE RIDGE','BLUE SPRINGS','BOAZ','BOLIGEE','BON AIR','BRANCHVILLE','BRANTLEY','BRENT','BREWTON','BRIDGEPORT','BRIGHTON','BRILLIANT','BROOKSIDE','BROOKWOOD','BRUNDIDGE','BUTLER','BYNUM','CAHABA HEIGHTS','CALERA','CAMDEN','CAMP HILL','CARBON HILL','CARDIFF','CAROLINA','CARROLLTON','CASTLEBERRY','CEDAR BLUFF','CENTER POINT','CENTRE','CENTREVILLE','CHALKVILLE','CHATOM','CHELSEA','CHEROKEE','CHICKASAW','CHILDERSBURG','CITRONELLE','CLANTON','CLAY','CLAYHATCHEE','CLAYTON','CLEVELAND','CLIO','COALING',
We can't make this file beautiful and searchable because it's too large.
"zip","city","state","latitude","longitude","timezone","dst"
"00210","Portsmouth","NH","43.005895","-71.013202","-5","1"
"00211","Portsmouth","NH","43.005895","-71.013202","-5","1"
"00212","Portsmouth","NH","43.005895","-71.013202","-5","1"
"00213","Portsmouth","NH","43.005895","-71.013202","-5","1"
"00214","Portsmouth","NH","43.005895","-71.013202","-5","1"
"00215","Portsmouth","NH","43.005895","-71.013202","-5","1"
"00501","Holtsville","NY","40.922326","-72.637078","-5","1"
"00544","Holtsville","NY","40.922326","-72.637078","-5","1"
"00601","Adjuntas","PR","18.180103","-66.74947","-4","0"
@nahidacm
nahidacm / awesome-php.md
Last active December 11, 2015 12:58 — forked from ziadoz/awesome-php.md

Awesome PHP Libraries

A list of amazingly awesome PHP libraries that you should consider using (and some other shiny extras).

<?php
$img_location = Mage::getBaseDir('media'). '/igallery'.$file_path;
$imageResized = Mage::getBaseDir('media'). '/igallery/resized'.$file_path;
$image= new Varien_Image($img_location);
$image->resize(80, 80);
$image->save($imageResized);
echo '<img src="'.Mage::getBaseUrl('media'). 'igallery'.$value['file'].'" />';
<?php
//Table names and table prefixes
$tableName = Mage::getSingleton('core/resource')
getTableName('catalog_product_entity');
// if prefix was 'mage_' then the below statement
// would print out mage_catalog_product_entity
echo $tableName;
//Accessing the database connection resource