Łukasz Pełszyński detomastah

View gist:8470959
1 2 3 4 5 6 7 8 9 10
<% if @recruitment.tandc %>
<% content_for :title, "Education Partner Checklist 2013/14" %>
<h2>Training</h2>
<p>Before you start running the Apps for Good course you need to attend a Train The Trainer session, so that you feel confident in delivering the course to your students.</p>
 
<h3 style="margin-top:1em;">Please register to attend to one of the Train The Trainer sessions listed below.</h3>
 
<!-- <p>The Education Partner checklist provides you with the training, resources and expert guidance to successfully deliver the Apps for Good course.</p> -->
<%
# TODO: EventBrite API
View Adjust areas of expertise
1 2 3 4 5 6 7 8 9
ActiveRecord::Base.transaction do
ExpertiseArea.find_by_name!("Development / programming").update_attribute(:name, "Technical & data feasibility")
ExpertiseArea.find_by_name!("Market research / customer development").update_attribute(:name, "User & market insight")
ExpertiseArea.find_by_name!("Marketing / customer acquisition").update_attribute(:name, "Marketing")
ExpertiseArea.find_by_name!("User experience / Design").update_attribute(:name, "User experience")
ExpertiseArea.create!(:name => "Idea screening")
ExpertiseArea.create!(:name => "Web development (HTML, CSS, Javascript)")
ExpertiseArea.create!(:name => "Social app development (Facebook)")
end
View gist:5161314
1 2 3 4 5 6 7 8 9 10
class Girl
def initialize(secret_name)
@secret_name
end
end
 
class Ala < Girl
def name
@secret_name
end
View gist:5030848
1 2 3 4 5 6 7 8 9 10
import sys
 
arr = [a for a in range(1,129)]
arr2 = [a for a in range(1001,1129)]
for a in xrange(0, int(sys.argv[1])):
for b in xrange(0,128):
if arr[b] % 2 == 0:
arr[b] += arr2[b]
else:
arr2[b] *= arr[b]
View gist:5030383
1 2 3 4 5 6 7 8 9 10
arr = (1..129).map{|a| a}
arr2 = (1001..1129).map{|a| a}
 
(0..ARGV[0].to_i).each do |a|
(0..128).each do |b|
if arr[b] % 2 == 0
arr[b] += arr2[b]
else
arr2[b] *= arr[b]
end
View gist:4985534
1 2 3 4 5 6 7 8 9 10
ActiveRecord::Base.transaction do
orders_to_fix = Order.joins(:billing_address).where("orders.billing_address_id = addresses.id AND addresses.addressable_type = 'User'")
 
orders_to_fix.each do |order|
billing_address = order.build_billing_address order.billing_address.attributes_for_clone
billing_address.addressable = order
billing_address.save(:validate => false)
 
ActiveRecord::Base.connection.execute("UPDATE orders SET billing_address_id = #{billing_address.id} WHERE id = #{order.id}")
end
View gist:4555335
1 2 3 4 5 6 7 8 9 10
# 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 |
View gist:4345898
1 2 3 4 5 6 7 8 9 10
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)
View gist:4169871
1 2 3 4 5 6 7 8 9 10
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>
View gist:4071304
1 2 3 4 5 6 7
Image.all.each do |img|
begin
img.file.recreate_versions!
rescue
puts "Cannot recreate version for Image with ID: #{img.id}"
end
end
Something went wrong with that request. Please try again.