Skip to content

Instantly share code, notes, and snippets.

@adanzilla
adanzilla / gist:005e48f96f6093a959f4
Created August 6, 2015 17:12
SQL - Actualiza la tabla wp_posts al migrar tu Wordpress
UPDATE wp_posts
SET
post_content = REPLACE (post_content, 'http://localhost/tusitio.com.mx', 'http://www.tusitio.com.mx')
WHERE post_content LIKE '%http://localhost/tusitio.com.mx%';
UPDATE wp_posts
SET
guid = REPLACE (guid, 'http://localhost/tusitio.com.mx', 'http://www.tusitio.com.mx')
WHERE guid LIKE '%http://localhost/tusitio.com.mx%';
@adanzilla
adanzilla / gist:ea0f2c62b8eb8c253fce
Created August 6, 2015 15:06
jQuery - Validación acepta solo numeros
jQuery('.solo_numeros').keyup(function(e){
if (/\D/g.test(this.value)){this.value = this.value.replace(/\D/g, '');}
});
@adanzilla
adanzilla / gist:3c45541ae195c4e5998a
Last active September 3, 2015 16:07
PHP - PDO - MySQL Connect
<?php
$dsn = 'mysql:host=XXXX.XXXX.XXXX.XXXX;dbname=DBNAME';
$nombre_usuario = 'dbuser';
$password = 'dbpass';
$opciones = array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
);
$pdo = new PDO($dsn, $nombre_usuario, $password, $opciones);
?>
@adanzilla
adanzilla / jqueryCenter_fn.js
Last active August 29, 2015 14:24
jQuery - Función Center
jQuery.fn.center = function () {
this.css("position","absolute");
this.css("top", Math.max(0, ((jQuery(window).height() - jQuery(this).outerHeight()) / 2) + jQuery(window).scrollTop()) + "px");
this.css("left", Math.max(0, ((jQuery(window).width() - jQuery(this).outerWidth()) / 2) + jQuery(window).scrollLeft()) + "px");
return this;