text stringlengths 10 2.61M |
|---|
class Api::V1::PartyDataController < Api::V1::BaseController
before_action :set_collection
def data
json = {
attend: @collection.post_in.value,
success: @collection.success.value,
fail: @collection.post_in.value - @collection.success.value,
leftTicket: @collection.maximum - @coll... |
class PacketSpam
attr_accessor :enabled, :callAfter, :callBefore, :dependencies
def initialize(mother)
@parent = mother
@enabled = true
@callAfter = false
@callBefore = true
@dependencies = {
'author' => 'Lynx',
'version' => '1.0',
'hook_type' => 'game'
}
@packets = [
'u#sp', 's#upc', 's#... |
require_relative 'container'
class LoginPage < Container
URL = "https://www.phptravels.net/login"
def open
@browser.goto URL
self
end
def login_as(user, pass)
user_field.set user
password_field.set pass
login_button.click
next_page = BookingPage.new(@browser)
... |
class Employee::LeaveApplicationsController < Employee::BaseController
def index
@leave_applications = @user.leave_applications.page(params[:page])
end
def new
@leave_application = @user.leave_applications.build
end
end |
# Portions Originally Copyright (c) 2008-2011 Brian Lopez - http://github.com/brianmario
# See MIT-LICENSE
require "rubygems" unless defined?(Gem)
require "benchmark" unless defined?(Benchmark)
require "stringio" unless defined?(StringIO)
if !defined?(RUBY_ENGINE) || RUBY_ENGINE !~ /jruby/
begin
require "yajl"
... |
# desc "Explaining what the task does"
# task :momentum_cms do
# # Task goes here
# end
namespace :momentum_cms do
namespace :fixture do
desc 'Import a site via fixtures'
task :import => :environment do |t|
source = ENV['SOURCE']
site = ENV['SITE']
if source.blank?
puts "SOURCE ex... |
module Ann
module Helpers
# A simple extension to ActionView's form builder that makes easy display
# error messages for each attribute in the form.
#
# Usage:
# <%= ann_form_for record, class: 'form', url: url_for(record) do |f| %>
# <%= f.label :name %>
# <%= f.text_field :name... |
class TruckCartConnection < ActiveRecord::Base
belongs_to :cart
belongs_to :truck
scope :finished, -> { where(status: "finished") }
end
|
class House < ApplicationRecord
has_many :trains
accepts_nested_attributes_for :trains
end
|
# encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
module TwitterCldr
module Segmentation
class RuleSet
class << self
def create(locale, boundary_type, options = {})
new(locale, StateMachine.instance(boundary_type, locale), options)
end
... |
class Survey < ActiveRecord::Base
extend BaseModel
belongs_to :user
has_many :questions
accepts_nested_attributes_for :questions, :allow_destroy => true
### Constants
HIDDEN_COLUMNS = ["created_at", "updated_at", "last_update", "status", "nation_id"]
def save_responses(params)
nation_id = params["n... |
require 'spec_helper'
describe Types::Element do
include_context :types
before do
element.extend(Types::Element)
element_with_hooks.extend(Types::Element)
end
describe 'text' do
it 'can be read' do
element.browser_element.should_receive(:text).and_return('text')
element.text.should ==... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.define "app" do |app|
app.vm.provision "shell", path: "provision-celery.sh"
app.vm.box = "ubuntu/xenial64"
app.vm.network "private_network", ip: "192.168.144.10", virtualbox__intnet: true
app.vm.hostname = "app"
... |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
# Mayor.create(:name =>... |
module DeviseApiAuth
module TokenUtils
extend self
require 'openssl'
def generate_user_token(string, digester: Digest::SHA2)
return if !string.is_a?(String) || string.blank?
digester.hexdigest(string+DeviseApiAuth::Config.options[:user_salt])
end
class SecureCredentials
def initialize(headers: ... |
class Social < ActiveRecord::Base
belongs_to :user
validates :facebook_link, format: { with: /facebook.com\//}
validates :linkedin_link, format: { with: /linkedin.com\//}
validates :youtube_link, format: { with: /youtube.com\//}
validates :instagram_link, format: { with: /instagram.com\//}
end
|
class User
attr_reader :id, :name
def initialize(id:, name:)
@id = id
@name = name
end
def to_json
return {
"id" => @id,
"name" => @name,
}
end
end
|
require "test_helper"
describe Rugged::Config do
before do
@path = temp_repo('testrepo.git')
@repo = Rugged::Repository.new(@path)
end
after do
destroy_temp_repo(@path)
end
it "can read the config file from repo" do
config = @repo.config
assert_equal 'false', config['core.bare']
ass... |
module CronSpec
##
# Base class for the definition of CronSpecificationFactory classes.
#
class CronSpecificationFactory
WildcardPattern = /\A\*\z/
SingleValuePattern = /\A(\d+)\z/
RangePattern = /\A(\d+)-(\d+)\z/
StepPattern = /\A\*\/(\d+)\z/
##
# Constructs a new CronSpecificationF... |
module CopyPeste
class Core
# This class is used to store data between each execution of commands.
class CoreState
attr_accessor :analysis_module
attr_accessor :conf
attr_accessor :events_to_command
attr_accessor :graphic_mod
attr_accessor :module_mng
def initialize
... |
class PageRedirect < ActiveRecord::Migration
def up
add_column :pages, :redirect, :boolean
add_column :pages, :action_name, :string
add_column :pages, :controller_name, :string
end
def down
remove_column :pages, :redirect
remove_column :pages, :action_name
remove_column :pages, :controller_name... |
require 'factory_face'
require 'factory_face_rails/generator'
require 'rails'
module FactoryBot
class Railtie < Rails::Railtie
initializer "factory_face.set_fixture_replacement" do
FactoryBotRails::Generator.new(config).run
end
initializer "factory_face.set_factory_paths" do
FactoryBot.defi... |
=begin
#Swagger Petstore
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.4.2
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.2.1-SNAPSHOT
=end
require 'cgi'
module BhalleExample
class Pet... |
class Station
attr_accessor :station_name, :zone
def initialize(station_name, zone)
@station_name = station_name
@zone = zone
end
end
|
require_relative '../../lib/first/person'
RSpec.describe Person do
let(:person) { described_class.new(first_name, last_name, education_level) }
let(:first_name) { anything }
let(:last_name) { anything }
let(:education_level) { anything }
describe '#full_name' do
let(:full_name) { person.full_name }
... |
require "rails_helper"
RSpec.describe ReportregsController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/reportregs").to route_to("reportregs#index")
end
it "routes to #new" do
expect(:get => "/reportregs/new").to route_to("reportregs#new")
end
... |
class AddDeliverableIdToIssues < ActiveRecord::Migration[4.2]
def self.up
add_column :issues, :deliverable_id, :integer
end
def self.down
remove_column :issues, :deliverable_id
end
end
|
class Admins::CardApplyTemplatesController < Admins::BaseController
before_action :set_template, only: [:show, :edit, :update, :destroy, :add_item, :remove_item, :set_default]
def index
@templates = CardApplyTemplate.includes(items: :shop).order(id: :desc)
.page(params[:page])
.per(params[:per])
... |
class ApiSessionsController < ApiController
def create
if authenticate
render json: { status: :success, email: current_user.email }
else
invalid_login_attempt
end
end
end
|
module Commonsense
module Core
class Tag < ActiveRecord::Base
has_many :incoming_tag_relations,
:class_name => "TagRelation",
:foreign_key => "destination_id",
:dependent => :destroy
has_many :outgoing_tag_relations,
:class_na... |
require 'erb'
require 'ostruct'
require_relative 'utils'
module MagicServer
# This method takes a url like this: /erbtest?boo=hello
# and turns it into a map with :route and :arguments
# as keys. /erbtest would be :route, and boo => hello
# would be :arguments. The reason why this is done is
# so that the r... |
#!/usr/bin/env ruby
require_relative 'Emergency'
class Earthquake < Emergency
def initialize(epicenter=nil, magnitude=nil, radius=nil)
super()
@type = :earthquake
if epicenter.nil?
epicenter = "Place de la Bourse, 1000 Bruxelles"
end
if magnitude.nil?
... |
require 'bundler/capistrano'
require "rvm/capistrano"
set :rvm_ruby_string, :local # use the same ruby as used locally for deployment
set :user, 'ubuntu'
set :domain, 'ec2-23-23-233-0.compute-1.amazonaws.com'
set :application, "dealStreet"
set :repository, "git@github.com:dalebiagio/DealStreetLinux.git"
#set :... |
class CreateClients < ActiveRecord::Migration
def change
create_table :clients do |t|
t.string :company_name
t.string :email
t.string :sector
t.string :size
t.boolean :can_contact
t.timestamps null: false
end
end
end
|
When(/^I go to events page$/) do
visit new_event_path
end
When(/^I submit the form for event$/) do
fill_in 'Location', with: 'something'
fill_in 'Starts at', with: Time.now
fill_in 'Ends at', with: Time.now
select first('MyString'), from: 'Hobby'
click_button 'Create Event'
end
Then(/^I should see a succ... |
# frozen_string_literal: true
module Vedeu
# Produces ASCII character 27 which is ESC
ESCAPE_KEY_CODE = 27
module Input
# Captures input from the user terminal via 'getch' and
# translates special characters into symbols.
#
# @api private
#
class Capture
include Vedeu::Common
... |
# frozen_string_literal: true
require "kafka/statsd"
require "socket"
require "fake_statsd_agent"
describe "Reporting metrics to Statsd", functional: true do
example "reporting connection metrics" do
agent = FakeStatsdAgent.new
Kafka::Statsd.port = agent.port
agent.start
kafka.topics
agent.w... |
json.array!(@site_settings) do |site_setting|
json.extract! site_setting, :id, :year_id
json.url site_setting_url(site_setting, format: :json)
end
|
require 'spec_helper'
module Boilerpipe::Filters
describe MinClauseWordsFilter do
describe '#process' do
let(:text_block) { Boilerpipe::Document::TextBlock }
let(:text_block1) { text_block.new('one two three four five, one two', 7) }
let(:text_block2) { text_block.new('one two', 2) }
let(... |
require_relative 'test_helper'
require './lib/sales_engine'
require 'csv'
class MerchantRepositoryTest < Minitest::Test
def setup
item_file_path = './test/fixtures/items_truncated.csv'
merchant_file_path = './test/fixtures/merchants_truncated.csv'
invoice_file_path = './test/fixtures/invoices_truncated.... |
# frozen_string_literal: true
# This is a porting of Thor::Shell::Basic
# rewritten as a module that can be included by
# plugins
# Thor is available under MIT license
# Copyright (c) 2008 Yehuda Katz, Eric Hodel, et al.
module Quicken
module Helpers
module Base
# Say (print) something to the user. If the... |
class CreateRuns < ActiveRecord::Migration
def change
create_table :runs do |t|
t.string :state
t.timestamp :started_at
t.timestamp :finished_at
t.references :workflow
t.timestamps
end
end
end
|
module Api
module V1
class CitiesController < BaseController
skip_before_action :set_resource
def index
@cities = @parser.get_cities
end
def show
city = @parser.get_city(params[:id])
unless city
@errors = {
city: 'City doesn\'t exists'
... |
class NoteRepository
include Curator::Repository
indexed_fields :user_id
end
|
class Dog
attr_accessor :breed, :name
def initialize(breed, name)
@breed = breed
@name = name
end
def wag_tail(emotion, frequency)
@emotion = emotion
@frequency = frequency
"The dog is #{emotion} and wags his tail #{frequency} "
end
def pant
put... |
class CreateProductRebates < ActiveRecord::Migration[5.0]
def change
create_table :product_rebates do |t|
t.belongs_to :product, null: false, foreign_key: true
t.belongs_to :rebate, null: false, foreign_key: true
t.timestamps
end
end
end
|
module UsersHelper
def owner?(user)
if user.kind_of?(String)
user.eql?(current_user.user_name)
else
current_user.eql?(user)
end
end
end
|
# frozen-string-literal: true
module Down
VERSION = "4.6.0"
end
|
require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/gempackagetask'
$LOAD_PATH.unshift 'lib'
require 'lolspeak/version'
$KCODE = "UTF-8"
task :default => [:test_units]
desc "Run basic tests"
Rake::TestTask.new("test_units") do |t|
t.pattern = 'test/*_test.rb'
t.verbos... |
require 'Log4r'
#require 'log4r/formatter/patternformatter.rb'
class ILogger
def self.log
if @logger.nil?
@logger = Log4r::Logger.new('Metamask Application')
@logger.outputters << Log4r::Outputter.stdout
@logger.outputters << Log4r::FileOutputter.new(
'MetamaskTe... |
class Product < ApplicationRecord
has_many :reviews, dependent: :destroy
has_many :favorites, dependent: :destroy
belongs_to :category
belongs_to :user
validates :title, presence: true, uniqueness: {message: 'must be unique.'}
validates :description, presence: true, length: {minimum: 10}
validates :price... |
require 'test_helper'
class VoteTest < ActiveSupport::TestCase
test "must have candidate_id" do
assert Vote.create!(candidate_id: 2, voter_id: 2)
assert_raise ActiveRecord::RecordInvalid do
Vote.create!(candidate_id: nil, voter_id: 2)
end
end
test "must have voter_id" do
assert Vote.creat... |
class AddIndexToUserColumnOnIsGuest < ActiveRecord::Migration
def change
end
add_index :users, :is_guest
end
|
json.array!(@offices) do |office|
json.extract! office, :id, :company_id, :user_id, :nombre, :calle_numero, :colonia, :codigo_postal, :latitud, :longitud, :telefono
json.url office_url(office, format: :json)
end
|
require 'spec_helper'
describe TimeSlot do
let(:club_night) { ClubNight.create(FactoryGirl.attributes_for(:club_night)) }
let(:event) { club_night.events.create(FactoryGirl.attributes_for(:event)) }
let(:time_slot) { event.time_slots.create(FactoryGirl.attributes_for(:time_slot)) }
describe "#dj_ids=" d... |
# frozen_string_literal: true
class Update < Aid::Script
def self.description
'Updates your dev environment automatically'
end
def self.help
<<~HELP
aid update
This script is a way to update your development environment automatically.
It will:
- rebase origin/master onto this b... |
require 'simplecov'
SimpleCov.start
require './lib/cypher'
require './lib/code_breaker'
require './lib/encoder'
describe CodeBreaker do
before(:each) do
@message = 'hello world! end'
@key = '02715'
@date = '040895'
@breaker = CodeBreaker.new()
end
describe 'initialize' do
it 'exists' do
... |
class PharmacyUser < ActiveRecord::Base
belongs_to :pharmacy
belongs_to :user
attr_accessible :pharmacy_id, :user_id
end
|
class RecipesController < ApplicationController
before_action :set_recipe, only: [:show, :edit, :update, :destroy]
def index
@recipes = Recipe.all.order("created_at DESC")
end
def show
end
def new
@recipe = Recipe.new
end
def edit
end
def create
@recipe = Recipe.new(recipe_params)
respond_to do ... |
#
# Cookbook Name:: ktc-razor
# Recipe:: default
#
#
install_path = node['razor']['install_path']
directory ::File.join(install_path + "/lib/project_razor/model/ubuntu/", "precise_ktc") do
mode "0755"
end
%w[
precise_ktc/boot_install.erb
precise_ktc/boot_local.erb
precise_ktc/kernel_args.erb
precise_ktc/os_boo... |
class EntriesController < ApplicationController
def index
now = DateTime.now
@pr = Project.find(params[:project_id])
@entries = @pr.entries_for_month(2015, 7)
@month_hours = @pr.total_hours_in_month(now.year, now.month)
render ("index")
end
def new
@pr = Project.find params[:project_id]
@entr = @pr.e... |
class FiguresController < ApplicationController
get '/figures' do
erb :'figures/index'
end
get '/figures/new' do
erb :'figures/new'
end
get '/figures/:id/edit' do
@figure = Figure.find(params[:id])
erb :'/figures/edit'
end
get '/figures/:id' do
@figure = Figure.find(params[:id])
... |
# A binary search tree was created by traversing through an array from left to right
# and insterting each element. Given a binary search tree with distinct elements, print all possible
# array that could have led to this tree.
# given:
# 2
# 1 3
# return [2,1,3], [2,3,1]
require_relative 'node.rb'
# can do this ... |
class VersionsController < ApplicationController
layout "application"
def show
@version = PaperTrail::Version.find(params[:id])
end
def index
@html_title = "Recent Activity"
@versions = PaperTrail::Version.order(:created_at => :desc).paginate(:page => params[:page],
:per_page => 50)
... |
require 'erector'
require 'omf-web/data_source_proxy'
module OMF::Web::Theme
class AbstractPage < Erector::Widget
depends_on :js, '/resource/vendor/stacktrace/stacktrace.js'
depends_on :js, '/resource/vendor/require/require.js'
depends_on :js, '/resource/vendor/underscore/underscore.js'
depends_on... |
class CreateChildTasks < ActiveRecord::Migration[6.0]
def change
create_table :child_tasks do |t|
t.string :title
t.datetime :child_deadline
t.integer :possibility
t.integer :done
t.integer :result
t.integer :self_motivation
t.string :explanation
t.references :paren... |
class Example < ActiveRecord::Base
validates :name, presence: true, length: {minimum: 3, maximum: 50}
validates :url, presence: true, length: {minimum: 10, maximum: 300}
validates :giturl, presence: true, length: {minimum: 10, maximum: 300}
validates :description, presence: true, length: {minimum: 10, maximum: ... |
##################################################################################
#
# config.rb
#
# [更新日]
# - 2014/01/15
#
# [解説]
# - Sass & Compass 設定ファイル
#
# [参考URL]
# - http://dev.classmethod.jp/ria/html5/web-desiner-corder-scss-config/
#
###########################################################... |
# 1. The number of orphan planets (no star). TypeFlag = 3
# 2. The name (planet identifier) of the planet orbiting the hottest star.
# 3. A timeline of the number of planets discovered per year grouped by size. Use the following groups: “small� is less than 1 Jupiter radii, “medium� is less than 2 Jupiter radi... |
class User < ActiveRecord::Base
attr_accessor :remember_token
validates :name, presence: true,
length: { maximum: 25 }
VALID_EMAIL_REGEX = /\A\w+@\w+\.\w+\z/i
before_save { self.email = self.email.downcase }
validates :email, presence: true,
length: { maximum: 255 },
format: { with: VAL... |
class RenameColumnTypeInMedicineSampleToTypemedicine < ActiveRecord::Migration[5.0]
def change
rename_column :medicine_samples, :type, :typemedicine
end
end
|
class CargoTrain < Train
TYPE = 'cargo'
private
def valid_car_type?(car)
car.class == CargoCar
end
end |
module CopyPeste
module Require
module Mixin
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
# @note
# - Only the first call of a namespace will require the
# associated file.
# - If there is not a file named as the folder,... |
class ZhishiNotification
ZHISHI_EVENTS = /new\.(?<type>question|user|answer|comment)/
attr_reader :resource, :wrapper_type
def initialize(payload)
@wrapper_type = payload['notification']['type']
@resource = Hashie::Mash.new(payload['notification'])
end
def match_notification_type
@match ||= ZHI... |
class ManagedRecordMailer < ApplicationMailer
default template_path: 'mail/managed_records'
layout 'mail/admin'
def created
setup
return unless @manager.notifications.new_managed_record?
subject = I18n.translate(@record.model_name.i18n_key, scope: 'mail.managed_record.created.subject', record: ... |
class MembershipsController < ApplicationController
before_filter :authenticate_user!
def destroy
@membership = Membership.find(params[:id])
if @membership.present?
@membership.destroy
end
flash[:notice] = "Removed Membership."
redirect_to root_url
end
private
def membership_... |
require 'spec_helper'
describe StoryMerge do
let(:command) { StoryMerge.new }
before { command.stub(:story_branch).and_return('62831853-tau-manifesto') }
subject { command }
its(:cmd) { should match /git merge/ }
shared_examples "story-merge with known options" do
subject { command }
it "should no... |
require 'wikipedia'
require 'vocabularise/wikipedia_handler'
require 'vocabularise/mendeley_handler'
require 'vocabularise/request_handler'
module VocabulariSe
HANDLE_INTERNAL_RELATED_TAGS = "internal:related_tags"
HANDLE_INTERNAL_RELATED_TAGS_MENDELEY = "internal:related_tags:mendeley"
HANDLE_INTERNAL_RELATED_T... |
class UsersController < ApplicationController
def create
if user_exists
render json: user
else
new_user = User.create(user_params)
if new_user
render json: new_user
else
render json: new_user.errors
end
end
end
def update
respond_to do |format|
... |
###Collections Practice
collection_array = ["blake", "ashley", "scott"]
#1. sort the following array in ascending order
collection_array.sort
#2. sort the following array in descending order
collection_array.sort.reverse
#3. put the following array in reverse order
collection_array.reverse
#4. grab the secon... |
module Api
class OrdersController < ApplicationController
before_filter :order_params
def create
#{:order => {:total, :email, :phone, :address, :name, :last_name, :code},:line_items_attributes => [{:product_id, :price, :count}]}
logger.debug params[:order][:toral]
logger.debug params["order"]["toral"]
... |
class User
include Mongoid::Document
include Mongoid::Timestamps
attr_accessible :name, :email, :password, :password_confirmation, :remember_me, :subscription_plan_id, :use_dropbox
attr_accessible :trial_expires_at, as: :admin
field :name
field :xero_auth, type: Hash
field :xero_auth_expires_at, type: D... |
module RedPenTeacher
class DiffMarker < BaseMarker
def initialize(true_answer)
super(lambda do |answer|
answer == true_answer
end)
end
end
end
|
# frozen_string_literal: true
class RolesController < ApplicationController
def index
# Returns all tasks in order by id
@roles = Role.order(id: :asc)
end
def new
@roles = Role.new
end
def show
@roles = Role.find(params[:id])
end
def create
redirect_to '/roles' if current_user.role... |
require 'spec_helper'
RSpec.describe 'log parser printer' do
it 'prints out a given data array with header and description sugar' do
data_array = [
[:b, 1],
[:a, 2],
]
description = 'LogParserPrinter test description'
follower_text = 'test count'
ordering_description = 'ascending orde... |
module ApplicationHelper
def public_article_path(article)
issue = article.issue
year = issue.year
super year: year.year, issue: issue.number, article_slug: article.slug
end
def language_attributes
{lang: I18n.locale}
end
def page_title(page=nil)
title = "Stuyvesant Spectator"
slogan ... |
#!/usr/bin/env ruby
require 'json'
require 'pry'
require_relative 'lib/run'
require_relative 'lib/git_helpers'
class MergeAndPush
SLEEP = 20
def initialize(branch)
@branch = branch
end
def checks_passed?(timeout:)
start_time = Time.now
repo_name = GitHelpers::repo_name
github_org = GitHelpers... |
require 'socket'
namespace :data do
namespace :load do
desc "Cache data contained in the ECHO 10 format to return with granule results"
task :echo10 => ['environment'] do
puts "Starting data:load:echo10"
log_error('data:load:echo10') do
CollectionExtra.load_echo10
end
end
d... |
# write a method that takes one argument, a string containing one
# or more words
# and returns the given string with words that contain five
# or more characters reversed
# each string will consists of only letters and spaces
# spaces should be included only when more than one word is present
# Examples:
#
# puts r... |
module Topographer
class Importer
module Strategy
class CreateOrUpdateRecord < Topographer::Importer::Strategy::Base
def import_record (source_data)
mapping_result = mapper.map_input(source_data)
search_params = mapping_result.data.slice(*mapper.key_fields)
model_inst... |
class GeojsonUploader < CarrierWave::Uploader::Base
FILENAME = 'meditation-venues.geojson'
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
'geojson'
end
def cache_dir
"#{Rails.root}/tmp/uploads"
... |
# logicmonitor.rb
# Contains classes used by various providers in the LogicMonitor Puppet Module
# === Authors
#
# Sam Dacanay <sam.dacanay@logicmonitor.com>
# Ethan Culler-Mayeno <ethan.culler-mayeno@logicmonitor.com>
#
# Copyright 2016 LogicMonitor, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "Licens... |
# encoding: utf-8
#
# © Copyright 2013 Hewlett-Packard Development Company, L.P.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
#... |
class Carta
attr_reader :numero, :pinta
def initialize(numero, pinta)
pinta.upcase!
pintas =['C', 'D', 'E', 'T']
if (numero >= 1 && numero <=13) && pintas.include?(pinta)
@numero = numero
@pinta = pinta
else
raise ArgumentError.new(' No es ... |
Node = Struct.new(:type) do
attr_accessor :batch_size
attr_reader :stock
def initialize(*args)
super(*args)
@stock = 0
end
def build(quantity)
@stock += batch_size * quantity
end
def take_stock(max)
if max >= stock
used_stock = stock
@stock = 0
else
used_stock = ma... |
require 'spec_helper'
module Boilerpipe::SAX::TagActions
describe BlockTagLabel do
let(:subject) { BlockTagLabel.new(nil) }
let(:handler) { ::Boilerpipe::SAX::HTMLContentHandler.new }
describe '.new' do
it 'takes a label action'
end
describe '#start' do
it 'returns true' do
e... |
#Author: John Kilfeather
require 'test/unit'
require 'MatrixStats.rb'
#create class that extends module just for testing
class TestMatrix
include MatrixStats
attr_accessor :size
def initialize size, values
@size = size
@numbers = Array.new(values)
end
end
class TC_MatrixStats < Test::Unit::TestCase
def setup... |
module Vhost::FckeditorExtensions
module Controller
# Overwriting this method will tell all fckeditor instances exactly which
# site they should scope down to.
def current_directory_path
# @todo this needs to be turned into the current_site.hostname but protect against the * hostname
# o... |
# Double Doubles
# A double number is a number with an even number of digits whose left-side digits are exactly the same as its right-side digits. For example, 44, 3333, 103103, 7676 are all double numbers. 444, 334433, and 107 are not.
# Write a method that returns 2 times the number provided as an argument, unless ... |
require 'test_helper'
class TaskTest < ActiveSupport::TestCase
setup :activate_authlogic
setup :valid_task
def valid_task
@session = login_as users(:guy)
@person = Person.make :user => @session.user
@company = Company.make :person => @person
@project = Project.make :company => @company
plan ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.