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 / delete_customers.sql
Last active August 29, 2015 14:21
Magento Delete Customers
SET FOREIGN_KEY_CHECKS=0;
-- reset customers
TRUNCATE `customer_address_entity`;
TRUNCATE `customer_address_entity_datetime`;
TRUNCATE `customer_address_entity_decimal`;
TRUNCATE `customer_address_entity_int`;
TRUNCATE `customer_address_entity_text`;
TRUNCATE `customer_address_entity_varchar`;
TRUNCATE `customer_entity`;
TRUNCATE `customer_entity_datetime`;
@jrodriguez-ifuelinteractive
jrodriguez-ifuelinteractive / delete_orders.sql
Last active August 29, 2015 14:21
Magento Delete Orders
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE `sales_flat_creditmemo`;
TRUNCATE `sales_flat_creditmemo_comment`;
TRUNCATE `sales_flat_creditmemo_grid`;
TRUNCATE `sales_flat_creditmemo_item`;
TRUNCATE `sales_flat_invoice`;
TRUNCATE `sales_flat_invoice_comment`;
TRUNCATE `sales_flat_invoice_grid`;
TRUNCATE `sales_flat_invoice_item`;
TRUNCATE `sales_flat_order`;
#!/bin/bash
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
chmod 744 cron.sh
chmod 744 mage
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.");
}
@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
<?php
$category = Mage::getModel('catalog/category');
$categories = $category->getCategories(62, 1, true);
foreach ($categories as $_category) {
echo $_category->getName() ;
}
#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
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),
));
@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');
@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))) {