text stringlengths 10 2.61M |
|---|
# frozen_string_literal: true
require 'stannum/rspec/match_errors'
require 'support/contracts/manufacturer_contract'
require 'support/entities/factory'
require 'support/entities/gadget'
require 'support/entities/manufacturer'
# @note Integration spec for Stannum::Contract.
RSpec.describe Spec::ManufacturerContract d... |
class BusinessesController < ApplicationController
skip_before_filter :authorize, :only => [:index, :search, :show, :locations, :business_names, :send_to_phone]
before_filter :find_business_by_id, :only => [:show, :edit, :send_to_phone, :update, :destroy,
:add_favorite,... |
class Grid
def initialize
end
x_axys = %w{a b c d e f g h i j}
y_axys = (1..10).to_a.map {|y| y.to_s}
x_axys.each do |x|
y_axys.each do |y|
define_method((x+y).to_sym) do
if instance_variable_get("@#{x + y}")
instance_variable_get("@#{x + y}")
else
instance_vari... |
class FacebookerQueueWorker
def initialize
# Load the facebooker_parser_patch to disable post-processing
# TODO: Re-enable facebooker's parsing and allow the developer to send a string of Ruby to evaluate against the result
# Unfortunately, this will involve some reworking of Facebooker::BatchRun
# be... |
class Like < ActiveRecord::Base
belongs_to :user
belongs_to :product, counter_cache: true
validates :user_id, uniqueness: { scope: :product_id }
after_create :notify_product_owner
def as_json options={}
{}
end
private
def notify_product_owner
product.user.notifications.create! from_id: user... |
class QuestionsTrial < ActiveRecord::Base
belongs_to :question
belongs_to :trial
end
|
require File.dirname(__FILE__) + '/../../spec_helper'
ruby_version_is ""..."1.9" do
require 'ping'
describe "Ping.pingecho" do
it "responds to pingecho method" do
Ping.should respond_to(:pingecho)
end
it "pings a host using the correct number of arguments" do
Ping.pingecho('127.0.0.1'... |
require 'rails_helper'
describe "products/index" do
before(:each) { assign(:products, create_list(:product, 2)) }
it "renders a list of products" do
render
assert_select "tr>td", text: "Product title".to_s, count: 2
assert_select "tr>td", text: "Product description".to_s, count: 2
end
end
|
require 'rails_helper'
feature "adds a character" do
# Acceptance Criteria:
# * I can access a form to add a character on a TV show's page
# * I must specify the character's name and the actor's name
# * I can optionally provide a description
# * If I do not provide the required information, I receive an error message... |
class RenameBoleto < ActiveRecord::Migration
def self.up
rename_table :spree_boletos, :spree_boleto_docs
end
def self.down
rename_table :spree_boleto_docs, :spree_boletos
end
end
|
class CreateRelatedResources < ActiveRecord::Migration[5.2]
def up
create_table :related_resources do |t|
t.integer :resources_category_id
t.string :title
t.text :content
t.belongs_to :resources_category, index: true
t.string :url
t.timestamps
end
end
def down
dro... |
#!/usr/bin/env ruby
require 'json'
require_relative 'anagram_client'
require 'test/unit'
# capture ARGV before TestUnit Autorunner clobbers it
class TestCases < Test::Unit::TestCase
# runs before each test
def setup
@client = AnagramClient.new(ARGV)
# add words to the dictionary
@client.post('/word... |
class Category < ApplicationRecord
has_many :category_products
has_many :products, through: :category_products
validates :name, presence: true, uniqueness: true
end
|
module Escpos
module ImageProcessors
class Base
attr_reader :image, :options
def initialize(image_or_path, options = {})
@options = options
assert_options!
end
# Require correct dimensions if auto resizing is not enabled
def assert_dimensions_multiple_of_8!
... |
# frozen_string_literal: true
class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :set_locale
def set_locale
I18n.locale = params[:locale] || extract_locale_from_header || I18n.default_locale
end
def default_url_optio... |
# frozen_string_literal: true
class SearchResult < SitePrism::Section
element :title, 'span.title'
element :description, 'span.description'
def cell_value=(value)
execute_script(
"document.getElementById('first_search_result').children[0].innerHTML = '#{value}'"
)
end
def cell_value
evalu... |
# frozen_string_literal: true
ADVANCED_SEARCH_TESTING_1 = {
"id": "1",
"abstract_tesim": ["Incomplete at beginning and end.",
"The tale of Sindbād and his princely pupil, in colloquial Arabic."],
"creator_ssim": ["Me and Frederick"],
"creator_tesim": ["Me and Frederick"],
"alternativeTit... |
class JobOffering < ApplicationRecord
belongs_to :company
belongs_to :job
end
|
def get_letter_grade(integer)
case integer
when 90..100 then 'A'
when 80..89 then 'B'
when 70..79 then 'C'
when 60..69 then 'D'
else 'F'
end
end
def shortest_string(array)
array.sort_by(&:length).first
end
### Don't touch anything below this line ###
p "Fetch Letter Grade: You should have 2 true... |
require 'rails_helper'
RSpec.describe Game::StartSingle, type: :service do
subject(:service) { described_class }
it "creates a single game for the user" do
user = double(User)
allow(user).to receive(:can_create_game?).and_return(true)
expect(user).to receive(:create_single_game!)
service.call(u... |
require 'CSV'
require 'bigdecimal'
require 'time'
class InvoiceItem
attr_reader :id,
:item_id,
:invoice_id,
:unit_price,
:quantity,
:created_at,
:updated_at
def initialize(item_data, repo)
@id = item_data[:id].to_i
@item_i... |
class TransactionProduct < ActiveRecord::Base
belongs_to :product
belongs_to :order, class_name: "Transaction"
end
|
class AddForeignIdColumnToDislikes < ActiveRecord::Migration[5.0]
def change
add_reference :dislikes, :dislikers, foreign_key: true
end
end
|
class MoneyRenderer < ResourceRenderer::AttributeRenderer::Base
def display(attribute_name, label, options = {}, &block)
options.reverse_merge!(format: :long)
format = options.delete(:format)
money = value_for_attribute(attribute_name)
"#{h.humanized_money(money)} #{money.currency}".html_safe
... |
require 'formula'
class Exenv < Formula
homepage 'https://github.com/mururu/exenv'
url 'https://github.com/mururu/exenv/archive/v0.1.0.tar.gz'
sha1 '0984b6c260e42d750c8df68c8f48c19a90dc5db9'
head 'https://github.com/mururu/exenv.git'
def install
inreplace 'libexec/exenv', '/usr/local', HOMEBREW_PREFIX
... |
module MigrationComments::ActiveRecord::ConnectionAdapters
module Table
def change_comment(column_name, comment_text)
@base.set_column_comment(_table_name, column_name, comment_text)
end
def change_table_comment(comment_text)
@base.set_table_comment(_table_name, comment_text)
end
alia... |
RSpec.shared_context "tag", shared_context: :metadata do
let(:tag_json) { file_fixture("tag.json").read }
let(:tags_json) { file_fixture("tags.json").read }
let(:tag) { JSON.parse(tag_json) }
end |
require 'rails_helper'
RSpec.describe Project, type: :model do
before(:all) do
@user = User.first || create(:user)
@category = Category.first || create(:category, user_id: @user.id)
@project = Project.first ||
create(:project, user_id: @user.id, category_id: @category.id)
end
it "is valid with... |
class EasySchedulerTaskInfo < ActiveRecord::Base
self.table_name = 'easy_scheduler_tasks'
STATUS_INITIALIZED = 1
STATUS_PLANNED = 2
STATUS_RUNNING = 3
STATUS_ENDED_FAILED = 4
STATUS_ENDED_OK = 5
def self.find_unfinished(page_url_ident = nil)
find(:first, :conditions => {:page_url_iden... |
class Band < ActiveRecord::Base
has_many :venues, through: :shows
validates(:name, {:presence => true})
validates(:genre, {:presence => true})
before_save :capitalize_name, :capitalize_genre
private
define_method(:capitalize_name) do
name = self.name
name_split = name.split
name_spli... |
class GmpointAddColumnsToLands < ActiveRecord::Migration
def change
add_column :lands, :location_latitude, :float
add_column :lands, :location_longitude, :float
add_column :lands, :location_address, :string
end
end
|
RSpec.describe 'Categories', type: :request do
describe 'GET /tag/画像.html' do
describe 'contents' do
it 'renders' do
get '/tag/%E7%94%BB%E5%83%8F.html'
expected = (Rails.root + 'spec/fixtures/views/画像.html').read
got = response.body.split("\n")
expected.split("\n").each_wit... |
module Shadowsocks
class Listener < ::Shadowsocks::Connection
attr_accessor :stage, :remote_addr, :remote_port, :addr_to_send, :cached_pieces,
:header_length, :connector, :config, :ip_detector
def receive_data data
data_handler data
outbound_scheduler if connector
end
d... |
# frozen_string_literal: true
# rubocop:todo all
# Copyright (C) 2020 MongoDB Inc.
#
# 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... |
require_relative 'Hang-Woman2'
require_relative 'utils'
class Runner
def initialize
run
end
def get_user_input
puts "Enter a letter or write solve and guess the puzzle."
user_input = gets.chomp
user_input.downcase!
if user_input.include? "solve"
@game.solver(user_input)
elsif user... |
class FoodsController < ApplicationController
def index
@foods = Food.all
end
def soup
@soups = Food.sort_by(params[:sort_by], "soup").paginate(page: params[:page], per_page: 3)
end
def salad
@salads = Food.sort_by(params[:sort_by], "salad").paginate(page: params[:page], per_page: 3)
end
d... |
class ApiWorker
include Sidekiq::Worker
def perform(domain_id)
domain = Domain.find(domain_id)
hostname = domain[:hostname]
# steps to grab origin_ip_address
dns = Dnsruby::Resolver.new
result = dns.query(hostname)
request = result.answer.last.rdata_to_string
domain.update_attribute(:o... |
require 'test_helper'
class UsersEditTest < ActionDispatch::IntegrationTest
def setup
@user = users(:drew)
end
test "return user show view when user is activated" do
get user_path(@user)
assert_template 'users/show'
end
test "return home page when user is not activated" do
@user.activated ... |
require 'rails_helper'
RSpec.describe PopulationsController, type: :controller do
render_views
describe "GET #index" do
it "returns http success" do
get :index
expect(response).to have_http_status(:success)
end
end
describe "GET #show" do
it "returns http success" do
get :show, ... |
module RailsAdminNestable
class Engine < ::Rails::Engine
initializer "RailsAdminNestable precompile hook", group: :all do |app|
app.config.assets.precompile += %w(rails_admin/rails_admin_nestable.js rails_admin/jquery.nestable.js rails_admin/rails_admin_nestable.css)
end
initializer 'Include Rails... |
class Router
def initialize(controller)
@controller = controller
@running = true
end
def run
puts ' -- 👩🍳👨🍳 My CookBook 👩🍳👨🍳 --'
while @running
display_tasks
action = gets.chomp.to_i
print `clear`
route_action(action)
puts ''
puts '----------------... |
class Benefit < ActiveRecord::Base
mount_uploader :photo, AvatarUploader
belongs_to :benefit_type
has_many :accompanimentbenefits
has_many :articlebenefits
has_many :benefitcoupons
has_many :accompaniments, through: :accompanimentbenefits
has_many :articles, through: :articlebenefits
has_man... |
class RemoveCallLetters < ActiveRecord::Migration[4.2]
def change
remove_column :shows, :call_letters, :string
end
end
|
module PostToS3
module ViewHelpers
def s3_upload_form_for(upload, &block)
open_form = <<HTML
<form action="#{upload.bucket_url}" enctype="multipart/form-data" method="post">
<div>
<input name="key" type="hidden" value="#{upload.key}" />
<input name="AWSAccessKeyId" type="hidden" value="#{upload.access_key_i... |
require "./test/test_helper"
class GameRepoTest < MiniTest::Test
def setup
@game_repo = GameRepo.new('./data/game_fixture.csv')
end
def test_game_repo_exists
assert_instance_of GameRepo, @game_repo
end
def test_game_repo_has_games
assert_equal 30, @game_repo.repo.count
assert_equal Array, @... |
class Client < ActiveRecord::Base
belongs_to :company
has_many :invoices, dependent: :destroy
has_many :company_invoices, through: :invoices, source: :company
has_secure_password
email_regex = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]+)\z/i
validates :name, :address_line1, :city, :state, :zip, :phone, :company_... |
# Copyright 2010 Mark Logic, Inc.
#
# 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 required by applicable law or agree... |
require 'rails_helper'
RSpec.describe Item, type: :model do
before do
@item = FactoryBot.build(:item)
end
describe '出品する商品の保存' do
context '商品が保存されるとき' do
it '全て入力されていれば保存される' do
expect(@item).to be_valid
end
end
context '商品が保存されないとき' do
it 'imageが空だと保存されない' do
... |
class AddExtColumnToReports < ActiveRecord::Migration
def change
add_column :reports, :corp_id, :integer,index: true
add_column :reports, :begin_at, :timestamp
add_column :reports, :end_at, :timestamp
add_column :reports, :license_number, :string
add_column :reports, :mobile, :string
end
end
|
require 'spec_helper'
describe Comment do
it { should belong_to :user }
it { should belong_to :app }
let(:blanks){[nil, '']}
it { should have_content(:body).when('This app is pretty sweet', 'lets see it come to life!') }
it { should_not have_content(:body).when(*blanks) }
end
|
class Bank
def self.print_statement(account)
print_headings
print_transactions(account)
end
def self.print_headings
puts 'date || credit || debit || balance'
end
def self.print_transactions(account)
transactions = account.transaction_history.reverse
transactions.each do |transact|
... |
json.array!(@agencies) do |agency|
json.extract! agency, :id, :name, :description, :grade, :tag_list
end
|
class Stop < ActiveRecord::Base
has_many :direction_stop, dependent: :destroy
end
|
require "nokogiri"
module Bliss
class ParserMachine < Nokogiri::XML::SAX::Document
def initialize(parser)
@depth = []
# @settings = {} # downcased
@root = nil
@nodes = {}
@current_node = {}
@on_root = nil
@on_tag_open = {}
@on_tag_close = {}
#@constraints ... |
class Deposit < ActiveRecord::Base
attr_accessible :quality, :weight, :farm_id, :cp_id, :weighed_at, :possible_duplicate
belongs_to :farm
belongs_to :cp
before_create :check_for_erroneous_input
validates_presence_of :weight, :weighed_at, :cp, :farm
validates :weight, :numericality => {:greater_than_or_equa... |
require 'generators/seed_migrator/helper'
# Generator to install tmx data update in a new rails system.
class SeedMigrator::InstallGenerator < Rails::Generators::Base
include Generators::SeedMigrator::Helper
source_root File.expand_path('../templates', __FILE__)
# Create the initializer file with default optio... |
class DrinkValidator < ActiveModel::Validator
def validate(record)
drink_type = record.drink_type.to_sym
record.errors[:drink_type] = "Invalid drink type" and return false unless Drink::DRINK_TYPES.include? drink_type
needed_aspects = Drink::DRINK_TYPES[drink_type]
needed_aspects.each do |aspect|
... |
require 'io/console'
require_relative 'gameplay'
require_relative 'board_status'
require_relative 'interface'
require_relative 'reset'
require_relative 'exit_on_escape'
require_relative 'command_options'
class Game
attr_reader :gameplay
attr_reader :board_status
attr_reader :interface
attr_reader :reset
at... |
class TipoPergunta < ActiveRecord::Base
has_many :perguntas
end
|
require './test/minitest_helper'
class DispatchmeOauthTest < MiniTest::Test
def test_that_a_token_is_returned
assert_kind_of Dispatchme::AccessToken, @@access_token
refute_nil @@access_token.token
refute_nil @@access_token.expires_in
refute_nil @@access_token.created_at
end
end |
define :rails_chores, :task => 'chores' do
namespace = params[:name]
taskname = params[:task]
rakefile = "#{@node[:rails][:deploy_to]}/current/Rakefile"
logdir = "#{@node[:rails][:deploy_to]}/shared/log/cron"
cron_user = "#{@node[:rails][:user]}"
directory logdir do
owner cron_user
group "sysadmin"
re... |
require_relative '../lib/discourse_segment/common'
module Jobs
class SegmentAfterCreateBookmark < Jobs::Base
def execute(args)
segment = DiscourseSegment::Common.connect
post = Post.find_by(id: args[:post_id])
segment.track(
user_id: args[:user_id],
event: 'Post Bookmarked',
... |
class FayeClientsController < ApplicationController
before_action :load_faye_client
def update
@faye_client.user_id = current_user.id
@faye_client.status = params[:status]
@faye_client.client_type = params[:client_type]
@faye_client.idle_duration = params[:idle_duration]
old_status = current_... |
require_relative "players"
require_relative "word_bank"
require_relative "game"
class Runner
def initialize
@word_bank = WordBank.new
@game = Game.new(@word_bank.get_word)
@players = Players.new
get_player_names
@players.shuffle
end
def is_player_count_valid?(number)
number.between?(1,5)... |
class CreatePeople < ActiveRecord::Migration
def change
create_table :people do |t|
t.string :first_name
t.string :last_name
t.date :birthday
t.string :email
t.string :password
t.string :phone
t.string :address
t.string :city
t.string :state
t.integer :p... |
class ChangeUserTable < ActiveRecord::Migration
def change
add_column :users, :password, :string
remove_column :users, :icon, :stirng
end
end
|
class Notifier < ApplicationMailer
def notify(evaluation, user, subject)
@evaluation = evaluation
mail(from: "evaluation@think-bridge.com", to: user.email, subject: subject, delivery_method_options: Rails.application.secrets.evaluation_smtp)
end
def new_project(project, email, user)
@project = projec... |
require 'spec/spec_helper'
require 'archive'
describe "WorksNewPage" do
before do
@fandom = "Supernatural"
@rating = "Not Rated"
@content = "Bad things happen, etc."
@character = "Dean Winchester"
@pairing = "Dean Winchester/Sam Winchester"
@title1 = "Wendigo"
@title2 = "Bad Day At Bl... |
require_relative 'everything'
require 'sqlite3'
require 'singleton'
class QuestionLikes
attr_accessor :user_id, :question_id
def self.all
data = QuestionDBConnection.instance.execute("SELECT * FROM question_likes")
data.map { |datum| QuestionLikes.new(datum) }
end
def self.find_by_id(id)
question_... |
class UpdateSmoochBotSettings < ActiveRecord::Migration[4.2]
def change
bot = BotUser.smooch_user
unless bot.nil?
TeamBotInstallation.where(user_id: bot.id).each do |tbi|
settings = tbi.settings || {}
bot.get_settings.each do |setting|
s = setting.with_indifferent_access
... |
require 'cinch'
module AIBot::Protocol::IRC
include AIBot::Protocol
##
# The IRC protocol.
class IRC < Protocol
attr_reader :threads, :bots
def initialize(configuration)
super configuration
@threads = []
@bots = []
end
##
# Starts the IRC protocol.
def start(aibot)
... |
module Monsove
class Configuration
include ActiveSupport::Configurable
config_accessor :storage
# For scp
config_accessor :server
config_accessor :username
config_accessor :ssh_key
# For fog based
config_accessor :access_id
config_accessor :secret_key
# General
config_a... |
module RSence
module ArgvUtil
# Main argument parser for the save command. Sends the USR1 POSIX signal to the process, if running.
def parse_save_argv
init_args
expect_option = false
option_name = false
if @argv.length >= 2
@argv[1..-1].each_with_index do |arg,i|
if expect_option
... |
require 'test_helper'
describe UsersController do
include Devise::TestHelpers
let(:archer) { users(:archer) }
let(:lana) { users(:lana) }
it 'should get index' do
get :index
assert_response :success
end
it 'should get show' do
get :show, id: archer
assert_response :success
end
descr... |
class CreateAnswerSpaces < ActiveRecord::Migration[5.2]
def change
create_table :answer_spaces do |t|
t.string :category
t.string :user_answer
t.integer :answer_column_id
t.timestamps
end
end
end
|
class Log
def initialize(url, ip)
@url = url
@ip = ip
end
attr_reader :url, :ip
end
|
class PointsTransaction < DomainModel
belongs_to :points_user
has_end_user :end_user_id
has_end_user :admin_user_id
validates_presence_of :amount
validates_presence_of :points_user
before_create :set_defaults
def self.by_user(user)
self.where(:end_user_id => user.id)
end
def set_defaults
... |
# frozen_string_literal: true
require "application_system_test_case"
class ReportsTest < ApplicationSystemTestCase
setup do
login_user(user_email: "user_1@mail", password: "111111")
end
test "日報一覧ページを表示できる" do
visit reports_url
assert_selector "h1", text: I18n.t("reports.index.index")
end
test... |
# A work entry, belonging to a user & task
# Has a duration in seconds for work entries
class WorkLog < ActiveRecord::Base
acts_as_ferret({ :fields => ['body', 'company_id', 'project_id'], :remote => true })
belongs_to :user
belongs_to :company
belongs_to :project
belongs_to :customer
belongs_to :task
... |
class ChampionsController < ApplicationController
def index
@champions = Champion.all
render json: @champions
end
end
|
# -*- encoding : utf-8 -*-
module Retailigence #:nodoc:
# Configure Retailigence with your credentials.
#
# === Example
# Retailigence.configure do |config|
# config.api_key = 'yourapikeyhere'
# config.production = false # Use the test route
# end
class Configuration
# The API key issued... |
class Sessions < ActiveRecord::Migration[6.1]
def change
create_sessions
add_column_to_pair_users
end
def create_sessions
create_table :sessions do |t|
t.timestamps
end
end
def add_column_to_pair_users
add_column :pair_users, :session_id, :integer
end
end
|
require "#{File.expand_path(File.dirname(__FILE__))}/helper.rb"
class TestElseWithCounters < Test::Unit::TestCase
def test_given_CONDITION_evaluates_to_true_ELSE_is_not_performed
else_proc = Proc.new{raise StandardError.new('You\'ll never catch me!') }
t = Class.new(TestClass) { storage_bucket :stars, :count... |
Rails.application.routes.draw do
# get 'departments/name:string'
root "students#index"
# get "students" => "students#index"
# get "students/:id" => "students#show", as: "student"
# delete "students/:id" => "students#destroy"
# get "students/:id/edit" => "students#edit", as: "edit_student"
# patch "studen... |
require 'spec_helper'
describe GildedRose do
describe "#update_quality" do
before do
@foo = Item.new("foo", 1, 1)
@brie = Item.new("Aged Brie", 1, 47)
@sulfuras = Item.new("Sulfuras, Hand of Ragnaros", 100, 49)
@ticket = Item.new("Backstage passes to a TAFKAL80ETC concert", 1, 40)
... |
require "application_system_test_case"
class WishesTest < ApplicationSystemTestCase
setup do
@wish = wishes(:one)
end
test "visiting the index" do
visit wishes_url
assert_selector "h1", text: "Wishes"
end
test "creating a Wish" do
visit wishes_url
click_on "New Wish"
fill_in "Budge... |
#!/usr/bin/env ruby
#
# Created on 2007-11-9.
# Copyright (c) 2007. All rights reserved.
begin
require 'rubygems'
rescue LoadError
# no rubygems to load, so we fail silently
end
require 'optparse'
OPTIONS = {
}
MANDATORY_OPTIONS = %w( )
parser = OptionParser.new do |opts|
opts.banner = <<BANNER
Usage: #{F... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
## When running `vagrant up` run it with the `--no-parallel` option.
## This ensures that the fuel_master comes up first
vm_box = 'yk0/ubuntu-xenial'
pxe_ip = '10.1.1.2'
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented be... |
class File
def self.which? cmd
dir = ENV['PATH'].split(':').find {|p| File.executable? File.join(p, cmd)}
File.join(dir, cmd) unless dir.nil?
end
end
|
require 'rails_helper'
describe User do
it 'is instantiable' do
expect{ user = User.new }.not_to raise_error
end
it 'defaults attributes to nil' do
user = User.new
expect(user.first_name).to be_nil
expect(user.last_name).to be_nil
expect(user.name).to be_nil
expect(user.email).to be_nil... |
require "spec_helper"
describe XSD::ElementsList do
before do
@xml = <<-XML
<xs:schema targetNamespace="http://www.example.com/common"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cm="http://www.example.com/common">
<xs:complexType name="Sequence">
<xs:sequence>
<xs:sequence minOccurs="0" max... |
require 'java'
java_import 'net.scapeemulator.game.model.player.interfaces.Interface'
java_import 'net.scapeemulator.game.model.player.skills.Skill'
LEVEL_UP_WINDOW = 741
SKILL_INFO_WINDOW = 499
AMOUNT_CHILD_BUTTONS = 15
CHILD_START_BUTTON = 10
FLASHING_ICON_VARBIT = 4729
MAIN_INFO_VARBIT = 3288
... |
class AddColumnsToApplicantActivities < ActiveRecord::Migration
def change
add_column :applicant_activities, :subject, :string
add_column :applicant_activities, :body, :text
end
end
|
# 正则表达式匹配
# 给定一个字符串 (s) 和一个字符模式 (p)。实现支持 '.' 和 '*' 的正则表达式匹配。
#
# '.' 匹配任意单个字符。
# '*' 匹配零个或多个前面的元素。
# 匹配应该覆盖整个字符串 (s) ,而不是部分字符串。
#
# 说明:
#
# s 可能为空,且只包含从 a-z 的小写字母。
# p 可能为空,且只包含从 a-z 的小写字母,以及字符 . 和 *。
# 示例 1:
#
# 输入:
# s = "aa"
# p = "a"
# 输出: false
# 解释: "a" 无法匹配 "aa" 整个字符串。
# 示例 2:
#
# 输入:
# s = "aa"
# p = "a*"
# 输出:... |
class Gallories::ProductsController < ApplicationController
def show
@product = Product.active.find(params[:id])
roomtype = @product.showroom_type # returns bedroom or livingroom root
showroom = current_user.send(roomtype.name.downcase.to_sym)
@has_product = showroom ? showroom.has_product?(@product... |
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable, :confirmable,
:recoverable, :rememberable, :trackable, :validatable
# Associations for User with Users_role and Role
has_many :users_roles
has_many :roles, through: :users_roles
# Associations for User with profile
h... |
# frozen_string_literal: true
module Types
MutationType = GraphQL::ObjectType.define do
name 'Mutation'
description 'Root query to mutate data'
field :createChallenge, function: ::Mutations::Create::Challenge.new
field :createCompletion, function: ::Mutations::Create::Completion.new
field :creat... |
class Galette < Formula
homepage "https://github.com/simon-frankau/galette"
head "https://github.com/simon-frankau/galette.git"
depends_on "rust" => :build
def install
system "cargo", "build", "--release", "--bin", "galette"
bin.install "target/release/galette"
end
end
|
Given(/^user logged in with new user name "([^"]*)" credentials$/) do |username|
@user_name=username
visit(LoginPage)
on(LoginPage) do |page|
DataMagic.load("account_combination.yml")
login_data = page.data_for(:account_combination)
password = login_data['password']
ssoid = login_data[username + "... |
class AddDefaultValueToEmail < ActiveRecord::Migration[6.0]
def change
change_column_default(:stores, :email, 'francisco.abalan@pjchile.com')
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.