Skip to content

Instantly share code, notes, and snippets.

View phillipoertel's full-sized avatar

Phillip Oertel phillipoertel

View GitHub Profile
Scaling RoR MUC
Roles
- "big decisions" group
- Examples:
- do we take on non-refugees
- when do we start the weekly course
- do students have to qualify for the weekly course
- which volunteers do we take on
source 'http://rubygems.org'
# REFINERY CMS ================================================================
# Anything you put in here will be overridden when the app gets updated.
gem 'refinerycms', '1.0.8'
group :development, :test do
# To use refinerycms-testing, uncomment it (if it's commented out) and run 'bundle install'
# Then, run 'rails generate refinerycms_testing' which will copy its support files.
class PortfolioItem::Image
dragonfly_accessor :image_original # store original
dragonfly_accessor :image_medium # 660px
end
class PortfolioItem
include PortfolioItem::ImagesConcern
end
class PortfolioItem::Image < ActiveEceord::Base
end
class PortfolioItem < ActiveEceord::Base
has_many :images, class_name: 'PortfolioItem::Image', dependent: :destroy
# id stored in column portfolio_items.tile_image_id
has_one :tile_image, class_name: 'PortfolioItem::Image', dependent: :destroy
@phillipoertel
phillipoertel / pi_images_refactoring.rb
Created May 27, 2014 19:59
pi_images_refactoring.rb
class PortfolioItem
#
# alt
#
#has_attached_file :teaser, styles: { tile: ["555x>", :jpg] }
#
# neu
#
require 'test/unit'
class StringCalculator
def add(string)
string.split(',').map(&:to_i).inject(:+) || 0
end
end
class TestStringCalculator < Test::Unit::TestCase
class Account
def initialize(id)
@balance = 0
@id = id
end
def decrease_balance(amount)
@balance -= amount
end
require 'embedly'
key = ENV['KEY']
timeout = 60
client = Embedly::API.new(key: key, timeout: timeout)
url = 'http://de.qantara.de/inhalt/zivilgesellschaftliche-initiativen-im-libanon-ich-bin-kein-maertyrer'
p client.extract(url: url)
require_relative '../features_helper'
require_relative 'registration_spec_helper'
feature "Registering as new user", :js do
include RegistrationSpecHelper
background do
visit root_path
click_on("Registrieren")
end
@phillipoertel
phillipoertel / gist:8997250
Created February 14, 2014 07:45
Aufgabe 1
contents = {
user1: [1, 2, 4, 5, 6],
user2: [7, 8, 9],
user3: [10, 11, 12, 13]
}
# regeln:
- höchstens 6 elemente zurückgeben
- von möglichst vielen usern
- gleichmaessig