Skip to content

Instantly share code, notes, and snippets.

View pollin14's full-sized avatar

Victor Aguilar pollin14

  • Medtrainer
  • Mexico D.F.
View GitHub Profile
;; RESUME:
;; Xdebug configuration file in order to use together with Netbeans.
;;
;; OS: ubuntu 14:04
;; FILENAME: /etc/php5/apache2/conf.d/20-xdebug.ini
zend_extension=xdebug.so
xdebug.default_enable=1
xdebug.remote_enable=1
SET foreign_key_checks = 0;
@pollin14
pollin14 / gist:c0d4f68ef4eac9b41724
Last active August 29, 2015 14:10
Get the last query in Laravel4
$queries = \DB::getQueryLog();
\Log::info(end($queries))
@pollin14
pollin14 / sublime-packages.yaml
Last active August 29, 2015 14:11
sublime packages
packages :
- jshint # requires the nodejs package with the same name.
- SideBarEnhancement
- TrailingSpaces
- DocBlockr
- SublimeLinter
- SublimeLinter-jshint
- Emmet
/*
* Widget 1.0
* Author: Wender Lima
*/
!function(e,l,id,s,r,d){
var c=null,
v=null,
jQ=null,
h=e.getElementsByTagName('head')[0],
w=e.getElementById(id);
@pollin14
pollin14 / php-cs-fixer-pre-commit.php
Last active September 25, 2015 21:31 — forked from mardix/php-cs-fixer-pre-commit.php
A pre-commit hook to check syntax errors and PSR2
#!/usr/bin/php
<?php
/**
* .git/hooks/pre-commit
*
* This pre-commit hooks will check for PHP error (lint), and make sure the code
* is PSR compliant.
*
* Dependecy: PHP-CS-Fixer (https://github.com/fabpot/PHP-CS-Fixer)
*
@pollin14
pollin14 / clean-blast.py
Last active April 22, 2017 22:42
Read a FASTA format and remove all except the ID and the sequence and write a new FASTA file
## Tested with python Python 2.7.12
# Instructions
#
# 1. Put the fasta file in the same directory of this file with the name
# blast.fasta.
# 2. Run the script with the origin file name and the destination file name
#
# Example: python clean_blast.py file1.fasta my_file.fasta
@pollin14
pollin14 / reindex-non-anchor-category.sql
Created July 13, 2017 15:32
Consulta que Magento realiza para re-indexar los productos en la categorías non-anchor
## _reindexNonAnchorCategories
## This method is not the problem
##
## Results
## Range self::RANGE_CATEGORY_STEP = 500
## Take the entities which id is between 500*n 500*(n+1)
## Benchmark 13687 rows affected in 3s 942ms X 32 queries ~ 96s
INSERT INTO `catalog_category_product_index_tmp` (`category_id`, `product_id`, `position`, `is_parent`, `store_id`, `visibility`)
SELECT
`cc`.`entity_id` AS `category_id`,
@pollin14
pollin14 / reindex-anchor-category.sql
Created July 13, 2017 15:53
Consulta que Magento realiza para re-indexar los productos en la categorías anchor
## _reindexNonAnchorCategories
## This method is not the problem
##
## Results
## Range self::RANGE_CATEGORY_STEP = 500
## Take the entities which id is between 500*n 500*(n+1)
## Benchmark completed 4m 21s 77ms X 32 queries = 2h 19m 12s = 2h
INSERT IGNORE INTO `catalog_category_product_index_tmp` (`category_id`, `product_id`, `position`, `is_parent`, `store_id`, `visibility`)
SELECT
`cc`.`entity_id` AS `category_id`,
@pollin14
pollin14 / select-relaciones-entre-rules-products.sql
Last active July 20, 2017 15:01
Dos sentencias SELECT para obtener la relación entre reglas y productos en Magento
SELECT
2,
`cg`.`customer_group_id`,
`p`.`entity_id`,
189796,
1484006400,
1514764799,
'by_percent',
50,
0,