text stringlengths 10 2.61M |
|---|
class AddColumnsToPlayers < ActiveRecord::Migration[6.0]
def change
add_column :players, :role, :string
add_column :players, :bat_style, :string
add_column :players, :bowl_style, :string
end
end
|
require 'spec_helper'
describe SequencesController do
let(:project) { FactoryGirl.create(:project) }
let(:theme) { FactoryGirl.create(:theme) }
let(:sequence) { FactoryGirl.create(:sequence,
publication_status: 'public',
theme: theme,
project: project,
user: user) }
let(:activity) { FactoryGirl... |
class SalesController < ApplicationController
def index
@sales = Sale.parse_sales('db/sales.csv')
end
end
|
require 'rubygems'
require 'minitest/autorun'
#require 'minitest/pride'
require 'mocha'
require 'Qt4'
module KeyPressEventsTestHelper
def z_key_press_event
key_press_event(Qt::Key_Z, "z")
end
def backspace_key_press_event
key_press_event(Qt::Key_Backspace)
end
def return_key_press_event
key_pre... |
def find_item_by_name_in_collection(name, collection)
# Implement me first!
#
# Consult README for inputs and outputs
i = 0
while i < collection.length do
return collection[i] if collection[i][:item] == name
i += 1
end
end
def consolidate_cart(cart)
# Consult README for inputs and outputs
#
#... |
require 'rails_helper'
RSpec.describe OrderItemsController, type: :controller do
let(:order_item_params) { FactoryGirl.attributes_for(:order_item) }
let(:order_item) { FactoryGirl.build_stubbed(:order_item) }
let(:price) { FactoryGirl.build_stubbed(:price) }
let(:order) { FactoryGirl.build_stubbed(:order_acti... |
class RenameCraftInResourcesTable < ActiveRecord::Migration
def up
rename_column :resources, :craft, :craft_id
end
def down
end
end
|
require 'spec_helper'
describe Photo do
before :each do
@contestant = build(:contestant)
@photo = build(:photo, owner: @contestant)
end
describe "self.category?" do
it "returns true for category in Photo::CATEGORIES and 'canada'" do
%w{Flora FaUNa landscapes}.push(:Canada).each do |category|
... |
require 'rails_helper'
RSpec.describe Service, type: :model do
it "is valid" do
expect(create(:service)).to be_valid
end
end
|
# Cookbook Name:: razor_tag_LWRP
# Provider:: tag
#
action :add do
@server_ip = URI.parse(new_resource.server)
image_uuid = get_image_uuid(new_resource.os_name)
if image_uuid
if !model_present?
add_model(image_uuid)
new_resource.updated_by_last_action(true)
else
Chef::Log.debug("#{new_re... |
require 'rails_helper'
describe 'User' do
let!(:user) { create(:user) }
it 'successfully authenticates with email' do
sign_in (user)
expect(page).to have_content 'sign out'
end
end |
class Message < ApplicationRecord
attr_accessor :video_file_name
belongs_to :user
has_many :replies
default_scope -> { order(created_at: :desc) }
mount_uploader :picture, PictureUploader
mount_uploader :video, VideoUploader
validates :content, presence: true, length: { maximum: 140 }
validates :user_id,... |
class Audit < Audited::Audit
# Extensions
include Searchable
searchable_columns %w[auditable_type action audited_changes]
# Scopes
default_scope { order(created_at: :desc) }
scope :with_associations, -> { includes(:user, :auditable) }
end
|
class RenameWorkoutGroupTable < ActiveRecord::Migration[5.1]
def change
rename_table :wokout_groups, :workout_groups
end
end
|
class Cart < ActiveRecord::Base
has_and_belongs_to_many :products
belongs_to :customer
def update_cart
total = 0
self.products.each do |product|
total += product.price
end
self.total_price = total
self.number_of_products = self.products.count
self.save!
end
end
|
class ServiceController < ApplicationController
def index
require 'json'
@users = User.search(params[:term])
if(params[:category] > 0) then @users = User.search(params[:term]).category(params[:category]) end
render :json => @users
end
end
|
class BookingSerializer < ActiveModel::Serializer
attributes :id, :departure_date, :package_id, :voucher_id, :price, :status, :adult_bio_ids, :child_bio_ids,
:number, :customer_id, :identity_ids, :person, :midtrans_id, :child_passport_ids, :booking_status,
:product, :passport_ids, :booking_s... |
require 'rails_helper'
RSpec.describe App, type: :model do
describe 'associations' do
it { is_expected.to belong_to(:user) }
it { is_expected.to have_many(:deployments).dependent(:destroy) }
it { is_expected.to have_many(:configs).dependent(:destroy) }
it { is_expected.to have_many(:integrations).dep... |
class Station
attr_reader :station_name, :station_zone
def initialize(station, zone)
@station_name = station
@station_zone = zone
end
end
|
class PostsController < ApplicationController
def new
@post = Post.new(date: friday)
end
def show
@post = Post.find(params[:id])
end
def create
@post = Post.create(post_params.permit(:start_time))
if @post.persisted?
redirect_to post_path(@post)
else
render action: :new
... |
require_relative './abstract_factory'
require_relative './factory_search'
require_relative '../ext/commands/index'
# Finds a command from the commands directory
# Returns nil if none found
class CommandLookup
include AbstractFactory.new(Commands)
include FactorySearch
attr_reader :result
def initialize(q... |
class RemoveFromPhoto < ActiveRecord::Migration
def change
remove_attachment :photos, :image
end
end
|
require 'spec_helper'
describe CartsController do
def valid_attributes
{ customer_id: 2,
total: 123.99 }
end
def valid_session
{ id: 1 }
end
before(:each) do
@product = Product.create( name: "something",
description: "something else",
... |
# == Schema Information
#
# Table name: projects
#
# id :integer not null, primary key
# code :string(255) default(""), not null
# name :string(255) default(""), not null
# description :text
# created_at :datetim... |
require 'rails_helper'
RSpec.describe WebhooksController, :type => :controller do
include SmsSpec::Helpers
FIXTURES_PATH = Rails.root.join("spec", "fixtures")
describe "#receive" do
before(:each) do
@user = User.create(name: "Sophie DeBenedetto", email: "sophie.debenedetto@gmail.com", github_usernam... |
class AddUriToBand < ActiveRecord::Migration
def change
add_column :bands, :uri, :string
end
end
|
class WastingDecorator < Draper::Decorator
delegate_all
def self.name_response
"えらい!よく我慢できました!\nあなたのそのブレない心に称賛を送ります!\nその調子で誘惑に打ち勝っていきましょう!!"
end
def self.price_response(today_wastings, yesterday_wastings)
day_difference = today_wastings.pluck(:price).sum - yesterday_wastings.pluck(:price).sum
if d... |
module Mail::ApplicationHelper
STATUS_ICONS = {
created: 'created',
needs_review: 'alert',
needs_urgent_review: 'alert',
expired: 'expired',
finished: 'verified',
}.freeze
STATUS_COLORS = {
created: '#21ba45',
needs_review: '#f2711c',
needs_urgent_review: '#db2828',
expired: ... |
class Aquamacs < Cask
url 'http://braeburn.aquamacs.org/releases/Aquamacs-Emacs-2.5.dmg'
homepage 'http://aquamacs.org/'
version '2.5'
sha1 '2d9052b94751b0454e109700ff8d0204d80310f4'
link 'Aquamacs.app'
end
|
# frozen_string_literal: true
require "test_helper"
module FuelSurcharge
class ChronopostTest < Minitest::Test
def test_time_period
nominal_case do
assert_equal "Juillet 2019", @chronopost.time_period
end
failing_case do
assert_nil @chronopost.time_period
end
end
... |
module GoogleNGrams
module Processor
class Client
def initialize(opts = {})
GoogleNGrams::Processor.log(:info, "Initializing Client...")
@ngram_type = opts.delete(:ngram_type) || 1
@raw_data_path = GoogleNGrams::Processor.config[:raw_data_path] + opts.delete(:raw_data_path)
... |
class Notifier < ActionMailer::Base
default from: "donotreply@lotifyme.co"
layout 'mailer'
def welcome_email(user)
@user = user
mail(to: @user.email, subject:'welcome to lottifyme')
end
def email_for_past_draw(pick)
@user = pick.user
@pick = pick
mail(to: @user.email, subject:'your resou... |
class Tree
attr_accessor :type, :age, :windy, :bark
end
a_tree = Tree.new
a_tree.type = "deciduous"
a_tree.bark = "rough"
a_tree.windy = "wisha wisha"
puts "A #{a_tree.type} tree with #{a_tree.bark} bark is blown in the wind and says #{a_tree.windy}."
puts a_tree.inspect
|
class CoursesController < ApplicationController
def index
if session[:user_id] == nil
redirect_to '/login'
else
@courses = Course.all
@course = Course.new
end
end
def new
if session[:user_id] == nil
redirect_to '/login'
end
@course = Course.new
end
def creat... |
class Kid < ApplicationRecord
validates :username, length: {minimum: 7, maximum: 25},
uniqueness: true,
presence: true
validates :age, numericality: {greater_than_or_equal_to: 6, less_than_or_equal_to: 15},
presence: true
end
|
source 'http://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', ">= 4.0.0"
# Use sqlite3 as the database for Active Record
group :development, :test do
gem 'sqlite3'
gem 'database_cleaner'
gem 'cucumber-rails', :require => false
gem 'rspec-rails', '~> 2.14.0... |
Rails.application.routes.draw do
root to: "static_pages#root"
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
namespace :api, defaults: {format: :json} do
#This is Rails shortcut. instead of putting POST 'api/users', to: "users#CREATE" you can do this
... |
# == Schema Information
# Schema version: 20110314110640
#
# Table name: merchants
#
# id :integer(4) not null, primary key
# name :string(255)
# email :string(255)
# password :string(255)
# phone :string(255)
# company_name :string(255)
# keyword :string(255)
# ip_... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
box = "ubuntu/focal64"
box_version = "20201210.0.0"
k8s_version = "1.20.0-00"
docker_version = "19.03"
servers = [
{
:name => "k8s-master",
:type => "master",
:ip_addr => "192.168.205.10",
:mem => "2048",
:cpu => "2"
},
{
... |
require 'constrained/version'
describe Constrained::Version do
describe "parsing strings into versions" do
it "can parse a basic version" do
ver = described_class.parse('1.2.3')
expect(ver.major).to eq 1
expect(ver.minor).to eq 2
expect(ver.patch).to eq 3
expect(ver.pre).to be_nil... |
require 'rails_helper'
describe "the add a product process" do
it "adds a new product" do
visit products_path
click_link 'Sign up'
fill_in 'user_email', :with => 'user@email.com'
fill_in 'user_password', :with => 'hello'
fill_in 'user_password_confirmation', :with => 'hello'
click_on 'Sign U... |
class CreateHrFormulas < ActiveRecord::Migration
def self.up
create_table :hr_formulas do |t|
t.integer :value_type
t.string :default_value
t.integer :formula_id
t.string :formula_type
t.timestamps
end
end
def self.down
drop_table :hr_formulas
end
end
|
# -*- coding: utf-8 -*-
class HomeworkAssign < ActiveRecord::Base
# --- 模型关联
belongs_to :homework
belongs_to :user
include Comment::CommentableMethods
alias :creator :user
def student_upload_zip_path
"#{Homework::HOMEWORK_ATTACHMENTS_DIR}/homework_student#{self.user.id}_#{self.homework.id}.zip"
end... |
class PhotosController < ApplicationController
def index
respond_with @photos = Photo.page(params[:page]).per(16)
end
def random
# ensure that the seed is a single place decimal
seed = Float(params[:seed].to_i % 10) / 10
# use the seed to ensure pagination is performed without duplicates
... |
class Stack
class UsageError < RuntimeError
end
def initialize
@items = []
end
def depth
@items.size
end
def empty?
@items.size == 0
end
def top
@items.last
end
def push(item)
@items.push(item)
end
def pop
fail UsageError, "Cannot pop an empty stack" if empty?
... |
# == Schema Information
#
# Table name: items
#
# id :integer not null, primary key
# active :boolean default(TRUE)
# barcode_count :integer
# category :string
# distribution_quantity :integer
# name ... |
# frozen_string_literal: true
require "forwardable"
module Mover
class Message
extend Forwardable
def_delegator :folder, :log
def_delegator :folder, :conn_from
def_delegator :folder, :conn_to
ERROR_FILE = "log/error.log"
attr_reader :folder, :uid, :to
def initialize(folder:, uid:, to... |
require File.dirname(__FILE__) + '/spec_helper'
describe "LazyMappingHash instance" do
before(:each) do
@lash = LazyMappingHash.new
end
it "should have class Hash" do
@lash.class.should == Hash
end
it "should be inherited from Hash" do
@lash.class.ancestors.first.should == Hash
end
... |
require "rails_helper"
describe "As a visitor" do
describe "When I visit the patient index page" do
it "I see the names of all patients listed from oldest to youngest" do
patient_1 = Patient.create!(name: "Katie Bryce", age: 24)
patient_2 = Patient.create!(name: "Denny Duquette", age: 39)
patie... |
require 'builder'
module Spree
module CdataHelper
def cdata_helper_for(xml)
lambda do |data|
proc { data.nil? ? data : xml.cdata!(data) }
end
end
end
end
|
class RomanNumeral
NUMERAL_DICTIONARY = {
"I" => 1,
"IV" => 4,
"V" => 5,
"IX" => 9,
"X" => 10,
"XL" => 40,
"L" => 50,
"XC" => 90,
"C" => 100,
"CD" => 400,
"D" => 500,
"CM" => 900,
"M" => 1000
}
def convert_to_numeral num
defined_numbe... |
#1 - Create a contact_list using hashes
#Each entry should have a name, telephone, email, location
#2 - Create a method that tells you how many contacts are in your contact list
#3 - Create a method that iterates through each contact. It should print the name, telephone and email details
#4 - Create a method that s... |
module Api::V1
class RafflesController < ApiController
before_action :authenticate
before_action :creator_user, only: [:draw_raffle]
before_action :verify_date, only: [:draw_raffle]
before_action :verify_numbers, only: [:draw_raffle]
def index
@raffles = Raffle.includes(:user, :prizes)... |
# == Schema Information
#
# Table name: tags
#
# id :integer not null, primary key
# text :string(20) not null
# taggings_count :integer default("0")
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_tags_on_... |
class AppliesController < ApplicationController
def new
load_examination
load_qualifications
notice = "You need to add your qualification before apply"
redirect_to qualifications_path, notice: notice if @qualifications.count < 1
build_examinee
end
def create
build_examinee
save_examin... |
class ConwayRules
require_relative '../lib/gameboard.rb'
#returns a new GameBoard representing the next
#generation as calculated from this generation
def next_gen(board)
next_board = GameBoard.new(board.size)
board.each_index do |x, y|
neighbours=0
#iterate through nine-cell neighbourho... |
class CreateEmployees < ActiveRecord::Migration[5.2]
def change
create_table :employees do |t|
t.string :name
t.string :address
t.string :gender
t.string :contact_no
t.string :email
t.string :position
t.string :image
t.string :rfid_code
t.date :hire_date
... |
class AnonymiseExtraMobileDataRequestsJob < ApplicationJob
queue_as :default
# Running:
# * ExtraMobileDataRequest.all.group('account_holder_name').count
# * ExtraMobileDataRequest.all.group('device_phone_number').count
# on production shows that the same device_phone_number (and account_holder_name)
# are... |
# multiply_lists.rb
# Write a method that takes two Array arguments in which each Array contains a
# list of numbers, and returns a new Array that contains the product of each
# pair of numbers from the arguments that have the same index. You may assume
# that the arguments contain the same number of elements.
# Pseud... |
# Fdf_config_handler
#
# This class is used to get informations about the extensions the FDF should ignore
#
require_relative 'Comments_class'
require_relative 'Ignored_class'
class Fdf_config_handler
def initialize(comments_filename = $COMMENTS, ignored_filename = $IGNORED)
@comments_conf = Comments_class.new... |
require 'pry'
class LinkedList
attr_accessor :name, :nodes, :head, :tail
def initialize
@head = nil
@tail = nil
@nodes = 0
end
def append(value)
if @head == nil
prepend(value)
@tail = @head
else
temp_node = @head
temp_node = temp_node.next until temp_node.next.nil?
... |
module GHI
module Commands
class Close < Command
attr_accessor :web
def options
OptionParser.new do |opts|
opts.banner = <<EOF
usage: ghi close [options] <issueno>
EOF
opts.separator ''
opts.on '-l', '--list', 'list closed issues' do
assigns[:command]... |
# An AdminCommandProcessor parse
# and executes comands of the form
# command a:b c:d etc
# e.g., create-command token:foo123 verb:add_group_and_document group:linearstudent doc:1701
class AdminCommandProcessor
def initialize(hash)
@input = hash[:input]
@user = hash[:user]
@tokens = @input.split(... |
class FontScheherazadeNew < Formula
head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/scheherazadenew"
desc "Scheherazade New"
desc "Named after the heroine of the classic arabian nights tale"
homepage "https://fonts.google.com/specimen/Scheherazade... |
#!/usr/bin/env ruby
# load MySQL class
require 'mysql'
require 'parsedate'
netjuke_query = "
SELECT netjuke_artists.name AS artist_name,
MIN(netjuke_tracks.date) AS first_seen
FROM netjuke_artists, netjuke_tracks
WHERE netjuke_artists.id = netjuke_tracks.ar_id
GROUP BY netjuke_artists.name... |
class Band < ActiveRecord::Base
has_many(
:albums,
class_name: 'Album',
primary_key: :id,
foreign_key: :band_id,
dependent: :destroy
)
validates(
:name, presence: true
)
def self.find_by_credentials(name)
band = Band.find_by(name: name)
return nil if band.nil?
band
end... |
class ClassGenerator
attr_accessor :tab_count, :tab_character
def initialize
@tab_count = 0
@tab_character = " "
end
def tab_space
(1..@tab_count).inject("") do|rtn, count|
rtn = "#{rtn}#@tab_character"
rtn
end
end
def increment_tab
@tab_count += 1
end
def decrement... |
Before do
Capybara.default_driver = :chrome
Capybara.default_max_wait_time = 5
Capybara.ignore_hidden_elements = false
@logger = Logger.new(STDOUT)
@logger.level = Logger::INFO
end
After do |scenario|
if scenario.failed?
puts scenario.name
puts scenario.exception.message
end
Capybara.current_s... |
require "journey"
describe Journey do
subject(:journey) {described_class.new}
# let(:oystercard) {double('oystercard')}
it "has empty history" do
expect(journey.history).to eq []
end
#
let(:station) {double('station')}
let(:stations) { {entry_station: station, exit_station: station }}
it "st... |
require_relative '../../../automated_init'
context "Output" do
context "Print Error" do
context "Reverse" do
context "Assertion Failure" do
output = Output.new
output.reverse_backtraces = true
assertion_failure = Fixture::AssertionFailure.build
output.print_error(assertion... |
class Link < ActiveRecord::Base
validates :title, :url, presence:true
def self.search(value = "")
where("title ILIKE ?", "%#{value}%")
end
end
|
require File.dirname(__FILE__) + '/../test_helper'
class CardiosessionTest < ActiveSupport::TestCase
fixtures :cardiotypes, :users, :cardiosessions
def setup
@quentin = users(:quentin)
@run_session = cardiosessions(:quentinrun)
@swim_session = cardiosessions(:quentinswim)
@run = cardiotypes(:run... |
class Node
attr_accessor :title
attr_accessor :visited
attr_accessor :distance
attr_accessor :neighbors
def initialize(title)
@title = title
@visited = false
end
end |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe RootController, type: :controller do
context 'with logged in user' do
login_user
describe '#index' do
let(:projects) { create_list(:project, 2, creator: @current_user) }
before { get :index }
it { expect(response).to ha... |
module Metrc
class PlantBatch
include Mongoid::Document
include Mongoid::Timestamps::Short
# Fields update after batch scheduled
# Original Cultivation::Batch that generated this record
field :batch_id, type: BSON::ObjectId
# Lot no for this batch, this is only for visualization
field :l... |
require 'rails_helper'
RSpec.feature "UserCanLogouts", type: :feature do
it 'user can click on sign out' do
user = create(:user, password: "1234")
visit '/login'
fill_in "Email", with: user.email
fill_in "Password", with: "1234"
click_on "Submit"
expect(current_path).to eq root_path
cl... |
module Badgeable
class Railtie < ::Rails::Railtie
def badge_definition_file
"#{Rails.root}/lib/badges.rb"
end
initializer "badgeable.assign_badge_definitions_file" do
if File.exists?(badge_definition_file)
Badgeable::Config.badge_definitions = File.read(Pathname.new(badge_definition_... |
class AddFieldsToUser < ActiveRecord::Migration[5.1]
def change
add_column :users, :coins, :integer
end
end
|
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
##################
# CentOS nodes #
##################
# Ansible-node101
config.vm.define "ansible-node101" do |cfg|
cfg.vm.box = "centos/7"
cfg.vm.provider "virtualbox" do |vb|
vb.name = "Ansible-Node101"
end
... |
class RenameArtistToCreative < ActiveRecord::Migration
def change
rename_table :artists, :creatives
rename_column :categorizings, :artist_id, :creative_id
rename_column :artworks, :artist_id, :creative_id
rename_column :videos, :artist_id, :creative_id
end
end
|
#encoding:utf-8
module Deepspace
module WeaponType
class Type
attr_reader :power, :name
def initialize(pow, s)
@power = pow
@name = s
end
def to_s
"#{@name}, Power #{@power}"
end
end
LASER = Type.new(2.0, "LASER")
MISSILE = ... |
class AddIndexToChats < ActiveRecord::Migration
def change
add_index :chat_room_users, [:user_id, :chat_room_id], unique: true
add_index :chat_message_reads, [:user_id, :chat_message_id], unique: true
end
end
|
class CollegesController < ApplicationController
def new
build_college
end
def create
build_college
save_college or render(:new)
end
def activate
load_college_by_token
process_college_activation
end
private
def load_college_by_token
@college ||= college_scope.find_by acti... |
FactoryBot.define do
factory :recommended_search do
lowest_cost { false }
highest_cost_benefit { false }
lower_weight { false }
lower_size { false }
end
end
|
FactoryGirl.define do
factory :document do
name 'A method of blah'
url 'http://foo.com'
before(:create) do |document|
user = FactoryGirl.create(:user, email: "document_user_#{Time.now.to_i + rand(10000)}@foo.com")
document.user_id = user.id
end
end
end
|
class ProjectsController < ApplicationController
before_action :authenticate_user!
def index
@projects = Project.all
end
def create
project = Project.new(project_params)
if project.save
RecentEvent.create( user: current_user, parent_obj: project, content: "created the project <a href='/proj... |
require 'rails_helper'
RSpec.describe User do
describe "following and unfollowing other users" do
let(:john) {create(:user, username: "John Doe")}
let(:solo) {create(:user, username: "Solo User")}
it "add relationships between the other users" do
john.follow(solo)
expect(john.following?(s... |
class Provider < ActiveRecord::Base
belongs_to :location
has_many :competencies
has_many :assessments, through: :competencies
has_many :networks
has_many :insurances, through: :networks
has_many :targets
has_many :age_groups, through: :targets
attr_accessor :zip_code, :distance
validates :name, :pro... |
# frozen_string_literal: true
# Loads data from Facebook group to database
class UpdateEventFromKKTIX
extend Dry::Monads::Either::Mixin
extend Dry::Container::Mixin
register :find_event, lambda { |params|
event_id = params[:id]
event = Event.find(id: event_id)
if event
Right(event)
else
... |
require 'rails_helper'
RSpec.describe UserProfile, type: :model do
describe 'Signup Page' do
context 'Password with' do
it 'Only digits' do
@user = FactoryGirl.build(:user_profile, password: "12345678")
@user.valid?
expect(@user.errors.messages[:password]).to include(... |
class AddCpaPeriod < ActiveRecord::Migration
def change
add_column :menus, :cpa_period, :integer
end
end
|
class SoftwareBinder::CLI
@@last_category_search = []
def call
puts "Welcome to Software Binder!"
load_categories
list_categories
list_softwares
reset?
end
def load_categories
self.class.last_category_search.clear
SoftwareBinder::Software.reset
SoftwareBinder::Category.reset
... |
class Hamming
VERSION = 2
def self.compute(str_a, str_b)
raise ArgumentError if str_a.length != str_b.length
str_a.chars.each_index.count { |ind| str_a[ind] != str_b[ind] }
end
end
|
require 'rails_helper'
feature 'non-admin cannot access user index' do
before(:each) do
User.create(username: "notanadmin", password: "password1234", email: "notanadmin@gmail.com")
visit new_user_session_path
fill_in 'Email', with: "notanadmin@gmail.com"
fill_in 'Password', with: "password1234"
... |
#
# Cookbook Name:: practicingruby
# Recipe:: postgresql
#
# Installs PostgreSQL and creates database
#
db = node["practicingruby"]["database"]
# Install PostgreSQL server if database is local
include_recipe "postgresql::server" if db["host"] == "localhost"
# Install PostgreSQL client
include_recipe "postgresql::cli... |
Pod::Spec.new do |s|
s.name = "NotifeeCore"
s.version = "1.0.0"
s.description = "NotifeeCore"
s.summary = <<-DESC
NotifeeCore module - podspec
DESC
s.homepage = "https://notifee.app"
s.license ... |
class Piece < ActiveRecord::Base
belongs_to :master_piece, :foreign_key => :piece_id
belongs_to :play
belongs_to :user, :foreign_key => :owner
validate :owner, :presence => true
validate :posx, :presence => true
validate :posy, :presence => true
validate :piece_id, :presence => true
validate :play_id, ... |
Website::Application.routes.draw do
mount Public::Engine => '/'
end
|
#
# Author:: Jörgen Brandt <joergen.brandt@onlinehome.de>
# Cookbook:: chef-cuneiform
# Recipe:: cre
#
# Copyright:: 2015-2018 Jörgen Brandt
#
# 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 Licens... |
class PagesController < ApplicationController
expose(:users){User.all.order(:id)}
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.