text
stringlengths
10
2.61M
class Users::VerifiesController < ApplicationController skip_before_action :redirect_if_unverified before_action :redirect_if_verified # GET /users/verify def show SendPinJob.perform_now(current_user) if !current_user.pin_sent_at? @user = User.new end # POST /users/verify def create @user = ...
require File.join(Dir.pwd, 'spec', 'spec_helper') describe 'UserAddressList' do before do simulate_connection_to_server end after do end it 'should pass if user address list attribute is not specifed' do user_id = 123 request_data = FactoryGirl.attributes_for(:user_address_list, { :tot...
class IncomesController < ApplicationController def index @incomes = Income.where(user_id: current_user.id) end def view end def new @income = Income.new end def create @income = Income.new(income_params) @income.user_id = current_user.id if @income.save redirect_to incomes_path, notice: "Incom...
require 'spec_helper' describe Ecm::Tournaments::Participant do context 'associations' do it { should belong_to :ecm_tournaments_tournament } it { should belong_to :participable } it { should have_many :ecm_tournaments_team_memberships } end context 'validations' do it { should validate_presence...
# coding: utf-8 lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'fastlane/plugin/ios_flavors/version' Gem::Specification.new do |spec| spec.name = 'fastlane-plugin-ios_flavors' spec.version = Fastlane::IosFlavors::VERSION spec.author ...
require "rails_helper" RSpec.describe RequestUserStatistic, type: :model do before do @tenant = "bfcoder" FactoryBot.create( :request_user_statistic, truncated_time: Time.zone.now, tenant: @tenant, user_id: 6, ) FactoryBot.create( :request_user_statistic, truncated...
# A Participant is anyone who is participanting in a study # Please keep in mind that a participant is tied to a group, thus # Every participant is inherently part of at least one group require "strong_password" class Participant < ActiveRecord::Base # Include default devise modules. Others available are: # :confir...
# frozen_string_literal: true require 'test_helper' require 'json' class UsersControllerDestroyTest < ActionController::TestCase tests UsersController test 'should check user token on destroy' do @request.headers['Content-Type'] = JSON_MIME_TYPE @request.headers[API_KEY_HEADER] = GUEST_API_KEY delete...
# Оцениватель отчетов class ReportAssesser attr_reader :error def initialize(current_user) @user = current_user end def assess(report, attributes) if @user == report.expert || @user.may?(:manage, :reports) report.assign_attributes(attributes, as: :admin) report.assess! else r...
class Task < ActiveRecord::Base attr_accessible :active, :name, :points has_many :chores validates_presence_of :name validates_numericality_of :points, :only_integer => true, :greater_than_or_equal_to => 0 scope :active, where('active = ?', true) scope :alphabetical, order('name') end
Gem::Specification.new do |spec| spec.name = "kiss" spec.authors = "Franzi WL" spec.version = '1.0.0' spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) } spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(...
# ============================================================================= # # MODULE : lib/dispatch_queue_rb/internal/heap.rb # PROJECT : DispatchQueue # DESCRIPTION : # # Copyright (c) 2016, Marc-Antoine Argenton. All rights reserved. # ==================================================================...
class Fixevents < ActiveRecord::Migration def self.up drop_table :events create_table :events do |t| t.string :name t.text :description t.string :country t.string :city t.string :state t.date :date t.string :event_code t.date :created_at #t.integer :account_id t.timestamps end end def self...
# Helper Method def position_taken?(board, index) !(board[index].nil? || board[index] == " ") end # Define your WIN_COMBINATIONS constant WIN_COMBINATIONS = [ [0,1,2], #1 [3,4,5], #2 [6,7,8], #3 [0,3,6], #4 [1,4,7], #5 [2,5,8], #6 [0,4,8], #7 [2,4,6] #8 possible win scenarios ] def won?(board) # b...
require 'digest/sha1' module Hashie def hash instance_values.reduce(1) do |result, (_var, val)| 31 * result + (val.nil? ? 0 : digest(val)) end end def ==(other) instance_values.reduce(true) do |result, (var, val)| break false unless result && other.respond_to?(var) val == other.__s...
# encoding: UTF-8 class Film class Brin # Méthode pour parser def parse bloc arr = bloc.split(RC) @id = arr.shift.to_i @id > 0 || raise(BadBlocData, "Impossible de parser le brin défini par #{bloc.inspect} : il manque l'identifiant numérique.") @libelle = arr.shift.nil_if_empty @li...
require 'bigdecimal/math' require 'yaml' module Utils class GenericUtils START_ROW = 3 def self.get_sheet(filename, sheet_number = 1, library = 'SimpleXlsxReader') sheet = nil if library == 'SimpleXlsxReader' doc = SimpleXlsxReader.open(filename) ...
require 'spec_helper' describe "MongoDoc::Document" do class UpdateAttributesChild include MongoDoc::Document attr_accessor :child_data attr_accessor :child_int, :type => Integer end class UpdateAttributes include MongoDoc::Document attr_accessor :data attr_accessor :int, :type => Int...
$:.unshift(File.expand_path('../../lib', __FILE__)) require "bundler/setup" require 'sinatra/base' require 'sinatra/static_assets' require 'dotenv' Dotenv.load require 'queryparams' require 'rest-client' require 'json' require 'sass' require 'boxr' require "better_errors" require 'sass/plugin/rack' require 'sinatra/f...
require_relative 'atm_formatter/helpers/base_formatter' class ATMCreateTestFormatter < ATMFormatter::BaseFormatter RSpec::Core::Formatters.register self, *NOTIFICATIONS def example_started(notification) if (notification.example.metadata.key?(:test_id) && !notification.example.metadata[:test_id].strip.empty?) ...
FactoryGirl.define do factory :bill do amount 1 sequence :id do |n| "#{n}" end description "Winkel" end end
require 'test_helper' class RsvpTest < ActiveSupport::TestCase context "can find" do before do @event = Event.create!( :name => 'intresting event', :starts => Date.today + 10 ) @u1 = User.create!( :email => 'user1@example.com', :password => '12345678') @u2 = User.create!( :email => 'user2@exa...
class LinesAuthorable < ActiveRecord::Base belongs_to :lines_article, foreign_key: :article_id belongs_to :lines_author, foreign_key: :author_id end
require 'spec_helper' describe Puppet::Type.type(:ilb_rule) do # Modify params inline to tests to change the resource # before it is generated let(:params) do { :name => "rule1", :ensure => :present, :vip => '10.10.10.1', :protocol => 'tcp', :port => '80', :persistent => ...
module Finance module RiskToleranceQuestionnaire extend self def process(answers) validated_answers = check_supplied_answers(answers) stock_ratio_low, stock_ratio_high = calculate_optimal_bucket(validated_answers) pratt_arrow_high = calculate_pratt_arrow_risk_aversion(STUDY_FULLSTOCK_RET...
# --- Day 14: Reindeer Olympics --- # # This year is the Reindeer Olympics! Reindeer can fly at high speeds, but must # rest occasionally to recover their energy. Santa would like to know which # of his reindeer is fastest, and so he has them race. # # Reindeer can only either be flying (always at their top speed) or r...
require 'test_helper' class NewTest < ViewCase setup :visit_adminpanel_new_product_path teardown :teardown def test_shared_new_page_messages assert_button(I18n.t('action.add', resource: Adminpanel::Product.display_name)) end def test_submitting_with_invalid_information sleep 0.2 click_button('...
require 'inverted_index/base_index' ## InvertedIndex::ArrayIndex Class # # Aim: convert array value to inverted index # # Design: use each value of element attr array as hash key in the inverted_hash # and element_ids as as the array value # module InvertedIndex class ArrayIndex < BaseIndex def self....
class Ripple::BlockController < NetworkController layout 'tabs' before_action :set_height before_action :breadcrumb private def set_height @height = params[:block] end def breadcrumb return if action_name == 'show' end end
module Users module NameChangeHandlingService include BaseService def call(name_change, user, approve) name_change.transaction do name_change.approve(user, approve) || rollback! notify_user(name_change, name_change.user) end end private def notify_user(name_change, ...
class ChangenumerContract < ActiveRecord::Migration def change change_column :worker_contracts, :numberofcontract, :string end end
class ApplicationController < ActionController::Base protect_from_forgery before_filter :configure_permitted_parameters, if: :devise_controller? rescue_from CanCan::AccessDenied do |exception| redirect_to root_url, alert: exception.message end def page_subtitle result = I18n.t :"controller_titles.#...
class ReportDesignerWorker include Sidekiq::Worker sidekiq_options queue: 'smooch_priority', retry: 3 sidekiq_retry_in { |_count, _e| retry_in_callback } sidekiq_retries_exhausted { |msg, e| retries_exhausted_callback(msg, e) } def self.retry_in_callback 1 end def self.retries_exhausted_callback(ms...
#trida pro pristup do Flexibee, casti "adresar" class FbAdresa < FbConnect #budeme pristupovat do evidence "adresar" self.element_name = "adresar" self.url_params = "?mode=ruby" #najit jednoho #FbStudent.find "(jmeno begins 'I')", :params => { :mode => 'ruby' } #vylistovat vsechny: #FbStudent.fin...
# 2520 is the smallest number that can be divided by each of the numbers from # 1 to 10 without any remainder. # # What is the smallest positive number that is evenly divisible by all of the # numbers from 1 to 20? def lcm(*args) reduce_factors(args) until args.length == 1 a = args.pop b = args.pop ...
class Indocker::Volumes::External attr_reader :name, :path def initialize(name, path) @name = name @path = path end end
require 'rake' require 'rake/gempackagetask' task :default => [:run] task :run do `shoes #{File.join(File.dirname(__FILE__),"picmov_shoes.rb")}` end # Generate GEM ---------------------------------------------------------------------------- PKG_FILES = FileList[ 'R[a-zA-Z]*', 'bin/**/*', 'lib/**/*' ] - [ '...
class AddIndexOnDetailsUrlToProperty < ActiveRecord::Migration def change add_index :properties, :detailsUrl, :unique => true end end
class ApplicationController < ActionController::Base protect_from_forgery with: :exception before_action :authenticate_gameplan_user! def authenticate_gameplan_user! if params[:user] && params[:user][:email] if User.find_by_email( params[:user][:email].downcase) authenticate_user! else ...
require 'spec_helper' describe ArtistsController do describe 'collection' do describe 'GET #index' do it 'saves all artists as instance variable' do artist = create(:artist) artist2 = create(:artist2) get :index assigns(:artists).should eq [artist, artist2] end ...
class Slide < ActiveRecord::Base has_one :image, :as => :viewable, :class_name => Spree::Image, :dependent => :destroy accepts_nested_attributes_for :image, :allow_destroy => true attr_accessible :slide_order, :image validates :image, :presence => true end
require 'test_helper' feature 'Edit an article' do # visitors scenario 'visitors cannot access button to edit an article' do # Given that I am a visitor # When I go to the list of articles visit articles_path # Then I won't have access to Edit any articles page.wont_have_link 'Edit' end s...
#!/usr/bin/env ruby -w lib = File.expand_path('../lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'sn76489' require 'ffi' module SDL2 extend FFI::Library ffi_lib 'SDL2' INIT_AUDIO = 0x00000010 AUDIO_S8 = 0x8008 # signed 8-bit samples AUDIO_S16LSB = 0x8010 # signed 16-bit sa...
class Rule < ApplicationRecord belongs_to :game has_many :coefficient_time_ranges, dependent: :destroy has_many :coefficient_tables, through: :coefficient_time_ranges # Выгрузка coefficient tables только для конкретной коллекции rules def self.coefficient_tables CoefficientTable.joins(:rules).where(rules...
# 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...
# encoding: utf-8 require 'spec_helper' describe TTY::Text, '#wrap' do let(:text) { 'ラドクリフ、マラソン五輪代表に1万m出場にも含み' } let(:length) { 8 } let(:indent) { 4 } subject { described_class.wrap(text, :length => length, :indent => indent) } it { is_expected.to eq(" ラドクリフ、マラ\n ソン五輪代表に1\n 万m出場にも含み") } end # wra...
class CreateBasicTables < ActiveRecord::Migration def change create_table :users do |t| t.string :username, null: false t.string :firstname, null:false t.string :surname, null:false t.timestamps end create_table :ratings do |t| t.integer :score, null: false t.inte...
require 'rails_helper' RSpec.describe "timelines/_line.html.erb" do let(:post) { create(:post) } before do render "timelines/line", post: post end subject { Nokogiri::HTML(rendered) } it "can be rendered" do expect(subject.css(".line").count).to eq 1 expect(subject.css(".replies")).to be_empty ...
class YelpTools < Formula desc "Tools that help create and edit Mallard or DocBook documentation." homepage "https://github.com/GNOME/yelp-tools" url "https://download.gnome.org/sources/yelp-tools/3.18/yelp-tools-3.18.0.tar.xz" sha256 "c6c1d65f802397267cdc47aafd5398c4b60766e0a7ad2190426af6c0d0716932" bottle ...
require 'rake' require 'rake/packagetask' require 'yaml' require 'sprockets' require 'fileutils' module ActiveJSHelper ROOT_DIR = File.expand_path(File.dirname(__FILE__)) SRC_DIR = File.join(ROOT_DIR, 'src') DIST_DIR = File.join(ROOT_DIR, 'dist') DOCS_DIR = File.join(ROOT_DIR, 'docs') TEST_DIR = File.join...
module TomcatRails require 'optparse' class CommandLineParser def self.parse default_options = { :port => 3000, :environment => 'development', :context_path => '/', :libs_dir => 'lib', :classes_dir => 'classes', :config => 'config/tomcat.yml' } ...
require_relative '../config/environment' prompt = TTY::Prompt.new def login puts "Welcome to TRACK" puts "The INITECH Employee Management System\n\n" prompt = TTY::Prompt.new pw = prompt.mask("Please enter password") if pw == "password" puts "Welcome" application else ...
require 'spec_helper' describe Platform do let :platform do FactoryGirl::build(:platform) end let :second_platform do FactoryGirl::build(:second_platform) end it 'should have valid factories' do platform.should be_valid end context 'validations' do it 'should be invalid if the color_co...
require 'spec_helper' describe Item do let(:item) { build_stubbed(:item) } describe "associations" do it { should belong_to(:post) } it { should belong_to(:standup) } end describe "validations" do it { should validate_presence_of(:title) } it { should validate_presence_of(:standup) } end ...
class ApplicationController < ActionController::Base before_action :configure_permitted_parameters, if: :devise_controller? around_action :user_time_zone, if: :current_user protect_from_forgery with: :exception def configure_permitted_parameters devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:em...
# [![Build Status](http://travis-ci.org/lmarburger/altum.png)](http://travis-ci.org/lmarburger/altum) # # **Altum** uses the magic of Pusher and websockets to drive a [ShowOff][] # presentation remotely. # # Altum consists of a piece of Rack middleware and some JavaScript that keeps # viewers in sync with the presenter...
module Yaks class Config extend Yaks::Util::Deprecated include Yaks::FP::Callable, Attribs.new( format_options_hash: Hash.new({}), default_format: :hal, policy_options: {}, policy_class: DefaultPolicy, primitivize: Primitivize.c...
require "fog/core/model" module Fog module Google class SQL ## # A Google Cloud SQL service tier resource # # @see https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/tiers class Tier < Fog::Model identity :tier attribute :disk_quota, :aliases => "DiskQuota" ...
class Teacher < ApplicationRecord validates :name, presence: true has_many :courses, dependent: :destroy has_many :relations, dependent: :destroy has_many :students, through: :relations end
class Movie < ActiveRecord::Base has_many :rankings has_many :charts, :through => :rankings validates :title, :presence => true validates :imdb_id, :uniqueness => true validates :rating, :numericality => true validates :rating, :inclusion => 0..10 end
object @conversation attributes :id, :usernames child :messages, :object_root => false do attributes :created_at_formatted, :body, :sender_username end code :book do {id: @conversation.book_ids.last} end
require 'rails_helper' feature 'User can vote for a answer', %q{ In order to show that answer is good As an authenticated user I'd like to be able to set 'like' for answer. } do given(:liker) { create(:user) } given(:author) { create(:user) } given!(:question) { create(:question, user: author) } given!(:...
class FormatECH < FormatStandard def format_pretty_name "Elder Custom Highlander" end def include_custom_sets? true end def deck_issues(deck) issues = [] deck.physical_cards.select {|card| card.is_a?(UnknownCard) }.each do |card| issues << [:unknown_card, card] end return issue...
module Api module V1 class SessionsController < ApplicationController skip_before_action :authenticate def create user = User.find_by(email: auth_params[:email]) if user.authenticate(auth_params[:password]) token = Auth.issue({id: user.id}) render json: {jwt:token, user_id: u...
class BibleSearch module Chapters def chapters(book_sig) if book_sig.is_a?(Hash) unless required_keys_present?(book_sig, [:version_id, :book_id]) raise ArgumentError.new('Book signature hash must include :version_id and :book_id') end return chapters("#{book_sig[:version_i...
require 'github_repo' class GithubService def initialize(token = "") @conn = Faraday.new(url: "https://api.github.com") do |faraday| faraday.params[:access_token] = token faraday.adapter Faraday.default_adapter end end def member_data user_details = get_json("/users/aschreck") end def get...
class UsersController < ApplicationController include CurrentUserConcern before_action :set_user, only: %i[show edit update destroy] def index @users = User.all if @users render json: { users: @users } else render json: { error: 'No users found' }, status: :internal_server_error end ...
module Contributor module Calc class Commit COMMAND = "git shortlog -s -n --since=%{beginning_at} --until=%{end_at}" attr_reader :result def initialize @result = Hash.new { |h, k| h[k] = 0 } end def run authors = Contributor.configuration.authors execute_c...
class ProductPolicy < ApplicationPolicy def index? @user.admin? end def new? if user.present? !@user.buyer? end end def edit? if user.present? if !@user.buyer? true else false end end end def destroy? if user.present? !@user.buyer? ...
class ProMembershipManager def initialize(user) @user = user end # Subscribe the user to the given plan using the given token. If they are a # new subscriber, charge them immediately. If they are already pro and just # switching plans then update their token, move them to the new plan and only # charge...
class AddRepoNameToProjects < ActiveRecord::Migration def change add_column :projects, :repo_name, :string end end
class MessagesController < ApplicationController before_filter :authenticate_user! #before_action :set_user def new @price = Price.first @letter_conversation = LetterConversation.find(params[:letter_conversation_id]) @message = @letter_conversation.messages.build end def create @price = Price...
# pod lib lint --allow-warnings Pod::Spec.new do |s| s.name = 'iOSHTTPServer' s.version = '2.5.10' s.summary = 'Edit from CocoaHTTPServer2 only for iOS/CodboWebview.' s.description = <<-DESC Edit from CocoaHTTPServer2 only for iOS/CodboWebview; Origin seen https://github...
class RenameDeliveryPartnerIdentifierToPartnerOrganisationIdentifier < ActiveRecord::Migration[6.1] def change rename_column :activities, :delivery_partner_identifier, :partner_organisation_identifier end end
require 'spec_helper' describe package('php') do it { should be_installed } end describe package('php-fpm') do it { should be_installed } end describe file('/etc/php.ini') do it { should be_file } its(:content) { should match /\[PHP\]/ } end
require 'test_helper' class GameRecordsControllerTest < ActionController::TestCase setup do @game_record = game_records(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:game_records) end test "should get new" do get :new assert_respons...
require 'rails_helper' feature 'User visits homepage' do context 'user enters text into source field' do scenario 'expect text to be in source field' do ruby_code = load_fixture 'ruby.rb' visit root_path fill_in 'Try some code', with: ruby_code expect(find_field('Try some code').value)....
require 'spec_helper' describe Round do let(:competition) { FactoryGirl.create(:competition) } let(:round) { competition.rounds.build(closing_date: Date.tomorrow) } before { round.save } subject { round } it { should respond_to(:competition) } it { should respond_to(:closing_date) } it { should respond...
require 'rails_helper' RSpec.describe "investigationcosts/show", type: :view do before(:each) do @investigationcost = assign(:investigationcost, Investigationcost.create!( investigation: nil, item: "Item", amount: 2.5, currency: "Currency" )) end it "renders attributes in <p>" do...
shared_examples_for 'a worker' do let(:worker) { described_class } it 'responds to :handle_event' do expect(worker).to respond_to(:handle_event) end end
class Game < ApplicationRecord has_one_attached :rule has_many_attached :pieces has_many_attached :covers end
module Commontator module ApplicationHelper end end module ApplicationHelper def div_image url, options={}, &block style = "background-image: url(#{url});" options[:style] = style + options[:style].to_s content_tag 'div', nil, options, &block end def aware_date date, &block if date.year == D...
class CreateInterviewReferences < ActiveRecord::Migration[5.1] def change create_table :interview_references do |t| t.integer :trainer_id t.integer :company_lead_interview_id t.timestamps end end end
class Account @@ctr = 0 def initialize(check) if check == pin @balance = balance @@trans = trans @valid = true puts "Welcome back!\nYour current balance is $#{@balance}\n\n" else puts pin_error @valid = false end end public def valid? @valid end def ...
require 'test_helper' class DeliveryOrdersControllerTest < ActionController::TestCase setup do @delivery_order = delivery_orders(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:delivery_orders) end test "should get new" do get :new as...
require 'test_helper' class FileSentsControllerTest < ActionDispatch::IntegrationTest setup do @file_sent = file_sents(:one) end test "should get index" do get file_sents_url assert_response :success end test "should get new" do get new_file_sent_url assert_response :success end te...
And /^there should be no (.*) with (.*) '([^']*)'$/ do |object_type, key, value| klass = class_for_object_type(object_type) expect(klass.find_by(key => value)).to be_nil end Then /^a (.*) with (.*) '([^']*)' should exist$/ do |object_type, key, value| klass = class_for_object_type(object_type) expect(klass.fin...
require File.dirname(__FILE__) + '/../test_helper' require 'projects_controller' # Re-raise errors caught by the controller. class ProjectsController; def rescue_action(e) raise e end; end class ProjectsControllerTest < Test::Unit::TestCase fixtures :projects def setup @controller = ProjectsController.new ...
# # Be sure to run `pod lib lint GDTAd.podspec' to ensure this is a # valid spec before submitting. # # Any lines starting with a # are optional, but their use is encouraged # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name = 'GDTAd' s.ve...
require 'rails_helper' describe User do it "has a valid factory" do expect(build(:user)).to be_valid end let(:user) { build(:user) } describe "validations" do it { expect(user).to validate_presence_of(:nickname) } it { expect(user).to validate_presence_of(:email) } end describe "association...
#Subject: [ruby-talk:10587] Re: Word wrap algorithm #From: Kevin Smith <sent qualitycode.com> #Date: Fri, 9 Feb 2001 01:35:37 +0900 #Morris, Chris wrote: #>I'm in need of a word wrap method -- anyone know of an existing one #>(preferably in Ruby) I could use? #Here's one I threw together, and it has worked #w...
class CreateProductDetails < ActiveRecord::Migration def change create_table :product_details do |t| t.references :product, index: true t.string :description t.string :place t.integer :price t.integer :inventory t.date :date_from, default: Time.now t.date :date_to, defaul...
class ApplicationController < ActionController::Base before_action :set_current_user before_action :configure_permitted_parameters, if: :devise_controller? protected def configure_permitted_parameters devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :email]) devise_parameter_sanitizer.permit(:sign_in)...
class UsersController < ApplicationController load_and_authorize_resource except: :create skip_before_action :authenticate_user, only: :create def show render json: { user: UserSerializer.new(@user) }, status: :ok end def create registration = UserRegistrationForm.new(create_params) ...
#! /usr/local/bin/ruby # The example for using a Client-Library cursor. # This example relies on the pubs2 database. # (see $SYBASE/scripts/installpubs2 ) # # ex. # $ LANG=ja_JP.ujis ; export LANG # $ ruby cursor_update.rb -S SYBASE -U sa -P XXXXXX # # NOTE: this is not work with Free...
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable validates_presence_of :name, :lastname, :phone, :email...
# Back-End Web Development - Homework #1 # # Secret Number is a game you will build in two parts. # The purpose of the game is to have players guess a secret number from 1-10. # # Read the instructions below. # This exercise will test your knowledge of Variables and Conditionals. # #####################################...
class EventType < ApplicationRecord has_many :events validates :name, :color, presence: true before_save :generate_text_color before_update :generate_text_color scope :active, -> { where(status: true) } def event_ui_data { title: self.name, duration: self.duration_string }.to_json end def duratio...
class Bishop < Piece include SlidingPiece VECTORS = DIA SYMBOLS = {white: "\u2657", black: "\u265d"} def initialize(current_pos, color, board) super(current_pos, color, board) @symbol = SYMBOLS[color] end end
# frozen_string_literal: true require_relative 'validation.rb' require_relative 'module_manufacturer.rb' require_relative 'instance_counter.rb' class Train include Validation include Manufacturer include InstanceCounter attr_accessor :list_of_vagons, :number, :speed, :vagoncounter NUMBER_FORMAT = /^([a-z]|[1...