This file contains hidden or 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
Show hidden characters
| { | |
| "ignored_packages": | |
| [ | |
| "Vintage", | |
| ], | |
| // Controls where trailing white space is removed on save. | |
| // - "none": Do not remove any trailing white space on save. | |
| // - "all": Remove all trailing white space on save. |
This file contains hidden or 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
| FixtureError = Class.new(StandardError) | |
| # | |
| # Wrapper for fixtures so they can be loaded with a FactoryBot type syntax | |
| # Usage: | |
| # fixture :user, :admin | |
| # | |
| # This will try to find a model with an id that matches the fixture label | |
| def fixture(model_name, label) | |
| model = model_name.to_s.classify.constantize | |
| id = ActiveRecord::FixtureSet.identify(label) |
This file contains hidden or 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
| STATUSES = [:foo, :bar, :this, :that] | |
| scope :by_status, -> do | |
| status_strings = STATUSES.join(',') | |
| joins( | |
| "JOIN unnest('{#{status_strings}}'::text[]) WITH ORDINALITY t(status, order_by_status) USING (status)" | |
| ).order('order_by_status') | |
| end |
This file contains hidden or 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 'parslet' | |
| class Store | |
| class << self | |
| def headings | |
| @headings ||= [] | |
| end | |
| def links | |
| @links ||= [] |
This file contains hidden or 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 'csv' | |
| # This is the source data - basically an array of hashes | |
| data = [ | |
| {a: 1, b: 2}, | |
| {a: 3, b: 4} | |
| ] | |
| # This is a path to the file we are going to create. | |
| # __dir__ is the directory of the current file - that is, this file's directory |
This file contains hidden or 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 "active_support/core_ext" | |
| class XBuilder | |
| attr_reader :data, :namespace, :root | |
| def initialize(data) | |
| @namespace = data.delete(:_namespace) | |
| @root = data.delete(:_root) | |
| @data = data | |
| end |
This file contains hidden or 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 'active_support' | |
| require 'active_support/core_ext/integer/time' | |
| class SalaryPatternGenerator | |
| def self.generate(*args) | |
| new(*args).generate | |
| end | |
| attr_reader :period, :salary, :day_offset, :salary_offset, :start_at |
This file contains hidden or 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 TrueLayer | |
| class IdentifyApplicant | |
| TRUE_LAYER_URL = 'https://api.truelayer.com'.freeze | |
| attr_reader :token, :error | |
| def initialize(token) | |
| @token = token | |
| end |
This file contains hidden or 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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
| <title><%= page_title %></title> |
This file contains hidden or 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
| # Set up the spy object | |
| let(:chargebee_site) { spy(ChargebeeSite) } | |
| # Hook it into the work flow | |
| before do | |
| allow(ChargebeeSite).to receive(:new).and_return(chargebee_site) | |
| end | |
| # use `have_received` to test connection | |
| it 'creates a chargebee coupon' do |
NewerOlder