This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$list = array( | |
"AL"=>"Alabama", | |
"AK"=>"Alaska", | |
"AZ"=>"Arizona", | |
"AR"=>"Arkansas", | |
"CA"=>"California", | |
"CO"=>"Colorado", | |
"CT"=>"Connecticut", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tar -zcvf /home/backup/archive.tar.gz /var/lib/mysql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Backup all Databases*/ | |
mysqldump -u <username> -p --all-databases > /home/tmp/backup/dbs.sql | |
/*Backup Single Database*/ | |
mysqldump -u <username> -p db_name > /home/tmp/backup/db_name.sql | |
/*Backup Single Database - Compressed */ | |
mysqldump -u <username> -p db_name --quick | gzip > /home/tmp/backup/db_name.sql.gz | |
/*Import gzipped database*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Word limit | |
function wordLimit($str, $limit = 100, $end_char = '…') | |
{ | |
if (trim($str) == '') | |
return $str; | |
// always strip tags for text | |
$str = strip_tags($str); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Character limit | |
function characterLimit($str, $limit = 150, $end_char = '...') | |
{ | |
if (trim($str) == '') | |
return $str; | |
// always strip tags for text | |
$str = strip_tags(trim($str)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//$product = Mage::getModel('catalog/product'); | |
$product = new Mage_Catalog_Model_Product(); | |
echo time(); | |
// Build the product | |
$product->setAttributeSetId(9);// #4 is for default | |
$product->setTypeId('simple'); | |
$product->setName('Some cool product name'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Windows | |
#<Directory "D:/vhosts"> | |
# Options Indexes FollowSymLinks Includes ExecCGI | |
# AllowOverride All | |
# Order allow,deny | |
# Allow from all | |
#</Directory> | |
#linux | |
<Directory "/var/vhosts"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
App::uses('Model', 'Model'); | |
class AppModel extends Model { | |
public function beforeSave($options = array()) { | |
// save our HABTM relationships | |
foreach (array_keys($this->hasAndBelongsToMany) as $model){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Mynamespace_Mymodule_Model_Product_Attribute_Source_Vendor extends Mage_Eav_Model_Entity_Attribute_Source_Abstract { | |
public function getAllOptions() { | |
// $options[] = array('value' => 0, 'label' => 'Select Vendor'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>The HTML5</title> | |
<meta name="description" content="The HTML5 Herald"> | |
<meta name="author" content="SitePoint"> |
OlderNewer