text stringlengths 10 2.61M |
|---|
require 'yaml'
module Fog
class << self
def credential=(new_credential)
@credential = new_credential
@credentials = nil
end
def credential
@credential || :default
end
def config_path
ENV["FOG_RC"] || '~/.fog'
end
def credentials
@credentials ||= begin
... |
# frozen_string_literal: true
puts "\n== Upload startup images ======================================================"
Rails.root.join('db/seeds/images').glob('*').sort.map do |folder|
folder.glob('*').sort.map { |file| { file => folder.basename.to_s.to_i } }
end.flatten.inject(:merge).each do |img_file, darkness|
... |
module Persistence
class ArticleSearchService
include Pharrell::Constructor
constructor Persistence::Database
def initialize(db)
@db = db
end
def search(query)
query = query.downcase
results = @db[:articles].where(Sequel.ilike(:title, "%#{query}%"))
results.map { |r| Mod... |
require 'date'
require 'colorize'
class Blog
def initialize
@bloglist = [] #array should be able to handle pagination
@post_counter = 0
end
def post_to_blog(post)
@bloglist << post
end
def publish_front_page
@bloglist = @bloglist.sort {|bloglist_1,bloglist_2| bloglist_1.date <=> bloglist_2.... |
require 'erb'
require 'tempfile'
module Puppler
class Command
# puppler command: bundle puppet modules in the current project
#
# Basically does the following:
# 1. Check for module directories or run the #{Puppler::Command::Install}
# 2. Process the module directories one by one
# 2.1 Initia... |
require 'rails_helper'
RSpec.describe 'Artists API', type: :request do
let!(:artist) { create(:artist) }
let(:artist_id) { artist.id }
describe 'Get /artists' do
before { get '/artists' }
it 'returns a status code of 200' do
expect(response).to have_http_status(200)
end
it 'returns a lis... |
# coding: utf-8
# Autor inicial: Daniel Hamilton Smith
# Adopta aportes de Vladimir Támara Patiño <vtamara@pasosdeJesus.org>: https://github.com/dhasane/analisis-palabras/commit/3055a69fad020f180a1beb6cb33a19d7a3138eb6
require 'set'
# Árbol Trie
#
# Es un árbol n-ario que permite almacenar varias cadenas para de... |
class EventsController < ApplicationController
before_action :logged_in_user, only: [:create, :destroy]
def show
@event = Event.find(params[:id])
@attendees = @event.attendees.all.paginate(page: params[:page], per_page: 12)
end
def index
@events = Event.all
@past_events = Event.past.order(:date).pagina... |
class TweetJob < ApplicationJob
queue_as :default
def perform(tweet)
return if tweet.published?
# Reschedule a tweet to the future
return if tweet.publish_at > Time.current
tweet.publish_to_twitter!
end
end
# Push the publish_t forward
# noon -> 8am
# -
# 8am -> set tweet id
# Noon -> publish... |
require_relative '../../sections/headers/main_header'
module Web
module Pages
class Dashboard < SitePrism::Page
set_url '/dashboard'
element :span_welcome_name, '[data-test="dashboard-welcome"]'
element :btn_criar_perfil, '[data-test="dashboard-createProfile"]'
element :btn_editar_perfil... |
class AddNumberingToCourseNumberings < ActiveRecord::Migration
def change
add_column :course_numberings, :new_number, :string
add_column :course_numberings, :old_number, :string
end
end
|
module TicTacToeRZ
module Validators
module InputValidator
def self.valid?
return lambda { |input, valid_choices| valid = valid_choices.include?(input) }
end
end
end
end |
require "application_system_test_case"
class VeiculosTest < ApplicationSystemTestCase
setup do
@veiculo = veiculos(:one)
end
test "visiting the index" do
visit veiculos_url
assert_selector "h1", text: "Veiculos"
end
test "creating a Veiculo" do
visit veiculos_url
click_on "New Veiculo"
... |
#
# Be sure to run `pod spec lint LocalizableUI.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://gith... |
class ChangeColumnNamesInSongs < ActiveRecord::Migration
def change
rename_column :songs, :pdf_url, :chart
rename_column :songs, :mp3_url, :mp3
end
end
|
class Category < ActiveRecord::Base
has_many :trips, through: :trip_categories
has_many :trip_categories
has_many :tasks
validates_presence_of :name
validates_uniqueness_of :name, case_sensitive: false
end
|
require 'sinatra/base'
require 'active_record'
require 'logger'
require 'active_support/core_ext/string/strip'
module Sinatra
module ActiveRecordHelper
def database
settings.database
end
end
module ActiveRecordExtension
def database=(spec)
set :database_spec, spec
@database = nil
... |
# frozen_string_literal: true
class Firestore::Footprint < Firestore::Base
COLLECTION_NAME = 'footprint'
class_attribute :repo
self.repo = client.col COLLECTION_NAME
def self.find(document_id)
snapshot = repo.doc(document_id).get
snapshot.data.merge({ documentId: snapshot.document_id }) if snapshot.e... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :configure_permitted_params, if: :devise_controller?
before_action :find_static_pages
before_action :set_gon_user
helper_method :current_order
layout :set_layout
rescue_from ActiveRecord::RecordNotFo... |
class AddDefaultWorkout < ActiveRecord::Migration[5.2]
def change
add_column :workouts, :user_default, :boolean, default: false
end
end
|
module Widgets
module Page
# Widget for menu item in, e.g., guest or member menus.
class MenuItem < Views::Base
needs :caption, href: '#', item_method: :get
def content
li { link_to caption, href, link_options }
end
private
def link_options
{}.tap do |options|... |
require 'rails_helper'
describe "the update park route", :type => :request do
park = FactoryGirl.create(:park)
it 'tests the put route' do
put "/parks/#{park.id}", params: { :name => 'Rocky Mountain'}
get "/parks/#{park.id}"
expect(JSON.parse(response.body)["name"]).to eq('Rocky Mountain')
end
end
|
Rails.application.routes.draw do
mount ActionCable.server => '/cable'
post '/login', to: 'home#login'
post '/logout', to: 'home#logout'
resources :questions
resources :votes, only: [:create]
resources :question_comments
root to: "home#show"
end
|
class AuthorResource < JSONAPI::Resource
attributes :name
filter :name
has_many :posts
has_many :comments
end
|
class ApplicationController < ActionController::Base
before_action :basic_auth, if: :production?
before_action :configure_permitted_paramaters, if: :devise_controller?
before_action :set_category_brand
protect_from_forgery with: :null_session
private
def configure_permitted_paramaters
devise_parameter... |
=begin
write a method dice_outcomes which takes the number of dice to roll and the number of times to roll them, then outputs a visual chart of how many times each possible number comes up.
=end
def dice_outcomes(num_dice, num_rolls)
results = {}
(num_dice...(num_dice * 6) + 1).each do |n|
results[n] = ... |
require 'minimax_rb'
RSpec.describe MinimaxRB do
it "returns available moves" do
array = ["X", "-", "-", "-"]
empty_marker = "-"
expect(MinimaxRB.available_moves(array, empty_marker)).to eq([1,2,3])
end
it "returns the grid size (3x3, 4x4) of the board" do
array = Array.new(9)
expect(Minim... |
Pod::Spec.new do |s|
s.name = "JPGuideCenter"
s.version = "0.0.1"
s.summary = "a giude "
s.description = <<-DESC
程序启动引导页
DESC
s.homepage = "https://github.com/chichi1314"
s.screenshots = "https://github.com/agdsdl/DLSlideView/raw/master/Images/demo1.jpg", "https... |
require "pry"
class People
attr_reader :name, :height, :eye_color, :gender
@@all = []
def initialize(people_data)
@name = people_data["name"]
@height = people_data["height"]
@eye_color = people_data["eye_color"]
@gender = people_data["gender"]
@@all... |
# coding : utf-8
require 'benchmark'
require 'turkish_stemmer'
Benchmark.bmbm(7) do |x|
x.report('regex') do
TurkishStemmer.class_eval do
def self.turkish?(word)
!! word.match(TurkishStemmer::ALPHABET)
end
end
100_000.times { TurkishStemmer.turkish?("aaa") }
end
x.report('loop'... |
require 'thrift'
require File.join(File.dirname(__FILE__), 'hbase', 'hbase_constants')
require File.join(File.dirname(__FILE__), 'hbase', 'hbase_types')
require File.join(File.dirname(__FILE__), 'hbase', 'hbase')
# Try to make the crazy nesting that Thrift generates a little less painful
module Hbase
Client = ::Apa... |
class Person < ApplicationRecord
has_one :user, dependent: :restrict_with_error
has_one :address, as: :addressable, dependent: :destroy
has_many :phones, dependent: :destroy, inverse_of: :person
validates :name, :cpf, :rg, :address, presence: true
validates :cpf, uniqueness: { case_sensitive: false }
valid... |
class BadHaiku < ActiveRecord::Base
before_save :how_many_syllables
after_update :attempt_resubmit
def how_many_syllables
self.syllable_estimate = SyllableCounter::Count.new.get_syllables(self.description)
return true
end
def attempt_resubmit
haiku = Haiku.new(author: author, description: descri... |
class ChangeDistractorsType < ActiveRecord::Migration
def change
change_column :questions, :distractors, :string
end
end
|
class AbstractResp
attr_reader :body, :request, :response
def initialize(body, request, response)
@body, @request, @response = body, request, response
end
def obj
JSON.parse(body.to_s)
rescue JSON::ParserError
body
end
def ok; self; end
def no; self; end
end
|
vpc_id_kt = attribute('vpc_id', description: 'VPC ID')
s3_bucket_kt = attribute('s3_bucket_address', description: 'S3 Bucket address')
control 'aws_resources' do
describe aws_vpc(vpc_id_kt) do
it { should exist }
its('cidr_block') { should eq '10.0.0.0/16' }
end
describe aws_s3_bucket(bucket_name: 'cl... |
require 'spec_helper'
describe "Users" do
describe "GET /users" do
it "Should have the content 'Listing messages'" do
visit '/messages'
expect(page).to have_content('Listing messages')
end
end
describe "GET /users/new" do
#before { visit messages_path } // same as below before(:each) ... |
class UsersController < ApplicationController
def index
authorize User
@users = User.all
@users = paginate(@users).decorate
end
end
|
# GithubUrlValidator object determines if a value is a
# valid Github URL
class GithubUrlValidator < ActiveModel::EachValidator
include BrigadesHelper
def validate_each(record, attribute, value)
pattern = %r{^((http|https):\/\/)?(www\.)?github\.com\/.+\/?$}
error = 'is an invalid Github URL'
validate_ur... |
class FontDuruSans < Formula
head "https://github.com/google/fonts/raw/main/ofl/durusans/DuruSans-Regular.ttf", verified: "github.com/google/fonts/"
desc "Duru Sans"
homepage "https://fonts.google.com/specimen/Duru+Sans"
def install
(share/"fonts").install "DuruSans-Regular.ttf"
end
test do
end
end
|
# frozen_string_literal: true
module SXS
class Publisher
def initialize(queue_url, provider:)
@provider = provider
@queue_url = queue_url
end
def publish(body)
publisher.publish(body)
end
private
def environment
ENV['RAILS_ENV']
end
def memory
SXS::P... |
class QuestDefinition < ActiveRecord::Base
attr_accessor :objective
has_many :objectives
belongs_to :user
has_friendly_id :name, :use_slug => true
before_save :parse_objective
def start_quest(user, why)
quest = Quest.new
quest.quest_definition = self
quest.user = user
self.objectives.each d... |
require 'capistrano'
module Capistrano
class LogWithAwesome < Capistrano::Logger
#replaces the built in Capistrano logger with awesome
def self.init(config)
@config = config
level = @config.logger.level
@config.logger = new
@config.logger.level = level
end
def self.log_with_a... |
#!/usr/bin/ruby
require 'logger'
require 'uri'
require 'json'
require 'fileutils'
require 'open3'
require 'sqlite3'
begin
$config = JSON::parse(File.read("config.json"))
rescue
puts "#{Time.now.strftime('%Y-%m-%d %H:%M:%S')} [FATAL] Incorrect JSON file or 'config.json' does not exist!"
exit 1
end
unless ARGV.a... |
class App < ActiveRecord::Base
validates :name, presence: true
has_many :events
belongs_to :user
end
|
##----------------------------------------------------------------------------##
## CP's Battle Engine v1.2b
## Created by Neon Black
##
## Only for non-commercial use. See full terms of use and contact info at:
## http://cphouseset.wordpress.com/liscense-and-terms-of-use/
##-------------------------------------------... |
require 'rails_helper'
describe AverageAgeForPositionCacheManager do
describe '.fetch' do
before do
allow(NHL).to receive(:average_age_for_position)
end
context 'with no cache saved' do
it 'gets the result from the model' do
Rails.cache.delete 'NHL::average_age_for_position::C'
... |
ENV['RACK_ENV'] ||= 'development'
require_relative 'dm_setup'
require 'sinatra/base'
require 'sinatra/flash'
class Chitter < Sinatra::Base
enable :sessions
set :session_secret, 'secret'
register Sinatra::Flash
helpers do
def current_user
@current_user ||= User.get(session[:user_id])
end
end
... |
class Question < ActiveRecord::Base
has_many :answers
validates :detail, :presence => true
end
|
Shindo.tests('Linode | linode requests', ['linode']) do
@linode_format = Linode::Formats::BASIC.merge({
'DATA' => { 'LinodeID' => Integer }
})
@linodes_format = Linode::Formats::BASIC.merge({
'DATA' => [{
'ALERT_BWIN_ENABLED' => Integer,
'ALERT_CPU_THRESHOLD' => Integer,
'ALER... |
#!usr/bin/env ruby
# The function calculateSlope
# asks user for two x,y coordinates
# Then splits each coordinate into an array
# Using the map method, converts them to a float
# Then each part of the array is assigned
# either x1, x2, y1, or y2
# Then, the slop itself is calculated
# After that, we determine if the ... |
class Api::V1::ScreeningLists::ConsolidatedController < ApiController
search_by :countries, :q, :type, :sources, :name, :distance, :address
def sv_filename
"CSL_#{Time.now.strftime('%Y_%m_%d')}"
end
end
|
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
class V1::CacheController < V1::BaseController
include ActionController::Caching
self.perform_caching = true
self.cache_store = ActionController::Base.cache_store
def cache_with key, opts={}
lk = "#{controller_name}.#{action_name}.#{key}"
puts lk
Rails.cache.fetch lk, opts do
yield
end
... |
require 'test_helper'
require_relative '../patient_test'
class PatientTest::Exportable < PatientTest
before do
# Perils of subclassing - this restores db to clean
Patient.destroy_all
ArchivedPatient.destroy_all
end
describe 'export concern methods' do
before do
@patient = create :patient
... |
ActionController::Routing::Routes.draw do |map|
map.resources :workouts
map.resources :temp_photos
map.root :controller => 'workouts', :action => 'index'
end
|
class HomeController < ApplicationController
layout :static_page_layout
before_action :load_user, except: :heartbeat
before_action :find_product_if_present_in_params, only: :index
skip_before_action :initialize_user, only: :heartbeat
skip_before_action :load_cart, only: :heartbeat
def index
@products ... |
require 'maws/command'
class SetSecurityGroups < Command
def description
"set-security-groups - create or update security groups from security rules configuration"
end
# override from command to ignore selection
def verify_options
if @config.command_line.region.blank?
Trollop::die "Region must b... |
class AddBaseFieldToPartnerProfile < ActiveRecord::Migration[5.0]
def change
add_column :partner_profiles, :name, :string
add_column :partner_profiles, :address, :text
add_column :partner_profiles, :location, :string
add_column :partner_profiles, :avatar, :text
add_column :partner_services, :mobil... |
class UsersArtist < ApplicationRecord
belongs_to :user, dependent: :destroy
has_many :artists
end
|
class Post < ApplicationRecord
belongs_to :user
validates :title, :body, presence: true
validates :title, length: { minimum: 10,
message: -> (object, data) do
"Your post title is #{(10 - data[:value].length)} characters too short."
end
}
end
|
module ApplicationHelper
def create_table_header ability, model
if can? ability, model
content_tag(:th)
end
end
def can_show_linkify display_text, object
show_linkify( display_text, :read, object, object.class.to_s.underscore.pluralize )
end
def show_linkify display_text, ability, object, url_token
... |
require "./app/services/update_balance"
require "ostruct"
require "active_support/core_ext/date/calculations"
RSpec.describe UpdateBalance do
context "balance from today with everything changed" do
let(:balance) { described_class.new(balance: FakeBalance.new, params: true) }
it "should send email" do
... |
# frozen_string_literal: true
require 'faker'
MOVIE_TITLES = [
'Back to the Future', 'Harry Potter', 'Hobbit', 'Star Wars', 'Ghost Busters'
].freeze
SEASON_TITLES = [
'Friends', 'Dr Who', 'New Girl', 'Seinfeld', 'Breaking Bad'
].freeze
MOVIE_TITLES.each do |movie_title|
film = Film.new(title: movie_title, plo... |
class City < ApplicationRecord
belongs_to :country
has_many :customers
end
|
# frozen_string_literal: true
describe "Idempotent async producer", functional: true do
let(:producer) { kafka.async_producer(max_retries: 3, delivery_interval: 1, retry_backoff: 1, idempotent: true) }
after do
producer.shutdown
end
example 'duplication if idempotent is not enabled' do
producer = kafk... |
require 'minitest/autorun'
require 'minitest/pride'
require './lib/braille_runner'
class BrailleRunnerTest < Minitest::Test
def test_it_exist
braille_runner = BrailleRunner.new
assert_instance_of BrailleRunner, braille_runner
end
def test_it_has_three_outputs
braille_runner = BrailleRunner.new
as... |
module CDI
module V1
module Users
class FacebookUnlinkService < BaseActionService
include V1::ServiceConcerns::OauthParams
attr_reader :user
action_name :facebook_unlink_account
def initialize(user, options = {})
@user = user
super(options)
end... |
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-pl... |
require_relative '../views/orders_view'
require_relative '../models/order'
class OrdersController
def initialize(meal_repository, customer_repository, employee_repository, order_repository)
@meal_repository = meal_repository
@customer_repository = customer_repository
@employee_repository = employee_repo... |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
class ApplicationStatus < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name, :scope=>"school_id", :case_sensitive=>false
DEFAULT_STATUSES = [{:name=>"pending",:description=>"The application is being processed",:notification_enabled=>false,:is_active=>true,:is_default=>true},
{:na... |
class ProductCategory < ApplicationRecord
belongs_to :restaurant
has_many :products
#Campo obrigatório
validates :title, presence: true
end
|
class Course < ActiveRecord::Base
has_many :course_instances, :order => "instance_name DESC", :dependent => :destroy
named_scope :courses_ascending, :order => "name ASC"
named_scope :courses_descending, :order => "name DESC"
after_create :update_newsfeed
private
def update_newsfeed
Newsfeed.course_added(... |
require 'erb'
require 'yaml'
require 'sinatra/base'
module Pglint
class Web < Sinatra::Base
set :root, File.expand_path(File.dirname(__FILE__) + "/../../web")
set :public_folder, Proc.new { "#{root}/assets" }
set :views, Proc.new { "#{root}/views" }
set :locales, ["#{root}/locales"]
get '/' ... |
class VotingResultObserver < ActiveRecord::Observer
# send notification if the vote was changed
def after_save(result)
result.send_notification = true if (result.is_manual_add || result.is_edited) && result.original_vote != result.vote
end
# after save, record notification trigger
def after_commit(result)
i... |
require 'rails_helper'
RSpec.feature "User can view all categories" do
scenario "they see the page for all categories" do
login_user
categories = %w(funny silly crazy).map do |category_name|
Category.create(name: category_name)
end
visit categories_path
categories.each do |category|
... |
class Attendance::CheckoutReminderWorker
include Sidekiq::Worker
sidekiq_options queue: 'default'
def perform(attendance_id, hmac_secret, minutes_before_leaving)
AttendanceMailer.checkout_reminder(attendance_id, hmac_secret, minutes_before_leaving).deliver
end
end
|
# This file was generated by the docusign_rest:generate_config rake task.
# You can run 'ruby lib/tasks/docusign_task.rb' as many times as you need
# to replace the content of this file with a new config.
require_relative '../lib/docusign_rest'
DocusignRest.configure do |config|
config.username = 'jonkinney@g... |
Given("I am in the open account page") do
open_new_account_page.load
end
When("I select the type account {string} and the existing account to transfer the funds") do |type|
open_new_account_page.fill_form(type)
end
When("I click in the button open new account") do
open_new_account_page.wait_until_selec... |
# == Schema Information
#
# Table name: recommendations
#
# id :integer not null, primary key
# sender_id :integer
# receiver_id :integer
# content :string(255)
# created_at :datetime
# updated_at :datetime
# category :string(255)
# item :string(255)
#... |
Pod::Spec.new do |s|
s.name = 'SwiftPlayer'
s.version = '0.4.0'
s.summary = 'Swift stream music player, on top of HysteriaPlayer'
s.description = <<-DESC
This CocoaPod provides the ability to use a stream player using swift. Built on top of HysteriaPlayer framework.
... |
describe LocaleFile do
subject(:locale_file) do
build :locale_file
end
it { is_expected.to validate_presence_of(:name) }
context 'when it is validated that it is unique' do
let(:dup) { locale_file.dup }
before do
locale_file.save
end
it 'do not save' do
expect(dup.save).to be... |
require "rails_helper"
RSpec.describe UserPolicy do
subject { described_class }
context "with an admin" do
let(:user) { FactoryGirl.build(:admin) }
let(:record) { FactoryGirl.build(:admin) }
%i(index? new? create? edit? update? destroy?).each do |action|
permissions action do
it "grants... |
class FontHindJalandhar < Formula
head "https://github.com/google/fonts.git", branch: "main", only_path: "ofl/hindjalandhar"
desc "Hind Jalandhar"
homepage "https://github.com/itfoundry/hind-jalandhar"
def install
(share/"fonts").install "HindJalandhar-Bold.ttf"
(share/"fonts").install "HindJalandhar-Li... |
class InstantFeeParticular < ActiveRecord::Base
belongs_to :instant_fee_category
belongs_to :master_fee_particular
# tax associations
has_many :tax_assignments, :as => :taxable
has_many :tax_slabs, :through => :tax_assignments, :class_name => "TaxSlab"
has_many :collectible_tax_slabs, :as => :collectible_e... |
class Account
attr_accessor :balance
def initialize
@balance = 0
end
def validate!
raise "Your balance is 0" if balance.zero?
end
end
|
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :prefer_html?
hide_action :prefer_html?, :set_html_preference
def prefer_html?
session[:html_preference] == 'true'
end
def set_html_preference(preference)
session[:html_preference] = preference
end
private... |
class KPI
def initialize(forecast)
@forecast = forecast
@accounts_totals = AccountTotals.new(forecast, "1.year")
end
def top_selling_product
product_totals = []
max_revenue = 0
top_product = {}
@forecast.revenues.each do | revenue |
balance = 0
revenue.transactions.each d... |
class ChangeFlagsOfHunts < ActiveRecord::Migration
def up
change_column :hunts, :started, :boolean, default: false
change_column :hunts, :paused, :boolean, default: false
change_column :hunts, :completed, :boolean, default: false
end
def down
end
end
|
# frozen_string_literal: true
module Kruger
class Client
class Response
attr_reader :response
def initialize(response = nil)
@response = response
end
def body
response.parsed_response
end
def success?
response.success?
end
def status
... |
require 'spec_helper'
describe Collection do
let(:subject) { FactoryGirl.create(:collection) }
let(:reloaded_subject) { Collection.find(subject.pid) }
it 'can be part of a collection' do
expect(subject.can_be_member_of_collection?(double)).to be true
end
it 'can contain another collection' do
anoth... |
# ----------------RUBY HASHES AND LOOPS 10/21/2019
# HASHES - dictionary-like collection of unique keys and their values. Also called associative arrays, they are similar to Arrays, but where an Array uses integers as its index, a Hash allows you to use any object type. Hashes enumerate their values in the order that ... |
class LicenseFeeCalculator
def calculate(booking)
annual_booking_number = booking.annual_booking_number
usage_fee_rate = percentage_rate(annual_booking_number)
# Get all the rates summed across all of the rooms
room_rates_total = booking.rate_total
# Usage fee based off the rate of the hotel, d... |
class FontZenLoop < Formula
head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/zenloop"
desc "Zen Loop"
desc "Latin fonts designed by yoshimichi ohira, as part of zen fonts collection"
homepage "https://fonts.google.com/specimen/Zen+Loop"
def insta... |
Rails.application.routes.draw do
root to: 'application#home'
get :heartbeat, to: 'application#heartbeat'
constraints subdomain: 'api', defaults: { format: :json } do
api_version(module: 'V1', header: { name: 'Accept', value: 'application/vnd.lunarandflo.api+json; version=1' }, default: true) do
resourc... |
# frozen_string_literal: true
# code cracker class
class CodeCracker
def encryption(message, key)
hash = hash_encryption(key)
translation = ''
message.each_char do |letter|
translation += hash[letter].nil? ? letter : hash[letter]
end
p translation
end
private
def hash_encryption(key... |
require 'rails_helper'
RSpec.describe DynamicNestedForms::ViewHelpers do
describe '#autocomplete_to_add_item' do
let(:patient) { create(:patient) }
let(:physicians) { create_list(:physician, 3) }
before(:each) do
visit edit_patient_path(patient)
end
it "displays patient" do
... |
class PagesController < ApplicationController
layout "ipanel"
def show
@area = Bubble::Area.where(code: (params[:area_code] || "yst")).first!
@page = @area.find_page(params[:page_slug].to_s.split("/").last || "index")
end
end |
Project3Rickshaw::Application.routes.draw do
resources :drivers
resources :stops
resources :locations
root :to => 'application#index'
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.