This file contains 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
$.ajax({ | |
url: 'http://www.website.com/ajax', | |
data: '&ajaxcmd=getSomeInfo&id=' + id, | |
dataType: 'html', | |
success:function(output){ | |
var regex = /^\s*$/; | |
if(regex.test(output)) { | |
alert('Empty response'); | |
} else { | |
alert('Not empty'); |
This file contains 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
version=1.7.0.2 | |
wget http://www.magentocommerce.com/downloads/assets/$version/magento-$version.tar.gz | |
tar -zxvf magento-$version.tar.gz | |
mv magento/* magento/.htaccess . | |
chmod -R o+w media var | |
chmod o+w app/etc | |
rm -rf magento/ magento-$version.tar.gz | |
rm -rf index.php.sample LICENSE.txt LICENSE.html LICENSE_AFL.txt php.ini.sample RELEASE_NOTES.txt |
This file contains 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
find . -type f -exec chmod 644 {} \; | |
find . -type d -exec chmod 755 {} \; | |
chmod 550 pear | |
chmod 550 mage | |
chmod -R 777 media var |
This file contains 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
<a href="delete?id=1" class="confirm">Delete 1</a> | |
<a href="delete?id=2" class="confirm">Delete 2</a> | |
<a href="delete?id=3" class="confirm">Delete 3</a> | |
<div class="modal hide fade" id="confirm-delete" role="dialog" aria-labelledby="confirm-delete-header" aria-hidden="true"> | |
<div class="modal-header"> | |
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | |
<h3 id="confirm-delete-header">Delete Confirmation</h3> | |
</div> | |
<div class="modal-body"> |
This file contains 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 | |
// Sorting a multi-dimensional array (of objects), by price | |
usort($products, function($a, $b) { | |
$a = (object) $a; | |
$b = (object) $b; | |
if ($a->price == $b->price) { | |
return 0; | |
} else { | |
// return $a->price > $b->price ? -1 : 1; // DESC | |
return $a->price > $b->price ? 1 : -1; // ASC |
This file contains 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 | |
/** | |
* Pretty accurate way of calculating the Luma (Brightness) value | |
* | |
* @param array|int|false $r | |
* @param int|false $g | |
* @param int|false $b | |
* @return int | |
*/ |
This file contains 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 UsersController extends AppController { | |
[...] | |
$this->User->setValidationRule('account'); | |
[...] | |
This file contains 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 | |
// Includes text RGB to show text as white or black. This value was calculated using; | |
// $brightness = sqrt( (R * R * .299) + (G * G * .587) + (B * B * .114) ) | |
// If $brightness was greater than 130, then the text was set to white | |
$ral_colours => array( | |
'RAL 1000' => array( | |
'rgb' => '190,189,127', | |
'name' => 'Green Beige', |
This file contains 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 | |
rebuild_tree(1, 1); | |
function rebuild_tree($parent_id, $left) { | |
// The right value of this node is the left value + 1 | |
$right = $left+1; | |
// Get all children of this node |
This file contains 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
<select name="location_tree[1]" id="location-tree-1"> | |
<option value="0" selected="selected">Please Select...</option> | |
<option value="2">Africa</option> | |
<option value="203">Asia</option> | |
<option value="332">Asia Pacific</option> | |
<option value="1299">Caribbean</option> | |
<option value="1749">Central America</option> | |
<option value="1925">Europe</option> | |
<option value="17949">India & Indian Ocean</option> | |
<option value="18058">Middle East</option> |