text stringlengths 10 2.61M |
|---|
require 'oauth'
require 'json'
require 'csv'
class GoodDataTwitterAds::Campaigns
attr_reader :client
def initialize config={}
@client = config[:client]
end
#-----------------------------------------------------LIST OF CAMPAIGNS------------------------------------------------------------------
# This function w... |
Facter.add(:xcode_license_accepted) do
confine kernel: 'Darwin'
setcode do
require 'puppet/util/plist'
xcode_active_directory = Facter.value(:xcode_active_directory)
if xcode_active_directory.nil?
# no tools installed
nil
elsif xcode_active_directory == '/Library/Developer/CommandLineT... |
require_relative 'twitter_secrets'
require_relative 'lib/connect_four'
class NoResponseError < StandardError; end
while true
begin
hash_string = (('a'..'z').to_a + ('A'..'Z').to_a + (1..9).to_a).shuffle[0..2].join
initiate_tweet = Twitter.update "Who wants to get demolished? #dbc_c4 ##{hash_string} #{Time.n... |
module TeachersPet
class Cli
option :organization, required: true
option :repository, required: true
students_option
common_options
option :ssh, banner: 'HOST', default: TeachersPet::Configuration.sshEndpoint
desc 'push_files', "Run this command from a local Git repository to push the files ... |
class Card
include Mongoid::Document
field :card_no, type: Integer
embedded_in :deck
end
|
require 'helper_frank'
module Rdomino
describe Agent do
before do
@a = Rdomino.test[:test].agent('a')
end
it '#invoke_from_console' do
@a.must_be_instance_of Agent
@a.parent.must_be_instance_of Database
@a.run_console.first.must_match /Command has been executed on remote server/
... |
class ApplicationController < ActionController::Base
# Adds a few additional behaviors into the application controller
include Blacklight::Controller
# Adds Sufia behaviors into the application controller
include Sufia::Controller
include DeviseRemoteUser::ControllerBehavior
# Please be sure to impe... |
module PeopleHelper
def logged_in?(person)
current_person && current_person == person
end
def admin?
person_signed_in? && current_person.admin?
end
def person_avatar(person)
if person.picture?
image_tag(person.picture_url(:person_profile), :width => 300)
else
image_tag('/avatar.... |
class Matriz
# include Comparable
# include Enumerable
attr_reader :filas, :columnas, :matriz
def initialize(m)
@filas = m.size
@columnas = m[0].size
@matriz = m;
end
def to_s
aux = "["
for i in 0...@filas do
aux << "["
for j in 0...@columnas do
if (j == @columnas... |
class Constants
MEMBER_TYPES = {:team_lead => 'team_lead', :programmer => 'programmer'}
BUILDINGS = {:b1 => 'Stae Building', :b2 => 'Twin Tower'}
FLOORS = {:f1 => 'First Floor', :f2 => 'Second Floor'}
ROOMS = {:r1 => 'Room#01', :r2 => 'Room#2'}
ACT_PRIORITY = {:p1 => 'High', :p2 => 'Medium', :p3 => 'Low'}
A... |
require_relative 'config'
require 'logger'
require 'thin'
require 'sinatra'
require 'sinatra/param'
require 'sinatra/reloader' if development?
require 'sinatra/json'
require 'data_mapper'
require_relative 'qiniu_patch'
require_relative 'mailer'
require_relative "path_resolver"
require_relative "qiniu_patch"
require_re... |
class CreateDatabrowsers < ActiveRecord::Migration
def up
create_table :databrowsers do |t|
t.references :browser, index: true, foreign_key: true
t.references :theme, index: true, foreign_key: true
t.timestamps null: false
end
end
def down
drop_table :databrowsers
end
end
|
class IncidentReport < ActiveRecord::Base
belongs_to :user
CURRENT_STATUS = %w(Recovered Ongoing)
MEASURER_STATUS = %w(Implemented Development)
SOURCE = %w(Internal External)
RECURRENCE_CONCERN = %w(Low Medium High)
validates :service_impact, :problem_details, :how_detected, :occurrence_time, :detection_tim... |
require 'spec_helper'
describe "todo_list" do
before(:each) do
@empty = Todo::TodoList.new("../fixtures/todo-blank.txt")
@three = Todo::TodoList.new("../fixtures/todo-three.txt")
end
describe "#initialize" do
it "should accept a path to a todo file" do
flunk
end
it "should... |
require 'code'
describe SomeClass do
subject { SomeClass.new(value: 1) }
context '.increment_value!' do
it 'increments the value' do
expect(subject.increment_value!).to eq(2)
end
end
context '.decrement_value!' do
it 'decrements the value' do
expect(subject.decrement_value!).to eq(0)
... |
require 'sumac'
# make sure it exists
describe Sumac::Calls::LocalCalls do
def build_local_calls
connection = instance_double('Sumac::Connection')
id_allocator = instance_double('Sumac::IDAllocator')
allow(Sumac::IDAllocator).to receive(:new).and_return(id_allocator)
calls = Sumac::Calls::LocalCalls... |
class IssuesController < ApplicationController
load_and_authorize_resource :project
load_and_authorize_resource :issue, :through => :project, :shallow => true
before_action :assign_user, :only => [:create]
before_action :fetch_board_and_connections, :only => [:index]
def index
@issues = if @board.pres... |
#########################################
# This class provided the methods to properly distribute given resources between plugins
#########################################
class ParamsResourcer < Params
def initialize
#Init hashes
@plugin_cores = {}
@plugin_priority = {}
@plugin_ram = {}
#Load cores
... |
require "spec_helper"
RSpec.describe "Day 5: Alchemical Reduction" do
let(:runner) { Runner.new("2018/05") }
let(:input) { "dabAcCaCBAcCcaDA" }
describe "Part One" do
let(:solution) { runner.execute!(input, part: 1) }
it "counts the remaining polymer units after reaction" do
expect(solution).to e... |
# exercise_10.rb
# Can hash values be arrays?: Yes
h = {a: ['b', 'c', 'd']}
# Can you have an array of hashes? Yes
a [{:a=>1, :b=>2, :c=>3}]
|
# longest_sentence.rb
# Write a program that reads the content of a text file and then prints the
# longest sentence in the file based on number of words. Sentences may end with
# periods (`.`), exlamation points (`!`), or question marks (`?`). Any sequence
# of characters that are not spaces or sentence-ending charact... |
require "application_system_test_case"
class PollsTest < ApplicationSystemTestCase
setup do
@poll = polls(:one)
end
test "visiting the index" do
visit polls_url
assert_selector "h1", text: "Polls"
end
test "creating a Poll" do
visit polls_url
click_on "New Poll"
fill_in "Title", wi... |
require 'rails_helper'
describe 'Merchants Index API' do
before :each do
@merchants = create_list(:merchant, 100)
end
describe 'happy path' do
it "sends a list of merchants in an array called 'data'" do
get api_v1_merchants_path
expect(response).to be_successful
merchants = JSON.pars... |
require 'spec_helper'
require 'ruby-progressbar/output'
class MyTestOutput < ProgressBar::Output
def clear; end
def bar_update_string
bar.to_s
end
def log(_string)
stream.puts 'We All Float'
end
def resolve_format(*)
'%t |%B|'
end
def eol
bar.stopped? ? "\n" : "\r"
end
end
class ... |
require 'spec_helper'
describe Lolita::Configuration::Columns do
let(:dbi){Lolita::DBI::Base.create(Post)}
it "should create columns" do
columns=Lolita::Configuration::Columns.new(dbi)
columns.class.should == Lolita::Configuration::Columns
end
it "should respond to array methods" do
columns=Loli... |
class SubjectSetFirstPage
include Mongoid::Document
field :name, type: String
field :thumbnail, type: String
field :meta_data, type: Hash
field :group_key_id, type: String
field :subject_set_id, type: String
end
|
class FontGlory < Formula
head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/glory"
desc "Glory"
desc "Suitable for logos, headlines and body text with the available six weights"
homepage "https://fonts.google.com/specimen/Glory"
def install
(s... |
module Asaas
module Entity
class Payment
include Virtus.model
attribute :id, String
attribute :customer, String
attribute :subscription, String
attribute :billingType, String
attribute :value, Float
attribute :netValue, Float
attribute :originalValue, Float
a... |
# Copyright 2007-2014 Greg Hurrell. All rights reserved.
# Licensed under the terms of the BSD 2-clause license.
require 'strscan'
require 'walrat'
module Walrat
# Unicode-aware (UTF-8) string enumerator.
class StringEnumerator
# Returns the char most recently scanned before the last "next" call, or
# nil... |
# frozen_string_literal: true
module Vedeu
module EscapeSequences
# Provides escape sequence strings for setting the cursor position
# and various display related functions.
#
# @api public
#
module Esc
include Vedeu::Common
include Vedeu::EscapeSequences::Actions
include... |
# frozen_string_literal: true
def next_smaller(num)
digits = num.to_s.chars.map(&:to_i)
(2..digits.size).each do |slice_length|
slice = digits.last slice_length
next if ordered? slice
out_of_order = slice.shift
rest = slice
replacement = (ix = rest.rindex { |n| n < out_of_order }) &... |
# -*- encoding : utf-8 -*-
class CreateRecommendationsGroupsJoinTable < ActiveRecord::Migration
def change
create_table :groups_recommendations, id: false do |t|
t.uuid :recommendation_id
t.uuid :group_id
end
end
end
|
class UsersController < ApplicationController
before_action :find_and_set_user, only: [:show, :edit, :update, :destroy]
before_action :authorize_user!, only: :destroy
def index
end
def show
redirect_to root_path, alert: "Access denied." unless current_user.id == @user.id
end
def new
@user = Us... |
class ResetPasswordMailer < ApplicationMailer
# send a signup email to the user, pass in the user object that contains the user's email address
def send_reset_password_email(user)
@user = user
@url = "http://localhost:3000/api/v1/users/reset_password?token=#{@user.reset_password_token}"
mail( to: @use... |
module Kaya
module Commands
def self.help
$K_LOG.debug "#{self}:#{__method__}" if $K_LOG
puts "
Kaya has some commands:
- install
- start
- stop
- restart
- reset
Note: If you stop kaya and then you want to get it up and the port you are using is ... |
class Devices::ApplicationController < ApplicationController
def set_device
@device = @user.devices.find_by_name!(params[:device_name])
end
end
|
#!/usr/bin/env ruby
#coding:utf-8
module PlainSite
VERSION='0.0.1'
end
|
require 'spec_helper'
describe User do
describe "user_key" do
let(:user) { User.new.tap {|u| u.email = "foo@example.com"} }
before do
allow(user).to receive(:username).and_return('foo')
end
it "should return email" do
expect(user.user_key).to eq 'foo@example.com'
end
it "should... |
class Sentence < ActiveRecord::Base
serialize :solution, Hash
has_and_belongs_to_many :exercises
has_many :tasks
scope :starters, lambda{ |bulk_size| order(id: :asc).limit(bulk_size) }
scope :needed, lambda{ |ids_list| order(id: :asc).where('tasks_count < 40').where('id not in (?)', ids_list) }
scope ... |
require_relative './bootstrap.rb'
require 'rubygems'
gem "minitest"
require 'minitest/autorun'
require 'minitest/mock'
require 'ABCImporter'
class ABCImporterTest < Minitest::Test
include ACMEJobStreamerImport
def setup
@importer = ABCImporter.new CONFIG
@database = @importer.database
@database.cl... |
require 'rbconfig'
class PurgeableInstallGenerator < Rails::Generator::Base
def manifest
record do |m|
m.file "purgeable.yml", "config/purgeable.yml"
end
end
def self.gem_root
File.expand_path('../../../', __FILE__)
end
def self.source_root
File.join(gem_root, 'templates', 'install')
... |
class String
define_method(:word_count) do |sentence_to_check, include_partial_matches, filter_on_case|
word_to_count = self
words_to_check = []
word_occurence_count = 0
partial_matches = []
if filter_on_case == "true" #user wants to exclude words with different cases
if sentence_to_check.in... |
class AddRentItemToItems < ActiveRecord::Migration[5.2]
def change
add_reference :items, :rent_item, foreign_key: true
end
end
|
require 'faraday'
require 'faraday_middleware'
# excon 174m
# net-http-persistent 42m
# HTTPClient 131m
#
module Legion
module Extensions
module Http
module Runners
module Http
def status(**_opts)
{ test: true }
end
def get(host:, uri: '', port: 80, **opts)... |
$LOAD_PATH.unshift(File.dirname(__FILE__))
require_relative './directors_database'
def directors_totals(source)
result = {}
director_index = 0
while director_index < source.size do
director = source[director_index]
result[director[:name]] = gross_for_director(director)
director_index += 1
end
resu... |
# frozen_string_literal: true
#
# Fluentd Kubernetes Metadata Filter Plugin - Enrich Fluentd events with
# Kubernetes metadata
#
# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy ... |
module EventSource
module Postgres
class Write
include EventSource::Write
dependency :put
def configure(session: nil)
Put.configure(self, session: session)
end
def write(batch, stream_name, expected_version: nil)
logger.trace(tag: :write) { "Writing batch (Stream N... |
# frozen_string_literal: true
module ActionDispatch
# This middleware guards from DNS rebinding attacks by white-listing the
# hosts a request can be sent to.
#
# When a request comes to an unauthorized host, the +response_app+
# application will be executed and rendered. If no +response_app+ is given, a
#... |
# coding: utf-8
require 'spec_helper'
feature 'Gerenciar Cliente' do
before :each do
end
scenario 'Incluir Cliente' do
visit new_cliente_path
preencher_e_verificar_cliente
end
scenario 'Alterar Cliente' do #, :javascript => true do
cliente = FactoryGirl.create(:cliente)
visit... |
class CreateTransactions < ActiveRecord::Migration[6.1]
def change
create_table :transactions do |t|
t.decimal :amount
t.datetime :date
t.boolean :buy
t.belongs_to :user, null: false, foreign_key: true
t.belongs_to :coin, null: false, foreign_key: true
t.timestamps
end
e... |
class Entry < ActiveRecord::Base
named_scope :in_category, lambda {|category| {:order => "date DESC", :conditions => {:category => category}}}
end
|
class Gallery < ActiveRecord::Base
extend FriendlyId
friendly_id :name, use: :slugged
has_many :gallery_items
validate :name, :presence => true
mount_uploader :image, GalleryUploader
end
|
# frozen_string_literal: true
require 'test_helper'
class TianguisTest < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::Tianguis::VERSION
end
end
|
require File.join(File.dirname(__FILE__), 'spec_helper')
require 'nobbie/wx'
require 'nobbie/wx/command/console_reporter'
module Nobbie
module Wx
module Command
describe "ConsoleReporter" do
it "behave like a Reporter" do
ConsoleReporter.new.should be_kind_of(Reporter)
... |
# encoding: utf-8
#
# © Copyright 2013 Hewlett-Packard Development Company, L.P.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
#... |
class CreateTrainings < ActiveRecord::Migration
def change
create_table :trainings do |t|
t.string :title
t.string :prefix
t.text :purpose
t.text :programm
t.text :people
t.string :time
t.string :cost
t.string :img
t.integer :solution_id
t.timestamps
... |
class User < ActiveRecord::Base
def correct_token? token
(token == self.auth_token) and not self.auth_token.empty?
end
end
|
module Koal::Callable
extend ActiveSupport::Concern
class_methods do
def call(*args)
new.call(*args)
end
end
end
|
module XMLPipes #:nodoc:
module Searchable
def self.extended(base)
base.class_eval do
def self.from_document_id(document_id, options = {})
raise NotImplementedError,
'XMLPipes::Searchable requires you to implement this method yourself. ' \
'Sorry.'
... |
class UserRelationship < ActiveRecord::Base
belongs_to :follower, class_name: "User"
belongs_to :being_followed, class_name: "User"
validate :not_following_self
def not_following_self
unless follower_id != being_followed_id
errors.add(:base, "You can't follow yourself")
end
end
end
|
class Hook < ApplicationRecord
belongs_to :project
validates :payload, presence: true
validates :sent_at, presence: true
delegate :name, to: :project, prefix: true
def self.most_recent_for(user_id, limit = 100)
joins(project: :subscriptions)
.where('subscriptions.user_id = ?', user_id)
.whe... |
require 'rails_helper'
RSpec.describe Course, type: :model do
before do
@course = FactoryBot.create(:course)
end
it "should regist course" do
expect(FactoryBot.build(:course)).to be_valid
end
it " arrow course to duplicate only course_name" do
expect(FactoryBot.create(:course, professor: "金子")).to ... |
module ShooterTest
class HyperDrive < Drive
self.identification = 6
self.boost = 20.0
self.max_speed = 5000.0
self.brake = 0.05
self.friction = 0.1
self.heating_rate = 0.05
self.cooldown_rate = 0.01
def generate_particles(ship)
particle_shape = SDC::DrawShapeCircle.new
particle_shape.radius = ... |
class AddUseFlgAndTagIdToMovie < ActiveRecord::Migration
def change
add_column :movies, :use_flg, :boolean, null: false
add_column :movies, :tag_id, :integer, null: false
end
end
|
# This class wraps a spreadsheet file.
# It provides two methods:
# * **parse** for reading the file content as an array of arrays,
# * **model_generator** for create a collection of class instances based on a given class.
class RecordRoo::DataSource
def initialize filepath
@filepath = filepath
end
# Return... |
require "spec_helper"
describe "Advocate's Tenant Dashboard", type: :feature do
let!(:admin) { login_as_admin }
let(:user_with_no_violations) { FactoryBot.create(:user) }
let(:user_with_recent_violations1) { FactoryBot.create(:user) }
let(:user_with_recent_violations2) { FactoryBot.create(:user) }
let(:user... |
class TeamHomeSeason < ApplicationRecord
belongs_to :team_season
has_many :matches
has_many :player_seasons
has_many :start_appearances, through: :player_seasons
has_many :substitute_appearances, through: :player_seasons
has_many :corners
def home_matches_played
matches.where("kickoff < ?", DateT... |
class Blog < ActiveRecord::Base
belongs_to :user
belongs_to :department
has_many :comments, dependent: :destroy
has_many :likes, dependent: :destroy
has_one_attached :blog_image
LIST = Department.all.collect {|c| [ c.department_name, c.id ]}
validates :title, presence: true, length:{minimum:3, maximum:500... |
#
# Cookbook Name:: mesos
# Recipe:: slave
#
# Copyright (C) 2015 Medidata Solutions, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... |
class GenreSerializer < ActiveModel::Serializer
attributes :id, :title, :songs
has_many :song_genres
has_many :songs, through: :song_genres
end
|
module Foyer
module Grape
module Helpers
extend ActiveSupport::Concern
protected
def user_signed_in?
current_user.present?
end
def current_user
return nil unless headers['Authorization'] =~ /^Bearer (.*)/m
@current_user ||= Foyer.token_finder.call($1)
... |
class AddCostToEventItems < ActiveRecord::Migration
def change
add_column :event_items, :cost, :float
end
end
|
class Api::V1::GardensController < ApplicationController
def index
gardens = Garden.all
render json: gardens
end
def show
garden = Garden.find(params[:id])
render json: garden
end
def create
garden = Garden.new(garden_params)
if garden.save
render json: garden
else
40... |
module ApplicationHelper
def has_user?
!!params[:user_id]
end
def own_recipe?(recipe)
recipe.user_id == current_user.id
end
def can_edit_comment?(comment)
if comment.nil? || comment.commenter.nil? ||current_user.nil?
false
else
comment.commenter_id == current_user.id
end
en... |
class Facultad < ApplicationRecord
has_many:profesors
end
|
require 'rails_helper'
RSpec.describe 'ログイン', type: :system do
before do
driven_by(:rack_test)
end
describe 'userコントローラーのテスト' do
describe 'userが存在するときの画面表示' do
before 'ユーザーIDをセッションから取り出せるようにする' do
# session[:user_id]に値を入れユーザーがログインしている状態を作る
user = create(:user)
allow_any_ins... |
# http://fiveislands.hatenablog.com/entry/2016/08/15/082338
module Subject
def register_observer observer
raise 'should implement register_observer method'
end
def remove_observer observer
raise 'should implement remove_observer method'
end
def notify_observers
raise 'should implement notify_obs... |
module Lang
def self.enter_ip(lang)
case lang
when "tr","TR"
puts "\nLütfen, hedef ip'yi giriniz:".light_blue
when "en","EN"
puts "\nPlease, enter a target ip:".light_blue
when "ru","RU"
puts "\nПожалуйста, введите IP адрес:".light_blue
else
puts "\nNot supported language!".light_red
exi... |
require 'yaml'
class HadoopCommands
@@hadoop_dfs = "bin/hadoop dfs"
def initialize(hadoop_path, hdfs_path)
@hadoop_path = hadoop_path
@hdfs_path = hdfs_path
end
def copy_to_hdfs(localpath, opts = {})
copy_path = get_path(opts)
basename = File.basename("#{localpath}")
file_exists = list(:... |
Shortener::Application.routes.draw do
#match '/' => 'urls#new'
#match 'settings' => "users#edit", :as => :settings
resources :urls
match ":shorturl" => "urls#goto"
root :to => 'urls#new'
end
|
require 'rails_helper'
describe Signature, type: :model do
subject(:signature) { FactoryGirl.create :signature }
it { is_expected.to be_audited }
context "with valid attributes" do
it { is_expected.to be_valid }
end
context "without a signature image" do
before { subject.assign_attributes(image: ni... |
class RemovePlayerIdFromAssists < ActiveRecord::Migration[5.1]
def change
remove_column :assists, :player_id, :integer
add_column :assists, :start_appearance_id, :integer
add_column :assists, :substitute_appearance_id, :integer
end
end
|
class InvitationsController < ApplicationController
before_action :authenticate_user!, only: [:new, :create]
def new
@invitation = Invitation.new
@category = Category.find(params[:category_id])
respond_to do |format|
format.html { }
format.js
end
end
def create
@user = current_user
... |
$LOAD_PATH << '../../comrank/lib'
require 'yaml'
require 'csv'
require 'active_record'
require 'sinatra/activerecord'
require 'sinatra/activerecord/rake'
require 'cxbrank/const'
require 'cxbrank/master'
Time.zone = 'Tokyo'
ActiveRecord::Base.configurations = YAML.load_file(CxbRank::DATABASE_FILE)
ActiveRecord::Base.e... |
class SearchController < ApplicationController
skip_authorization_check
def search
if params[:q].nil?
@words = []
else
@words = Word.search params[:q]
end
end
end |
Given(/^I run this test script$/) do
require 'watir-webdriver'
browser = Watir::Browser.new :firefox # should open a new Firefox window
browser.window.maximize
browser.goto 'http://nitrowriters.com/form/form.html' # or type the local path to your downloaded copy
browser.text_field(:id => 'my_text_field').set... |
class CommentsController < ApplicationController
def create
params[:comments][:user_id] = current_user.id
comment = Comment.create(comment_params)
if comment.save
render json: comment
else
render json: comment.errors.messages, status: 422
end
end
private
def comment_params
... |
class CreateSubscriptDependencies < ActiveRecord::Migration[5.1]
def change
create_table :subscript_dependencies do |t|
t.integer :parent_script_id
t.integer :child_script_id
t.integer :algorithM_id
t.timestamps
end
end
end
|
require 'tempfile'
describe ManageIQ::PostgresHaAdmin::RailsConfigHandler do
subject { described_class.new(:file_path => @yml_file.path, :environment => 'test') }
before do
@yml_file = Tempfile.new('database.yml')
yml_data = YAML.load(<<-DOC)
---
base: &base
username: user
wait_timeout: 5
port:
test... |
# frozen_string_literal: true
#
# Overload the integer class
#
class Integer
def human_size(a_kilobyte_is_1024_bytes = true)
HumanSize::Size.human_size(self, a_kilobyte_is_1024_bytes)
end
end
|
class ReviewsController < ApplicationController
before_action :find_partner
before_action :find_review, only: [:edit, :update, :destroy]
def new
@review = Review.new
end
def create
@review = Review.new(review_params)
@review.partner_id = @partner.id
@review.user_id = current_user.id
... |
# our calculator should ...
# add two integers and return an integer
# subtract two integers and return an integer
# multiply two integers and return an integer
# RSpec
# 'describe' block for each group of tests
# 'it' block for each individual test
# expect(<YOUR CODE>).to eq <RESULT>
require_relative 'calcu... |
class SubjectsController < ApplicationController
include MyUtility
before_action :set_subject, only: [:show, :edit, :update, :destroy]
# GET /subjects
def index
placeholder_set
param_set
@count = Subject.notnil().includes(:p_name).search(params[:q]).result.count()
@search = Subject.notnil().inc... |
class Api::V1::InvoiceItems::FindAllController < ApplicationController
def index
render json: InvoiceItem.find_all(invoice_item_params)
end
private
def invoice_item_params
params.permit(:invoice_id, :id, :item_id, :result, :quantity, :unit_price, :created_at, :updated_at)
end
end
|
class Planet < ApplicationRecord
belongs_to :home_world
validates :planet_name, presence: true, uniqueness: true
validates :rotation_period, :orbital_period, :diameter, :gravity, :surface_water, :population, presence: true
validates :population, numericality: true
end
|
# frozen_string_literal: true
class Participant
attr_accessor :hand, :score
def initialize
@hand = []
@score = 0
end
end
module Hand
def display_hand
rendered_hand = hand.map { |card| build_card(card) }
9.times do |index|
puts rendered_hand.map { |card| card.lines[index].chomp.lstrip }.... |
class NotificationsController < ApplicationController
include Response
before_action :notification_params, only: :create
AUTHORS = {
namtx: "[To:2261556]",
phandinhman: "[To:1956097]",
leductienttkt: "[To:2155577]",
tjn0994: "[To:2031014]",
khacthe: "[To:2259103]",
NguyenHuuGiap: "[To:2031... |
Pod::Spec.new do |s|
s.name = "SwiftyDropbox"
s.version = "2.0.3"
s.summary = "Dropbox Swift SDK for APIv2"
s.homepage = "https://dropbox.com/developers/"
s.license = "MIT"
s.author = { "Ryan Pearl" => "rpearl@dropbox.com" }
s.source = { :git => "https://github.com/drop... |
class TargetHeavy::Client
# @!attribute [r] snitch_address
# @return[String] the IPv4 address of the target-snitch server
attr_reader :snitch_address
# @!attribute [r] snitch_port
# @return[String] the port that the target-snitch server is bound to on +snitch_address+
attr_reader :snitch_port
# @!attrib... |
require 'test/unit'
$:.unshift "../../.."
require 'rdoc/markup/simple_markup'
include SM
class TestParse < Test::Unit::TestCase
class MockOutput
def start_accepting
@res = []
end
def end_accepting
@res
end
def accept_paragraph(am, fragment)
@res << fragment.to_s
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.