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 'rspec/expectations' | |
module DelayedJobHelper | |
RSpec::Matchers.define :delay_method do |expected| | |
def supports_block_expectations? | |
true | |
end | |
match do |proc| |
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
# A simple custom validator that validates the size attribute of | |
# the records specified file attribute. | |
# | |
# examples: | |
# - validates :image, file_size: { maximum: 3.megabytes } | |
# - validates :file, file_size: { range: 1.kilobyte..3.megabytes, message: 'not in 1KB to 3MB range' } | |
# | |
class FileSizeValidator < ActiveModel::EachValidator | |
attr_reader :size |
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 'netaddr' | |
class IpAddressMatcher | |
def initialize(terms) | |
@cidrs = cidrs(terms) | |
end | |
def ===(other) | |
@cidrs.any? { |cidr| cidr.matches?(other) } | |
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
/* for versions below 10 */ | |
<!--[if IE]> | |
<link rel="stylesheet" type="text/css" href="all-ie-only.css" /> | |
<![endif]--> | |
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { | |
/* IE10+ CSS styles go here */ | |
} |
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 Capybara | |
module Node | |
module Actions | |
alias_method :old_check, :check | |
alias_method :old_uncheck, :uncheck | |
def check(locator, options = {}) | |
Capybara.current_session.evaluate_script js_element_check(locator, true) | |
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
module Capybara | |
module Node | |
module Actions | |
alias_method :old_check, :check | |
alias_method :old_uncheck, :uncheck | |
def check locator | |
Capybara.current_session.evaluate_script js_element_check(locator, true) | |
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
module UserAgentHelper | |
extend ActiveSupport::Concern | |
Browser = Struct.new(:browser, :version) | |
SUPPORTED_BROWSER_BLACKLIST = [ | |
Browser.new(UserAgent::Browsers::InternetExplorer.new.browser, UserAgent::Version.new('7.0')) | |
].freeze | |
included do |
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 'notifications/client' | |
def client | |
@client ||= Notifications::Client.new(ENV['SETTINGS__GOVUK_NOTIFY__API_KEY']) | |
end | |
def notifications args | |
client.get_notifications(args) | |
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
if defined?(PryByebug) | |
Pry.config.color = true | |
Pry.config.prompt_name = 'Pry:' + File.basename(Dir.pwd) | |
Pry.commands.alias_command 'c', 'continue' | |
Pry.commands.alias_command 's', 'step' | |
Pry.commands.alias_command 'n', 'next' | |
Pry.commands.alias_command 'f', 'finish' | |
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
[ | |
{ "keys": ["super+shift+["], "command": "prev_view" }, | |
{ "keys": ["super+shift+]"], "command": "next_view" }, | |
{ "keys": ["super+alt+left"], "command": "prev_view" }, | |
{ "keys": ["super+alt+right"], "command": "next_view" }, | |
{ "keys": ["ctrl+y"], "command": "show_overlay", "args": {"overlay": "command_palette", "text": "Snippet: "}}, | |
{ "keys": ["super+i"], "command": "copy_path" } | |
] |
OlderNewer