Skip to content

Instantly share code, notes, and snippets.

View stnc's full-sized avatar
🎯
Focusing

TUNÇ Selman stnc

🎯
Focusing
View GitHub Profile
@stnc
stnc / admin-redirect.php
Created August 1, 2017 20:09 — forked from kharissulistiyo/admin-redirect.php
Admin Page Redirection After WordPress Theme Activated
/**
* WordPress snippet
* Admin page redirection
* Put this inside theme setup function
*/
global $pagenow;
if ( is_admin() && 'themes.php' == $pagenow && isset( $_GET['activated'] ) ) {
@stnc
stnc / Install-Magento-1.md
Created September 13, 2017 15:15 — forked from rafaelstz/Install-Magento-1.md
Install Magento 1.9.2.4 (With Sample Data)
@stnc
stnc / shopping_cart_sales_rule_with_coupon.php
Created October 19, 2017 19:26 — forked from antoinekociuba/shopping_cart_sales_rule_with_coupon.php
Magento - Create shopping cart price rule with a specific coupon code programmatically.
<?php
/**
* Create Shopping Cart Sales Rule with Specific Coupon Code Programmatically
*/
// All customer group ids
$customerGroupIds = Mage::getModel('customer/group')->getCollection()->getAllIds();
// SalesRule Rule model
$rule = Mage::getModel('salesrule/rule');
@stnc
stnc / chrome-bg-with-sw-communication.md
Created January 6, 2018 16:49 — forked from zdila/chrome-bg-with-sw-communication.md
How to send messages from service worker to the chrome extension without having the webapp open

In the background script we have:

chrome.webRequest.onBeforeRequest.addListener(function (details) {
  if (details.method === 'HEAD') {
    if (details.url.endsWith('?start')) {
      ringSound.play();
    } else if (details.url.endsWith('?stop')) {
      ringSound.pause();
 ringSound.currentTime = 0;
@stnc
stnc / Magento:XML: Remove Footer links.xml
Last active February 9, 2018 11:53 — forked from cristianstan/Magento:XML: Remove Footer links.xml
Magento:XML: Remove Footer links
@stnc
stnc / local-Remote-SFTP.sh
Created March 1, 2018 11:53 — forked from themorgantown/local-Remote-SFTP.sh
Sync a local folder with SFTP or FTP server using git-ftp
# Instructions for syncing a local folder with a remote FTP or SFTP server
# The only requirement is homebrew. To get git-ftp:
brew update && brew install git-ftp
# Initialize a git repo in the directory you want to sync. Track all files, and commit them to your repo:
git init
git add -A && git commit -m "Committed all files"

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

@stnc
stnc / magento.sql
Created December 11, 2018 00:03 — forked from cagartner/magento.sql
MYSQL RAW SELECTS FOR MAGENTO
# Get Customers taxvat
SELECT ce.*, ea.attribute_code, cev.value
FROM customer_entity AS ce
LEFT JOIN eav_attribute AS ea ON ce.entity_type_id = ea.entity_type_id AND ea.backend_type = 'varchar'
LEFT JOIN customer_entity_varchar AS cev ON ce.entity_id = cev.entity_id AND ea.attribute_id = cev.attribute_id
WHERE ea.attribute_code = 'taxvat';
# Get Customer Data from orders
SELECT `increment_id`, `customer_id`, `customer_firstname`, `customer_email`, `customer_taxvat` FROM `sales_flat_order`;
@stnc
stnc / gulpfile.js
Created December 11, 2018 00:04 — forked from cagartner/gulpfile.js
Magento 2 Minification Gulp Script
var gulp = require('gulp');
var cleanCSS = require('gulp-clean-css');
var minify = require('gulp-minify');
gulp.task('default', [
'css',
'requireJsMinify',
'jsMinify'
@stnc
stnc / mask.js
Created December 11, 2018 00:04 — forked from cagartner/mask.js
Igor Escobar Jquery Input Mask 11 digitos telefones
var maskBehavior = function (val) {
return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009';
},
options = {onKeyPress: function(val, e, field, options) {
field.mask(maskBehavior.apply({}, arguments), options);
}
};
$('.phone').mask(maskBehavior, options);