Skip to content

Instantly share code, notes, and snippets.

View pawel2105's full-sized avatar

Pawel Janiak pawel2105

View GitHub Profile
@pawel2105
pawel2105 / gist:6268555
Last active December 21, 2015 07:08
How to install Sphinx 0.9.8 on Ubuntu or OSX
curl -O http://sphinxsearch.com/files/sphinx-0.9.8-rc2.tar.gz
tar -zxvf sphinx-0.9.8-rc2.tar.gz
cd sphinx-0.9.8-rc2
./configure
make
sudo make install
bundle exec rake thinking_sphinx:configure
bundle exec rake thinking_sphinx:index
bundle exec rake thinking_sphinx:start
@pawel2105
pawel2105 / stacktrace
Last active December 11, 2015 21:28
ActiveSupport::JSON.decode breaking when updating to Rails 2.3.16
@object = "{'source': 'Direct', 'details': 'Unknown', 'vdate': 1333236870729}"
Rails 3.2.15
> ActiveSupport::JSON.decode(@object)
# => {"details"=>"Unknown", "vdate"=>1333236870729, "source"=>"Direct"}
Rails 3.2.16
> ActiveSupport::JSON.decode(@object)
headlines = ["one","two","three","flee"]
#enumerables have a method #to_phrase.rhyme_key which gives a key based on pronunciation.
So headlines.map(&:to_phrase.rhyme_key) => 1,2,3,3 (for example)
#Now I want to filter out all the strings that don't have rhyme_key counterparts,
essentially leaving ["three","flee"] in the convoluted example above. I tried the code below,
but that just stores the rhyme_key values in the headlines array which is useless to me because
the original string literals get replaced with the values. How do I check against the values via
the methods without replacing the original strings?