text stringlengths 10 2.61M |
|---|
class Film < ApplicationRecord
belongs_to :genere
has_many :season
validates :name, :presence => true, :uniqueness => true
end
|
require "tree"
require "minitest/autorun"
describe "a tree of employees" do
it "can be traversed using 3 depth first approaches" do
tree = Tree.new('Tim', Tree.new('Johny', Tree.new('Dan'), Tree.new('Katie', Tree.new('Peter'), Tree.new('Andrea'))), Tree.new('Phil', Tree.new('Craig'), Tree.new('Eddie')))
prin... |
class Character < ActiveRecord::Base
belongs_to :user
has_many :character_spells
has_many :spells, :through => :character_spells
belongs_to :player_class
belongs_to :specialization
validates :name, presence: true
validates :level, presence: true
validates :casting_modifier, presence: true
end |
class AddNamesToChats < ActiveRecord::Migration[5.2]
def change
add_column :chats, :studentName, :string
add_column :chats, :mentorName, :string
end
end
|
FactoryGirl.define do
factory :room do
trait :with_student do
association :student
end
trait :with_course do
association :course
end
factory :valid_room, traits: [:with_student, :with_course]
end
end |
module Commentable
extend ActiveSupport::Concern
included do
has_many :comments, as: :commentable, dependent: :destroy
has_many :commenters, through: :commentable, source: :user
end
end
|
require "test_helper"
class PurgeTest < Minitest::Test
def setup
@upyun = Upyun::Purge.new
end
def test_purge
result = @upyun.purge("http://xx.xxxx.com/xxx.jpg")
assert_equal true, result.key?("invalid_domain_of_url")
end
def test_purge_mult
result = @upyun.purge(["http://xx.xxxx.com/xxx.j... |
class RoomAvailability
attr_accessor :beds, :date, :availability, :end_date, :room_channel_id
def initialize(beds, date, availability)
@beds = beds
@date = date
@availability = availability
end
def self.get_room_availability_for_changes(changes, hotel_id)
result = []
changes.each do |c|
... |
class KarmaType
include Mongoid::Document
include Mongoid::Timestamps
has_many :karmas, :foreign_key => :karma_id
field :name, :type => String
field :description, :type => String
field :value, :type => Integer
validates_presence_of :name, :description, :value
end
|
module HerokuEnv
module Rails
class Railtie < ::Rails::Railtie
rake_tasks do
namespace :heroku_env do
namespace :config do
desc "Create heroku_env.yml from heroku config"
task :create => :environment do
heroku_config = `heroku config --shell`.split("\... |
class UserDashboardFacade
def initialize(user)
@user = user
end
def github_repos(quantity)
get_repos_result[0...quantity].map do |repo_data|
Github::Repository.new(repo_data)
end
end
def github_followers
get_followers_result.map do |follower_data|
Github::Follower.new(follower_d... |
# set path to app that will be used to configure unicorn,
# note the trailing slash in this example
dir = '/mnt/app/RunRTBTester/current'
worker_processes 2
working_directory dir
timeout 30
# Specify path to socket unicorn listens to,
# we will use this in our nginx.conf later
listen "#{dir}/tmp/sockets/unicorn.sock... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe FoodsController, type: :controller do
before do
session[:name] = 'apapun'
end
describe '#index' do
it 'does it successfully' do
get :index
expect(response).to have_http_status :ok
end
end
describe '#show' do
it... |
class AdminMailMailer < ApplicationMailer
def admin_email(admin, user, booking)
@greeting = "Hi"
@booking = booking
@admin = admin
@user = user
@url = 'http://example.com/login'
mail(to: @admin.pluck(:email), subject: "Notification of Booking")
end
end
|
require 'inject'
describe "i2" do
context "with block" do
it "will be 15 when applied to [1,2,3,4,5]" do
result = [1,2,3,4,5].inject {|memo, value| memo + value } # 15
expect([1,2,3,4,5].i2 {|memo, value| memo + value } ).to eq result
end
it "will be 45 when applied t... |
FactoryGirl.define do
factory :invitation do
user
event
invited false
attending false
status nil
end
end
|
Pod::Spec.new do |s|
s.name = "POPFormTable"
s.version = "0.2.0"
s.summary = "POPFormTable is cutom UITableViewController that support generate some common input field for Object-c project."
s.homepage = "https://github.com/popeveryday/POPFormTable"
s.license = 'MIT'
s.aut... |
module Couchino
class Plugin
attr_reader :pusher
attr_accessor :options
def self.name(plugin_name)
@@plugins ||= {}
@@plugins[plugin_name] = self
end
def self.plugins
@@plugins ||= {}
end
def initialize(pusher, options = {})
@pusher = pusher
@options = opti... |
require_relative('../db/sql_runner')
require_relative('./film.rb')
require_relative('./customer.rb')
class Ticket
attr_reader :id
attr_accessor :film_id, :customer_id
def initialize( options )
@id = options['id'].to_i if options['id']
@film_id = options['film_id'].to_i
@customer_id = options['custo... |
class Attribution < ActiveRecord::Base
# Order is significant for these.
# Attributions will be ordered by the numeric
# "role" attribute in ascending order.
ROLE_AUTHOR = 1
ROLE_CONTRIBUTOR = 2
ROLE_SOURCE = 3
ROLE_TEXT = {
ROLE_AUTHOR => "Author",
ROLE_CONTRIBUTOR => "C... |
#
# Cookbook Name:: transmission-debian
# Recipe:: torrents
#
# Copyright 2016 Chef Software, 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/LICEN... |
class User < ActiveRecord::Base
has_many :encounters_as_attacker, foreign_key: "attacker_id", class_name: "Encounter"
has_many :encounters_as_defender, foreign_key: "defender_id", class_name: "Encounter"
validates :username, presence: true
validates :password, presence: true
end |
class AddSelectedPolygonIdsToLayer < ActiveRecord::Migration
def change
add_column :layers, :selected_polygon_ids, :text
end
end
|
cask :v1 => 'ibackup' do
version '7.5'
sha256 'faa69e95f62dfeb04a6ede20e7b856d43645f1bd07aede743c5d364d2845aabf'
url "http://www.grapefruit.ch/iBackup/versions/iBackup%207.x/iBackup%20#{version}.dmg"
homepage 'http://www.grapefruit.ch/iBackup'
license :unknown # todo: change license and remove this commen... |
class CreateVirtualMachines < ActiveRecord::Migration
def change
create_table :virtual_machines do |t|
t.string :hostname
t.integer :ram
t.integer :cores
t.integer :localStorage
t.integer :clusterId
t.timestamps
end
end
end
|
class RenameUsername < ActiveRecord::Migration
def self.up
rename_column :users, :username, :name
end
end
|
Pod::Spec.new do |s|
s.name = 'CustomPods'
s.version = '0.1.2'
s.summary = 'A sample project for learning how to create custom pods'
s.description = <<-DESC
This fantastic view changes its color gradually makes your app look fantastic!
DESC
s.swift_v... |
class LikesController < ApplicationController
before_action :requires_login, only: [:create]
def create
like = Like.create(like_params)
render json: like
end
private
def like_params
params.permit(:poem_id)
end
end
|
class Cernight::Configuration
class Executor
include Cernight::Cognito
def initialize(method, params)
@method = method
@params = params
end
def run
begin
client.send(@method, @params)
rescue Aws::CognitoIdentityProvider::Errors::InvalidParameterException => error
... |
module Concerns::Susanoo::Admin::DivisionsController
extend ActiveSupport::Concern
included do
before_action :admin_required
before_action :set_division, only: %i(edit update destroy)
#
# GET /susanoo/admin/divisions
#=== 部局一覧
#
def index
@divisions = ::Division.order("number")
... |
Pod::Spec.new do |s|
s.name = 'FantasticViewMarkPayTesting2'
s.version = '1.0.1'
s.summary = 'By far the most fantastic view I have seen in my entire life. No joke.'
s.description = <<-DESC
This fantastic view changes its color gradually makes your app look fantastic!
... |
require 'rails_helper'
describe "All routes" do
it "routes profile to users#profile" do
expect(get("/users/profile")).to route_to(controller: "users", action: "profile")
end
end
|
# Write your sql queries in this file in the appropriate method like the example below:
#
# def select_category_from_projects
# "SELECT category FROM projects;"
# end
# Make sure each ruby method returns a string containing a valid SQL statement.
def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabe... |
class SchoolsController < ApplicationController
before_filter :load_person
before_filter :load_school, :only => [:show, :edit, :update, :delete, :destroy]
before_filter :new_school, :only => [:new, :create, :index]
filter_access_to :all, :attribute_check => true
# GET /people/1/schools
# GET /people/1/scho... |
class AddCodeToSubmissions < ActiveRecord::Migration
def change
add_column :submissions, :code, :text, :default => ""
remove_column :submissions, :code_link, :string
end
end
|
class TripsController < ApplicationController
def index
@trips = Trip.limit(10)
@current_trips = Trip.current.by_start_date
@past_trips = Trip.past
end
def new
@trip = Trip.new
end
def create
@trip = Trip.create(trip_params)
respond_with @trip, location: -> { trips_path }
end
d... |
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.2'
# Use mysql as the database for Active Record
gem 'mysql2'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use C... |
# Encoding: UTF-8
#
# Cookbook Name:: duo-openvpn-build
# Library:: helpers
#
# Copyright 2016, Socrata, 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/licen... |
class AddDiscardedAtIndexToUsers < ActiveRecord::Migration[6.0]
def change
add_index :users, :discarded_at
end
end
|
# encoding: utf-8
# Apply different float masks on an image to extract the image's background
class Xi::DIP::Preprocess::BackgroundMask
# Apply the requested masks
# @param image [Magick::Image] the given image
# @param masks [Array] list of masks (hash of name and arguments)
# @return [Array, Float] the 2D ... |
class SampleSelf
attr_accessor :name
def initialize(name)
@name = name
end
def hello
# selfなしでnameメソッドを呼び出し
puts "Hello, #{name}"
end
def hi
# selfつき
puts "Hi, #{self.name}"
end
def my_name
# インスタンス変数で呼び出し
puts "my name is #{@name}"
end
end
user = SampleSelf.new("Alice... |
module BackpackTF
class MarketPrice
# Process reponses from IGetMarketPrices
class Response < BackpackTF::Response
@response = nil
@items = {}
def self.items
@items = @response['items'].each_with_object({}) do |(name, attr), acc|
acc[name] = BackpackTF::MarketPrice.new(nam... |
class ApplicationMailer < ActionMailer::Base
default from: 'aio.japan.oo@gamil.com'
layout 'mailer'
end
|
class User < ApplicationRecord
include AppHelpers::Activeable::InstanceMethods
extend AppHelpers::Activeable::ClassMethods
include AppHelpers::Validations
include AppHelpers::Deletions
include UserAuthentication
has_secure_password
# Relationships
belongs_to :organization
# has_many :teams, through:... |
class TodoItemsController < ApplicationController
respond_to :html
respond_to :js, only: [:new, :create, :destroy]
respond_to :json, only: [:edit, :update]
before_action :authenticate_user!, :set_list
def new
@todo_item = TodoItem.new
end
def create
@todo_item = TodoItem.new todo_item_params.me... |
# Virus Predictor
# I worked on this challenge [with: LeeAnne Hawley ].
# We spent [2] hours on this challenge.
# EXPLANATION OF require_relative
# require_relative is a link to a file in the same directory
# require is a link to a file outside of the directory and requires a path
require_relative 'state_data'
class... |
class Ccgsl < Formula
desc "C++ interface for the gnu Scientific Library"
homepage "https://ccgsl.sourceforge.io/"
url "https://downloads.sourceforge.net/project/ccgsl/ccgsl-1.16.1.tar.gz"
sha256 "6a846749ed35eaa0844935356450c5590d53e40a70ac596ef6718d89652509f1"
depends_on "gsl"
def install
system "./... |
class Order < ApplicationRecord
has_secure_token
belongs_to :user
has_one :info, class_name: "OrderInfo", dependent: :destroy
has_many :items, class_name: "OrderItem", dependent: :destroy
accepts_nested_attributes_for :info, reject_if: :all_blank
def build_item_cache_from_cart(cart)
cart.items.eac... |
require 'oauth'
require 'json'
require 'csv'
class GoodDataTwitterAds::PromotedTweets
attr_reader :client
def initialize config={}
@client = config[:client]
end
#-----------------------------------------------------LIST OF PROMOTED TWEETS------------------------------------------------------------------
# This... |
# frozen_string_literal: true
require_relative 'components/standardize_names'
class NoDrawing < StandardError
end
namespace :caststone do
namespace :components do
desc 'Capitalize all words in component names'
task standardize_names: :environment do |task|
standardize_names = StandardizeNames.new
... |
class CreateSystemStats < ActiveRecord::Migration
def change
create_table :system_stats do |t|
t.float :user_cpu
t.float :sys_cpu
t.float :load_1
t.float :load_5
t.float :load_15
t.timestamps
end
end
end
|
class CreateLogs < ActiveRecord::Migration
create_table :logs, :force => true do |t|
t.string :title
t.text :body
t.belongs_to :user
t.string :users_to_notify
t.string :category
t.string :status
t.timestamps
end
def self.down
drop_table :logs
end
end
|
class AddStatusAndDurationToTask < ActiveRecord::Migration[5.1]
def change
add_column :tasks, :status, :boolean
add_column :tasks, :duration, :string
end
end
|
class UserBooksController < ApplicationController
skip_before_action :authorized, only: [:index, :show]
before_action :set_user_book, only: [:show, :update, :destroy]
# GET /user_books
def index
@user_books = UserBook.all
render json: @user_books
end
# GET /user_books/1
def show
render json:... |
module Zheng
module Actions
module Player
module_function
def add(name, rank)
if Zheng::Rating.is_rank? rank
Zheng::Player.create(:name => name, :rank => rank)
else
Zheng::Player.create(:name => name, :rating => rank.to_i)
end
end
def add_exter... |
require_relative '../lib/rules/rules_list'
require_relative '../lib/order'
require_relative '../lib/item'
describe RulesList do
let(:order) { Order.new }
let(:rules) { described_class.new }
describe "#apply_item_rules" do
before do
i1 = Item.new('A', 'Item A', 40.00)
i2 = Item.new('B', 'Item B',... |
require 'rails_helper'
RSpec.describe Season, type: :model do
let(:season) { FactoryBot.create(:season) }
it 'has a valid factory' do
expect(season).to be_valid
end
describe 'validations' do
it { should validate_presence_of(:year) }
it { should validate_uniqueness_of(:year) }
end
describe 'y... |
require 'homologenie/structure/multidimensional_array'
include HomoloGenie::Structure
module HomoloGenie
module Alignment
class NeedlemanWunsch
public
attr_reader :alignments
attr_reader :score
attr_reader :table
ReferencePath = Struct.new(:score, :index)
def initialize()... |
class WebPage < ActiveRecord::Base
validates_uniqueness_of :full_url
validates_uniqueness_of :shortened_url
##TODO Validate url
before_save :shorten_url
private
def shorten_url
self.shortened_url = SecureRandom.hex(2)
end
end |
class TitleVendorsPage < GenericBasePage
include DataHelper
#class HeaderPage < GenericBasePage
element(:titleVendors) {|b| b.link(text: "Title Vendors")}
element(:vendorsByState) {|b| b.link(text: "Vendors By State")}
end
|
require 'stringio'
class Hadupils::Extensions::HiveTest < Test::Unit::TestCase
shared_context :provide_hive_ext do
setup do
@ext = Hadupils::Extensions::Hive.new(@tempdir.path)
end
end
shared_context :hive_aux_jars_path_cases do
should 'assemble hive_aux_jars_path from auxiliary_jars appropria... |
# Problem 380: Amazing Mazes!
# http://projecteuler.net/problem=380
#
# An m×n maze is an m×n rectangular grid with walls placed between grid cells such that there is exactly one path from the top-left square to any other square. The following are examples of a 9×12 maze and a 15×20 maze:
#
#
# http://projecteuler... |
require 'web_helper'
feature 'sign in' do
let(:user) do
User.create(name: 'test', email: 'test@test.com', password: '123', password_confirmation: '123')
end
scenario 'sign in with no issues' do
sign_in(email: user.email, password: user.password)
expect(page).to have_content "Hi #{user.name}"
end
... |
class BrowserStakeout
class Options < Hash
attr_reader :opts, :orig_args, :browsers, :files
def initialize(args)
super()
@orig_args = args.clone
self[:safari] = true
self[:firefox] = false
self[:index] = "index\.htm[l]?"
@opts = OptionParser.new do |o|... |
# frozen_string_literal: true
Sequel.migration do
change do
create_table :coaches do
primary_key :id
String :fullname, null: false
String :avatar
String :personal_info
DateTime :created_at, null: false
DateTime :updated_at, null: false
DateTime :deleted_at
end
en... |
class StudentAchvGoal < ApplicationRecord
belongs_to :user
belongs_to :achievement_goal
has_one :achievement, through: :achievement_goal
has_one :goal, through: :achievement_goal
end
|
module Common
class GrowPhase
include Mongoid::Document
include Mongoid::Timestamps::Short
field :name, type: String
field :is_active, type: Boolean, default: true
field :number_of_days, type: Integer
field :number_of_days_avg, type: Float, default: -> { 0 }
scope :active, -> { where(is_... |
module Airmodel
module Associable
# defines a clone of the child class on this model
# required args: association_name
def has_many(association_name, args={})
args[:class_name] ||= association_name.to_s.singularize.capitalize
define_method association_name do
config = if args[:base_ke... |
class PostsController < BaseController
before_action :set_post, only: [:show, :update, :destroy]
def index
@posts = current_user.posts
.page(params[:page])
.per(params[:per_page] || 20)
render json: @posts
end
def show
render json: @post
end
... |
module ConsoleHelper
def solution_debug_link(body)
slug = body["errors_javascript"]["solution_location"]["slug"]
parent_id = body["errors_javascript"]["solution_location"]["id"]
position = body["errors_javascript"]["solution_location"]["position"]
line_number = body["errors_javascript"]["solution_lo... |
module AccountsHelper
def period_buttons
content_tag(:div, class: "button-bar chart-toggle") do
concat period_button("1W", "past_week")
concat period_button("1M", "past_month")
concat period_button("1Y", "past_year")
concat period_button("YTD", "year_to_date")
end
end
def period_b... |
#!/usr/bin/env ruby
require 'optparse'
vopts = %w[ca cert dh extra-certs key pkcs12 secret crl-verify
http-proxy-user-pass tls-auth tls-crypt]
opt = {}
OptionParser.new do |opts|
opts.on('--conf CONF') { |c| opt[:conf] = c }
vopts.each do |vo|
opts.on("--#{vo} #{vo}") { |o| opt[vo] = o }
end
end... |
class Affiliate < ActiveRecord::Base
attr_accessible :user_count, :earned_credits, :users_expensed_credit
has_many :users
end
|
require 'logger'
module SCC
# Provides a simple logging interface.
class Logger
def self.setup(target)
@logger = ::Logger.new(target)
end
def self.info(message)
@logger.info(message) if @logger
end
end
end
|
module QBIntegration
class Item < Base
attr_reader :items, :page_num, :new_page_number
def initialize(message = {}, config)
super
end
def get
now = Time.now.utc.iso8601
@items, @new_page_number = item_service.find_by_updated_at(page_number)
summary = "Retrieved #{@items.count... |
class Song < ActiveRecord::Base
has_many :playlists
has_many :users, :through => :playlists
validates :title, :artist, presence: true, length: { minimum: 2 }
before_save do
self.times_added ||= 0
self.times_added += 1
self
end
end
|
require "socket_helpers/version"
require 'rails'
module SocketHelpers
class MyRailtie < Rails::Railtie
end
module ControllerHelpers
require 'oj'
def public_attrs(record)
attrs = record.attributes.merge('record_class' => record.try(:published_class) || record.class.to_s.underscore)
return Oj.d... |
module Talis
module Hierarchy
# Common functionality to Hierarchy resources (Node, Asset)
module Resource
# The methods defined within this module are available to instances of,
# and the class itself that extends Talis::Hierarchy::Resource.
module Helpers
# @return [String] The hier... |
require 'test_helper'
class SongRequestsControllerTest < ActionController::TestCase
setup do
@song_request = song_requests(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:song_requests)
end
test "should get new" do
get :new
assert_res... |
module Frank::HTTP
class RequestFactory
@allowed_methods ||= ["GET", "POST", "PUT", "DELETE", "HEAD", "PATCH", "OPTIONS", "TRACE", "CONNECT"]
module ClassMethods
def create_request(method, path, &block)
raise ArgumentError unless block_given? and @allowed_methods.include?(method)
reques... |
class RequisitesController < ApplicationController
before_action :authorize_request
before_action -> { authorize_user(['admin', 'manager']) },
only: [:create]
# GET /requisites
def index
@requisites = Requisite.all
render json: @requisites, status: :ok
end
# POST /requisites
def create
... |
require 'rails_helper'
feature "category items" do
fixtures :categories
fixtures :items
let(:category) { Category.find_by_name("Category B") }
before(:each) do
visit "/"
click_link category.name
end
it "can visit a category page" do
expect(current_path).to eq(category.dao.prepend("/"))
end... |
module Yito
module Model
module Booking
module SupplementsCalculation
#
# Calculate supplements (time to/from, pickup/return place and driver age)
#
def calculate_supplements
# Calculate the new price of the reservation
driver_age_data = build_driver_age... |
class Post < ActiveRecord::Base
#include Impressionist::IsImpressionable
#is_impressionable :counter_cache => true, :column_name => :views_count, :unique => true
belongs_to :user
belongs_to :subforum
has_many :comments, :dependent => :destroy
has_many :pictures, as: :imageable, :dependent => :destroy
has... |
# frozen_string_literal: true
require 'spec_helper'
require 'bolt_spec/files'
require 'bolt/module'
describe Bolt::Module do
include BoltSpec::Files
let(:modulepath) { [fixtures_path('modules')] }
let(:mods) { Bolt::Module.discover(modulepath) }
it 'returns the path' do
expect(mods['vars'].name).to eq('... |
class Admin::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
layout 'admin/application'
helper_method :current_user
private
def current_user
#code
@current_... |
# ARGV requires a passed command line argument
# $stdin.gets.chomp requires a user to respond to a prompt
# choosing between one or the other requires deciding when you want the user to pay attention
# irb can open and read and print the contents of a file as well as any script
# without lines 1 - 7
# filename is as... |
Then(/^I verify that users count should be displayed$/) do
has_xpath?("//div[@class='totalCount left']").should eq(true)
end
Then(/^I verify all existing users are loaded in 'User List'$/) do
sleep 15
@userspage.scrollBottomWidget('User List')
nro_users = all(:xpath, "//div[@id='users_list']//table[@id='userLi... |
module API
module V1
module Games
class GamesCacheable < API::V1::Base
helpers API::Helpers::V1::GamesHelpers
before do
authenticate_user
end
VALID_GAMES_ENDPOINTS = [
:quiz,
:poll,
:complete_sentence,
:word_search,
... |
class Baner < ActiveRecord::Base
attr_accessible :kode, :likeurl, :position, :showcount, :clickcount, :showshowcount, :showclickcount, :gourl
belongs_to :position
attr_accessible :position_id
attr_accessible :banerimage
has_attached_file :banerimage, :styles => {:thumb => "100x100>"}, :default_url => "/ima... |
class Player
attr_reader :name, :symbol, :score
def initialize(name, symbol)
@name = name
@symbol = symbol
@score = 0
end
def increase_score
@score += 1
end
end
|
require 'spec_helper'
describe "qwyz pages" do
subject { page }
before do
@user = create_test_user("n", "e@q.c", "passpass", "passpass")
sign_in(@user)
end
describe "create a qwyz" do
before { visit new_qwyz_path }
it { should have_content("Create a Qwyz")}
it { should have_title("Create a New Qwyz")}
... |
class RemoveIsBookedByUserFromMytimeslots < ActiveRecord::Migration
def self.up
remove_column :mytimeslots, :is_booked_by_user
end
def self.down
add_column :mytimeslots, :is_booked_by_user, :boolean
end
end
|
require 'formula'
class Alvar < Formula
homepage 'http://virtual.vtt.fi/virtual/proj2/multimedia/alvar/index.html'
url 'https://github.com/tzwenn/alvar.git', :branch => 'master'
version '2.0.0'
depends_on 'homebrew/science/opencv'
depends_on 'tinyxml'
depends_on 'cmake' => :build
option :cxx11
def i... |
# frozen_string_literal: true
module Files
class TwoFactorAuthenticationMethod
attr_reader :options, :attributes
def initialize(attributes = {}, options = {})
@attributes = attributes || {}
@options = options || {}
end
# int64 - 2fa ID
def id
@attributes[:id]
end
def ... |
class Event < ActiveRecord::Base
acts_as_voteable
acts_as_taggable_on :tags, :sections
acts_as_featured_item
acts_as_moderatable
acts_as_media_item
named_scope :newest, lambda { |*args| { :order => ["created_at desc"], :limit => (args.first || 10)} }
named_scope :top, lambda { |*args| { :order => ["likes... |
require 'json'
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'puppet_x', 'nexus', 'config.rb'))
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'puppet_x', 'nexus', 'exception.rb'))
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', '... |
Dado('el centro con nombre {string}') do |nombre_centro|
@request = {
'nombre': nombre_centro
}
@nombre_centro = nombre_centro
end
Cuando('se registra el centro') do
@response = Faraday.post(CENTROS_URL, @request.to_json, 'Content-Type' => 'application/json')
if @response.successful?
json_response = ... |
class BookingsController < ApplicationController
def index
policy_scope(Booking)
@bookings = Booking.all.order("created_at DESC")
@prestations = Prestation.all
end
def show
@bookings = Booking.all
@booking = Booking.find(params[:id])
authorize @booking
@answer = Answer.new
@answer.bo... |
require 'spec_helper'
feature 'Enter names' do
scenario 'submitting names' do
sign_in_and_play
expect(page).to have_content 'Harry vs. Mara'
end
end
feature "Other player's hit points" do
scenario 'see how close to winning' do
sign_in_and_play
expect(page).to have_content 'Mara: 60HP'
end
end
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.