This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def starred_product? id | |
all_stars = stars | |
all_stars.any? {|star| star.product_id == id } | |
# stars.find_by_product_id(id).present? | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
# } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"sort": [ | |
{ "name" : {"order":"asc"}} | |
], | |
"query": { | |
"bool": { | |
"must": [{ "query_string": { "query":"*" }}] | |
} | |
}, | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
# } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "rainbow" | |
require "ostruct" | |
require "fileutils" | |
if really = ARGV.include?("--really") | |
puts "You specified --really so I'm going to go ahead and makes these changes to your files. Good luck!".color(:red), "" | |
else | |
puts "You didn't specify --really so these changes won't really happen.".color(:green), "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "rainbow" | |
require "ostruct" | |
require "fileutils" | |
if really = ARGV.include?("--really") | |
puts "You specified --really so I'm going to go ahead and makes these changes to your files. Good luck!".color(:red), "" | |
else | |
puts "You didn't specify --really so these changes won't really happen.".color(:green), "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"code.google.com/p/go.crypto/scrypt" | |
"crypto/aes" | |
"crypto/cipher" | |
"crypto/rand" | |
) | |
func EncryptAESCFB(dst, src, key, iv []byte) error { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |