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
| # frozen_string_literal: true | |
| require 'bundler/inline' | |
| gemfile do | |
| source 'https://rubygems.org' | |
| gem 'minitest', '~> 5.14.0' | |
| gem 'webmock', '~> 3.14.0' | |
| gem 'faraday', '~> 1.7.0' |
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
| # frozen_string_literal: true | |
| require "bundler/inline" | |
| gemfile(true) do | |
| source "https://rubygems.org" | |
| gem 'rails', '6.1.0' | |
| gem 'sqlite3' | |
| 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
| -- install hspec | |
| -- $ cabal install --lib hspec | |
| -- | |
| -- import in GHCi | |
| -- $ ghci polynomial.hs | |
| -- *Main> toPolynomial "1" | |
| -- "1.0" | |
| -- *Main> toPolynomial "0 1 0 3" | |
| -- "1.0 * x^1 + 3.0 + x^3" | |
| -- |
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
| # frozen_string_literal: true | |
| require 'bundler/inline' | |
| class Polynomial | |
| attr_reader :coeffs | |
| def initialize(coeffs) | |
| @coeffs = coeffs | |
| 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
| # frozen_string_literal: true | |
| require 'bundler/inline' | |
| gemfile(true) do | |
| source 'https://rubygems.org' | |
| gem 'rack' | |
| gem 'minitest' | |
| gem 'rack-test' |
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
| # frozen_string_literal: true | |
| require "bundler/inline" | |
| gemfile(true) do | |
| source 'https://rubygems.org' | |
| gem 'activerecord', '6.1.0' | |
| gem 'sqlite3' | |
| 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
| const assert = require('assert').strict; | |
| function solution(a, k) { | |
| if (k === 0 || a.length === 0) { | |
| return a; | |
| } | |
| const last = a[a.length - 1]; | |
| const butlast = a.slice(0, a.length - 1); | |
| return solution([last, ...butlast], k - 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
| # frozen_string_literal: true | |
| # Run all tests: | |
| # $ ruby fizz-buzz.rb | |
| # | |
| def generate_functional(limit) | |
| fizzes = [nil, nil, :fizz].cycle | |
| buzzes = [nil, nil, nil, nil, :buzz].cycle | |
| fizzes.take(limit).zip(buzzes.take(limit)) |
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
| # frozen_string_literal: true | |
| require 'bundler/inline' | |
| gemfile(true) do | |
| source 'https://rubygems.org' | |
| gem 'path_expander', '~> 1.1.0' | |
| gem 'minitest', '~> 5.11.0' | |
| 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
| # frozen_string_literal: true | |
| require "bundler/inline" | |
| CARRIERWAVE_BASE64_VERSION = ENV['CARRIERWAVE_BASE64_VERSION'] || '~> 2.3.5' | |
| gemfile(true) do | |
| source "https://rubygems.org" | |
| gem 'rails', '~> 5.2.0' |
NewerOlder