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 permitted_params | |
product_params = params.require("product").permit( | |
:name, :raw_scores, :_type, | |
:articles, :article_ids, :raw_rating, :msrp, :slug, | |
:publish_on, :tags, :upc, :price_grabber_id, | |
:rubric_id, :brand_id, :archive_state, :is_scoring_baseline, | |
:scaled_scores, :amazon_asin, :amazon_is_related_product, award_ids: [], | |
attachment_ids: [], website_ids: [], keywords: [], types: [], | |
manufacturer_specs: [:id, :name, :value, :value_units, :value_type, :order, :options] | |
) |
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
~ $ cat /usr/local/Cellar/elasticsearch/0.90.6/config/elasticsearch.yml | |
##################### ElasticSearch Configuration Example ##################### | |
# This file contains an overview of various configuration settings, | |
# targeted at operations staff. Application developers should | |
# consult the guide at <http://elasticsearch.org/guide>. | |
# | |
# The installation procedure is covered at | |
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup.html>. | |
# |
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
namespace :data_migrations do | |
desc "backport awarded_times field for existing products" | |
task awarded_times_backport: :environment do | |
product_ids = Award.all.map(&:product_ids).flatten.uniq | |
pb = ProgressBar.new(product_ids.count) | |
product_ids.each do |id| | |
pb.increment! | |
product = Product.where(id: id).first | |
if product |
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
class Product | |
before_save :early_before | |
around_save :around | |
before_save :late_before | |
def early_before | |
puts "early before" | |
end | |
def around |
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
### Keybase proof | |
I hereby claim: | |
* I am lukebergen on github. | |
* I am lukebergen (https://keybase.io/lukebergen) on keybase. | |
* I have a public key whose fingerprint is CA20 CB32 13AD B8ED 3A2A 5B28 4573 8E8C EDE6 2164 | |
To claim this, I am signing this object: |
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
# To replace tvi's need dropdown with the price dropdown, in categories/televisions/configatron.rb, replace this: | |
configatron.televisions.filters[:need] = { | |
resource: 'articles#show', | |
prompt: 'Find the perfect product for...', | |
options: [ | |
{ name: 'Budget Buyers', query: { id: 'Budget-Buyers' }, url: '/buying-guides/budget-buyers' }, | |
{ name: 'Sports Fans', query: { id: 'Sports-Fans' }, url: '/buying-guides/sports-fans' }, | |
{ name: 'Movie Nights', query: { id: 'Movie-Nights' }, url: '/buying-guides/movie-nights' }, | |
{ name: 'Perfect Picture', query: { id: 'Perfect-Picture' }, url: '/buying-guides/perfect-picture' }, |
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
Failures: | |
1) Api::V1::AuthorsController index returns a list of authors by website ids | |
Failure/Error: authors.should have(1).author | |
expected 1 author, got 0 | |
# ./spec/controllers/api/v1/authors_controller_spec.rb:39:in `block (3 levels) in <top (required)>' | |
2) Api::V1::ProductsController types returns all of the product types available | |
Failure/Error: get :types | |
JSON::Schema::ValidationError: |
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
# Elasticsearch version: 1.3.4 | |
curl -XDELETE localhost:9200/test > /dev/null 2>&1 | |
curl -XPUT localhost:9200/test/test/1 -d '{ | |
"name": "Finn", | |
"age": null | |
}' > /dev/null 2>&1 | |
curl -XPUT localhost:9200/test/test/2 -d '{ |
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 find_100s(digits, i=0) | |
if i == digits.length - 1 | |
eval(digits) == 100 ? [digits] : [] | |
else | |
[find_100s(digits[0..i] + "+" + digits[i+1..-1], i+2), find_100s(digits[0..i] + "-" + digits[i+1..-1], i+2), find_100s(digits, i+1)] | |
end | |
end | |
puts find_100s("123456789") |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" | |
elementFormDefault="qualified" vc:minVersion="1.0"> | |
<xs:annotation> | |
<xs:documentation> | |
Google Product Review Feeds allow content providers to | |
provide product reviews to Google Shopping. | |
An XML file can be validated with this schema by running: | |
xmllint --schema product_reviews.xsd --noout file.xml |
OlderNewer