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
So a guy walks into a bar one day and he can't believe his eyes. There, in the corner, there's this one-foot-tall man, in a little tuxedo, playing a tiny grand piano. | |
So the guy asks the bartender, "Where'd he come from?" | |
And the bartender's, like, "There's a genie in the men's room who grants wishes." | |
So the guy runs into the men's room and, sure enough, there's this genie. And the genie's, like, "Your wish is my command." So the guy's, like, "O.K., I wish for world peace." And there's this big cloud of smoke—and then the room fills up with geese. | |
So the guy walks out of the men's room and he's, like, "Hey, bartender, I think your genie might be hard of hearing." | |
And the bartender's, like, "No kidding. You think I wished for a twelve-inch pianist?" | |
So the guy processes this. And he's, like, "Does that mean you wished for a twelve-inch penis?" | |
And the bartender's, like, "Yeah. Why, what did you wish for?" | |
And the guy's, like, "World peace." | |
So the bartender is understandably ashamed. |
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
Failure/Error: post :notification, { "communication_id" => "666", "content" => {"id_sale" => 123} } | |
WebMock::NetConnectNotAllowedError: | |
Real HTTP connections are disabled. Unregistered request: POST https://direct.paylane.com/rest/sales/info with body '{"id_sale":"123"}' with headers {'Authorization'=>'Basic ZGV0b21hc3RhaDpodTJzd2U0ag==', 'Connection'=>'close', 'Content-Type'=>'application/json', 'Host'=>'direct.paylane.com', 'User-Agent'=>'RubyHTTPGem/0.8.4'} | |
You can stub this request with the following snippet: | |
stub_request(:post, "https://direct.paylane.com/rest/sales/info"). | |
with(:body => "{\"id_sale\":\"123\"}", | |
:headers => {'Authorization'=>'Basic ZGV0b21hc3RhaDpodTJzd2U0ag==', 'Connection'=>'close', 'Content-Type'=>'application/json', 'Host'=>'direct.paylane.com', 'User-Agent'=>'RubyHTTPGem/0.8.4'}). | |
to_return(:status => 200, :body => "", :headers => {}) |
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
$affected = [] | |
$not_updated = [] | |
def update_timestamp(invoice, created_at) | |
if created_at.blank? | |
$not_updated << invoice | |
else | |
created_at = created_at.in_time_zone - 30.minutes | |
puts "#{invoice.id} #{invoice.created_at} -> #{created_at}" |
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
begin | |
$counter = 0 | |
def update_positions(scope, start) | |
scope.each_with_index do |ia, index| | |
ia.update_attribute(:position, start + index) | |
$counter += 1 | |
end | |
end | |
Product.all.each do |p| | |
ia = p.image_assignments.where("position IS NOT NULL").order("position DESC").first |
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
rake 0.400000 0.030000 0.430000 ( 0.422317) | |
gem-patching 0.010000 0.000000 0.010000 ( 0.009515) | |
simple_form 0.020000 0.000000 0.020000 ( 0.030241) | |
kronn-has_many_polymo 0.010000 0.010000 0.020000 ( 0.014797) | |
i18n-missing_translat 0.030000 0.000000 0.030000 ( 0.021213) | |
test-unit 0.000000 0.000000 0.000000 ( 0.000027) | |
devise 0.400000 0.030000 0.430000 ( 0.444638) | |
delocalize 0.060000 0.010000 0.070000 ( 0.060652) | |
activeadmin 2.860000 0.290000 3.150000 ( 3.165178) | |
meta_search 0.000000 0.000000 0.000000 ( 0.001347) |
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 'benchmark' | |
REGEXPS = [ | |
/^no such file to load -- (.+)$/i, | |
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, | |
/^Missing API definition file in (.+)$/i, | |
/^cannot load such file -- (.+)$/i, | |
] |
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
Image.all.each do |img| | |
begin | |
img.file.recreate_versions! | |
rescue | |
puts "Cannot recreate version for Image with ID: #{img.id}" | |
end | |
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
application@rommulus:~/projects/heute_kaufen/production/current$ RAILS_ENV=production bundle exec rake "cnet:update[false]" --trace | |
** Invoke cnet:update (first_time) | |
** Invoke cnet:config/application.yml (first_time) | |
** Execute cnet:config/application.yml | |
** Invoke environment (first_time) | |
** Execute environment | |
** Execute cnet:update | |
Downloading CNet data to /home/application/projects/heute_kaufen/production/current/tmp | |
rake aborted! | |
undefined method `log' for #<Rails::Paths::Root:0x00000005652a20> |
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
ActiveRecord::Base.transaction do | |
Category.all.each do |c| | |
ordered_configs = c.search_attribute_configs. | |
joins(:search_attribute). | |
order("cnet_search_attributes.name"). | |
select("DISTINCT search_attribute_configs.id, cnet_search_attributes.name") | |
ordered_configs.each_with_index do |sa_config, index| | |
sa_config = SearchAttribute::Config.find(sa_config.id) | |
sa_config.update_attribute(:position, index + 1) |
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
# encoding: utf-8 | |
Feature: Product cross selling | |
In order to maximize customer satisfaction (and our profit :]) | |
As a potential customer | |
I want to see items related to product I am currently looking | |
Scenario: Product page should show cross sell items | |
Given the following products exists | |
| product | name | gross_price | available_amount | number | manufacturer_product_number | | |
| camera | Kamera | 1199 | 22 | HK029737 | 01G-P3-1556-KR | |
OlderNewer