Skip to content

Instantly share code, notes, and snippets.

View alexsancho's full-sized avatar
💭
I may be slow to respond.

Alex Sancho alexsancho

💭
I may be slow to respond.
  • VMLY&R
  • Barcelona, Spain
  • 05:37 (UTC +02:00)
View GitHub Profile
<?php
function misopciones($name) {
return $name . 'mi cadena de opciones';
}
@alexsancho
alexsancho / post.php
Created March 10, 2018 18:28
post.php
$posts_ids = get_posts('post_type=post&posts_per_page=-1&fields=ids');
// $posts_ids is now an array of IDs
foreach( $posts_ids as $post_id ) {
save_index( $post_id );
}
@alexsancho
alexsancho / Urlkey.php
Created April 27, 2014 18:03
Custom magento module that removes stop words from url before save
<?php
/**
* Product url key attribute backend
*
* @category Mage
* @package Mage_Catalog
* @author Magento Core Team <core@magentocommerce.com>
*/
class Module_Catalog_Model_Product_Attribute_Backend_Urlkey extends Mage_Catalog_Model_Product_Attribute_Backend_Urlkey
{
@alexsancho
alexsancho / wp_fabfile.py
Created October 19, 2012 23:45 — forked from YellowSharkMT/wp_fabfile.py
Wordpress Fabfile
# Wordpress Fabfile, for migrating the database, and deploying w/ git.
# For background: "My New & Improved Fabfile for Deploying WordPress"
# http://wp.me/p2a3Vy-1b
#
# This fabfile is specifically-geared for our unique setup, which consists
# of 2 servers (local, remote), and 3 sites (local, dev, and prod). Dev and
# prod sites both live on the remote server.
#
# In general, a little bit of the programming happens on a local site,
# but the database updates and file uploads (both in Wordpress, and edits
#!/usr/bin/env ruby
# DESCRIPTION: Tries to do something with unrecognized shell input.
# See the case statement for descriptions and examples.
require 'rubygems' unless defined? Gem # rubygems is only needed in 1.8
require 'term/ansicolor'
include Term::ANSIColor
# Use all arguments
@alexsancho
alexsancho / log.sh
Created December 14, 2011 22:13
Display a message.
#!/usr/bin/env bash
#####################################################################
# Program: log
#####################################################################
# Version: 1.0
# Date: 18.10.2011
# Author: (c) by Alex Sancho - <alex@alexsancho.name>
#
# Notes: Display a message.
#####################################################################
@alexsancho
alexsancho / snippet.sh
Created December 8, 2011 19:01
rvm after_cd hook that adds current path to directory stack.
#!/usr/bin/env bash
#####################################################################
# after_cd_push_pwd
#####################################################################
#
# rvm after_cd hook that adds current path to directory stack.
# It limits the stack size to MAX value and removes duplicated
# dirs.
#
# rvm overwrites the default popd command and by unknown reasons changes