Skip to content

Instantly share code, notes, and snippets.

View romikoops's full-sized avatar

Roman Parashchenko romikoops

View GitHub Profile
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
SELECT objects.name FROM objects JOIN object_types ON objects.object_type_id = object_types.object_type_id AND object_types.name = 'Building' WHERE NOT EXISTS (SELECT params.object_id FROM params, attributes WHERE objects.object_id = params.object_id AND attributes.attr_id = params.attr_id AND attributes.name = 'E-mail' AND params.text_value REGEXP '^[0-9a-zA-Z_\.\-]+@.*\.[a-z]+$')
@romikoops
romikoops / gist:adceb5c090672bb9a5e1
Created December 10, 2014 11:29
Example of metaprogramming
class QuestionRow
def initialize(internal_id: nil, chapter: nil, position: nil, text: nil, images: nil, video: nil, explanation: nil,
error_points: nil, prerequisite_id: nil, external_id: nil, choices: nil)
method(__method__).parameters.each do |type, name|
if type == :key
instance_variable_set "@#{name}", eval("#{name}")
self.class.class_eval { attr_reader name}
end
end
end
@romikoops
romikoops / main.rb
Created February 11, 2015 12:44
design
module PaymentMethods
class Base
def request_url(params)
raise 'Not implemented'
end
def response_notification
raise 'Not implemented'
end
end
@romikoops
romikoops / main.rb
Created February 11, 2015 13:13
OBT architecture
# /payment_methods/
# /payment_methods/obt/request.rb
# /payment_methods/obt/notification.rb
# /payment_methods/skrill/request.rb
# /payment_methods/skrill/notification.rb
# /payment_methods/base_request.rb
# /payment_methods/base_notification.rb
# /payment_provider.rb
module PaymentMethods
@romikoops
romikoops / server.md
Last active August 29, 2015 14:16 — forked from jtadeulopes/server.md

Update and upgrade the system

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get autoremove
sudo reboot
@romikoops
romikoops / README.md
Created December 31, 2015 01:18 — forked from joakimk/README.md
CircleCI elixir build example

This runs a build for a small elixir (phoenix) project in about 40 seconds by caching as much of the compiled files as possible.

We've been using this for months in multiple projects without any issues. Please ping be if there is any issues with this script and I'll update it.

It should be generic enough to work on any elixir app using mix.

If you have a elixir_buildpack.config, then enable that section in the build script to keep versions in sync!

Feature: User settings feature
In order to use account settings
As registered user
I want to
Background:
Given registered UNIQ_USER user logged in system
Scenario: sign in details, profile and mailings settings tabs exist
Then Profile page for UNIQ_USER should be opened
require 'rubygems'
require 'bundler'
Bundler.require(:default)
include FactoryGirl::Syntax::Methods
# Models
class User
attr_accessor :first_name, :last_name, :email, :sex
attr_accessor :profile