text stringlengths 10 2.61M |
|---|
class KatasController < ApplicationController
before_action :set_kata, only: [:show, :edit, :update, :destroy]
# GET /katas
def index
@katas = Kata.page(params[:page])
end
# GET /katas/1
def show
end
# GET /katas/new
def new
@kata = Kata.new
@styles = Style.all
end
# GET /katas/1/... |
# frozen_string_literal: true
class Message
attr_reader :message_id, :listing_id, :sender_id, :recipient_id, :message, :timestamp
def initialize(message_id:, listing_id:, sender_id:, recipient_id:, message:, timestamp:)
@message_id = message_id
@listing_id = listing_id
@sender_id = sender_id
@reci... |
class OmniauthController < ApplicationController
skip_before_filter :authenticate
skip_before_filter :verify_subscription
skip_before_filter :accept_terms
skip_before_filter :complete_onboarding
def callback
@auth = request.env['omniauth.auth']
case @auth.provider
when 'facebook'
@uid = @a... |
require "mutant_school_api_model/resource"
module MutantSchoolAPIModel
class Term < MutantSchoolAPIModel::Resource
has_many :enrollments
attribute_names :begins_at, :ends_at
end
end
|
require "endpointer/version"
require "endpointer/resource_parser"
require "endpointer/app_creator"
require "endpointer/errors/invalid_arguments_error"
require 'endpointer/configuration'
module Endpointer
class << self
def run(config)
@configuration = config
app.run!
end
def app
Cacher.... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
# abort if vagrant-vbguest is not installed
if !Vagrant.has_plugin?("vagrant-vbguest")
abort "Please install the 'vagrant-vbguest' module"
end
# abort if vag... |
# encoding: utf-8
control "V-52197" do
title "The DBMS must protect audit tools from unauthorized modification."
desc "Protecting audit data also includes identifying and protecting the tools used to view and manipulate log data.
Depending upon the log format and application, system and application log tools may p... |
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
use Rack::Cors do
allow do
origins '*'
resource '*', headers: :any, methods: [:get, :post, :opt... |
FactoryGirl.define do
factory :user do
name "Adam Warlock"
email "adam@example.com"
password "marvel"
password_confirmation "marvel"
end
end |
class QuestionsController < ApplicationController
# GET /questions
# GET /questions.xml
def index
@questions = Question.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @questions }
end
end
# GET /questions/1
# GET /questions/1.xml
def show
... |
Rails.application.routes.draw do
devise_for :users
root controller: :jobs, action: :index
resources :jobs, only: :show
end
|
module CurrentUserConcern
extend ActiveSupport::Concern
included do
before_action :set_current_user
end
def set_current_user
@current_user = User.find_by(id: session[:user_id]) if session[:user_id]
end
def logged_in?
!current_user.nil?
end
end
|
class CreateTasks < ActiveRecord::Migration
def change
create_table :tasks do |t|
t.text :desciption
# Not mentioned here. we will also get a primary key called id.
t.timestamps null: false
end
end
end
|
require 'ostruct'
require 'httparty'
module Sc
module Campfire
class Campfire
include HTTParty
base_uri 'https://screenconcept.campfirenow.com'
headers 'Content-Type' => 'application/xml'
def self.rooms
Campfire.get('/rooms.xml')["rooms"]
end
def self.room(room... |
class Flight < ApplicationRecord
belongs_to :from_airport, class_name: "Airport", foreign_key: "from_id"
belongs_to :to_airport, class_name: "Airport", foreign_key: "to_id"
has_many :bookings
def formatted_date
date.strftime("%m/%d/%Y %H:%M%P")
end
end
|
require 'benchmark'
time = Benchmark.measure do
def collatz_sequence(num, length = 1) # the starting number is inclusive with the count
if (num == 1)
return length
else
length += 1
num.even? ? collatz_sequence(num / 2, length) : collatz_sequence(3 * num + 1, length)
end
end
longest... |
require 'test_helper'
class ReportsControllerTest < ActionController::TestCase
setup do
@report = reports(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:reports)
end
test "should get new" do
get :new
assert_response :success
end
... |
class PriceToString < ActiveRecord::Migration[5.0]
def change
change_column :bookings, :price, :string
end
end
|
Spree::CheckoutController.class_eval do
before_action :load_authorizenet_hosted_form, only: :edit
after_action :change_xframe_opts
private
def load_authorizenet_hosted_form
return unless @order.payment? && authorizenet_cim_enabled?
gateway = Spree::Gateway::AuthorizeNetCim.first
session[:authori... |
require 'spec_helper'
describe ServerTypesController do
render_views
let(:user) { User.make! }
before(:each) do
sign_in user
@cloud = Cloud.make!(:cloud_provider => CloudProvider.make!)
@server_type = ServerType.make!
@server_types = [@server_type]
end
it "should render index with server t... |
require 'rails_helper'
describe 'Visitor visit homepage, filters by property location' do
it 'and filters by nothing(show all properties normally)' do
#arrange
pousada = PropertyType.create!(name: 'pousada')
rio = PropertyLocation.create!(name: 'rio')
minas = PropertyLocation.create!(name... |
Cleaner::Application.routes.draw do
root to: "users#show"
match "/create", to: "users#create"
match "/", to: "users#show"
end
|
require_dependency "db_admin/api/base_controller"
module DbAdmin
class Api::SchemasController < Api::BaseController
include ActionController::MimeResponds
before_action :setup_db, only: [:index]
def index
schemas = @database.schemas
respond_to do |format|
format.json { render json: s... |
# coding: ASCII-8BIT
require 'tb'
require 'tmpdir'
require 'test/unit'
class TestTbPNM < Test::Unit::TestCase
def parse_pnm(pnm)
Tb::PNMReader.new(StringIO.new(pnm)).to_a
end
def generate_pnm(ary)
writer = Tb::PNMWriter.new(out = '')
ary.each {|h| writer.put_hash h }
writer.finish
out
end... |
class UserSerializer < ActiveModel::Serializer
attributes :id,
:first_name,
:last_name,
:email,
:phone,
:photo_url
attribute :role
def role
RoleSerializer.new object.role
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... |
# frozen_string_literal: true
# rubocop:todo all
require 'spec_helper'
# The only allowed read preference in transaction is primary.
# Because of this, the tests assert that the final read preference is primary.
# It would be preferable to assert that some other read preference is selected,
# but this would only work... |
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
#
# 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
#
# Unless requir... |
require 'csv'
class Clock < ActiveRecord::Base
validates :number, uniqueness: {scope: :time}
def self.import_csv(file)
csv_file = CSV.read(file.path, headers: true, encoding: "GB18030:UTF-8")
csv_file.each do |row|
create(
department: row["部门"],
name: row["姓名"],
number: row["考勤... |
require 'spec_helper'
describe Util::SchemaNaming do
before do
@class = Class.new
@class.send(:include, Util::SchemaNaming)
@schema = @class.new
@schema.stub(:config).and_return({})
def type_for(namespace)
@schema.stub(:namespace).and_return(namespace)
@schema.type
end
def... |
require 'terminal-table'
class Board
attr_reader :current_player, :squares
PLAYER_1 = 'x'
PLAYER_2 = 'o'
WIN_STATES = [
# horizontal
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
# vertical
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
# diagonal
[0, 4, 8],
[6, 4, 2]... |
class Player
attr_reader :name, :value
def initialize
@name = gets.chomp.to_s
@array_boardcases = [0..9]
end
count_turn = "1".to_i
def play_turn
# Checking which player's turn it is
if count_turn.odd? == true
# Asking for the player what he wants to play
puts "Que so... |
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :calendar_user do
access_role "freeBusyReader"
hidden true
end
factory :calendar_user_changed, class: CalendarUser do
color_id "12"
background_color "#fad165"
foreground_color "#000000"
s... |
# -*- encoding: utf-8 -*-
module SendGrid4r::REST
#
# SendGrid Web API v3 IpAccessManagement
#
module IpAccessManagement
include Request
IpActivities = Struct.new(:result)
IpActivity = Struct.new(
:allowed, :auth_method, :first_at, :ip, :last_at, :location
)
WhitelistedIps = Struct... |
require_relative 'board'
require_relative 'player'
class MineSweeper
def initialize(player)
@player = player
@board = Board.new
run
end
def run
system('clear')
puts "Welcome to MineSweeper game!"
until @board.won?|| @board.over?
system('clear')
@board.render
play_turn... |
class CreateOffersMades < ActiveRecord::Migration
def change
create_table :offers_mades do |t|
t.string :orgId
t.string :userId
t.string :offerId
t.string :status
t.timestamps
end
end
end
|
execute 'apt_update' do
command 'apt-get update'
end
package 'git'
execute 'git_name' do
command 'git config --global user.name "Jagrajan Bhullar"'
end
execute 'git_email' do
command 'git config --global user.email jag@jagrajan.com'
end
package 'vim'
directory "/home/vagrant/.vim" do
owner "vagrant"
group "... |
class AddStartDateAndLengthToCourse < ActiveRecord::Migration
def change
add_column :courses, :start_date, :date
add_column :courses, :length, :integer
end
end
|
class EventDecorator < Draper::Base
decorates :event
def other_invitees_count
invitees.count - 1
end
def invitees_with_current_user_first
invitees.unshift(current_user).uniq
end
def other_invitees_who_have_not_voted_count
invitees_who_have_not_voted.reject { |i| i == current_user }.length
e... |
namespace :db do
desc "Fill database with sample data"
task :populate => :environment do
require 'faker'
Rake::Task["db:migrate:reset"].invoke
Country.destroy_all
State.destroy_all
City.destroy_all
Admin.destroy_all
User.destroy_all
Tag.destroy_all
Product.destroy_all
Announ... |
require "vending_machine/drink.1"
class VendingMachine
AVAILABLE_MONEY = [10, 50, 100, 500, 1000].freeze # 利用可能なお金の配列を作成(.freezeで値が変動しないようにしている)
attr_reader :total, :sale_amount # インスタンス変数に読み出す
def initialize # newメゾットで作成したインスタンスに代入
@total = 0
@sale_amount = 0
@drink_table = {}
5.times { ... |
class Availability < ActiveRecord::Base
scope :future, -> { where("end_at >= ?", Time.zone.now) }
scope :sort_by_priority, -> { order(priority: :asc) }
belongs_to :coach, class_name: :User
# Validate associations
validates :coach, presence: true
# Validate attributes
validates :start_at,
:e... |
##
#This class is generated by gem ActiveAdmin for creating Admin users
# the class has the following changes:
# 1- adding <tt> render 'admin/order'</tt>
ActiveAdmin.register Order do
show do
render 'admin/order'
end
end
|
require 'rails_helper'
feature 'User Accounts' do
scenario 'A User can sign up for an account' do
visit '/signup'
fill_in 'register_user_email', with: 'tester@test.com'
fill_in 'register_user_password', with: 'testpassword'
fill_in 'register_user_password_confirmation', with: 'testpassword'
clic... |
require "application_system_test_case"
class MeasurementsTest < ApplicationSystemTestCase
setup do
@measurement = measurements(:one)
end
test "visiting the index" do
visit measurements_url
assert_selector "h1", text: "Measurements"
end
test "creating a Measurement" do
visit measurements_url... |
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
acts_as_token_authenticatable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
validates :username,... |
Given /^(user "[^\"]*") is subscribed to the topic in (the forum of "[^\"]*")$/ do |user, forum|
user.user_topics.create! :topic => forum.topics.first
end
Given /^the (user "[^\"]*") is subscribed to the topics:$/ do |user, table|
table.hashes.each do |hash|
user.user_topics.create! :topic => Topic.find_by_tit... |
class Resource < ApplicationRecord
belongs_to :user
belongs_to :language
belongs_to :subfield
validates :website, presence: { message: 'cannot be blank.' }
validates :title, presence: { message: 'cannot be blank.' }
validates :url, presence: { message: 'cannot be blank.' }
validates :language_id, presenc... |
#!/usr/bin/env ruby
oplop_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(oplop_dir) unless $LOAD_PATH.include?(oplop_dir)
require 'oplop'
require 'oplop/cli'
require 'highline/import'
require 'optparse'
# -- exit nicely if control-c
Signal.trap("SIGINT") { exit 2 }
# -- opt... |
def my_each(array)
i = 0
while i < array.length # starts iteration
yield(array[i]) # execute block of code on array element with index i
i += 1 # move to next iterable
end
array # #each returns original array
end
|
class PrintWorker
include Sidekiq::Worker
sidekiq_options unique: true, :backtrace => true
def perform
p "I AM WORKING AT #{Time.now}"
sleep 120
end
end
|
require "spec_helper"
RSpec.describe ProgImage::Client do
let(:default_pool_size) { 3 }
let(:default_timeout) { 5 }
describe '.new' do
it 'sets up a connection pool with default values' do
expect(ConnectionPool).to receive(:new).with(size: default_pool_size, timeout: default_timeout)
described... |
FactoryBot.define do
factory :profil do
voice { "MyString" }
fullName { "" }
end
end
|
# frozen_string_literal: true
class DownloadsController < ApplicationController
include CurationConcerns::DownloadBehavior
# Overrides Hydra::Controller::DownloadBehavior due to an issue with self-signed certificates, see issue #113
# Uses Rails' ActionController::DataSteaming
def send_file_contents
self.s... |
# frozen_string_literal: true
require 'test_helper'
class UDPBackendTest < Minitest::Test
def setup
StatsD.legacy_singleton_client.stubs(:backend).returns(@backend = StatsD::Instrument::Backends::UDPBackend.new)
@backend.stubs(:rand).returns(0.0)
UDPSocket.stubs(:new).returns(@socket = mock('socket'))
... |
class Admin::UsersController < Admin::BaseController
before_action :_set_user, except: %i[index new create search]
def index
@datatable = UsersDatatable.new view_context
end
def search
render json: UsersDatatable.new(view_context)
end
def show; end
def new
@user = User.new
render parti... |
# frozen_string_literal: true
module ThreeScale
class MessageBusConfig
def initialize(message_bus_config = {})
@config = message_bus_config.dup
@enabled = config.delete(:enabled)
return unless using_redis?
redis_config = RedisConfig.new(config.delete(:redis))
@redis_config = setu... |
class UsersController < ApplicationController
def new
@user = User.new
end
def welcome
render './welcome'
end
def show
end
def signin(error = nil)
@error = error
end
def login
@user = User.find_by(username: params[:user][:username])
if ... |
get '/profile/comments' do
@comments = User.find(session[:userid]).comments
erb :profile_comments
end
|
require 'yaml'
module Contributor
class Configuration < Hash
def load_configuration!
yaml = YAML.load_file(yaml_file)
self.authors = yaml['authors'].map { |key, values| Author.new(key, values) }
self.terms = yaml['terms']
end
def method_missing(action, *args)
if /^(?<method>.*)=$... |
json.(@transactions) do |transaction|
json.(transaction, :id, :invoice_id, :result, :credit_card_number)
end
|
# frozen_string_literal: true
feature 'edit' do
scenario 'allows user to edit existing listing' do
visit '/'
click_on 'Sign up'
fill_in('first_name', with: 'Theodore')
fill_in('last_name', with: 'Humpernickle')
fill_in('username', with: 'ttotheh')
fill_in('email', with: 'theodore@humpernickle... |
require 'spec_helper'
describe Admin::Resource do
before {
@resource = Admin::Resource.new(res_seq: 1,
res_id: "TEST_RESOURCE",
res_desc: "RESOURCE FOR TESTING",
res_controller: "home",
... |
class OngSerializer < ActiveModel::Serializer
attributes :id, :name
has_many :initiatives
link(:self) { ong_url(object) }
class InitiativeSerializer < ActiveModel::Serializer
attributes :title
link(:self) { ong_initiative_url(object.ong_id, object) }
end
end
|
class Match < ApplicationRecord
has_many :bookings
validates_presence_of(:date, :home_team, :away_team)
include PgSearch
pg_search_scope :search_by_home_team_and_away_team,
against: [ :home_team, :away_team ],
using: {
tsearch: {prefix: true}
}
end
|
require 'rspec'
require './lib/messages'
require './lib/code'
RSpec.describe do
it 'exists' do
message = Message.new
expect(message).to be_an_instance_of(Message)
end
it 'has an intro' do
message = Message.new
expect(message.game_intro).to eq("Would you like to... |
class FizzBuzz
def initialize(end_number)
@end_number = end_number
@values = []
@string = ""
end
def run
for i in 1..@end_number
if (i % 3 == 0) && (i % 5 == 0)
@values << "FizzBuzz"
elsif (i % 3 == 0)
@values << "Fizz"
elsif (i % 5 == 0)
@values << "Buzz... |
column :before => 3, :width => 6 do
panel t('panels.reset_password'), :display_errors => :user do
block do
form_for @user, :url => password_reset_path(@user) do |user|
fieldset t('users.password_reset') do
user.hidden_field :perishable_token
user.password_field :password
... |
require 'rails_helper'
RSpec.describe Announcement, type: :model do
let(:announcement) { FactoryGirl.build(:announcement) }
it 'is valid with a valid title and post' do
expect(announcement).to be_valid
end
it 'is not valid when missing a title' do
announcement.title = nil
expect(announcement).to_... |
class AddBarcodeToSpreeVarients < ActiveRecord::Migration
def change
add_column :spree_variants, :barcode, :bigint
end
end
|
class AddCurrentDateToLaserGem < ActiveRecord::Migration[5.0]
def change
add_column :gem_specs, :current_version_creation, :date
add_column :ownerships, :github_id, :integer
remove_column :ownerships, :rubygem_owner, :boolean
remove_column :ownerships, :github_owner, :boolean
remove_column ... |
# @param {Integer[][]} intervals
# @return {Integer[]}
def find_right_interval(intervals)
starts = intervals.map.with_index { |interval, i| [interval.first, i] }.sort
intervals.map { |interval| (starts.bsearch { |s, i| s >= interval.last } || [-1])[-1] }
end
|
require 'rails_helper'
RSpec.describe ShortVisit do
before(:each) do
@user = User.create({name: 'test', email: 'email@email.com', new_password: 'new_password'})
@short_url = @user.short_urls.create({original_url: 'http://www.google.com'})
end
it "can create a new short visit" do
short_visit = @short_... |
# write a method called fizzbuzz that takes an array of integers as input and returns the same array, but with the following modifications:
# 1. If the integer is divisible by 3, it replaces the integer with the string "fizz"
# 2. If the integer is divisible by 5, it replaces the integer with the string "buzz"
# 3. ... |
class AddSurveyIdToBookings < ActiveRecord::Migration
def change
add_column :bookings, :survey_id, :integer
add_index :bookings, :survey_id
end
end
|
class QuestionsController < ApplicationController
before_action :require_login, only: [:create, :destroy, :edit, :update]
def index
@questions = Question.all
end
def show
@question = Question.find(params[:id])
@answer = Answer.new
@comment = Comment.new
@vote = Vote.new
end
def new
... |
namespace :check do
namespace :migrate do
# bundle exec rake check:migrate:remove_es_fields['recent_activity,recent_added']
desc "remove recent_activity and recent_added elasticsearch fields from media doc"
task remove_es_recent_fields: :environment do
# Read the last project media id we need to pr... |
# frozen_string_literal: true
class Blob
attr_accessor :alive, :age, :speed
def initialize(mutation_chance, speed)
@age = 0
@alive = true
@mutation_chance = mutation_chance
@speed = speed
# double speed means same distance, half time, but twice energy
end
def die
@alive = false
end
... |
require 'rubyXL'
module RailsPowergrid::GridConcern
alias __index_old index
def index
if params[:format] == "xlsx"
no_pagination
index_excel
else
__index_old
end
end
protected
def index_excel
prepare_collection_query
workbook = RubyXL::Workbook.new
sheet = workbook[0... |
module ApplicationHelper
# Sets the page title and outputs title if container is passed in.
# eg. <%= title('Hello World', :h2) %> will return the following:
# <h2>Hello World</h2> as well as setting the page title.
def title(str, container = nil)
@page_title = str
content_tag(container, str) if cont... |
require_relative 'train'
class CargoTrain < Train
def initialize(company_name, number)
@type = :cargo_train
super
end
def add_wagon(company_name = 'РЖД')
if speed.zero?
wagon = CargoWagon.new(company_name)
self.wagon << wagon
else
puts 'Поезд всё еще в движении, не возможно доб... |
module CartoDBUtils
module Metrics
class SQLAPI
SQLAPI_PATH = "/api/v1/sql"
EVENT_AGGREGATION_TEMPLATE = <<-EOS
WITH upsert AS (
UPDATE events
SET value=##VALUE##
WHERE timestamp='##TIMESTAMP##'
AND tags='##TAGS##'
RETURNING *
)
I... |
# frozen_string_literal: true
class Background
include Mongoid::Document
include Mongoid::Timestamps
field :url, type: String
embedded_in :backgrounded, polymorphic: true
has_mongoid_attached_file :image
end
|
require 'spec_helper'
describe Morpheus::ActsAsRestful do
let(:person_class) do
Class.new(Morpheus::Node) do
end
end
subject { person_class.new }
its(:rest) { should == {} }
it "should update rest info" do
subject.update_rest!( {'whatever' => {'that' => 123}} )
subject.rest["whatever"]["th... |
# frozen_string_literal: true
# typed: ignore
require_relative '../lib/common'
require 'hashie'
namespace :data do
desc 'Update files from MESU'
task :mobile_assets do
data_file = DataFile.new 'mobile_assets'
ipsw_data_file = DataFile.new 'ipsw'
data_file.data['mobile_assets'] ||= []
new_entries... |
module Comercio
module ExtendedWarranty
class ExtendedWarranty < SitePrism::Page
def refuse_warranty
if is_visible_el 'extended_warranty.refuse'
click_el 'extended_warranty.refuse'
end
end
def close_warranty_page
if is_visible_el 'extended_warranty.refuse'
... |
require 'yaml'
desc 'Perform some linting tasks on all of the data here'
task :lint do
talks_path = File.expand_path('../talks.yml', __dir__)
talks = YAML::load_file(talks_path)
abort 'ERROR: talks.yml: talks must be an array!' unless talks.is_a?(Array)
talks.each do |t|
print '.'
abort "ERROR: talk ... |
# encoding: utf-8
class RenameColumnUsersEntryFlgToRetireFlg < ActiveRecord::Migration
def up
rename_column :users, :entry_flg, :retire_flg
change_column :users, :retire_flg, :boolean, default: false
end
def down
rename_column :users, :retire_flg, :entry_flg
change_column :users, :entry_flg, :bo... |
module Calculators::CalculatorFactory
TYPES = {
1 => CharacterBasedCalculator,
2 => JsonBasedCalculator,
3 => NodesBasedCalculator
}
private_constant :TYPES
def self.for(panel_provider)
TYPES[panel_provider.id].new
end
end |
class Account < ActiveRecord::Base
belongs_to :user
has_one :group
has_many :subjects
has_many :groups, :through => :subjects
attr_accessible :name, :user_id, :group_id
validates :name, :presence => true,
:uniqueness => { :case_sensitive => false }
validates... |
Given /^Navigate to Organization Page$/ do
visit root_path
end
When /^I click on Organization Menu and click on View all Organization sub menu$/ do
within("#org") do
click_link 'orga'
end
within("#vieworg") do
click_link 'orgview'
end
end
Then /^I should see All Organization Details$/ do
page.should have_c... |
class SlideEffect < Draco::System
filter Visible, Position, Duration, Slide
def tick(args)
entities.each do |entity|
entity.components.delete(entity.components[:centered]) if entity.components[:centered]
next unless entity.components[:duration]
elapsed_time = entity.duration.start.elapsed_t... |
class AddColumnsToClubs < ActiveRecord::Migration[6.0]
def change
add_column :clubs, :nickname, :string
add_column :clubs, :home_venue, :string
add_column :clubs, :state, :string
add_column :clubs, :establish, :integer
add_column :clubs, :club_url, :string
add_column :clubs, :members, :bigint
... |
require_relative '../spec_helper'
module RubyEventStore
describe Facade do
let(:repository) { InMemoryRepository.new }
let(:facade) { RubyEventStore::Facade.new(repository) }
let(:stream_name) { 'stream_name' }
before(:each) do
repository.reset!
end
specify 'raise exception if ... |
class Route
include InstanceCounter
attr_reader :name
attr_accessor :stations
REGEXP = /[a-z]/i
def initialize(from, to, name)
@stations = [from, to]
@name = name
validate!
register_instance
end
def add_midway(name)
raise "Такая станция уже есть в маршруте!" if @stations.... |
class User < ApplicationRecord
has_secure_password
validates :username, presence: true, uniqueness: true
validates :email, presence: true, uniqueness: true
validates :password_confirmation, presence: true, on: :create
has_many :props
mount_uploader :image, ImageUploader
geocoded_by :address
after_val... |
class AddTypeToOrders < ActiveRecord::Migration
def change
add_column :orders, :type, :string, null:false, default: 'Order::Cart'
end
end
|
# encoding: UTF-8
require 'nokogiri'
require 'open-uri'
require 'sax-machine'
module XmlFeedParser
# Class for information associated with content parts in a feed.
# Ex: <content type="text">sample</content>
# instance.type will be "text", instance.text will be "sample"
class FeedContent
include SAXM... |
module BlameGun
module Statistics
class ArrayComposite
attr_reader :inner_statistics
def initialize(inner_statistics)
@inner_statistics = inner_statistics.freeze
end
def collect(*arguments)
inner_statistics.each do |inner|
inner.collect(*arguments)
end
... |
FactoryBot.define do
factory :clinician do
first_name "David"
last_name "Liang"
practice_name "The Center for Marfan Syndrome and Related Aortic Disorders at Stanford University Hospital"
address_line_1 "300 Pasteur Drive"
address_line_2 "3rd Floor, Room A31"
city "Stanford"
state "CA"
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.