Skip to content

Instantly share code, notes, and snippets.

View maccevedor's full-sized avatar

Mauricio Acevedo Rueda maccevedor

View GitHub Profile
@maccevedor
maccevedor / history
Last active August 29, 2015 14:04
History Terminal
history | grep phrase_to_search_for
@maccevedor
maccevedor / symfony.php
Created July 23, 2014 18:50
Ejemplo de comodines en symfony {slug}
# src/MDW/DemoBundle/Resources/config/routing.yml
blog_mostrar:
pattern: /blog/{slug}
defaults: { _controller: MDWDemoBundle:Blog:show }
@maccevedor
maccevedor / mac
Created July 22, 2014 18:24
Exemplo de para dar permisos a una carpeta en mac
sudo chmod -R 777 /Applications/Calculator.app
@maccevedor
maccevedor / file
Created July 7, 2014 21:47
Aceptar un tipo definido de archivos con html5
<h1>Match all image files (image/*)</h1>
<p><label>image/* <input type="file" accept="image/*"></label></p>
<h1>Match all video files (video/*)</h1>
<p><label>video/* <input type="file" accept="video/*"></label></p>
<h1>Match all audio files (audio/*)</h1>
<p><label>audio/* <input type="file" accept="audio/*"></label></p>
<h1>Match all image files (image/*) and files with the extension ".someext"</h1>
@maccevedor
maccevedor / push
Created July 5, 2014 15:42
Forzar actualizar todo desde el servidor remoto(cuidado si tienes archivos locales en esta carpeta lso elimina)
git push --all origin
@maccevedor
maccevedor / origin
Created July 5, 2014 15:23
Saber cual origin esta utilizando mi repositorio en git
git remote show origin
@maccevedor
maccevedor / Wordpress
Created July 4, 2014 16:10
Cambiar las url de un sitio con Wordpress
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
@maccevedor
maccevedor / procedure.sql
Created July 3, 2014 21:58
Ejemplo Procedimiento Almacenado con mysql , recibiendo un parametro
USE bdtienda;   DELIMITER $$ -- inicio DROP PROCEDURE IF EXISTS sp_productoPorCod$$ -- eliminamos si existe un procedimiento con el mismo nombre CREATE  PROCEDURE sp_productoPorCod (IN cod INT) -- creamos el procedimiento con un parámetro de entrada BEGIN  -- inicio cuerpo procedimiento almacenado     DECLARE estadoOfert CHAR(2);  -- declaramos  una variable local para almacenar el estado de Oferta.     /* Hacemos una consulta y el resultado lo almacenamos en la variable declarada*/     SELECT oferta INTO estadoOfert FROM productos WHERE oferta = 'SI' AND codproducto = cod;      IF estadoOfert = 'SI' THEN -- si está en oferta elegimos precio_oferta         SELECT codproducto, nombreproduc, precio_oferta FROM productos WHERE codproducto = cod;     ELSE -- sino el precio_normal         SELECT codproducto, nombreproduc,  precio_normal FROM productos WHERE codproducto = cod;        END IF; END $$  -- fin de cuerpo del procedimiento almacenado DELIMITER ; -- fin   call sp_productoPorCod(2); -- llamamos al proced
@maccevedor
maccevedor / edad
Created July 3, 2014 20:40
Calcular Edad con mysql
SELECT TIMESTAMPDIFF(YEAR, Campo , CURDATE()) AS age
@maccevedor
maccevedor / Git
Created July 2, 2014 19:17
Iniciar Git desde el terminal o cmd
cd <localdir>
git init
git add .
git commit -m 'message'
git remote add origin <url>
git push -u origin master