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 / function.php
Last active September 19, 2019 23:53
wordpress Quiz Cat plugin rest api (https://wordpress.org/plugins/quiz-cat/)
<?php
/** QUIZ ID for post ** */
# Registering the routes in here
add_action('rest_api_init', 'register_quizcat_id');
function register_quizcat_id()
{
register_rest_route('wp/v2', '/quizcat/id/(?P<id>[\d]+)',
array(
'methods' => 'GET',
'callback' => 'stnc_quiz_id',
@stnc
stnc / delete_git_submodule.md
Created May 24, 2019 00:12 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@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);
@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 / 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 / js_codes.js
Created August 26, 2018 18:44
Add to HomePage / Add to Links /Add to Favorites for javascript
/************************************************
* Add to HomePage
************************************************/
function homepage()
{
if (window.attachEvent && !window.opera){
document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage('http://www.guzelsozlerin.com/');
@stnc
stnc / index.html
Created August 25, 2018 11:07
Highcharts sankey problem fix (Demo http://jsfiddle.net/vh4792wy/39/ )
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/sankey.src.js"></script>
<div id="container"></div>
@stnc
stnc / Grid.php
Last active March 13, 2018 17:46
Magenro admin grid new Column element (code\local\Webkul\Mpshipping\Block\Adminhtml\Mpshipping\Edit\Tab\Grid.php)
<?php
class Webkul_Mpshipping_Block_Adminhtml_Mpshipping_Edit_Tab_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
public function __construct()
{
parent::__construct();
$this->setId('mpshippingGrid');
$this->setDefaultDir('ASC');
$this->setUseAjax(true);
$this->setSaveParametersInSession(true);

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 / 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"