Skip to content

Instantly share code, notes, and snippets.

def starred_product? id
all_stars = stars
all_stars.any? {|star| star.product_id == id }
# stars.find_by_product_id(id).present?
end
Feature: Sidebar search
Scenario: Searchable categories
Given I have the categories "dogs, cats"
Then I see the categories "dogs, cats" in the category sidebar
When I use the sidebar category search to find "dogs"
Then I see the categories "dogs" in the category sidebar
Scenario: Searchable retailers
Given I have the categories "dogs, cats"
# rails {
# Make rails boot faster
export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=100000000
export RUBY_HEAP_FREE_MIN=500000
# }
{
"sort": [
{ "name" : {"order":"asc"}}
],
"query": {
"bool": {
"must": [{ "query_string": { "query":"*" }}]
}
},
# rails {
# Make rails boot faster
export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=100000000
export RUBY_HEAP_FREE_MIN=500000
# }
func (i *Indexer) Flush() error {
r := bytes.NewReader(i.buffer.Bytes())
response, err := http.Post("http://"+api.Domain+":9200/_bulk", "application/json", r)
i.buffer.Reset()
if response != nil {
defer response.Body.Close()
}
return err
}
package main
import (
"code.google.com/p/go.crypto/scrypt"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
)
func EncryptAESCFB(dst, src, key, iv []byte) error {
http.HandleFunc("/create_passwords_file", createPasswordsFileHandler)
http.HandleFunc("/login", loginHandler)
http.HandleFunc("/logged_in", loggedInHandler)
http.HandleFunc("/passwords_file_exists/", passwordsFileExistsHandler)
http.HandleFunc("/search/", searchHandler)
http.HandleFunc("/store", storeHandler)
http.ListenAndServe(":8080", nil)