text stringlengths 10 2.61M |
|---|
class ShowController < ApplicationController
require 'open-uri'
require 'nokogiri'
def index
@title = 'Официальный дилер ПАО "Автоваз" в Пятигорске АО Производственная Фирма "Автостар'
@keywords = 'Официальный дилер ПАО Автоваз, автосалон, станция технического обслуживания автомобилей, крупнейший автор... |
require_relative "../lib/game.rb"
RSpec.describe Knight do
describe "#team" do
it "gives the corresponding color" do
expect(WhiteKnight.new("e4").team).to eql("white")
expect(BlackKnight.new("e4").team).to eql("black")
end
end
describe "#show" do
it "prints out the corresponding piece" d... |
Rails.application.routes.draw do
default_url_options :host => "localhost"
get 'welcome/index'
devise_for :users
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root to: "home#index"
resources :contacts
get 'welcome/index'
end
|
# frozen_string_literal: true
module ApplicationHelper
def flash_messages_for(object)
render(partial: 'shared/flash_messages', locals: { object: object })
end
def present(model, presenter_class = nil)
klass = presenter_class || "#{model.class}Presenter".constantize
presenter = klass.new(model, self)... |
class UsersController < ApplicationController
before_filter :authenticate_user!, except: [:show, :locations]
def show
@user = User.find(params[:id])
@animals = @user.owned_animals.order(birth_date: :desc).page(params[:page])
end
def dashboard
@animals = current_user
.owned_animals
... |
require "rails_helper"
RSpec.describe HistoryQuery, :type => :model do
before :each do
@department_1 = Department.create!
@department_2 = Department.create!
@product_1 = Product.create!(code: 111, price: 10, department: @department_1, stock: 3)
@product_2 = Product.create!(code: 222, price: 20, depar... |
class BookingsController < ApplicationController
before_action :authenticate_user!
before_action :set_profile, only: [:show]
def index
policy_scope(Booking)
@bookings = current_user.bookings
authorize @bookings
@experiences = current_user.experiences
end
def show
@booking = Booking.find(... |
ActiveRecord::Schema.define(:version => 0) do
create_table :customers, :force => true do |t|
t.string :name
t.string :address_street
t.string :address_city
t.string :address_country
t.decimal :balance
t.decimal :amount
end
end
|
require 'socket'
module TChat
class UserConnection
attr_accessor :user, :socket
def initialize(user, users_manager, socket)
@user = user
@users_manager = users_manager
@socket = socket
end
def start
# The thread that handles a single client
Thread.start(@socket)... |
puts 'Enter the length of the room in meters:'
length = gets.chomp.to_f
puts 'Enter the width of the room in meters:'
width = gets.chomp.to_f
area = length * width
sqft = (area * 10.7639).round(2)
puts "The area of the room is #{area} square meters (#{sqft} square feet)."
# Second time through essentially identical.... |
class AddColumnTimesSeen < ActiveRecord::Migration
def change
add_column :performers, :times_seen, :integer
end
end
|
class CreateAssets < ActiveRecord::Migration[5.0]
def change
create_table :assets do |t|
t.integer :user_id
t.string :name
t.text :description
t.string :file
t.timestamps
end
end
def up
remove_column :assets, :name, :description
end
def down
add_column :file_uplo... |
require 'rails_helper'
RSpec.describe RegisteredApplication, type: :model do
let(:user) { FactoryGirl.create :user }
let(:registered_application) { FactoryGirl.create :registered_application }
it { is_expected.to belong_to(:user) }
describe "attributes" do
it "has appname and url attributes" do
exp... |
class FontWallpoet < Formula
head "https://github.com/google/fonts/raw/main/ofl/wallpoet/Wallpoet-Regular.ttf", verified: "github.com/google/fonts/"
desc "Wallpoet"
homepage "https://fonts.google.com/specimen/Wallpoet"
def install
(share/"fonts").install "Wallpoet-Regular.ttf"
end
test do
end
end
|
require_relative '../constants'
require_relative '../utils/encryptor'
module Itpkg
module LogService
module_function
def teamwork(user, project_id, link, text, task_id=nil, story_id=nil)
ProjectLog.create user:user, project_id:project_id, link:link, text:text, task_id:task_id, story_id:story_id, creat... |
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require 'daggregator/model'
describe Daggregator::Model::Serialization do
before(:each) do
class TestClass < Object
attr_accessor :id
include Daggregator::Model
def initialize(id=3)
@id = id
end
def pr... |
class Site::WelcomeController < SiteController
def index
@questions = Question.last_questions(params[:page])
@answered = AnsweredQuestion.where(user: current_user)
end
end
|
# frozen_string_literal: true
describe Zafira::Api::User::Create::RunOwnerParams do
let(:environment) { build(:environment) }
let(:params_builder) do
Zafira::Api::User::Create::RunOwnerParams.new(environment)
end
let(:expected_result) do
{
username: 'ci_username',
email: 'ci@zafira.com',
... |
# frozen_string_literal: true
require_relative 'game_input'
require_relative '../player/bot'
# Where the player decides the format of the game: Player vs. Player, Bot vs. Bot or Bot vs. Player.
class GameSetup
include GameInput
def query_message
<<~QUERY
Please, set how players are:
- 0 for bot
... |
class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
protect_from_forgery with: :exception
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up){|u| u.permit(:email, :password, :password_confirmation, :first_name, :la... |
class AlterColumnClientOgrn < ActiveRecord::Migration
def change
change_column :clients, :ogrn, :integer, :limit => 8
end
end |
# When done, submit this entire file to the autograder.
# Part 1
def sum arr
arr.sum
end
def max_2_sum arr
if arr.empty?
return 0
else
arr.sort.last(2).inject(:+)
end
end
def sum_to_n? arr, n
if arr.empty?
return false
else
arr.combination(2).any? { |a, b| a + b == n }
end
end
# Part ... |
# Think.rb
require 'rubygems'
require 'fileutils'
require 'zipruby'
require 'nokogiri'
require 'uri'
require 'net/http'
require 'socket'
require 'macaddr'
require 'open-uri'
def postForm(strUri, params)
uri = URI(strUri)
depth = 10
begin
while depth > 0
response = Net::HTTP.post_form(uri, param... |
feature "View Gsa18F procurement" do
scenario "requester can see procurement details" do
requester = create(:user, client_slug: "gsa18f")
procurement = create(:gsa18f_procurement, :with_steps, requester: requester, urgency: 10)
proposal = procurement.proposal
login_as(requester)
visit proposal_p... |
require 'test_helper'
describe O::VM do
before do
@vm = O::VM::Machine::create([:regname1, :regname2], {}, [])
end
it 'should parse an int' do
@vm.set_register_contents(:regname1, 1).must_equal true
@vm.get_register_contents(:regname1).must_equal 1
@vm.set_register_contents(:regname2, 2).must_e... |
require 'spec_helper'
describe "Trips" do
let!(:user) { User.create(:username => "User 1", :email => "user@example.com", :password => "hungry") }
let!(:trip1) { user.trips.create(:display_name => "Trip 1", :primary_location => "Anywhere", :start_date => Date.today, :end_date => Date.today + 3) }
let!(:trip2) { u... |
class UsersController < ApplicationController
before_action :set_q, only: [:index, :search]
def index
@users = User.all
@all_ranks = Note.find(Like.group(:note_id).order('count(note_id) desc').limit(3).pluck(:note_id))
end
def show
@user = User.find(params[:id])
end
def search
@results =... |
require 'csv'
namespace :kfc do
# ----------------------------------------------------------------------------
#
# Restaurants, etc.
#
# ----------------------------------------------------------------------------
desc 'Import Stores, DMA, Franchise and Franchisee data from CSV'
task :import_data => ... |
module Tokenable
extend ActiveSupport::Concern
module ClassMethods
def has_secure_token(attribute = :token)
define_method("regenerate_#{attribute}") do
update_attributes(attribute => self.class.generate_token)
end
before_create { send("#{attribute}=", self.class.generate_token) }
... |
require 'spec_helper'
describe ArgyleHelper do
before(:each) do
Argyle.configuration.key = 'key'
@options = {form_id: 'ohai', name: 'ohai', action: plaid_index_path, token: 'myToken', webhook: 'http://myhook.com'}
end
describe "#plaid_link" do
it "responds to plaid_link" do
expect(helper).to r... |
require './test/test_helper'
class NodeTest < Minitest::Test
def setup
@node = Node.new(:blue)
end
def test_it_knows_its_own_data
assert_equal :blue, @node.data
end
def test_it_knows_whether_it_has_a_link
assert_equal nil, @node.link
node1 = Node.new(:yellow)
node1.link = @node
as... |
require "test_helper"
require "loyalty_connect"
module LoyaltyConnect
describe "OauthWrapper" do
it "should obtain a token via password workflow of oauth2" do
configuration = {
'client_id' => "client_id",
'client_secret' => "client_secret",
'server' => "server",
'... |
RSpec.describe "Experian UI" do
it "navigates to Experian HomePage", :smoke => true, :regression => true do |example|
@app.home.businessServices.click
@app.home.personalServices.click
end
it "clicks Business Services panel", :smoke => true, :regression => true do |example|
@app.home.businessServic... |
class CreateRepositoryCoders < ActiveRecord::Migration[5.0]
def change
create_table :repository_coders do |t|
t.integer :repository_id
t.integer :coder_id
t.timestamps
end
end
end
|
# encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
require 'spec_helper'
describe TwitterCldr::Parsers::NumberParser do
let(:separators) { ["\\.", ","] }
before(:each) do
@parser = described_class.new(:es)
end
describe "#group_separator" do
it "returns the ... |
if Vagrant::VERSION < "2.0.0"
$stderr.puts "Must redirect to new repository for old Vagrant versions"
Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
end
Vagrant.configure("2") do |config|
config.vm.define :testenv1 do |testenv1|
testenv1.vm.box = "ubuntu/xenial64"
testenv1.vm.network :pr... |
# frozen_string_literal: true
module Decidim
module Opinions
OpinionsType = GraphQL::ObjectType.define do
interfaces [-> { Decidim::Core::ComponentInterface }]
name "Opinions"
description "A opinions component of a participatory space."
connection :opinions,
type: Opini... |
def hipsterfy(word)
vowels = 'aeiou'
i = word.length - 1
while i > 0
char = word[i]
return word[0...i] + word[i+1..-1] if vowels.include?(char)
i -= 1
end
word
end
def vowel_counts(str)
count = Hash.new(0)
vowels = 'aeiou'
str.each_char do |char|
count[ch... |
module MRuby
module Bindings
module Hooks
def self.gem_name
'mruby-curses'
end
def self.module_name
'Curses'
end
end
end
end
|
class Author
attr_accessor :name
@count = 0
@instances = []
def initialize(name)
@name = name
@books = {}
@count += 1
@instances << self
end
def self.all
@instances.inspect
end
def books
@books
end
def write_book(title, word_count)
book = Book.new(:title, :word_count... |
#Code by Ray Alfano
#Copyright Ray Alfano 2014
#Class to illustrate a simple hash table, printing keys and values, and manipulating values
class HashExample
#Define a simple hash table
debtsTable={'JamesMoneyOwed' => 30, 'TomMoneyOwed' => 20, 'SteveMoneyOwed' => 10, 'Client' => 400}
#Print each key and value
... |
# Given integers a and b, determine whether the following pseudocode results in an infinite loop
# while a is not equal to b do
# increase a by 1
# decrease b by 1
# Assume that the program is executed on a virtual machine which can store arbitrary long numbers and execute forever.
def infinite_process?(a, b)
(a... |
# encoding: utf-8
require 'spec_helper'
module Ktl
describe MigrationPlan do
let :plan do
described_class.new(zk_client, old_brokers, new_brokers).generate
end
let :zk_client do
double(:zk_client)
end
let :old_brokers do
[0]
end
let :new_brokers do
[1]
end... |
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
include Zheng
describe Zheng::Parameters do
describe "parameter e" do
it "should be 0.014" do
Parameters::E.should == 0.014
end
end
describe "parameter a" do
it "should be 200 for rating 100" do
Parameters.A(100).should == 20... |
class UsersController < ApplicationController
def index
@users = User.all
end
def new
@user = User.new
end
def show
@user = User.find_by(id: params[:id])
if @user.nil?
head :not_found
end
@votes = Vote.where(user: @user)
end
end
|
# == Schema Information
#
# Table name: kits
#
# id :bigint not null, primary key
# active :boolean default(TRUE)
# name :string not null
# value_in_cents :integer default(0)
# visible_to_partners :boolean default(TRUE... |
class Garage
DEFAULT_CAPACITY = 20
def initialize(bikes = [], options = {})
@capacity = options.fetch(:capacity, DEFAULT_CAPACITY)
@bikes = bikes
end
def bike_count
@bikes.count
end
def dock(bike)
raise "Garage is full." if full?
@bikes << bike
end
def full?
bike_count == @capacity
end
de... |
class CreateBookings < ActiveRecord::Migration[5.0]
def change
create_table :bookings do |t|
t.references :family, references: :user
t.references :au_pair, references: :user
t.datetime :starts_on
t.datetime :ends_on
t.timestamps
end
end
end
|
module Charts
class QueryPlantDistributionByRoom
prepend SimpleCommand
def initialize(current_user, args = {})
@user = current_user
@args = args
@facility_id = args[:facility_id].split(',')
end
def call
if resource_shared?
strains = Inventory::FacilityStrain.in(facili... |
class Susanoo::PagesController < ApplicationController
include Concerns::Susanoo::PagesController
before_action :reject_event_page, only: %i(show edit new create)
# イベントに関するページを対象としているものは、viewを差し替える
# NOTE: インデックスページに関しては、通常ページと同じように編集できるようにする
def reject_event_page
template = "event_calendar/susanoo/pag... |
module Choshi::Decoratable
class DecoratorNotFound < ::StandardError
end
end
|
class Aquarium # a simple form of composition
attr_reader :fish
def initalize(args)
@fish = args[:fish]
end
end
class Fish
attr_reader :age, :stomach
def initialize(args)
@stomach = args.fetch(:stomach, [ ])
@age = args.fetch(:age, 0)
@type = args[:type]
end
# duplicate behaviors Module an... |
# frozen_string_literal: true
class ItemPolicy < ApplicationPolicy
class Scope < Scope
def readable
initial_scope = default_scope scope
permissions_scope = user.permissions.read_right
analyze initial_scope, permissions_scope
end
def writeable
initial_scope = Item.none
... |
module IPay
module Util
ESCAPE_CHARS = { '&' => '&', '"' => '"', '<' => '<', '>' => '>', "'" => ''' }
class << self
def escape(string)
string.to_s.gsub(Regexp.new(ESCAPE_CHARS.keys.join('|')), ESCAPE_CHARS)
end
def unescape(string)
stri... |
module Fog
module Compute
class Brkt
class Real
def list_load_balancers
request(
:expects => [200],
:path => "v1/api/config/loadbalancer"
)
end
end
class Mock
def list_load_balancers
response = Excon::Response.new
... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Partner, type: :model do
describe 'validations' do
subject { build(:partner) }
it { is_expected.to validate_uniqueness_of :name }
it { is_expected.to validate_presence_of :name }
end
it { have_many :addresses }
end
|
class StoreThermostatReading
include Interactor
def call
@token = Reading.set_token
reading = Reading.new(build_params)
if reading.valid?
StoreReadingWorker.perform_async(build_params.to_h)
context.reading = reading
else
context.fail!(reading: reading)
end
end
private
... |
class EnumInput < SimpleForm::Inputs::CollectionSelectInput
def collection
object.class.send(attribute_name).send(:options)
end
end
|
class AddGoogleCalIdToEvents < ActiveRecord::Migration[5.0]
def change
add_column :events, :gcalID, :string
end
end
|
class CreateCustomers < ActiveRecord::Migration
def change
create_table :customers do |t|
t.string :account_number
t.string :reference_person
t.integer :director_id
t.integer :partner_id
t.string :first_name
t.string :middle_name
t.string :last_name
t.string :phone1... |
module RemoteActionable
extend ActiveSupport::Concern
def delete
perform(:remote_delete, params[:category])
end
def ping
perform(:remote_ping, params[:category])
end
def transfer
perform(:remote_transfer, params[:category])
end
def update
perform(:remote_update, params[:category])
... |
class Spot < ActiveRecord::Base
belongs_to :user
validates :date, :time, :address, :floor, :section, :row, :spot, :note, :name, presence: true
end
|
##
# calculate pi based on random sampling of coordinates:
# GIVEN the known area of the unit circle in quadrant I is PI/4
# AND a number of samples NUMSAMPLES
# - NUMSAMPLES times, pick a random location in the unit square (0.0,0.0) to (1.0,1.0)
# - tally the coordinates inside the unit circle centered at (0.0,0.0)
#... |
class ShowMorePresenter < Blacklight::DocumentPresenter
# This class overrides some of the presenter methods from
# Blacklight::DocumentPresenter so that we can include a
# toggle to truncate and show/hide long descriptions.
def max_length
300
end
def render_index_field_value(field, options = {})
... |
class ThemeSerializer < ActiveModel::Serializer
attributes :id, :name, :color, :icon
end
|
require 'test/unit'
require 'soap/rpc/driver'
require 'hw_s.rb'
module SOAP
module HelloWorld
class TestHelloWorld < Test::Unit::TestCase
Port = 17171
def setup
@server = HelloWorldServer.new('hws', 'urn:hws', '0.0.0.0', Port)
@server.level = Logger::Severity::ERROR
@t = Thread.new {
Thread.c... |
class Importer < ApplicationRecord
# This is the file importer model
# Only one file at a time
has_one_attached :file
# One file could have many transactions
has_many :transactions
# The file needs to exist, can't parse without it
validates :file, presence: true
end
|
require 'moon-serializable/load'
require 'data_model/fields'
require 'data_model/fields_to_hash'
module Moon
# Moon::DataModel serves as the base for most structured data types in Moon
module DataModel
# Metal is a generic implementation of Moon::DataModel::Model
class Metal
include Fields
incl... |
require 'spec_helper'
require 'rails_helper'
feature 'adds a new game' do
scenario 'visitor requests a new game to be added' do
visit root_path
fill_in "Search Games", with: "Who's Your Daddy? 2"
click_on "Search"
click_on "Add a Game from IGDB"
fill_in "Search IGDB Database", with: "Who's Your D... |
require 'spec_helper'
describe ParticipantsController do
before(:each) do
Project.destroy_all
User.destroy_all
Participant.destroy_all
@user = Factory.create(:user)
@project = Factory.create(:project)
@user.projects << @project
sign_in @user
end
describe "GET 'index'" do
be... |
# --- Day 19: Medicine for Rudolph ---
# Rudolph the Red-Nosed Reindeer is sick! His nose isn't shining very brightly, and he needs medicine.
# Red-Nosed Reindeer biology isn't similar to regular reindeer biology; Rudolph is going to need custom-made medicine. Unfortunately, Red-Nosed Reindeer chemistry isn't similar... |
class Event < ApplicationRecord
belongs_to :user
has_many :responses, as: :postable, dependent: :destroy
mount_uploader :photo, PhotoUploader
end
|
require 'singleton'
require 'redis'
class DataStore
include Singleton
def initialize()
@redis = Redis.new(url: ENV["REDISTOGO_URL"])
end
def get(key)
return @redis.get(key)
end
def set(key, value)
@redis.set(key, value)
end
end |
require 'rails_helper'
RSpec.describe CategoryPolicy do
subject { CategoryPolicy.new(user, category) }
let(:category) { FactoryGirl.build :category }
context 'when logged in as admin' do
let(:user) { FactoryGirl.build :user, admin: true }
it { is_expected.to permit_action(:index) }
it { is_expected.... |
# -*- coding: utf-8 -*-
require 'spec_helper'
describe Mappie do
class Blog
attr_accessor :body, :category_id
include Mappie
mappie :category
def initialize(params={})
@body = params[:body]
@category_id = params[:category_id]
end
end
class Category
attr_accessor :i... |
require 'krxcode'
require 'thor'
require 'krxcode/generator'
require 'xcodeproj'
module Krxcode
class CLI < Thor
package_name "KRXcode"
desc "version", "KRXcode version."
def version
puts Krxcode::VERSION
end
desc "sort [MyProject.xcodeproj]", "Sort project files"
def sort file
... |
xml.instruct!
xml.Response do
xml.Gather(:action => hello_times_path(id: params[:id]), :numDigits => 4) do
xml.Say "Please enter the time you can accept the appointment as a 4 digit number representing the time. For example, enter 1 0 1 5 for 10:15am.", voice: 'alice'
end
end
|
require 'spec_helper'
describe BlastQueriesController do
describe 'GET /genes' do
before(:each) do
get :index
end
it "should render the 'intro' page with the genes tab selected" do
response.should render_template("blast_queries/index")
end
end
describe 'POST /genes' do
before(:e... |
class Auto::TestcaseScript < ActiveRecord::Base
has_many :testcases, :foreign_key => "script_id", :class_name => "Auto::Testcase", :dependent => :nullify
belongs_to :category, :class_name => "Auto::TestcaseCategory"
# after_create :syc_category_after_create
# after_destroy :syc_category_after_destory
# Default val... |
class Product < ActiveRecord::Base
belongs_to :user
belongs_to :category
has_many :line_items
has_and_belongs_to_many :carts
end
|
FactoryGirl.define do
factory :hobby do
name 'Tennis'
description 'hitting a ball with a racket'
end
end |
# == Schema Information
#
# Table name: text_styles
#
# id :integer not null, primary key
# korean_name :string
# english :string
# category :string
# font_family :string
# font :string
# font_size :float
# t... |
module LonoCfn
class Command < Thor
class << self
def dispatch(m, args, options, config)
# Allow calling for help via:
# ufo docker help
# ufo docker -h
# ufo docker --help
# ufo docker -D
#
# as well thor's nomral setting as
#
... |
require 'rest_client'
require 'json'
# :stopdoc:
#Copyright (c) 2002-2012 Rally Software Development Corp. All Rights Reserved.
#Your use of this Software is governed by the terms and conditions
#of the applicable Subscription Agreement between your company and
#Rally Software Development Corp.
# :startdoc:
module Ra... |
# Add an apt managed key
dep 'apt key added', :recv do
define_var :keyserver, :default => 'keyserver.ubuntu.com'
met? { sudo("apt-key list | grep #{recv}") }
meet { sudo "apt-key adv --keyserver #{var(:keyserver)} --recv #{recv}" }
end
# Add an apt source
dep 'apt source added', :source do
met? { shell('cat /... |
require 'thread'
class LockService
@locks_map = Hash.new
@global_lock = Mutex.new
def self.lock(str)
puts "LockService: lock(): #{Thread.current.object_id} :: str = #{str}"
@global_lock.synchronize {
unless @locks_map.has_key? str
@locks_map[str] = LockCounter.new
end
@locks_map[str]+1
}
puts... |
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
require 'airstream/version'
Gem::Specification.new do |s|
s.name = "airstream"
s.version = Airstream::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Christoph Lipautz"]
s.email = ["christoph at lipautz.org"]
s.homepage = "https://github.com/unuse... |
require 'zip'
require 'bsw_tech/jenkins_gem/gem_builder'
module BswTech
module JenkinsGem
class HpiParser
attr_reader :gem_spec
def initialize(zip_io)
Zip::File.open(zip_io) do |zip_file|
manifest = zip_file.find {|entry| entry.name.upcase == 'META-INF/MANIFEST.MF'}
unles... |
class Grub < Formula
desc "The GRand Unified Bootloader"
homepage "https://www.gnu.org/software/grub/"
# because he GRUB developers does not release new version since 2012
# it uses git repository instead of version 2.00
head "git://git.savannah.gnu.org/grub.git", :revision => "4fe8e6d4a1279b1840171d8e797d91... |
shared :set_collect_bang do |klass, cmd|
describe "#{klass}##{cmd}" do
before(:each) do
@set = klass[1, 2, 3, 4, 5]
end
it "yields each Object in self" do
res = []
@set.send(cmd) { |x| res << x }
res.sort.should == [1, 2, 3, 4, 5].sort
end
it "returns self" do
@set.... |
module Stackprofiler
module Filter
class BuildTree
def initialize(options={})
@options = options
end
def filter run, run2
stacks = run.stacks
root = StandardWarning.disable { Tree::TreeNode.new '(Root)', {addrs: [], open: true} }
stacks.each do |stack|
... |
require "helper"
require "prey/server"
describe Prey::Server do
let(:thrift) { Prey::Cluster.new.thrift }
let(:queue_name) { "prey" }
before(:each) { thrift.flush_queue(queue_name) }
describe "#stats" do
it "returns hash" do
stats = subject.stats
stats.should be_instance_of(Hash)
stats[... |
require 'spec_helper'
describe "libv8 locations" do
before do
@context = double(:CompilationContext)
end
describe "the system location" do
before do
@location = Libv8::Location::System.new
allow(@context).to receive :dir_config
end
describe "configuring a compliation context with it... |
module Roglew
class RenderHandle
def initialize(display, screen, window, version = nil)
@display, @screen, @window = display, screen, window
@loaded_extensions = Set.new
extension_list(:glx).each { |ext| load_extension(ext) }
attrList = FFI::MemoryPointer.new(:int, 11)
att... |
=begin
5.
+ Заданы три числа, которые обозначают число, месяц, год (запрашиваем у пользователя).
- Найти порядковый номер даты, начиная отсчет с начала года.
- Учесть, что год может быть високосным. (Запрещено использовать встроенные в ruby методы для этого вроде Date#yday или Date#leap?) Алгоритм опредления висок... |
require 'rails_helper'
RSpec.describe "registers/edit", type: :view do
before(:each) do
@register = assign(:register, Register.create!(
:weight => 1.5,
:residue => nil
))
end
it "renders the edit register form" do
render
assert_select "form[action=?][method=?]", register_path(@regis... |
# write a method which takes one argument, and if the argument is an array, it returns the first item in the array, and if it's not an array, it just returns the argument itself
def is_array?(argument)
if argument.class == Array
return argument[0]
else
return argument
end
end
is_array?([1, 2, 3])
is_arr... |
Rails.application.routes.draw do
devise_for :users, controllers: {
registrations: 'users/registrations',
sessions: 'users/sessions'
}
devise_scope :user do
get "signup", to: "users/registrations#new"
get "login", to: "users/sessions#new"
get "logout", to: "users/sessions#destroy"
end
# Fo... |
require "./lib/Lesson 99 Future Training/StrSymmetryPoint/str_symmetry_point"
describe 'StrSymmetryPoint' do
describe 'Example Tests' do
it 'Example 1' do
expect(str_symmetry_point("racecar")).to eq 3
end
it 'Example 2' do
expect(str_symmetry_point("x")).to eq 0
end
end
describe 'C... |
class StaticPagesController < ApplicationController
skip_before_action :authenticate_user!
def home
@events = current_user.events if current_user
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.