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 DailyStatsReport < KPI::Report | |
def users | |
result 'Users', User.count, :description => 'Total users count' | |
end | |
def premium_users | |
result 'Premium users', User.premium.count | |
end | |
def premium_users_percentage |
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
@import clearfix.sass | |
$grid_width: 1200px | |
$grid_glue: 10px | |
$grid_boxes: 24 | |
=grid-container | |
+clearfix | |
padding: | |
left: 0px |
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
describe "Activity form" do | |
let(:user) { Factory(:user) } | |
before { sign_in user.email, user.password } | |
describe "entering activity" do | |
before do | |
@enter = lambda do |what, duration, project=""| | |
within("#activity_form") do | |
fill_in "What?", :with => what | |
fill_in "How long?", :with => duration |
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 AuthenticationsController < ApplicationController | |
before_filter :authenticate_user!, :only => :destroy | |
def create | |
omniauth = request.env['omniauth.auth'] | |
authentication = Authentication.find_by_provider_and_uid(omniauth["provider"], omniauth["uid"]) | |
if current_user | |
if authentication && authentication.try(:user) != current_user | |
flash[:error] = I18n.t("This %{provider} account is already connected to another account in our service", :provider => authentication.provider) | |
elsif authentication.nil? |
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 create_user_session(data) | |
@user_session = UserSession.new(data) | |
@user_session.save do |result| | |
if result | |
# Should restore last uncompleted order and add current(guest) order to it, if exists. | |
order = @user_session.record.orders.last(:conditions => {:completed_at => nil}) | |
if order | |
if (session[:order_token] && guest_order = Order.find(:first, :conditions => {:token => session[:order_token], :user_id => nil, :completed_at => nil})) | |
guest_order.line_items.each do |line_item| | |
order.add_variant(line_item.variant, line_item.quantity) |
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 MethodClass | |
def initialize; @test = 1; end | |
def test | |
@test | |
end | |
end | |
class ReaderClass | |
attr_reader :test | |
def initialize; @test = 1; 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
upstream logo_contest_cluster { | |
server 127.0.0.1:3000; | |
} | |
server { | |
listen 80; | |
server_name logo-contest.eax.pl; | |
access_log /home/sevos/apps/logo-contest/log/access.log; | |
error_log /home/sevos/apps/logo-contest/log/error.log; |
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
module Animal | |
def self.included(base) | |
class << base | |
def method_added(name) | |
unless (@wrapped_methods ||= []).include? name | |
@wrapped_methods.push name | |
puts "Defined #{name}" | |
wrap_method name | |
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
installation_unit "postgres", | |
:description => "Install PostgreSQL server, PGAdmin3 and Ruby&Rails adapters" do |i| | |
i.install_system_package "postgres" | |
i.step "First start PostgreSQL server", :supported => :fedora do |s,i| | |
s.surun "service postgresql initdb" | |
s.surun "service postgresql start" | |
end | |
i.step "Run console to set default postgres password" do |s,i| | |
s.info "When you see" | |
s.info "postgres=# prompt type:" |
NewerOlder