(ns my.ns
(:require [clojure.spec.alpha :as s]))
I hereby claim:
- I am alexvpopov on github.
- I am derpov (https://keybase.io/derpov) on keybase.
- I have a public key ASCANeJV2M9hCMm5heFiuNcMzx9XDJGwsH2yuH710eN-qwo
To claim this, I am signing this object:
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
Failures: | |
1) Ruby2D::Image#contains? returns true if point is inside image | |
Failure/Error: ext_init(@path) | |
NoMethodError: | |
undefined method `ext_init' for #<Ruby2D::Image:0x007fbbaaa08c60> | |
# ./lib/ruby2d/image.rb:27:in `initialize' | |
# ./test/image_spec.rb:13:in `new' | |
# ./test/image_spec.rb:13:in `block (3 levels) in <top (required)>' |
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
RSpec.describe Person do | |
let(:person) { described_class.new('Fixed', 'Name', education_level, educator) } | |
describe '#educate' do | |
let(:education_level) { 2 } | |
let(:educator) { instance_double('PersonEducator') } | |
let(:updated_education_level) { education_level + 1 } | |
subject { person.education_level } |
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 read_price(selector) | |
elmenent = $driver.find_element(id: selector) | |
rescue Selenium::WebDriver::Error::NoSuchElementError | |
"Euer Return-wert" | |
else | |
return elmenent.attribute("value").to_s if elmenent == "NUM_HR_VSU" | |
elmenent.text().gsub(' €', '').gsub(',', '.') | |
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
# User.joins(accounts: :broker_server) | |
SELECT "users".* | |
FROM "users" | |
INNER JOIN "broker_accounts" | |
ON "broker_accounts"."user_id" = "users"."id" | |
AND "broker_accounts"."state" IN ('new', 'active', 'inactive', 'disabled', 'out-of-money') | |
INNER JOIN "broker_servers" | |
ON "broker_servers"."id" = "broker_accounts"."broker_server_id" | |
WHERE "users"."active" = 't' |
Let's say you have the following models:
class Admin < ActiveRecord::Base
has_one :login, as: :loginable
end
class User < ActiveRecord::Base
has_one :login, as: :loginable
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
#!/usr/bin/env bash | |
uninstall() { | |
list=`gem list --no-versions` | |
for gem in $list; do | |
gem uninstall $gem -aIx | |
done | |
gem list | |
gem install bundler | |
} |
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
__foo__ = "This foo sentence contains many foo instances, for example: foo, foo, foo." | |
* Match a single symbol: `foo.match /./ # => #<MatchData "T">` | |
* Match the first-found word character symbol: `foo.match /\w/ => #<MatchData "T">` | |
* Extract all symbols of a string: `foo.scan /./ # => ["T", | |
"h", | |
"i", | |
"s", | |
" ", | |
"f", |
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
require 'spec_helper' | |
ivan = Student.new 'Иван', 10, :second | |
mariya = Student.new 'Мария', 12, :first | |
neycho = Student.new 'Нейчо', 9, :third | |
students = [ivan, mariya, neycho] | |
describe "Array#to_proc" do | |
it "works for a single element" do |
NewerOlder