Skip to content

Instantly share code, notes, and snippets.

@enlacee
enlacee / kubuntu.install.sh
Last active December 25, 2017 09:12
kubuntu.install.sh
sudo apt-get update
sudo apt-get install
sudo apt-get install ubuntu-restricted-extras
sudo apt-get install preload
sudo apt-get install google-chrome-stable
sudo apt install yakuake
sudo apt-get install vlc
sudo apt-get install firefox
transmission torrent
@enlacee
enlacee / rewrite-wordpress.php
Last active October 4, 2017 14:45
cutoms rewrite rules with two params
<?php
/*
* @link: https://wordpress.stackexchange.com/questions/12965/custom-page-with-variables-in-url-nice-url-with-add-rewrite-rule
*
I think the add_rewrite_tag() is not needed, and can be replaced with adding the variables to the public query vars directly:
*/
// Either directly (in your init hook):
$wp->add_query_var( 'var1' );
$wp->add_query_var( 'var2' );
@enlacee
enlacee / set-scroll-conten-jquery.js
Created August 29, 2017 22:30
hacer scroll con el tamaño de cabecera
function getHeightHeader() {
var height = 0;
if ($('.header-page').length === 1) {
$headerPage = $('.header-page');
if ($headerPage.css('position') === 'fixed') {
height = $headerPage.height();
}
}
return height;
}
@enlacee
enlacee / objeto-javascript.js
Created August 27, 2017 04:25
crear un objeto padre javascript con prototype
/**
* Herencia basada en prototipos javascript
* definir un objeto padre o prototipo
* asi: todos los objetos de este tipo (objetos hijos)
* asi: se evita que cada objeto repita las propiedades y metodos comunes.
*
* Usando call, apply y bind
* ref: http://blog.amatiasq.com/2012/01/javascript-conceptos-basicos-this-call-y-apply/
*/
@enlacee
enlacee / sql.get.product.by.key.url.sql
Created August 15, 2017 21:43
sql para obtener productos por url key Magento 1.8
SELECT * FROM catalog_product_entity_varchar
where value like '%labial-cy-mad-4-color%' and attribute_id =(SELECT attribute_id FROM eav_attribute WHERE attribute_code LIKE 'url_key' and entity_type_id=4 )
@enlacee
enlacee / marcacion-al-ver-viewport.js
Created July 19, 2017 22:16
marcacion al ver viewport
var $sectionSteps = $('#section-steps');
var enterSectionStepFirtTime = false;
jQuery(window).scroll(function() {
var window_width = jQuery(window).width();
var window_height = 0;
var heightViewport = jQuery( window ).height();
<?php
function lbel_enqueue_custom() {
if ( is_page_template('templates/template-home.php')) {
wp_enqueue_script('template-home', get_template_directory_uri() . '/js/template-home.js', array(), false, true);
}
}
add_action( 'wp_enqueue_scripts', 'lbel_enqueue_custom' );
<?php
// no mostrar assets en admin
$screen = get_current_screen();
if ( 'toplevel_page_tt_list_test' != $screen->id )
return false;
}
@enlacee
enlacee / gist:d1aefe7b5f332e9c32e3d778386263af
Created May 13, 2017 03:21 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@enlacee
enlacee / sql.replace_string.sql
Created February 28, 2017 17:52
remplazar , por vacio en el campo firstname &lastname
UPDATE wp_altimea_subcription_mail_plugin SET firstname = REPLACE(firstname, ',', '') WHERE INSTR(firstname, ',') > 0;
UPDATE wp_altimea_subcription_mail_plugin SET lastname = REPLACE(lastname, ',', '') WHERE INSTR(lastname, ',') > 0;