Skip to content

Instantly share code, notes, and snippets.

var _ga = _ga || {};
var _gaq = _gaq || [];
_ga.trackSocial = function(opt_pageUrl, opt_trackerName) {
twttr.ready(function (twttr) {
_ga.trackTwitter(opt_pageUrl, opt_trackerName);
});
};
_ga.trackTwitter = function(opt_pageUrl, opt_trackerName) {
var trackerName = _ga.buildTrackerName_(opt_trackerName);
try {
@benytocarlo
benytocarlo / placeholder-ie.js
Created May 7, 2014 20:02
Placeholder IE Fix
jQuery(function() {
jQuery.support.placeholder = false;
test = document.createElement('input');
if('placeholder' in test) jQuery.support.placeholder = true;
});
// This adds placeholder support to browsers that wouldn't otherwise support it.
$(function() {
if(!$.support.placeholder) {
var active = document.activeElement;
$(':text').focus(function () {
@benytocarlo
benytocarlo / functions.php
Created June 12, 2014 15:11
ocultar actualizaciones de Wordpress (Core/Plugins)
<?php
#esto se debe agregar al functions.php del theme
define( 'WP_AUTO_UPDATE_CORE', false );
remove_action( 'load-update-core.php', 'wp_update_plugins' );
add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
?>
@benytocarlo
benytocarlo / mediamath.html
Created June 23, 2014 15:26
Tag event con MediaMath
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
@benytocarlo
benytocarlo / server_route.php
Created July 4, 2014 15:00
Ruta absoluta del servidor
<?php
echo dirname(__FILE__);
?>
@benytocarlo
benytocarlo / .htaccess
Last active August 29, 2015 14:05
seguridad htaccess
#activar charset utf8 cuando servidor no lo reconoce
AddDefaultCharset UTF-8
#Ocultar Listado Directorios
Options All -Indexes
#Hotlink
#RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]
module BootstrapPaginationHelper
class LinkRenderer < WillPaginate::ActionView::LinkRenderer
protected
def page_number(page)
unless page == current_page
link(page, page, :rel => rel_value(page))
else
link(page, "#", :class => 'active')
end
@benytocarlo
benytocarlo / gist:9a8182bd616c8472362e
Created June 23, 2015 18:19
Listado de Usuarios en magento
SELECT DISTINCT ce.entity_id AS b, email, 'default_password', (
SELECT value
FROM customer_entity_varchar
WHERE attribute_id =7
AND customer_entity_varchar.entity_id = b
) AS l_name, (
SELECT value
FROM customer_entity_varchar
@benytocarlo
benytocarlo / robots.txt
Created June 25, 2015 20:10
Robots.txt for Magento
User-agent: *
Disallow: /index.php/
Disallow: /*?
Disallow: /*.js$
Disallow: /*.css$
Disallow: /customer/
Disallow: /checkout/
Disallow: /js/
Disallow: /lib/
Disallow: /media/
@benytocarlo
benytocarlo / carros_abondanados
Last active August 29, 2015 14:24
Carros abandonados Magento
SELECT `main_table`.*, GROUP_CONCAT(item.sku) AS `skus`, (main_table.base_subtotal_with_discount*main_table.base_to_global_rate) AS `subtotal`, `cust_email`.`email`, `cust_fname`.`value` AS `firstname`, `cust_lname`.`value` AS `lastname`, CONCAT_WS(' ', cust_fname.value, cust_lname.value) AS `customer_name` FROM `sales_flat_quote` AS `main_table`
INNER JOIN `sales_flat_quote_item` AS `item` ON item.quote_id = main_table.entity_id
INNER JOIN `customer_entity` AS `cust_email` ON cust_email.entity_id = main_table.customer_id
INNER JOIN `customer_entity_varchar` AS `cust_fname` ON cust_fname.entity_id = main_table.customer_id AND cust_fname.attribute_id = 5
INNER JOIN `customer_entity_varchar` AS `cust_lname` ON cust_lname.entity_id = main_table.customer_id AND cust_lname.attribute_id = 7 WHERE (items_count != '0') AND (main_table.is_active = '1') GROUP BY `item`.`quote_id` ORDER BY updated_at DESC
// Agrupado por fecha
SELECT `main_table`.*, (main_table.base_subtotal_with_discount*main_table.base_to_