text
stringlengths
10
2.61M
require 'formula' class Le < Formula homepage 'http://freecode.com/projects/leeditor' # url 'http://ftp.yar.ru/pub/source/le/le-1.14.9.tar.xz' # upstream not responding, source from debian url 'http://ftp.de.debian.org/debian/pool/main/l/le/le_1.14.9.orig.tar.gz' sha1 'ce85cbefb30cf1f5a7e8349dbb24ffa0f65b1fd...
require 'rails_helper' RSpec.describe Post, type: :model do before do user = FactoryBot.create(:user) @post = FactoryBot.create(:post, user_id: user.id) # sleep 3 end describe 'Tweetの保存' do context 'Tweetが投稿出来る場合' do it '入力内容に不備がない場合、投稿できる' do @post.text = "テストテキスト" @pos...
require 'thor' require 'yaml' require 'json' require_relative 'thor' require_relative 'logger' require_relative 'configs' require_relative 'parser/parser' require_relative 'token/handler' require_relative 'code_object/base' require_relative 'dom/dom' require_relative 'processor' # `#setup_application` is called durin...
# Copyright (c) 2006, 2007 Ruffdogs Software, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License. # # This program is distributed in the hope that it will be ...
class UpdateTableVotesSetJobIdAsString < ActiveRecord::Migration[6.1] def change change_column :votes, :job_id, :string end end
class AddApplicantToPositionRequests < ActiveRecord::Migration def change add_column :position_requests, :applicant, :hstore execute "CREATE INDEX position_requests_applicant ON position_requests USING GIN(applicant)" end end
class AddDefaultAreaCodeToGemeinschaftSetup < ActiveRecord::Migration def change add_column :gemeinschaft_setups, :default_area_code, :string end end
class SearchesController < ApplicationController def show @resource = Resource.resolve_path(params[:query]) if @resource.present? return redirect_to([root_url, @resource.full_path].join('/')) end rescue ActiveRecord::RecordNotFound @notes = Note.where "path || '/' || name ilike ?", "%#{params...
describe Treasury::Models::Field, type: :model do context 'when check db structure' do it { is_expected.to have_db_column(:title).of_type(:string).with_options(limit: 128, null: false) } it { is_expected.to have_db_column(:group).of_type(:string).with_options(limit: 128, null: false) } it { is_expected.to...
require 'rails_helper' RSpec.describe Challenge, type: :model do # Validation tests it { should validate_presence_of(:name) } it { should validate_presence_of(:html) } it { should validate_presence_of(:css) } end
class Company::ApplicationController < ApplicationController before_action :authorize_company! layout "company" private def authorize_company! authenticate_company! unless current_company redirect_to root_path, alert: "YOU ARE NOT AUTHORIZED! You lack certain permissions to proceed further" e...
module Ranks TWO = "2" THREE = "3" FOUR = "4" FIVE = "5" SIX = "6" SEVEN = "7" EIGHT = "8" NINE = "9" TEN = "10" ELEVEN = "11" TWELVE = "12" THIRTEEN = "13" JACK = "jack" QUEEN = "queen" KING = "king" ACE = "ace" JOKER = "joker...
task :default => [:compile_js] task :compile_js do scripts = Dir["js/*.js"] content = "" scripts.each do |script| content += "\n" + File.read(script) end File.write("assets/lib.js", content) puts "Compiled JS assets" end
class Fighter < ApplicationRecord validates :name, presence: true validates :health, presence: true, inclusion: { in: 50..100 } validates :attack, presence: true, inclusion: { in: 0..50 } def is_survivor health > 0 end end
require "rails_helper" RSpec::Matchers.define :facilities do |facilities| match { |actual| actual.map(&:id) == facilities.map(&:id) } end RSpec.describe MyFacilitiesController, type: :controller do let(:facility_group) { create(:facility_group) } let(:supervisor) { create(:admin, :manager, :with_access, resourc...
require 'tmpdir' module KPM class Database class << self # Mysql Information functions LAST_INSERTED_ID = 'SELECT LAST_INSERT_ID();' ROWS_UPDATED = 'SELECT ROW_COUNT();' # Destination database DATABASE = ENV['DATABASE'] || 'killbill' USERNAME = ENV['USERNAME'] || 'root' ...
class PhotoViolationsController < ApplicationController layout "bare" before_filter :get_photo def new @photo_url = @photo.get_mid_size_url @name = "#{session_user.first_name} #{session_user.last_name}" if session_user @email = session_user.email if session_user end def create ...
module IOTA module API module Wrappers def getTransactionsObjects(hashes, &callback) # If not array of hashes, return error if !@validator.isArrayOfHashes(hashes) return sendData(false, "Invalid inputs provided", &callback) end ret_status = false ret_data =...
Pod::Spec.new do |spec| spec.name = "sMock" spec.version = "1.1.0" spec.summary = "Swift mock-helping library written with gMock (C++) library approach in mind" spec.description = <<-DESC Swift mock-helping library written with gMock (C++) library approach in mind; ...
class CreateHealthCareIndicators < ActiveRecord::Migration def self.up create_table :health_care_indicators, :primary_key => :indicator_id do |t| t.integer :indicator_id t.string :indicator_type t.integer :indicator_value t.string :facility t.date :indicator_date t.timestamps ...
class RestaurantsController < ApplicationController before_filter :require_signed_in!, :except => [:index] def new @city = City.find(params[:city_id]) @restaurant = @city.restaurants.new end def create @city = City.find(params[:city_id]) @restaurant = @city.restaurants.new(params[:restaurant])...
require('minitest/autorun') require_relative('../guest') class TestGuest < MiniTest::Test def setup @guest1 = Guest.new("Bob", 25.00) end def test_check_guest_has_name() assert_equal("Bob", @guest1.name()) end def test_check_guest_has_wallet() assert_equal(25.00, @guest1.wallet()) end def ...
class Contact < ActiveRecord::Base validates_presence_of :header_1, :link_1, :header_2, :link_2, :number, :address_name, :address_street, :city, :state, :zip_code end # == Schema Information # # Table name: contacts # # id :integer not null, primary key # header_1 :string(255) # link_1 ...
require "spec_helper" describe Enumerable do describe "#threading" do it "acts like #collect" do [1,2,3].threading(5) { |x| x * 2 }.to_a.should == [2,4,6] end it "runs things in separate threads" do [1,2,3].threading(5) { Thread.current.object_id }.to_a.uniq.size.should eq(3) end ...
class RMQViewData attr_accessor :events, :built, :is_screen_root_view, :screen, :cached_rmq #, :cache_queries def screen_root_view? !@is_screen_root_view.nil? end def cleanup clear_query_cache if @cached_rmq @cached_rmq.selectors = nil @cached_rmq.parent_rmq = nil @cached_rmq = n...
Pod::Spec.new do |s| s.name = 'BridgeTechSupport' s.version = '0.1.3' s.summary = 'Adds an amazing support menu bar to your app\'s menu. Really useful for all developers with any kind of app. 😉' s.description = 'Use this pod to see an example of how you might add an NSMenu ...
# coding: UTF-8 Encoding.default_internal = 'UTF-8' if defined? Encoding gem 'test-unit', '>= 2' # necessary when not using bundle exec require 'test/unit' require 'nokogiri' require 'redcarpet' require 'redcarpet/render_strip' require 'redcarpet/render_man' require 'redcarpet/compat' class Redcarpet::TestCase < Te...
class DocumentaryControl::BookWorksController < ApplicationController before_filter :authenticate_user!, :only => [:index, :new, :create, :edit, :update ] protect_from_forgery with: :null_session, :only => [:destroy, :delete] def index @type_book = TypeOfBookWork.where("cost_center_id = ?", get_company_cost_c...
class Community < ApplicationRecord include Postable has_many :users, dependent: :destroy belongs_to :creator, class_name: 'User' has_one_attached :avatar validates :name, presence: true acts_as_followable end
class CreateOpeningPlans < ActiveRecord::Migration def change create_table :opening_plans do |t| t.references :organization, index: true t.text :vision t.text :name t.text :description t.date :publish_date t.timestamps end end end
class Doctor < ApplicationRecord has_many :appointments, dependent: :destroy has_many :patients, through: :appointments def full_name "#{self.first_name} #{self.last_name}" end end
class CreateBaliseffvls < ActiveRecord::Migration[6.1] def change create_table :baliseffvls do |t| t.string :idBalise t.string :nom t.float :latitude t.float :longitude t.integer :altitude t.string :departement t.text :remarques t.integer :decalageHoraire t.st...
require 'rails_helper' RSpec.describe ApplicationCable::Connection, type: :channel do let(:username) { 'test' } it "identifies current_user from cookies" do connect cookies: { current_username: username } expect(connection.current_user).to eq(username) end it "rejects unauthorized connection" do ...
class AddVisibilityCreatedAtIndexOnPosts < ActiveRecord::Migration def change add_index :posts, [:visibility, :created_at] end end
class AddProviderToUserOauth < ActiveRecord::Migration def change add_column :user_oauth_tokens, :provider, :string end end
require 'rubylib/tcp_server' require 'dist_server/server/message' require 'dist_server/util/log' class BaseServer < GameTCPServer def initialize(server_info) @server_info = server_info super(server_info.name.nil? ? self.class.name : server_info.name) end def get_server_info @server_info end def get_...
require "uri" require "pincers/support/cookie_jar" module Pincers::Support class HttpClient class HttpRequestError < StandardError extend Forwardable def_delegators :@response, :code, :body attr_reader :response def initialize(_response) @response = _response super _re...
module Net RSpec.describe ICAPRequest do let(:uri) { URI('icap://localhost/echo') } it "creates a request with a method and path" do request = ICAPRequest.new 'METHOD', false, uri expect(request.method).to eq 'METHOD' end it "creates a request with a uri" do request = ICAPRequest.n...
require "rails_helper" RSpec.describe Item, type: :model do before do @item = FactoryBot.build(:item) end describe '出品登録' do context '新規登録できるとき' do it 'image、name、price、description、condition_id、shipping_charge_id、prefecture_id、shipping_date_id、category_id、userが存在すれば登録できる' do expect(@item)....
require 'rails_helper' RSpec.feature 'Visiting the schedule page', type: :feature do before do login_coach visit 'schedule' end scenario 'it loads the schedule page' do expect(current_path).to eq('/schedule') end scenario 'it displays the calendar' do expect(page).to have_css('div.calendar-c...
require "English" require "lucie/debug" require "sub-process/io-handler-thread" # # Spawns a sub-process and registers handlers for standard IOs and # process exit events. # class SubProcess::Shell # :nodoc: include Lucie::Debug # # Calls the block passed as an argument with a new # SubProcess::Shell object...
require "rails_helper" describe Experimentation::Runner, type: :model do describe ".call" do before { Flipper.enable(:experiment) } it "does not add patients, or create notifications if the feature flag is off" do Flipper.disable(:experiment) patient1 = create(:patient, age: 80) create(:b...
class Admin::TasksController < Admin::ApplicationController before_filter :setup_default_filter, only: :index def index @search = Task.search(params[:q]) search_result = @search.result(distinct: true) @tasks = show_all? ? search_result : search_result.page(params[:page]) end def show @task...
#-*- encoding : utf-8 -*- default_environment["PATH"] = "/usr/local/rbenv/shims:/usr/local/rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" set :application, "rails101_forum" set :domain, "ec2-54-248-164-60.ap-northeast-1.compute.amazonaws.com" set :repository, "git@github.com:maximx/...
#require 'spec_helper' / describe User do it 'create an user' do #Teste unitário user = User.new :name => 'Francieli', :email => 'francielifrv@gmail.com', :age => '20', :gender => User::FEMALE user.save.should be_true end it 'Fail to create a user when name is blank' do user = User.new :email => 'franciel...
class User < ApplicationRecord enum access_level: [:contractor, :company] has_many :proposals, dependent: :destroy has_many :submissions, dependent: :destroy has_many :comments, dependent: :destroy validates :user_name, presence: true, length: { minimum: 4, maximum: 16 } # Include default devise module...
# # Cookbook:: yourls # Attributes:: default # # Copyright:: 2018, Jailson Silva <jailson.silva@outlook.com.br> # # 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/l...
Pod::Spec.new do |spec| spec.name = 'MMObjectModel' spec.version = '0.0.1' spec.summary = "Handy superclass for mapping JSON or XML data to model classes" spec.homepage = "https://github.com/MacMannes/MMObjectModel" spec.author = { "André Mathlener" => "info@macmannes.nl" } spec....
FactoryGirl.define do sequence :url do |n| "/path/#{n}" end factory :event do url user end end
# # Re-opening the item class to add some methods. # class Nanoc3::Item def path path = self.identifier.split('/') path.delete('') path end def title t = self[:title] return t.match(/^(.*) expression$/)[1] if self.path[0] == 'exp' t end end class SidebarFilter < Nanoc3::Filter ...
class Front::ServicesController < FrontController def index @title = "Образы аниматоров на детский праздник | агентство Сказка Шоу" @description = "Наши аниматоры могут перевоплотиться в любимые образы героев мультфильмов, сказок и фильмов ваших детей. Образы для малышей, детей от 5 до 7 лет и старше. Вы може...
class Blogger < ApplicationRecord has_many :posts has_many :destinations, through: :posts end
require 'spec_helper' describe 'appdynamics_agent::machine' do on_supported_os(facterversion: '2.4').each do |os, os_facts| context "on #{os}" do let(:facts) { os_facts } let(:params) do { 'machine_path' => 'FOOBAR', 'machine_agent_file_32' => 'FOOBAR', ...
#!/usr/bin/ruby # # Vagrant File for HBO | gotweb # Provisioner: Salt # OS: Ubuntu 12.04 LTS 64Bit # Vagrant.configure("2") do |config| # Base Box - Hosted on S3 config.vm.box = "ubuntu_precise64_blank" config.vm.box_url = "http://poke.vagrant.boxes.s3.amazonaws.com/ubuntu_precise64_blank.box" # ...
require 'test_helper' class UserStoriesTest < ActionDispatch::IntegrationTest # test "the truth" do # assert true # end fictures :products test "buying a product" do LineItem.delete_all Order.delete_all mcfarlane_figure = products(:ruby) get "/" assert_response :success asser_templat...
module BreadcrumbHelper def render_breadcrumbs(type) breadcrumbs = send("#{type}_breadcrumb") # Don't link last item in breadcrumb breadcrumbs.last[1] = nil if breadcrumbs render GovukComponent::Breadcrumbs.new( breadcrumbs: breadcrumbs, classes: "govuk-!-display-none-print", ...
class Public::CartItemsController < ApplicationController before_action :authenticate_customer! def index @tax = 1.08 @cart_items = current_customer.cart_items @item_total = 0 @cart_items.each do |cart_item| @item_total += cart_item.item.price * cart_item.count end end def create # カ...
require File.dirname(__FILE__) + '/../../spec_helper' require File.dirname(__FILE__) + '/fixtures/methods' describe "Time#zone" do platform_is_not :windows do # zone names not available on Windows w/o supplying zone offsets it "returns the time zone abbreviation used for time" do with_timezone("AST") d...
class Category < ActiveRecord::Base has_many :posts validates_presence_of :name end
def display_board(board) puts " #{board[0]} | #{board[1]} | #{board[2]} " puts "-----------" puts " #{board[3]} | #{board[4]} | #{board[5]} " puts "-----------" puts " #{board[6]} | #{board[7]} | #{board[8]} " end def input_to_index(index) index=index.to_i-1 return index end def turn(board) puts "Pl...
# Match a private_ip_address line class MatchesPrivateIpAddressLine def self.===(item) item.include?('private_ip_address') end end
unless Kernel.respond_to?(:require_relative) module Kernel def require_relative(path) require File.join(File.dirname(caller[0]), path.to_str) end end end case RUBY_PLATFORM when /mingw|mswin/ @slash = "\\" else @slash = "/" end VERSION="2.0.4" require 'rubygems' require 'readline' # CHECK FOR GEM...
require 'spec_helper' describe "/judges/index.html.erb" do include JudgesHelper before(:each) do assigns[:judges] = [ stub_model(Judge), stub_model(Judge) ] end it "renders a list of judges" do render end end
# encoding: utf-8 class InstallationPurchase < ActiveRecord::Base attr_accessor :installation_name, :total attr_accessible :installation_id, :applicant_id, :qty, :unit, :unit_price, :total, :for_what, :part_name, :spec, :need_date, :as => :role_new attr_accessible :applican...
# class Formtastic::SemanticFormBuilder # # def method_required_with_enquiry_form?(attribute) # required_method = "#{attribute}_required?" # if @object && @object.respond_to?(required_method) # @object.send(required_method) || method_required_without_enquiry_form?(attribute) # else # method...
# encoding: utf-8 class MyApp < Sinatra::Application post '/doubleclick' do request.body.rewind input = JSON.parse request.body.read.gsub('=>', ':') logger.debug "Handling 'doubleclick' request." clickId = input['conversion'][0]['clickId'] if clickId == 'goodclid_uno' status 200 body "...
require 'rails_helper' RSpec.describe User, type: :model do it "has the username set correctly." do user = User.new username:"Pekka" expect(user.username).to eq("Pekka") end it "is not saved without a password." do user = User.create username:"Pekka" expect(user).not_...
Then /^I should see the hits metric for cinstance belonging to "([^"]*)"$/ do |buyer_name| buyer_account = Account.find_by_org_name!(buyer_name) metric = buyer_account.bought_cinstance.metrics.hits selector = XPath.generate { |x| x.descendant(:div)[x.attr(:'data-metric') == metric.name ] } should have_xpath(se...
require_relative 'reservable' require_relative 'hotel' module ReservationSystem class Reservation include Reservable attr_reader :check_in, :nights, :dates_reserved, :room def initialize(check_in_date, nights, room) @check_in = check_in_date @nights = nights @room = room @dates...
class GetBadgesService def initialize(test_passage) @test = test_passage.test @user = test_passage.user @test_passage = test_passage end def call Badge.select do |badge| rule = "reward_#{badge.rule}?" send(rule) end end private def reward_first_try? @test_passage.test_...
class RubyGem < ActiveRecord::Base #ask about where the dependent destory goes so if a #gem is removed, the reviews are destroyed has_many :reviews, inverse_of: :ruby_gem, dependent: :nullify validates_presence_of :name validates_uniqueness_of :name, :case_sensitive => false, message: 'already exists...
# app/controllers/users_controller.rb class UsersController < ApplicationController def index #get, shows everything for the user # render plain: "I'm in the index action!" render json: User.all end def show #get Route parameters (e.g. the :id from /users/:id) # user have to specify to see th...
# frozen_string_literal: true module API module Auth extend ActiveSupport::Concern included do helpers do AUTHENTICITY_TOKEN_LENGTH = 32 def session env['rack.session'] end def verified_request? !protect_against_forgery? || request.head? || ...
Given(/^the web applications runs on Heroku$/) do Capybara.current_driver = :selenium Capybara.app_host = 'https://secret-chamber-2192.herokuapp.com' end When(/^I open the application url$/) do visit(root_path) end Then(/^I must see the front page with application title "(.*?)"$/) do |title| page.has_title? t...
module VieraPlay class TV def initialize(control_url) @soap_client = Soapy.new( :endpoint => control_url, :namespace => "urn:schemas-upnp-org:service:AVTransport:1", :default_request_args => {"InstanceID" => "0"} ) end def stop send_command("Stop") end d...
class TaxAdvanceFinalTag < PayrollTag def initialize super(PayTagGateway::REF_TAX_ADVANCE_FINAL, PayConceptGateway::REFCON_TAX_ADVANCE_FINAL) end def deduction_netto? true end end
require "singleton" module Service # # keeps a list of configuration files. # class ConfigManager include Singleton def initialize @list = {} end def add service, path @list[ service ] = path end def [] service @list[ service ] end end end ### Local vari...
class ChangeTopic < ActiveRecord::Migration def change change_column_default :topics, :good, 0 change_column_default :topics, :bad, 0 end end
class BookingsController < ApplicationController def new @flight = Flight.find_by(id: params['flight']) @booking = Booking.new params['passengers'].to_i.times { @booking.passengers.build } end def create flight = Flight.find_by(id: params['flight']) @booking = Booking.new(booking_params) if @bo...
log " ***************************************** * * * Recipe:#{recipe_name} * * * ***************************************** " fslist=node[:clone12_2][:machprep][:newfs] opts = "-Ayes -prw -a agblksize=...
require 'rails_helper' RSpec.describe User, type: :model do subject do FactoryGirl.build(:user) end let(:user) do User.new( username: 'CalligraphyPuffin', email: 'puffin@gmail.com', encrypted_password: 'inkisawesome' ) end it { should have_valid(:username).when('sadusername') ...
Sputnik::Application.routes.draw do resources :users do member do get :following, :followers, :created, :participates end end resources :microposts do member do get :detail end end resources :polls do member do get :detail end end resources :sessions, only: [:new, :cr...
class PaperSubmissionMailer < ActionMailer::Base default from: "congressofaesf@gmail.com", :content_type => "text/html" def send_confimation_paper_submission(paper_submission) @paper_submission = paper_submission mail(:to => @paper_submission.email, :subject => "Confirmacao de submissao de resumo.") en...
class ToDoList attr_reader :list attr_accessor :listname def initialize(list = Array.new, listname = "Untitled list") @list = list @listname = listname end def check_item(index) @list[index][0] = !@list[index][0] end def delete_item(index) @list.delete_at(index) end def add_item(fi...
# Fibonacci # https://en.wikipedia.org/wiki/Fibonacci_number # Fibonacci.new.calculate(input) #=> output # input(Fn) -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 # output −21 13 −8 5 −3 2 −1 1 0 1 1 2 3 5 8 13 21 require "minitest/autorun" require "./fibonacci" class TestFibonacci < Minitest::Test def test_...
require 'spec_helper' describe SiteController do describe "GET 'index'" do it "returns http success" do create :strip get 'index' response.should be_success end context 'assigns' do let!(:strip){ create :strip } it '@latest' do get 'index' assigns(:latest)....
# frozen_string_literal: true require "factory_bot" require "factory_bot_rails/generator" require "factory_bot_rails/reloader" require "rails" module FactoryBotRails class Railtie < Rails::Railtie config.factory_bot = ActiveSupport::OrderedOptions.new config.factory_bot.definition_file_paths = FactoryBot.de...
require 'rails_helper' RSpec.describe SecureHeadersWhitelister do describe '.extract_domain' do def extract_domain(url) SecureHeadersWhitelister.extract_domain(url) end it 'extracts the domain and port from a url' do aggregate_failures do expect(extract_domain('http://localhost:1234/...
module Spree module Admin class SizingGuidesController < ResourceController def new @sizing_guide = SizingGuide.new @sizing_guide.build_sizing_guide_image end private def permitted_sizing_guides_attributes [:name, :description, :permalink, sizing_guide_image: [:a...
json.users do json.array! @users do |user| json.id user.id json.name user.name json.sleep_trackers user.sleep_trackers do |tracker| json.id tracker.id json.sleep_time tracker.sleep_time json.waking_time tracker.waking_time json.duration tracker.duration end end end json.total...
class Neighborhood < ActiveRecord::Base belongs_to :city has_many :listings has_many :reservations, through: :listings def neighborhood_openings(start_date, end_date) parsed_start = Date.parse(start_date) parsed_end = Date.parse(end_date) open_places = [] listings.each do |listing| blocked = listing....
# frozen_string_literal: true require 'http/request' require_relative '../client' require_relative '../streaming/connection' require_relative '../streaming/deleted_status' require_relative '../streaming/message_parser' require_relative '../streaming/response' module Mastodon module Streaming # Streaming client ...
require 'formula' class Man2html < Formula homepage 'http://www.oac.uci.edu/indiv/ehood/man2html.html' url 'http://www.oit.uci.edu/indiv/ehood/tar/man2html3.0.1.tar.gz' sha1 '18b617783ce59491db984d23d2b0c8061bff385c' def install bin.mkpath man1.mkpath system "/usr/bin/perl", "install.me", "-batch"...
module ScheduleMixins module Macros def create_schedule(options={}) options[:users_count] ||= 1 let(:schedule) { create(:schedule_with_layers_and_users, options) } let(:schedule_layer) { schedule.schedule_layers.first } (1..options[:users_count]).each_with_index do |id, index| let...
class Location < ApplicationRecord has_and_belongs_to_many :courses VALID_LOCATION = /\A[\d]{2}+\.[\d]{2}+\.[\d]{2}\z/ validates :name, presence: true, length: { is: 8, wrong_length: " min/max 8 character!" }, format: { with: VALID_LOCATION, message: " must be in format 00.00.00" } end
require 'highline/import' namespace :db do desc "Anonymize your database" task :anonymize => :environment do DbTools::Anonymizer.execute end namespace :user do desc "Change the password for an existing user" task :password => :environment do Spree::Setup.change_password end end end ...
class Admin::CampaignsController < Admin::AdminController before_action :set_campaign, only: %i[show edit update destroy] after_action :verify_authorized # GET /campaigns # GET /campaigns.json def index @campaigns = Campaign.all authorize @campaigns end # GET /campaigns/1 # GET /campaigns/1.js...
def fizzBuzz(num_range) (num_range).each do |num| if ( num % 3 == 0 ) && ( num % 5 == 0 ) print 'FizzBuzz' elsif num % 3 == 0 print 'Fizz' elsif num % 5 == 0 print 'Buzz' else print num end end end fizzBuzz(1..100)
class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable has_many :carts after_create :create_cart def cr...
require 'nokogiri' class XcriCap attr_reader :message, :contributor, :description, :provider_description, :provider_url, :provider_identifier, :provider_title, :course_title, :course_desc, :course_subject, :course_identifier, :course_type, :course_url, :course_abstract, :course_application_procedure def initialize(id...