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
| # This is part of a "locale" model, we use. | |
| # | |
| # @name contains the handle of the locale, e.g. "de-AT", or "da-DK". | |
| # this way, we exclude a key in phrase. It works perfect. | |
| def exclude_key_in_phrase(key) | |
| HTTParty.post('https://phraseapp.com/api/v1/translations/store.json', | |
| query: { | |
| auth_token: Phrase.auth_token, |
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
| 1.upto(100) do |i| | |
| if i % 5 == 0 and i % 3 == 0 | |
| puts "FizzBuzz" | |
| elsif i % 5 == 0 | |
| puts "Buzz" | |
| elsif i % 3 == 0 | |
| puts "Fizz" | |
| else | |
| puts i | |
| 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
| # have_content calls has_content? that is aliased by has_text? | |
| # | |
| # It checks, if the page has the text. when the text is not present, | |
| # it waits until the capybara timout to let the text appear. | |
| # | |
| # When our frontendcode should remove the content muffins, we could | |
| # test it like this way: | |
| it 'does not have content xyz after clicking the magic button' do | |
| find('a.magic_button').click |
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
| invoice = Invoice.last | |
| invoice.load_order_matches.with_score_gt(70) # <= LoadOrderMatchesCollection | |
| best_match = invoice.load_order_matches.best # <= LoadOrderMatch | |
| best_match.score # <= 97 | |
| best_match.invoice # <= Invoice | |
| best_match.load_order # <= LoadOrder | |
| best_match.similarities # <= [ amount: 500 ] | |
| class Invoice | |
| extend Matchability |
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 Attributify | |
| def attributify(key, unprocessed=params[key]) | |
| if unprocessed.is_a? Hash | |
| specific_params = {} | |
| unprocessed.each do |k,v| | |
| if (v.is_a?(Hash) && !k.to_s.match(/_attributes$/)) or (v.is_a?(Array) && !k.to_s.match(/_ids$/)) | |
| # Nested, so suffix with '_attributes' | |
| specific_params["#{k}_attributes".to_sym] = attributify(key, v) |
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
| snippet khv | |
| "${1}": { | |
| ${2} | |
| } | |
| snippet kv | |
| "${1}": "${2}" | |
| snippet s | |
| "${1}": { |
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
| Bankster::Client.credit_transfer( | |
| bic: "HYVEDEMM417", | |
| iban: "DE83763123456780253100", | |
| name: "Max Mustermann", | |
| purpose: "Miete", | |
| amount: 3700, | |
| currency: "EUR", | |
| eref: "my-end-to-end-id" | |
| ) |
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 'mongoid' | |
| require 'rspec' | |
| Mongoid.configure.connect_to('mongoid_test') | |
| class Syncer | |
| def self.perform(address); end | |
| end | |
| class Customer |
OlderNewer