Skip to content

Instantly share code, notes, and snippets.

Artur Roszczyk sevos

Block or report user

Report or block sevos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sevos
sevos / README.md
Last active May 9, 2019
Rails 5.2 + Komponent + Turbolinks + Stimulus
View README.md

Usage

rails new my_app --rc=template.rc -m template.rb
@sevos
sevos / feature_spec.rb
Created Mar 24, 2017
This is a helper simulating mouse events related to hovering over an element: onmouseenter onmouseleave etc.
View feature_spec.rb
require 'rails_helper'
RSpec.feature 'Feature', js: true do
include InteractionHelper
scenario 'Scenario' do
visit '/'
hover_mouse(find('div#id')) do
click_on 'Button'
View keybase.md

Keybase proof

I hereby claim:

  • I am sevos on github.
  • I am sevos (https://keybase.io/sevos) on keybase.
  • I have a public key ASAnWvwdcqTcBoAhocP3U5ugAXF9rJMkfsh7RVo9CDcOjAo

To claim this, I am signing this object:

@sevos
sevos / value_object.rb
Last active Dec 28, 2015
This is just an idea of value objects API and dirty implementation for Ruby. A frankenstein created from merge of Struct's and OpenStruct's APIs. It supoprts mandatory and optional fields. It raises exceptions if API of value object is misused. Feel free to comment and refactor the implementation!
View value_object.rb
# TODO: ValueObject should be immutable. Setter should return new instance.
class ValueObject < Struct
def self.new(*fields)
all_fields, optional_fields = if fields.last.is_a?(Hash)
optional_fields = fields.pop
[fields + optional_fields.keys, optional_fields]
else
[fields, {}]
end
@sevos
sevos / git-pair
Last active Mar 10, 2017 — forked from andrzejsliwa/pair
A script to change pairs
View git-pair
#!/usr/bin/env ruby
# encoding: utf-8
Person = Struct.new(:name, :email) do
def activate
`git config user.name '#{name}'`
`git config user.email '#{email}'`
end
end
View report_activity_spec.rb
require 'spec_helper'
require 'timebacus/use_cases/report_activity'
describe Timebacus::ReportActivity do
context 'with valid data' do
let(:activity) { mock(id: 5, duration: 1800, description: 'remote work') }
mock_const Timebacus::ReportActivity, 'Activity' do |activity_class|
activity_class.stub(new: activity)
@sevos
sevos / README.md
Created Jan 16, 2012
Problems with OpenSSL in Ruby 1.9.3 on Lion
View README.md

This gist show problem with Ruby 1.9.3 on my Mac OS X Lion (10.7.2).

I've tried RVM and Rbenv+ruby-build. I tried linking with system openssl, rvm-openssl and homebrew-openssl. Even if linking succeeded, the error when requiring digest/sha1 appeared.

Problem with requiring digest/sha1 causes bundler not working at all.

This gist contains:

  • test_1.9.2.txt - shows success on 1.9.2
  • test_1.9.3.txt - shows failure on 1.9.3
View inviter.rb
module Inviter
def invite(invitee)
open_profile(me)
within ".header" do
fill_in "Invite", with: invitee.email
click_link "Invite"
end
def invite(invitee)
Factory(:invitation, inviter: me, invitee_email: invitee.email)
View application_helper.rb
module ApplicationHelper
def present(object, klass = nil)
klass ||= "#{object.class}Presenter".constantize
presenter = klass.new(object, self)
yield presenter if block_given?
presenter
end
end
View app_actors_user.rb
class User
def initialize(context)
@context = context
end
def profile
@context.system.collections.profiles.where(id: @context.session[:current_user_id]).first
end
end
You can’t perform that action at this time.