text stringlengths 10 2.61M |
|---|
class AddCurrentDirectoryToUser < ActiveRecord::Migration
def change
add_column :users, :current_directory_id, :integer
end
end
|
# frozen_string_literal: true
RSpec.describe StatisticCalcs do
it 'has a version number' do
expect(StatisticCalcs::VERSION).not_to be nil
end
end
|
And /^I touch attach picture icon for project$/ do
@screen.picture_screen.moveToProjectPicture
end
And /^I touch take photo icon$/ do
@screen.picture_screen.openCamera
end
And /^I touch picture icon for location$/ do
@screen.picture_screen.touchLocationIconPicture
end
And /^Picture is visible in the ... |
class Article < ApplicationRecord
has_many :comments
belongs_to :category
belongs_to :subcategory
belongs_to :user
validates :title, presence: true
validates :description, presence: true
validates :contact, presence: true
has_attached_file :image,
styles: { medium: '300x300>', t... |
class Backlog < ApplicationRecord
has_many :backlog_columns
has_many :backlog_tags
has_many :children, class_name: "Backlog", foreign_key: "parent_id", dependent: :destroy
belongs_to :parent, class_name: "Backlog", foreign_key: "parent_id", optional: true
belongs_to :backlog_type
has_many :backlog_items
h... |
class Response < ActiveRecord::Base
belongs_to :question
belongs_to :answer
belongs_to :player
validates_presence_of :question_id, :answer_id, :player_id
validate :validates_only_one_answer_per_question_per_player
before_validation :cache_answer_details
def question
self[:question] ||= answer.que... |
module EtAtosFileTransfer
class BasicConstraint
def self.matches?(request)
::ActionController::HttpAuthentication::Basic.authenticate(request) do |username, password|
system = ::EtAtosFileTransfer::ExternalSystem.atos_only.to_a.detect do |s|
s.config_hash[:username] == username && s.config... |
require 'rubygems'
require 'bundler'
require 'time'
require 'date'
Bundler.require
require_relative "scripts/attendance_log.rb"
require_relative "scripts/generate_status.rb"
require_relative "scripts/generate_proto_status.rb"
NAME_FILE = "names.txt"
class Attendance < Sinatra::Base
helpers Sinatra::Cookies
enab... |
# encoding: utf-8
require 'string_ext'
describe 'String#to_bool' do
it 'asserts true to "y | yes | 1 | true | t"' do
expect("y".to_bool).to eq true
expect("yes".to_bool).to eq true
expect("true".to_bool).to eq true
expect("t".to_bool).to eq true
expect("1".to_bool).to eq true
end
it 'assert... |
=begin
* Modelo de la tabla Quotation de la base de datos
* @author rails
* @version 14-10-2017
=end
class Quotation < ApplicationRecord
belongs_to :client
belongs_to :adviser
has_many :services
has_many :activities, through: :services
has_many :articles
has_many :products, through: :articles
validate... |
# frozen_string_literal: true
class ChangeUsers < ActiveRecord::Migration[6.1]
def change
rename_column :users, :password, :password_digest
add_index :users, :email, unique: true
end
end
|
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
class MembersControllerTest < ActionController::TestCase
include Devise::TestHelpers
context 'basics' do
setup do
@user = Factory(:user)
@user.roles << Role[:admin]
@user.confirm!
sign_in @user
end
should 'ha... |
module RunPal
class AcceptJoinRequest < UseCase
def run(inputs)
inputs[:user_id] = inputs[:user_id].to_i
inputs[:join_req_id] = inputs[:join_req_id].to_i
user = RunPal.db.get_user(inputs[:user_id])
return failure(:user_does_not_exist) if user.nil?
join_req = RunPal.db.get_join_re... |
module PEBuild
module Transfer
class UnhandledURIScheme < Vagrant::Errors::VagrantError
error_key('unhandled_uri_scheme', 'pebuild.transfer')
end
require 'pe_build/transfer/open_uri'
require 'pe_build/transfer/file'
IMPLEMENTATIONS = {
'http' => PEBuild::Transfer::OpenURI,
'h... |
# == Informacion de la tabla
#
# Nombre de la tabla: *dbm_biblioteca_bibliografia*
#
# idBibliografia :integer(11) not null, primary key
# idDescriptorGenerico :integer(11) not null
# autor :string(255) default(""), not null
# titulo :string(255) default(""), not n... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# Base box
config.vm.box = "centos6"
# Provisioning
config.vm.share_folder("templates", "/tmp/vagrant-puppet/templates", "templates")
config.vm.provision :puppet do |puppet|
puppet.module_path = "modules"
puppet.manifests_path... |
class Comment < ActiveRecord::Base
belongs_to :user
belongs_to :asset
belongs_to :project
before_save :link_to_project
private
def link_to_project
self.project = asset.project
end
end
|
# == Schema Information
#
# Table name: timelines
#
# id :integer not null, primary key
# user_id :integer
# state :string(255) default(""), not null
# interval :string(255) default(""), not null
# created_at :datetime not null
# updated_at :datetime not null
#... |
# The following iterative sequence is defined for the set of positive integers:
# n ->n/2 (n is even) n ->3n + 1 (n is odd)
# Using the rule above and starting with 13, we generate the following sequence:
# 13 40 20 10 5 16 8 4 2 1 It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 ... |
describe ::PPC::API::Baidu::Plan do
auth = {}
auth[:username] = $baidu_username
auth[:password] = $baidu_password
auth[:token] = $baidu_token
Test_plan_id = []
it "can get all plans" do
response = ::PPC::API::Baidu::Plan::all( auth )
is_success( response )
end
it "can get all plan id" do
... |
class ChunkFeedsController < ApplicationController
before_action :load_entities
def index
@chunk_feed
end
def show
@chunk = Chunk.new(chunk_feed: @chunk_feed)
@chunks = @chunk_feed.chunks.includes(:user)
respond_to do |format|
format.html
format.json { render json: @chunk_feed }
... |
require "spec_helper"
describe "UserSession" do
describe "/GET new" do
it "login page should have the right title" do
visit login_path
page.should have_selector("title", :content => "Recipes | Login")
end
end
end
|
require 'httparty'
class Radio
include HTTParty
HEADERS = { headers: { 'Content-Type' => 'application/json' }}
BASE_URI = "http://localhost/api/v1/"
EXPECTED_RESPONSE_CODES = [200, 201]
def initialize(type)
@type = type
@objects = []
end
def search(keywords)
response = HTTParty.get( BASE_U... |
module Omnimutant
class Results
def initialize()
reset()
end
def reset
@unexpected_passes = []
end
def log_pass(filepath:, line_number:, original_line:, mutated_line:)
@unexpected_passes << {filepath:filepath,
line_number:line_number,
... |
class ApprovalsController < ApplicationController
before_action :authorize_user, only: [:new, :edit, :create, :update, :destroy]
before_action :set_approval, only: [:edit, :update, :destroy]
before_action :set_deal, only: [:index, :new, :create, :edit, :update, :destroy]
before_action :approvers_collection, onl... |
require 'rails_helper'
RSpec.feature "Authentication", type: :feature do
scenario 'A signed up user can log in' do
User.create(username: 'charlie@gmail.com', password: 'password')
visit('/')
click_link('Login')
fill_in('Username', with: 'charlie@gmail.com')
fill_in('Password', with: 'passwo... |
class UsersController < ApplicationController
before_action :set_user, only: [:show, :edit, :update, :destroy]
before_action :isAdmin?, only: [:index, :edit, :destroy]
before_action :isThisMyRecord?, only:[:show]
# GET /users
# GET /users.json
def index
@users = User.all
end
# GET /users/1
# GET ... |
require File.expand_path(File.dirname(__FILE__)) + '/lib/Premailer/Premailer'
require "java"
#$CLASSPATH << 'target/classes';
java_import "com.msiops.premailer.PremailerInterface"
class PremailerContact
include PremailerInterface
def initialize
end
def init(html, options)
options.keys... |
class AddUseridToWallets < ActiveRecord::Migration[5.1]
def change
add_reference :wallets, :user, foriegn_key: true
end
end
|
#encoding: UTF-8
module LLT
module Constants
module Markers
class Verb
THEMATIC_I = "i"
THEMATIC_E = "e"
THEMATIC_U = "u"
PRAESENS_CONIUNCTIVUS_A = "e"
PRAESENS_CONIUNCTIVUS = "a"
PRAESENS_CONIUNCTIVUS_IRREGULAR = "i"
FUTURUM_A = "b"
FUTUR... |
class RemotePortal
attr_accessor :remote_endpoint, :domain, :remote_id
def initialize(params)
self.remote_endpoint = params[:returnUrl]
self.domain = params[:domain]
self.remote_id = params[:externalId]
end
def valid?
# TODO: require domain
return (self.remote_endp... |
class Day14Solver
class Recipe
attr_accessor :value, :next_recipe
def initialize(value, next_recipe: nil)
@value = value
@next_recipe = next_recipe || nil
end
end
class RecipeMaker
attr_reader :number_of_recipes
def initialize
@elf_1_recipe = @root_recipe = Recipe.new(3)
... |
# frozen_string_literal: true
require 'test_helper'
require 'gem_of_life/application'
module GemOfLife
class ApplicationTest < Minitest::Test
# rubocop:disable all
def test_blinker_in_5_by_5_square_grid
input = StringIO.new <<~EOS
1 3
2 2 3
5 5
0 0 0 0 0
0 0 0 0... |
class Barbecue < ActiveRecord::Base
validates :title, presence: true
validates :venue, presence: true
validates :date, presence: true
has_many :interims
has_many :users, through: :interims
has_many :items
end
|
$:.push File.expand_path("lib", __dir__)
# Maintain your gem's version:
require "sepomex/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |spec|
spec.name = "sepomex_client"
spec.version = SEPOMEX::VERSION
spec.date = '2019-12-10'
spec.description = "SEPOM... |
require File.join(File.dirname(__FILE__), 'spec_helper')
require 'nobbie/wx'
require 'nobbie/wx/command/reporter'
module Nobbie
module Wx
module Command
describe "Reporter" do
it "provides a reporter interface for use by executor" do
Reporter.method_defined?(:before_executing... |
module SupplyTeachers
class Journey::ManagedServiceProvider
include Steppable
attribute :managed_service_provider
validates :managed_service_provider, inclusion: ['master_vendor', 'neutral_vendor']
def next_step_class
case managed_service_provider
when 'master_vendor'
Journey::Ma... |
=begin
#qTest Manager API Version 8.6 - 9.1
#qTest Manager API Version 8.6 - 9.1
OpenAPI spec version: 8.6 - 9.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end
require "uri"
module SwaggerClient
class BuildApi
attr_accessor :api_client
def initialize(api_client =... |
cookbook_file '/app.rb'
control_group 'My awesome app' do
control 'deployment' do
it 'should be deployed' do
expect(file('/app.rb')).to contain('awesome')
end
end
end
|
class Booking < ApplicationRecord
attr_accessor :number_of_passengers
has_and_belongs_to_many :passengers
belongs_to :flight
validates :flight_id, presence: true
accepts_nested_attributes_for :passengers
end
|
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe HealthCareApplication, type: :model do
describe 'validations' do
it 'should validate presence of state' do
health_care_application = described_class.new(state: nil)
expect_attr_invalid(health_care_application, :state, "can't be blan... |
require './f5'
require 'optparse'
require 'pp'
require 'ostruct'
class Optparser
def self.parse(args)
options = OpenStruct.new
opts = OptionParser.new do |opts|
opts.banner = "Usage: f5_vs_add_profile.rb [options]"
opts.separator ""
opts.separator "Specific options:"
... |
class AutoTweetJob < ApplicationJob
queue_as :default
sidekiq_options retry: false
include ActiveSupport::Rescuable
rescue_from ActiveRecord::RecordNotFound, with: :tweet_failure
def perform(automated_tweet)
if automated_tweet.present?
automated_tweet.publish_to_twitter!
ActionCable.server.broadcast "aut... |
require 'rspec'
require 'questions_database'
$FILEPATH = "./db/questions_test.db"
#Database initialized by import_db.sql - look there for appropriate values
describe "User" do
system("rm ./db/questions_test.db")
system("cat ./lib/import_db.sql | sqlite3 db/questions_test.db")
it "makes a list of most popular q... |
def count_words(string)
## Worked with Luke Woodruff
## http://stackoverflow.com/questions/5128200/how-to-count-identical-string-elements-in-a-ruby-array
stripped = string.downcase
stripped = stripped.gsub(/[^a-zA-Z\ ]/, "")
words = stripped.split
counts = Hash.new(0)
words.each { |word| counts[wo... |
class ItemsController < ApplicationController
before_action :authenticate_user!, except: [:index, :show]
before_action :set_item, only: [ :edit, :update, :show, :destroy]
before_action :category_all, only: [:index, :show]
before_action :brand_category_header, only: [:index, :show, :search, :detail_search]
bef... |
require "pry"
class TallestBuildingsTracker::CLI
def call
TallestBuildingsTracker::AsciiSkyscraperImage.show_image
border
puts "Welcome to the Tallest Buildings Tracker!".colorize(:yellow)
border
get_buildings
list_buildings
end
def border
... |
module ApiAuthentications
class Email < Base
def authenticate
@account = Account.find_by_email(@account_params[:email])
if @account && @account.valid_password?(@account_params[:password])
@session = @account.sessions.build(@session_params)
@account.save
else
@errors << 'E... |
# frozen_string_literal: true
class UsersController < ApplicationController
before_action :authenticate_user!
before_action :set_base_url
def index
@title = 'ユーザー一覧'
@api = api_v1_users_path
@q = User.all.ransack(params[:q])
@searched_users = @q.result(distinct: true)
render 'show_group'
e... |
module Concerns::HelpCategory::Association
extend ActiveSupport::Concern
included do
acts_as_tree order: "number"
has_many :helps
end
end
|
module ApplicationHelper
def set_stars(rating)
result = ""
for i in 1..5
if i > rating
result << '<span class="star-icon">☆</span>'
else
result << '<span class="star-icon full">☆</span>'
end
end
return result.html_safe
end
def gravatar_url(user)
gravatar = Di... |
class AddOisRequestRefToLicences < ActiveRecord::Migration
def change
add_reference :licences, :ois_request, index: true
end
reversible do |dir|
dir.up do
'ALTER TABLE licences ADD FOREIGN KEY (ois_request_id) REFERENCES ois_requests(id)'
end
end
end
|
class IncreaseDescriptionLength < ActiveRecord::Migration[5.0]
def up
change_column :shelters, :description, :string, limit: 4096, null: false, default: ''
end
def down
change_column :shelters, :description, :string, limit: 191, null: false, default: ''
end
end
|
# encoding: UTF-8
module API
module V1
class MultimediaCacheable < API::V1::Base
helpers API::Helpers::V1::MultimediaHelpers
before do
authenticate_user
end
with_cacheable_endpoints :multimedia do
paginated_endpoint do
desc 'Get paginated multimedia'
... |
module Fog
module AWS
class EC2
class Real
# Modify snapshot attributes
#
# ==== Parameters
# * snapshot_id<~String> - Id of snapshot to modify
# * attribute<~String> - Attribute to modify, in ['createVolumePermission']
# * operation_type<~String> - Operation... |
class PlaceSerializer < ActiveModel::Serializer
attributes :id, :name, :address, :longitude, :latitude, :city, :state, :country
has_many :events
def city
object.city.name unless object.city.nil?
end
def state
object.city.state.name unless object.city.nil? || object.city.state.nil?
end
def count... |
class Food < ActiveRecord::Base
has_many(:orders)
has_many(:parties, :through => :orders)
validates :name, :price, presence: true
validates :name, uniqueness: true
def to_s
"#{food.name}"
end
end |
require "test/unit"
require "path-to/application"
module PathTo
class TestApplication < Test::Unit::TestCase
attr_reader :simple_app, :bigger_app
class Users < Path
def [](user)
super(:user => user)
end
end
class Articles < Path
def [](slug)
super(:slug => ... |
class Show
attr_accessor :board
def initialize(board)
@board = board
end
def status
puts "-" * 13
(1..3).each do |x|
print('|')
(1..3).each do |y|
unless board.get_case([x,y]).content
print(' ')
else
... |
describe "Datoki.db :varchar" do
before {
CACHE[:datoki_db_varchar] ||= reset_db <<-EOF
CREATE TABLE "datoki_test" (
id serial NOT NULL PRIMARY KEY,
title varchar(123) NOT NULL,
body text
);
EOF
@klass = Class.new {
include Datoki
table :datoki_test
... |
require 'spec_helper'
describe 'workstation::default' do
# Serverspec examples can be found at
# http://serverspec.org/resource_types.html
['nano', 'tree', 'git'].each do
describe package('tree') do
it { should be_installed }
end
end
describe file('/etc/motd') do
its(:content) { should... |
class AddOrderingToPages < ActiveRecord::Migration[5.1]
def change
add_column :pages, :order, :integer
add_index :pages, :order, unique: true
end
end
|
require 'dotenv'
class Config
class Environment
def self.load
Dotenv.load( ".env.#{current}" )
end
def self.development?
current == 'development'
end
def self.test?
current == 'test'
end
def self.production?
current == 'production'
end
def self.current
... |
module CamaleonCms
module CustomFieldsConcern
# ======================CUSTOM FIELDS=====================================
# render as html the custom fields marked for frontend
def render_fields
object.cama_fetch_cache('render_fields') do
h.controller.render_to_string(partial: 'partials/rende... |
class DashboardsController < ApplicationController
before_filter :authenticate_user!
def show
@club_nights = current_user.club_nights.all
end
end
|
# frozen_string_literal: false
require_relative '../game/game_input'
# Replaces human actions
class Bot
include GameInput
def initialize
@combinations = GameInput::VALID_COLORS.repeated_permutation(4).to_a
@assserts = []
end
def random_secret_colors
# ALTERNATIVE GameInput::VALID_COLORS.sample(4... |
# frozen_string_literal: true
require 'spec_helper'
require 'fat_core/string'
require 'fat_core/date'
describe String do
describe 'class methods' do
it 'generates a random string' do
ss = described_class.random(100)
expect(ss.class).to eq String
expect(ss.size).to eq 100
end
end
descr... |
class Station
attr_reader :trains, :name
def initialize(name)
@name = name
@trains=[]
end
def get_description
"\"#{@name}\", поездов на станции: #{@trains.size}"
end
def receive_train(train)
# Если использовать напрямую (минуя класс train), данные о том, где находится поезд, будут рассог... |
class EventsController < ApplicationController
def index
@events = Event.all
end
def new
@event = Event.new
end
def create
@event = Event.new(event_params)
start = params[:start_date]
start_date = Date.new start["event(1i)"].to_i, start["event(2i)"].to_i, start["event(3i)"].to_i
end_params = params... |
class Project < ActiveRecord::Base
has_many :tasks, dependent: :destroy
validates_presence_of :name
end
|
class AddImageableToDrivers < ActiveRecord::Migration[6.0]
def change
add_reference :drivers, :imageable, polymorphic: true
end
end
|
require 'spec_helper'
describe Document do
it "should be able to check whether attached eaf file conforms to schema" do
document = Document.new
document.eaf = File.open(File.join(Rails.root, 'spec', 'fixtures', "02_04.eaf"))
document.eaf_schema_errors.should be_empty
end
it "should not crash on sch... |
ActiveAdmin.register Order do
menu label: "Заказы", priority: 6, parent: "Аптеки", parent_priority: 4
permit_params :name, :email, :phone, :dop_info, :checked_out_at
config.per_page = 30
filter :created_at, label: 'Дата создания'
filter :checked_out_at, label: 'Дата ответа'
filter :name, label: 'Имя'
fil... |
json.timelogs do
json.partial! 'api/v1/timelogs/show', collection: @timelogs, as: :timelog
end
|
require 'spec_helper'
describe 'Team' do
subject { class_double(NRL::Team, all: mocked_response('ladder.json')) }
describe '#all' do
let(:teams) { subject.all }
it 'returns an array of teams' do
expect(teams).to be_a(Array)
teams.each { |team| expect(team).to be_a(NRL::Team) }
end
end
e... |
require 'spec_helper_acceptance'
describe 'jdk_8_rpm' do
# Serverspec examples can be found at
# http://serverspec.org/resource_types.html
it 'Should apply the manifest without error' do
pp = <<-EOS
if $::osfamily in ['RedHat'] {
class { 'fmw_jdk::install':
java_home_dir => '/usr/j... |
ThinkingSphinx::Index.define :fruit, :with => :real_time do
# fields
indexes name, :sortable => true
# attributes
has created_at, :type => :timestamp
has updated_at, :type => :timestamp
end |
class LoansController < ApplicationController
def index
@loans = Loan.all
respond_to do |format|
format.json { render json: { loans: @loans }, status: :ok }
format.html
end
end
def show
respond_to do |format|
begin
@loan = Loan.find(params[:id])
format.json { rend... |
class BranchesController < ApplicationController
before_action :check_password, :only => [:destroy]
layout :set_layout
def new
@branch = Branch.new
@leaf = Leaf.new
@branches = Branch.page(params[:page])
if request.headers['X-PJAX']
render :partial => 'cur_page'
end
end
def crea... |
require './my_enumerables.rb'
describe Enumerable do
let(:test_arr) { [1, 2, 3] }
let(:test_block) { proc { |i| i * 2 } }
let(:ant_bear_cat) { %w[ant bear cat] }
let(:len_block_three) { proc { |word| word.length >= 3 } }
let(:len_block_five) { proc { |word| word.length >= 5 } }
let(:test_range) { (1..4) }... |
class PortfolioCategory < ActiveRecord::Base
attr_accessible :name
has_many :portfolios
end
|
class ReviewComment < ActiveRecord::Base
belongs_to :title_review
belongs_to :user
def self.max_body_length
1000
end
validates_presence_of :user, :title_review, :body
validates_length_of :body, :in => 2..ReviewComment::max_body_length, :allow_blank => :true
end
|
require_relative 'piece.rb'
class SteppingPiece < Piece
attr_accessor :board, :color, :pos
MOVEKNIGHT = [
[-2, -1],
[-2, 1],
[-1, -2],
[-1, 2],
[1, -2],
[1, 2],
[2, -1],
[2, 1]
]
MOVEKING = [
[0, 1],
[1, 1],
[1, 0],
[-1, 1],
[-1, 0],
[-1, -1],
[1, -... |
namespace :db do
desc "Give birth to the system (without going into labor)."
task :rebirth => ["db:drop", "db:create", "db:migrate", "data:seed"]
end
|
# route contains stations fot trains stops
class Route
attr_reader :transitional_stations
def initialize(first_station, last_station)
@first_station = first_station
@last_station = last_station
@transitional_stations = []
end
def add_transitional_station(station)
@transitional_stations << sta... |
class FollowPlayer < ActiveRecord::Base
validates :player, presence: true
validates :follower, presence: true
validates :player, uniqueness: {scope: :follower}
belongs_to :players, :foreign_key => 'player', :primary_key => 'id'
belongs_to :players, :foreign_key => 'follower', :primary_key => 'id'
end
|
class AddDoc < ActiveRecord::Migration
def change
add_column :doctor_adds, :doctor_id, :integer
end
end
|
class AlbumsController < ApplicationController
before_action :authenticate_user!
def index
@albums = current_user.albums
end
def new
if current_user && current_user.user_type == "admin"
@album = Album.new
else
flash[:admin_violation] = "Unauthorized action."
redirect_to '/'
e... |
# 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 rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
require 'sinatra'
require './lib/song'
get '/' do
end
get '/lyrics' do
logger.info "Params: #{params}"
artist, title = params['artist'], params['title']
Song.new(artist, title).lyrics
end |
class ApplicationController < ActionController::Base
protect_from_forgery
layout "main"
helper_method :current_character # therefore it's available in the views as well
# i18n
before_filter :set_locale
def set_locale
# if params[:locale] is nil then I18n.default_locale will be used
I18n.locale =... |
# frozen_string_literal: true
require 'spec_helper'
require 'bolt/executor'
require 'bolt/inventory'
describe 'get_target' do
include PuppetlabsSpec::Fixtures
let(:executor) { Bolt::Executor.new }
let(:inventory) { Bolt::Inventory.empty }
let(:tasks_enabled) { true }
around(:each) do |example|
Puppet[:... |
# frozen_string_literal: true
require "spec_helper"
describe GraphQL::Query::VariableValidationError do
let(:ast) { Struct.new(:name, :line, :col).new('input', 1, 2) }
let(:type) { Struct.new(:to_type_signature).new('TestType') }
let(:error_value) { 'some value' }
let(:problems) { [{'path' => ['path-to-problem... |
#!/usr/bin/ruby
#
require 'rubygems'
require 'yaml'
require 'spreadsheet'
MONTHS = ['07', '08', '09', '10', '11', '12', '01', '02', '03', '04', '05', '06']
ZOFFSET = [[2, 3], [5, 3], [8, 3], [11, 3], [14, 3], [17, 3],
[2, 46], [5, 46], [8, 46], [11, 46], [14, 46], [17, 46]]
GOFFSET = [[2, 2], [2, 51]... |
class ChangeBoxesSkuType < ActiveRecord::Migration[5.2]
def change
change_column :boxes, :box_sku, :string
end
end
|
class WildCardStandings::Team
attr_accessor :name, :record, :gb
def adjusted_wins
array = self.record.split("-").map(&:to_f)
wins = array[0] + (array[2] / 2)
wins
end
def self.sort_by_wins
@teams = WildCardStandings::Scraper.scrape_yahoo
@teams.sort! { |a, b| b.adjusted_wins <=> a.adjusted... |
class AddCurrentPLayerTurnToGame < ActiveRecord::Migration
def change
add_column :games, :current_turn_player_id, :integer, index: true, null: true
end
end
|
def descending_order(n)
#converting the n into an array of numbers
arr = n.to_s.split('')
output = arr.sort!.reverse.join('')
return output.to_i
end
=begin
Your task is to make a function that can take any non-negative integer as a argument and return it with it's digits in descending order. Essentially, ... |
module PivotalPlanningPoker
class Project < TrackerEntity
tracker_attribute :project_name, './name'
tracker_attribute :project_id, './id'
tracker_attribute :point_scale,'./point_scale'
def point_scale_array
point_scale.split(',')
end
def self.find(project_id, token)
raise Argumen... |
# frozen_string_literal: true
RSpec.describe Sidekiq::LimitFetch::Queues do
let(:queues) { %w[queue1 queue2] }
let(:limits) { { 'queue1' => 3 } }
let(:strict) { true }
let(:blocking) { nil }
let(:process_limits) { { 'queue2' => 3 } }
let(:options) do
{ queues: queues,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.