text stringlengths 10 2.61M |
|---|
# Graphs
# Representing a Graph
# A Node in a real-world graph represents something unique, such as a city on a map, or a person in a network. When studying graphs, the nodes can just be labeled with a unique number starting from 0, so they're easy to work with.
# There are many ways to represent a graph in a compute... |
FactoryBot.define do
factory :license do
name { Faker::Device.model_name }
qty { 1 }
key { Faker::Device.serial }
licenser_name { Faker::Name.name }
licenser_email { Faker::Internet.email }
reassignable { true }
cost { Faker::Number.decimal(l_digits: 2, r_digits: 2) }
purchased_at { Ti... |
class RestaurantSubway < ActiveRecord::Base
belongs_to :restaurant
belongs_to :subway
validates :restaurant_id, :subway_id, presence: true
validates :restaurant_id, uniqueness: {scope: :subway_id}
end |
require "test/unit"
require "mocha/setup"
require "rezource"
class SampleParent
end
class Sample
end
class SamplesController
def self.helper_method(*args)
end
def params
{}
end
include Rezource
end
module Namespaced
class SamplesController
def self.helper_method(*args)
end
def ... |
class History < ApplicationRecord
belongs_to :company, required: false
belongs_to :department, required: false
belongs_to :user, required: false
end
|
require_relative './abstract_adapter'
module Ketsuban
module Adapter
class Mysql2Adapter < AbstractAdapter
# @override
def fetch_next_id
[max_id_now + 1, auto_incremental_id].max
end
# @override
def increment_sequence(_now_id)
# do nothing
nil
end
... |
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_filter :configure_permitted_parameters, if: :devise_controller?
before_filter :get_judge
helper_method :p... |
class AbuseController < ApplicationController
def bounces
BounceJob.perform_later(email_param)
render plain: 'ok!'
end
def complaints
ComplaintJob.perform_later(email_param)
render plain: 'ok!'
end
private
def email_param
params.require(:email)
end
end
|
people = [
{
name: 'Jawaher',
transactions: [
{
type: 'COFFEE',
amount: 7.43
},
{
type: 'TACOS',
amount: 14.65
},
{
type: 'COFFEE',
amount: 4.43
}
]
},
... |
class PhotosController < ApplicationController
before_action :authenticate_user!, except: [:show]
before_action :set_photo, only: %i[show edit update destroy]
before_action :user_id_verification, only: %i[edit update destroy]
def new
@photo = Photo.new
end
def create
@photo = Photo.new(photo_param... |
class ChangeFeeFormatInSchedule < ActiveRecord::Migration
def self.up
change_column :schedules, :fee, :string
end
def self.down
change_column :schedules, :fee, :decimal
end
end
|
require "bundler/gem_tasks"
ENV['DATA_MODEL'] ||= 'omopv4'
desc "Setup test database"
task :test_db_setup do
require_relative 'test/db_setup'
end
desc "Setup test database"
task :test_db_teardown do
require_relative 'test/db_teardown'
end
run_spec = lambda do |data_model|
sh "DATA_MODEL=#{data_model} #{FileUti... |
require 'json'
require_relative '../model/calendario'
require_relative '../model/calendario_eventos'
require_relative '../model/GeneralError'
require_relative '../model/convertidor_objeto_json'
require_relative '../model/convertidor_json_objeto'
class Persistor
def initialize(fileClass = File, dirClass = Dir, conv... |
require 'digest/sha1'
class StudentsController < ApplicationController
def welcome
end
def signin
end
def after_signin
@student = Student.find_by(username: params[:username])
if @student.valid?
session[:student_id] = @student.id
redirect_to home_path
else flash[:messages] = @student.errors.f... |
class Holiday < ActiveRecord::Base
def self.get_holidays(from, to)
self.where("dt >= ? and dt <= ?", from, to).map {|day| day.dt }
end
def self.max_date
self.maximum(:dt)
end
def self.min_date
self.minimum(:dt)
end
end
|
# User Story 4:
# As a Maker
# So that I can let people know what I am doing
# I want to post a message (peep) to chitter
feature "post peep" do
scenario "to update people on my life, post peep to chitter stream" do
click_button('Add Peep!')
fill_in 'body', with: 'This is what I did today'
fill_in 'title', wit... |
module RiakRooms
class Hotels
include Client
attr_accessor :country,
:host,
:infile,
:update_indices
def initialize(opts)
@country = opts[:country]
@host = opts[:host]
@infile = opts[:in]
@update_indices = opts[:update_indicies]
end... |
require 'spec_helper'
describe 'nessus' do
['RedHat'].each do |system|
let(:facts) {{ :osfamily => system }}
it { should contain_anchor('nessus::begin') }
it { should contain_class('nessus::params') }
it { should contain_class('nessus::install') }
it { should contain_class('nessus::config') }... |
require_relative "exceptions"
module PageObjectHelpers
def self.included(base)
base.send :include, InstanceMethods
base.extend ClassMethods
end
module InstanceMethods
# Try to find and Choose matching Radio button
# N.B CHOOSE form so only selects radio if found, will NOT call SUBMIT
#
... |
require 'test_helper'
class MoneyMoney::StatementLineTest < MiniTest::Unit::TestCase
def setup
fixture = File.join(File.dirname(__FILE__), '../fixtures/statements.csv')
@lines = MoneyMoney::StatementLines.read(fixture)
end
def test_attribute_mapping_works
line = @lines[0]
assert_equal "EUR"... |
# Public: Get the recursive sum of all the digits in a number.
#
# n - Natural number.
#
# Examples
#
# digital_root(16)
# # => 7
#
# digital_root(942)
# # => 6
#
# Returns an array.
def digital_root(n)
n > 9 ? digital_root(n.to_s.chars.map(&:to_i).inject(:+)) : n
end |
# frozen_string_literal: true
module Cucumber
class Configuration
def zafira_test_case_handler_class
Zafira::Handlers::TestCase::Cucumber
end
def zafira_failed_test_case_handler_class
Zafira::Handlers::FinishedTestCase::Cucumber::Failed
end
def zafira_skipped_test_case_handler_class... |
class Element
def accept(visitor)
raise 'You must implement this method in a descendant class.'
end
end
|
require 'spec_helper'
require 'acceptance/tasks'
describe 'Task management', :acceptance do
before(:each) { create_test_user }
let(:tasks) { Acceptance::Task::Widget.new }
describe 'Task deletion' do
let(:project) { tasks.new_project }
let!(:action1) { project.new_sub_action }
let!(:action2... |
class Team < ApplicationRecord
has_many :student_teams
has_many :students, through: :student_teams
has_many :team_projects
has_many :projects, through: :team_projects
belongs_to :course
end
|
class CreateSiteProjects < ActiveRecord::Migration[5.0]
def change
create_table :site_projects, id: :uuid do |t|
t.timestamps
end
add_column :site_projects, :site_id, :uuid
add_index :site_projects, :site_id
add_column :site_projects, :project_id, :uuid
add_index :site_projects, :projec... |
module TheGrid
class Api
attr_reader :relation, :options
def initialize(relation)
@relation = relation
@options = { :delegated_commands => {} }
end
def delegate(commands)
options[:delegated_commands].merge! commands.stringify_keys
end
def compose!(params)
configure(p... |
require 'google/apis/drive_v2'
require 'googleauth'
require 'googleauth/stores/file_token_store'
require 'manager'
require 'fileutils'
# Controller for all pages
class PagesController < ApplicationController
include DriveManager
before_action :authenticate_user!, except: [:login]
def login
redirect_to ne... |
class Task < ActiveRecord::Base
#belongs_to :user, foreign_key: 'user_id'
#belongs_to :user, foreign_key: 'dispatcher_id', source: :dispatcher
#belongs_to :user, foreign_key: 'driver_id', source: :driver
belongs_to :company
has_many :statuses
has_many :messages
default_scope -> { order('created_at DESC')... |
class PersonnesController < ApplicationController
before_action :set_personne, only: [:show, :edit, :update, :destroy]
# GET /personnes
# GET /personnes.json
def index
@personnes = Personne.all
end
# GET /personnes/1
# GET /personnes/1.json
# GET /personnes/new
# GET /personnes/1/edit
# ... |
class BatteriesController < ApplicationController
before_action :authorize_user, only: [:new, :create, :edit, :update]
def index
if params[:search]
@batteries = Battery.search(params[:search]).order("created_at DESC")
else
@batteries = Battery.all
end
end
def new
@battery = Battery... |
require 'spec_helper_acceptance'
test_name 'firefox class'
describe 'mozilla::firefox' do
let(:manifest) {
<<-EOS
include 'mozilla::firefox'
EOS
}
context 'with defaults' do
it 'should work with no errors' do
apply_manifest(manifest, :catch_failures => true)
end
it 'should be i... |
When(/^I open seleniumframework website$/) do
@browser.goto "http://www.seleniumframework.com/Practiceform/"
end
And(/^I click open new browser window$/) do
puts "Before opening new window title --> #{@browser.title}"
@browser.button(id: "button1").click
all_windows = @browser.windows
puts "All window ha... |
namespace :autocancel do
desc "Schedule autocancel of requests to be run by a worker thread"
task :schedule => :environment do
Jobs::AutocancelJob.schedule
end
end
namespace :reminders do
desc "Schedule reminders to be sent by a worker thread"
task :schedule => :environment do
Jobs::ReminderJob.sched... |
class RepayMailer < ApplicationMailer
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.repay_mailer.paid.subject
#
def paid
@user = params[:user]
@extract = params[:extract]
mail(to: @user.email, subject: '[REEMBOLSO] - Pagamento efetuado.')... |
class Carrier < ApplicationRecord
has_many :loads, through: :carrier_load
end
|
class ManageIQ::Consumption::ShowbackBucket < ApplicationRecord
belongs_to :resource, :polymorphic => true
before_save :check_bucket_state, if: :state_changed?
has_many :showback_charges, :dependent => :destroy, :inverse_of => :showback_bucket
has_many :showback_events, :through => :showback_charges, :inverse_... |
require File.expand_path(File.join(File.dirname(__FILE__), "input_method/base"))
require File.expand_path(File.join(File.dirname(__FILE__), "input_method/readline"))
require File.expand_path(File.join(File.dirname(__FILE__), "input_method/io"))
require File.expand_path(File.join(File.dirname(__FILE__), "input_method/fi... |
class User < ApplicationRecord
has_many :statuses, dependent: :destroy
has_many :likes, dependent: :destroy
validates :name, :email, :password_confirmation, presence: true
validates :email, uniqueness: true
validates :password, length: { in: 6..20 }
validates :email, format: { with: URI::MailTo::EMAIL_REGEXP, me... |
require "spec_helper"
RSpec.describe Realogy do
describe "Checking status" do
it "Has a version number" do
expect(Realogy::VERSION).not_to be nil
end
it "Is a Module" do
expect(Realogy).to be_a(Module)
end
end
end
|
require 'socket'
require_relative 'Communicator'
require_relative 'CommandValidator'
require_relative 'CommandAssembler'
require_relative 'CommandHash'
require_relative 'SystemStrings'
require_relative 'DataHash'
require_relative 'PriorityQueue'
require_relative 'ConnectionThreader'
require_relative 'Looper'
require_re... |
require 'rails_helper'
RSpec.describe "users/edit", type: :view do
before(:each) do
@user = assign(:user, User.create!(
:id => "",
:username => "MyString",
:email => "MyString",
:encrypt_password => "MyString",
:salt => "MyString",
:role_id => "",
:is_active => false,
... |
require 'rails_helper'
RSpec.describe LocationsController, type: :controller do
before(:each) do
login_admin
end
let(:valid_attributes) {
{
name: 'Clinical Informatics',
address: '123 Fake St',
city: 'City',
state: 'AL',
zip_code: '12345',
phone_number: '123-123-1234... |
=begin
* Manager of the simple operation
* Description :Switch case of options
* Author:Ignacio Ferrero
=end
class ManageSimple
def manageSimple(graph, csa, option, graph_parsed)
utilities = GraphUtilities.new(graph_parsed)
case option
when 1 then utilities.getOperation(csa, "code")
... |
# frozen_string_literal: true
require 'pry'
# company class
class Company
attr_accessor :name, :size
def initialize(name, size)
@name = name
@size = size
end
end
companies = [
Company.new('Alpha', 30),
Company.new('Beta', 300),
Company.new('Delta', 3000)
]
### Your code below this
def company_s... |
=begin
Your company built an in-house calendar tool called HiCal. You want to add a feature to see the times in a day when everyone is available.
To do this, you’ll need to know when any team is having a meeting.
In HiCal, a meeting is stored as an array ↴ of integers [start_time, end_time].
These integers represent t... |
class CreateMultipleQuestions < ActiveRecord::Migration[5.2]
def change
create_table :multiple_questions do |t|
t.integer :multiple_id
t.text :question
end
end
end
|
class AddColumnsToUsers < ActiveRecord::Migration[5.0]
def change
add_column :users, :username, :string
add_column :users, :avatar_id, :integer
add_column :users, :level_id, :integer
add_column :users, :setting_id, :integer
end
end
|
module Paysafe
module REST
class Client
extend Forwardable
delegate [:account_number, :api_base, :api_key, :api_secret, :test_mode, :timeout] => :@config
# Initializes a new Client object
#
# @param options [Hash]
# @return [Paysafe::REST::Client]
def initialize(**optio... |
#
# Tests du controller PISiteController::PageController
#
require 'spec_helper'
require_controller 'pisite'
describe PISiteController::Page do
before(:each) do
@page = PISiteController::Page::new
end
describe "CRUD" do
it "doit répondre à :new" do
@page.should respond_to :new
end
it "doit répondr... |
task :default => :server
desc 'Start server with --auto'
task :server => :clean do
system 'jekyll --server --auto'
end
desc 'Clean up generated site'
task :clean do
system 'rm -rf _site'
end
desc 'Minify CSS & JS'
task :minify do
puts 'Minifing CSS & JS'
# Remove old assets
system 'rm css/*.min*'
system... |
# frozen_string_literal: true
require 'test_helper'
module Vedeu
module Colours
describe Repository do
let(:described) { Vedeu::Colours::Repository }
let(:instance) { described.new }
let(:storage) { {} }
describe '#initialize' do
it { instance.must_be_instance_of(described) ... |
#encoding: utf-8
class ResultMailer < ActionMailer::Base
default from: "XBindR <no-reply@cbi.seu.edu.cn>"
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.inform_mailer.send_notice.subject
#
def binding_prediction_mail(pred, emails)
@pred = pred
... |
class BookingsController < ApplicationController
def new
@flight = Flight.find(params[:flight_id])
@tickets = params[:tickets]
@booking = @flight.bookings.build
build_passengers(params[:tickets], @booking)
end
def create
@booking = Booking.new(booking_params)
if @booking.save
@booking.passengers.e... |
class ClustersController < ApplicationController
before_filter :require_auth
before_filter :set_cache_headers, :only => [:show, :index]
# GET /clusters/1
# GET /clusters/1.json
def show
# current_user must own this photo to see
@cluster = Cluster.find params[:id]
render_404 unless current_user.ca... |
# -*- encoding: utf-8 -*-
require File.expand_path('../lib/got_milk/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["TM Lee"]
gem.email = ["tm89lee@gmail.com"]
gem.description = %q{Ruby helper gem that tells you if your "string" got milk? and everything else... }
gem.summary ... |
class PagesController < ApplicationController
load_and_authorize_resource
respond_to :html
def show
@page = Page.find(params[:id])
end
def new
@page = Page.new
2.times do
@page.sides.build
end
end
def create
@page = Page.create(page_params)
respond_with @page
end
def ... |
#
# lib-generic.rb : generic functions for iot-server.rb
#
require 'optparse'
require 'webrick'
def parse_option()
option={}
OptionParser.new do |opt|
# opt.on('-a', '1文字オプション 引数なし') {|v| option[:a] = v}
opt.on('-p VALUE', 'port number for REST API') {|v| option[:port] = v}
# opt.on(... |
require 'minitest/pride'
require 'minitest/autorun'
require 'pry'
require './lib/pantry'
class PantryTest < Minitest::Test
def test_it_exists
pantry = Pantry.new
assert_instance_of Pantry, pantry
end
def test_it_has_stock_and_default_of_zero
pantry = Pantry.new
assert_equal ({}), pantry.stock
... |
module ComicsHelper
def comic_box(comic, votes)
html = ""
img_path = "#{comic.thumbnail.path}.#{comic.thumbnail.extension}"
html += content_tag(:div, nil, class: 'comic-box', style: "background-image: url('#{img_path}');")
html += content_tag(:div, upvote(comic, votes), class: 'comic-actions')
ht... |
require "helper"
describe Prey::Client do
describe "#[]" do
it "returns queue instance" do
subject["prey"].should be_instance_of(Prey::Queue)
end
end
end
|
class AddFirstTeacherToAttendances < ActiveRecord::Migration[5.1]
def change
add_column :attendances, :first_teacher, :boolean, default: false
end
end
|
require 'rails_helper'
RSpec.feature "User can star a company" do
xit "they see the company they have starred" do
VCR.use_cassette('company_creation') do
company = create_approved_company
user_logs_in
visit '/'
click_on "TestCo"
expect(current_path).to eq("/companies/#{company.id}... |
class Identity < ApplicationRecord
self.table_name = 'identities'
belongs_to :user, class_name: 'User', required: false
def self.find_for_oauth(auth)
find_or_initialize_by(uid: auth['uid'], provider: auth['provider'])
end
end
|
class TopicsController < ApplicationController
def index
@topics = Topic.all.includes(:favorite_users, :comment_users)
@topics = @topics.order("takephoto DESC")
end
def new
@topic = Topic.new
end
def create
@topic = current_user.topics.new(topic_params)
if @topic.save
redirect_t... |
namespace :db do
desc "Fill database with sample data"
task populate: :environment do
Rake::Task['db:reset'].invoke
make_users
make_connections
make_institutions
make_resources
make_posts
associate_user_institution
tag_posts_with_topics
end
end
def make_users
100.times do |n|
... |
require "rails_helper"
module Clockface
RSpec.describe "clockface/application/_flash.html.erb", type: :view do
it "displays a div for each flash message" do
flash[:error] = "Some error"
flash[:notice] = "Some notice"
render
expect(page.all(".flash").count).to eq(2)
end
it "disp... |
require './lib/ics/version'
Gem::Specification.new do |s|
s.name = "ics"
s.version = ICS::VERSION::STRING
s.author = "Jashank Jeremy"
s.email = "jashankj@cse.unsw.edu.au"
s.homepage = "https://github.com/jashank/ics"
s.description = "Internet Calendaring and Scheduling."
s.summar... |
class UserSessionsController < Devise::SessionsController
skip_before_action :authenticate_user_token!, only: :create
skip_before_action :verify_signed_out_user
swagger_controller :user_sessions, 'User Session Management'
swagger_api :create do
summary 'Sign in a user to the application and returns back a... |
require 'minitest/autorun'
require_relative '../game.rb'
require_relative '../standings'
class TestStandings < Minitest::Test
def setup
# TODO: mock games.
games = [
Game.new("My Fun Team 1, My Other Team 2"),
Game.new("My Fun Team 3, My Other Team 0"),
Game.new("My Fun Team 1, Trying Team... |
class CollectionSerializer < ActiveModel::Serializer
attributes :name, :author, :editorial, :year_of_publication
belongs_to :genre, serializer: GenreSerializer
end |
require 'open3'
class FfmpegMovieInfo
def initialize(path)
@movie = FFMPEG::Movie.new(path)
end
def fps
@movie.frame_rate || 25
end
def valid?
@movie.valid?
end
def video_bitrate
bitrate = @movie.video_bitrate
bitrate = bitrate.nil? ? @movie.bitrate : bitrate
"#{... |
CashIn::Application.routes.draw do
get 'login', to: 'sessions#new', as: 'login'
post 'login', to: 'sessions#create', as: 'login'
get 'logout', to: 'sessions#destroy', as: 'logout'
get 'dashboard', to: 'site#dashboard', as: 'dashboard'
resources :exams
resources :employments
resources :bankings
resourc... |
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
get 'pages/two'
get 'pages/three'
root to: 'pages#one'
end
|
require 'spec_helper'
describe "category" do
let!(:customer) { Fabricate(:customer) }
before(:each) do
login_customer_post("admin", "admin")
end
let(:category) { Category.create(name: "Name", description: "Description") }
it "should create a category" do
visit new_admin_category_path
fill_in... |
class Dose < ActiveRecord::Base
belongs_to :cocktail
belongs_to :ingredient
validates_uniqueness_of :ingredient_id, scope: :cocktail_id
validates :cocktail_id, :uniqueness => { :scope => :ingredient_id }
validates :description, presence: true
end
|
class RemovePlanTypeReferenceToDailyTraffics < ActiveRecord::Migration
def change
remove_reference :daily_traffics, :plan_type, index: true, foreign_key: true
end
end
|
require 'rubygems'
require 'algorithms'
class Dijkstra
def self.find_path street_array,initial,final
number_streets = street_array.length
node_i = street_array[initial]
node_d = street_array[final]
h = Haversine.new
max_distance =
h.distance_harvesine(node_i.lati,node_i.longi,node_d.lati,node_d... |
describe C2Version do
describe "#diff" do
it "compares this version (before) with the next (after)" do
test_client_request = create(:test_client_request)
test_client_request.project_title = "something different"
test_client_request.save!
versions = test_client_request.versions
expect... |
require_relative '../rails_helper'
RSpec.describe MarkdownHelper do
it 'is a module' do
expect(subject).to be_a(Module)
end
describe '#markdown' do
it 'converts markdown to HTML' do
text = 'You can submit an oral question online using [e-tabling](https://etabling.parliament.uk/)'
expect(sub... |
# frozen_string_literal: true
require 'yaml'
require './lib/models.rb'
class Conf
FILENAME = 'linebackup.yml'
attr_accessor :my_status, :last_message_ids, :latest_timestamp
def initialize
if File.exist? FILENAME
read
else
@my_status = UserStatus.new('mysender', 'myaddress')
@last_mess... |
module SimpleForm
module Components
module Errors
def error
error_text if has_errors?
end
def has_errors?
object && object.respond_to?(:errors) && errors.present?
end
protected
def error_text
"#{html_escape(options[:error_prefix])} #{errors.send(error... |
# Get My Number Game
puts "Welcome to 'Get My Number!'"
print "Enter your name: "
player_name = gets.chomp.capitalize
puts "Hello, #{player_name}! I've got a random number between 1 and 100.", "Can you guess it?"
total_guesses = 8
guess_number = rand (1..100)
guessed_it = false
total_guesses.times do |guessing_made|
... |
Pod::Spec.new do |s|
s.name = "GOMEBluetooth"
s.version = "3.8.9"
s.summary = "sdk"
s.homepage = "https://github.com/MaxsLin/GOMEBluetooth"
s.license = { :type => "MIT"}
s.platform = :ios, "8.0"
s.authors = { 'Max Mak' => 'maxmak@maxsmak.com'}
s.source = { :git ... |
require "minitest/spec"
require "minitest/autorun"
require "minitest/unit"
class ApplicationIntegrationTest < ActionDispatch::IntegrationTest
NEW_CLASS = Class.new
OK = "200"
NOT_FOUND = "404"
FOUND = "302"
UNAUTHORIZED = "401"
BAD_REQUEST = "400"
alias GET get
alias POST post
alias PUT put
alias ... |
class Screenshot < ApplicationRecord
validates :image, presence: true
mount_uploader :image, ScreenshotUploader
belongs_to :game
end
|
class Admin::TalentsController < ApplicationController
before_action :set_talent, only: [:show, :edit, :update, :destroy]
before_action :set_params
# GET /admin/talents
# GET /admin/talents.json
def index
@mypage = "タレント一覧"
@talents = Talent.all
end
def female
category_list 1
end
def m... |
require File.dirname(__FILE__) + '/example_helper.rb'
# Simple resource used to show auto-updating of links.
class Person
include JiakResource
server SERVER_URI
attr_accessor :name, :age
keygen { name.downcase }
auto_post
end
# Convenience method for checking number of links
def check_num_links(rsrc... |
class CreateStories < ActiveRecord::Migration[5.2]
def change
create_table :stories do |t|
t.references :user, foreign_key: true
t.references :working_article, foreign_key: true
t.date :date
t.string :reporter
t.string :group
t.string :title
t.string :subtitle
t.str... |
require 'rails_helper'
describe Job do
before(:each) do
@category = Category.create!(name: 'Some Category')
end
describe "Class Methods" do
it ".sort_by_interest" do
company = Company.create!(name: 'ESPN')
category = Category.create!(name: 'Tech')
job1 = company.jobs.create!(title: 'Dev... |
require 'csv'
require 'time'
require 'pry'
require_relative 'user'
require_relative 'trip'
require_relative 'driver'
module RideShare
class TripDispatcher
attr_reader :passengers, :trips, :drivers
def initialize(user_file = 'support/users.csv', trip_file = 'support/trips.csv', driver_file = 'support/trips.... |
require_relative 'demo_app_page'
class EditArticlePage < DemoAppPage
section :article_errors
validate :title, /\ADemo web application - Edit Article\z/
element :article_title_field, :fillable_field, 'article[title]'
element :article_text_field, :fillable_field, 'article[text]'
element :create_article_button,... |
require 'benchmark'
class KDTree
Node = Struct.new(:item, :axis, :left, :right)
def initialize(points)
throw ArgumentError unless points.is_a?(Array)
@root = build(points)
end
def find(query)
prepare_query(query)
find_by_query(query)
end
private
def build(points, depth = 0)
retur... |
class AddCacheToAccounts < ActiveRecord::Migration[6.0]
def change
add_column :accounts, :last_balance_cents, :integer
add_column :accounts, :last_balance_updated_at, :datetime
end
end
|
require 'cloudformation_mapper/resource'
class CloudformationMapper::Resource::AwsPropertiesElasticacheSecurityGroupIngress < CloudformationMapper::Resource
register_type 'AWS::ElastiCache::SecurityGroupIngress'
type 'Template'
parameter do
type 'Template'
name :Properties
parameter do
typ... |
#!/usr/bin/env ruby
require 'optparse'
require 'ostruct'
require 'fileutils'
require 'shellwords'
require 'csv'
require 'json'
WARMUP_ITRS = 15
# Checked system - error if the command fails
def check_call(command, verbose: false)
puts(command)
if verbose
status = system(command, out: $stdout, err: :... |
class AssignmentNotificationMessage
attr_accessor :patient_id
# a.k.a. date_selected
:assignment_date
:assignment_uuid
:assignment_reason
# date when Cog sends message with ON_TREATMENT
:date_on_arm
# dat... |
Pod::Spec.new do |spec|
spec.name = "DeclareUI"
spec.version = "0.3.3"
spec.summary = "Declarative framework wrapping UIKit constraints"
spec.description = "This framework is meant to make setting up constraints of a UIKit project more declarative and look similar to SwiftUI."
spec.homepag... |
module Naf
class ApplicationsController < Naf::ApplicationController
before_filter :set_rows_per_page
def index
respond_to do |format|
format.html
format.json do
set_page
applications = []
application = []
params[:search][:deleted] = params[:sea... |
Rails.application.routes.draw do
root 'welcome#index'
get 'favicon', to: "welcome#favicon"
get '/images/favicon.ico', to: "welcome#favicon"
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
post '/', to: 'alexa#index'
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.