Skip to content

Instantly share code, notes, and snippets.

@Niroshan3
Niroshan3 / observer.php
Created June 19, 2017 06:22
2Checkout Payment Extension - default observer.php
<?php
class Craig_Tco_Model_Observer extends Mage_Core_Block_Abstract {
public function issue_creditmemo_refund(Varien_Object $payment) {
$refund = Mage::getStoreConfig('payment/tco/refund');
if ($refund == '1') {
$order = $payment->getCreditmemo()->getOrder();
@Niroshan3
Niroshan3 / observer.php
Created June 19, 2017 06:27
2Checkout Payment Extension - changed observer.php
/* By: Niroshan - https://www.mazzitorch.com/2017/06/19/2checkout-payment-extension-magento-error-href-undefined-prototype/ */
<?php
class Craig_Tco_Model_Observer extends Mage_Core_Block_Abstract {
public function issue_creditmemo_refund(Varien_Object $payment) {
$refund = Mage::getStoreConfig('payment/tco/refund');
@Niroshan3
Niroshan3 / MagentoFileUpload.php
Last active May 25, 2018 05:50
Magento File Upload via Varien_File_Uploader
<?php
$uploader = new Varien_File_Uploader($_filename);
$uploader->setAllowedExtensions(array('zip','ZIP'));
$uploader->setAllowRenameFiles(true); //if true, uploaded file's name will be changed, if file with the same name already exists directory. Necessary to avoid conflicts
$uploader->setFilesDispersion(false); //To have a dispersion based on the original file name (as the file option does), we will have to do it manually
$uploader->setAllowCreateFolders(true); //for creating the directory if not exists
$extension = pathinfo(strtolower($_file['name']), PATHINFO_EXTENSION);
@Niroshan3
Niroshan3 / gaussianblur_filter.class.js
Created August 29, 2019 14:02 — forked from ncou/gaussianblur_filter.class.js
Gaussian Blur filter for fabric.js
/**
* Gaussian blur filter for fabricjs
* Example:
* obj.filters.push(new fabric.Image.filters.GaussianBlur(6));
* obj.applyFilters(canvas.renderAll.bind(canvas));
*
* Adapted from <a href="http://www.quasimondo.com/BoxBlurForCanvas">http://www.quasimondo.com/BoxBlurForCanvas</a>
*/
(function() {
@Niroshan3
Niroshan3 / meta-tags.md
Created November 4, 2019 09:12 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<style type="text/css">