Skip to content

Instantly share code, notes, and snippets.

View jrodriguez-ifuelinteractive's full-sized avatar

Jesus Rodriguez jrodriguez-ifuelinteractive

View GitHub Profile
@jrodriguez-ifuelinteractive
jrodriguez-ifuelinteractive / lbcheck.php
Last active July 16, 2018 12:29
Magento load balancer health check script
<?php
include './app/Mage.php';
try {
Mage::app();
echo gethostname();
} Catch (Exception $e) {
header("HTTP/1.0 503 Service Unavailable");
}
/* iPhone 3 portrait */
@media (device-height: 480px) and (-webkit-max-device-pixel-ratio: 1) and (orientation:portrait) {
}
/* iPhone 3 landscape */
@media (device-height: 480px) and (-webkit-max-device-pixel-ratio: 1) and (orientation:landscape) {
}
/* iPhone 4 retina portrait */
@media (device-height: 480px) and (-webkit-min-device-pixel-ratio: 2) and (orientation:portrait) {
/* iPhone 3 portrait */
@media (device-height: 480px) and (-webkit-max-device-pixel-ratio: 1) and (orientation:portrait) {
}
/* iPhone 3 landscape */
@media (device-height: 480px) and (-webkit-max-device-pixel-ratio: 1) and (orientation:landscape) {
}
/* iPhone 4 retina portrait */
@media (device-height: 480px) and (-webkit-min-device-pixel-ratio: 2) and (orientation:portrait) {
@jrodriguez-ifuelinteractive
jrodriguez-ifuelinteractive / gist:126691f408958a07e459
Last active August 29, 2015 14:02
app\code\core\Mage\Checkout\controllers\OnepageController.php
<?php
if (!$session->getLastSuccessQuoteId()) {
$this->_redirect('checkout/cart');
return;
}
$lastQuoteId = $session->getLastQuoteId();
$lastOrderId = $session->getLastOrderId();
$lastRecurringProfiles = $session->getLastRecurringProfileIds();
if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
@jrodriguez-ifuelinteractive
jrodriguez-ifuelinteractive / gist:5226f1a0f7a0523caeee
Last active August 29, 2015 14:02
Checkout Success Page Tester
<?php
class Ifuel_Successtest_IndexController extends Mage_Core_Controller_Front_Action
{
/**
* Success page redirect
*/
public function testAction()
{
if (!Mage::helper('core')->isDevAllowed()) {
$this->_forward('noroute');
<?php
class Ifuel_Cache_Block_Catalog_Category_View extends Mage_Catalog_Block_Category_View
{
protected function _construct()
{
$this->addData(array(
// Long term block
'cache_lifetime' => 999999999,
'cache_tags' => array(Mage_Catalog_Model_Product::CACHE_TAG, Mage_Catalog_Model_Category::CACHE_TAG),
));
#Apache >=2.4
<Directory /path/to/webroot>
AllowOverride All
AuthUserFile /etc/apache2/.htpasswd
AuthType Basic
AuthName "Restricted Content"
<Limit GET>
Require valid-user
</Limit>
<?php
$category = Mage::getModel('catalog/category');
$categories = $category->getCategories(62, 1, true);
foreach ($categories as $_category) {
echo $_category->getName() ;
}
@jrodriguez-ifuelinteractive
jrodriguez-ifuelinteractive / gist:baf4fcd033d1adcdc856
Last active February 23, 2017 20:01
Sort Objective-C Array
// NSMutableArray Example
// Using this method will sort your current array
NSMutableArray *unsortedArray = [[NSMutableArray alloc] initWithObjects:@"Albert", @"Eric", @"Betty", nil];
[unsortedArray addObject:@"Carl"];
[unsortedArray addObject:@"David"];
[unsortedArray sortUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
NSLog(@"sorted array: %@", unsortedArray);
// NSArray Example
// Using this method will create a new array
NSString *string = @"Hello Bla Bla";
NSString *searchText = @"bla";
NSUInteger searchOptions = NSCaseInsensitiveSearch | NSDiacriticInsensitiveSearch;
NSRange searchRange = NSMakeRange(0, string.length);
NSRange foundRange = [string rangeOfString:searchText options:searchOptions range:searchRange];
if (foundRange.length > 0) {
NSLog(@"Text Found.");
}