Skip to content

Instantly share code, notes, and snippets.

View liquid1982's full-sized avatar

Vincenzo Acinapura liquid1982

  • TrustLayer, Inc.
  • Miami, FL
View GitHub Profile
# Example code and benchmark harness for http://blog.gregspurrier.com/articles/arbitrary-reordering-of-ruby-arrays
require 'rubygems'
require 'rspec'
module Enumerable
def reorder_by1(order, &key_proc)
order.map do |x|
find {|obj| key_proc.call(obj) == x}
end
@liquid1982
liquid1982 / change-wp-domain
Created December 1, 2010 08:57
Query used to update the domain while moving a wordpress installation to a new domain.
SET @old = 'http://old'; # Vecchio dominio - da cui si trasferisce l'installazione
SET @new = 'http://new'; # Nuovo dominio - verso cui si trasferisce l'installazione
UPDATE wp_options SET option_value = replace(option_value, @old, @new) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, @old, @new);
UPDATE wp_posts SET post_content = replace(post_content, @old, @new);
@liquid1982
liquid1982 / reverse-tunnel.sh
Created March 23, 2009 09:07
Reverse tunnel SSH
ssh -v -p 22 -nNT4 -R *:<public-port>:localhost:<local-port> <public-host-username>@<public-host>
ssh -v -nNT4 -R *:3000:localhost:3000 user@www.host.com