Skip to content

Instantly share code, notes, and snippets.

@stuudmuffin
stuudmuffin / curl_progress.php
Last active May 11, 2024 20:21 — forked from bdunogier/curl_progress.php
PHP/cURL download progress monitoring
<?php
//If output buffer flushing does not work, web-search for reasons your php/webserver setup may need to be adjusted
header('X-Accel-Buffering: no');
if (ob_get_level() == 0) ob_start();
//create javascript progress bar
echo "<html>
<head>
<script type='text/javascript'>
function updateProgress(perc) {
@mroffice
mroffice / SUPEE 6788 patch for Magento Community Edition.md
Last active July 1, 2020 08:18
How I patched our Magento 1.9.2.1 CE with the notorious SUPEE 6788 patch that breaks all your extensions.

See Updates for new additional info

What is SUPEE-6788?

SUPEE-6788 is a bundle of patches for Magento. From the Magento Commerce website:

[SUPEE-6788] provides protection against several types of security-related issues, including remote code execution, information leaks and cross-site scripting.

## Why is it more complicated than previous patches?

@joecampo
joecampo / Connecting PHP 5.6 to MSSQL.md
Last active June 4, 2022 14:20
Connecting PHP 5.6 to MSSQL - Ubuntu (Debian) w/ Apache
@ankitsam
ankitsam / magento_category_list_by_product_id.php
Last active September 21, 2017 16:52
Magento Category Products List Sort by Product ID
<?php
/* Copy file
* app\code\core\Mage\Catalog\Block\Product\List.php
* to
* app\code\local\Mage\Catalog\Block\Product\List.php
*/
/* Replace */
$this->_productCollection = $layer->getProductCollection()->addAttributeToSort($_GET['order'], $_GET['dir']);
<?php
//
// delete-old-tweets.php - https://github.com/timdp
//
// -- Instructions --
// 1. Save this script somewhere as delete-old-tweets.php
// 2. Get your Twitter archive and extract it to the same folder
// 3. Clone https://github.com/themattharris/tmhOAuth to the same folder
// 4. Register an app at dev.twitter.com and enter its credentials below
@cgdangelo
cgdangelo / mage-constraints.sql
Created March 23, 2012 22:11
Recreate foreign keys for a Magento installation, after you fire the idiot who deleted all of them.
# one-liner for generating this: mysqldump --no-data -uroot magento1600 | nawk '{if(match($0, /CREATE TABLE `(.*)`/, matchesT)) { the_table = matchesT[1]; } if(match($0, /(CONSTRAINT .*),?/, matchesK) && the_table) { the_key = gensub(/,?$/, "", matchesK[1]); the_key = gensub(/^ */, "", the_key); print "ALTER TABLE `" the_table "` ADD", the_key ";"; }}'
ALTER TABLE `admin_rule` ADD CONSTRAINT `FK_ADMIN_RULE_ROLE_ID_ADMIN_ROLE_ROLE_ID` FOREIGN KEY (`role_id`) REFERENCES `admin_role` (`role_id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `api_rule` ADD CONSTRAINT `FK_API_RULE_ROLE_ID_API_ROLE_ROLE_ID` FOREIGN KEY (`role_id`) REFERENCES `api_role` (`role_id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `api_session` ADD CONSTRAINT `FK_API_SESSION_USER_ID_API_USER_USER_ID` FOREIGN KEY (`user_id`) REFERENCES `api_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `catalog_category_entity_datetime` ADD CONSTRAINT `FK_CAT_CTGR_ENTT_DTIME_ATTR_ID_EAV_ATTR_ATTR_ID` FOREIGN KEY (`attribute_id