Skip to content

Instantly share code, notes, and snippets.

View zackfern's full-sized avatar
🌭

Zack Fernandes zackfern

🌭
View GitHub Profile
@clintongormley
clintongormley / gist:4095280
Created November 17, 2012 12:00
Using synonyms in Elasticsearch

We create an index with:

  • two filters: synonyms_expand and synonyms_contract
  • two analyzers: synonyms_expand and synonyms_contract
  • three text fields:
    • text_1 uses the synonyms_expand analyzer at index and search time
    • text_2 uses the synonyms_expand analyzer at index time, but the standard analyzer at search time
    • text_3 uses the synonyms_contract analyzer at index and search time

.

@zackfern
zackfern / gist:1728279
Created February 3, 2012 05:19
Garrett's Witty Tagline Helper
def witty_tagline
uri = URI.parse("http://www.iheartquotes.com/api/v1/random?source=oneliners&format=text")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = false
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
raw CGI::unescape(response.body).split("[")[0]
end
@rajraj
rajraj / es.sh
Created January 3, 2012 20:07 — forked from aaronshaf/es.sh
Install ElasticSearch on CentOS 6
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@thbar
thbar / deploy.rb
Created September 7, 2010 18:18
Resque + god + capistrano recipe
# note - you may need to split into a before-deploy (stop) and after-deploy (start) depending on your setup
desc "Hot-reload God configuration for the Resque worker"
deploy.task :reload_god_config do
sudo "god stop resque"
sudo "god load #{File.join deploy_to, 'current', 'config', 'resque.god'}"
sudo "god start resque"
end
after 'deploy:update_code', 'deploy:update_shared_symlinks'