text stringlengths 10 2.61M |
|---|
require 'rails_helper'
RSpec.describe "OpinionPages", type: :request do
subject { page }
let(:content) { FactoryGirl.create(:content) }
describe "opinion creation" do
before { visit @content }
describe "with invalid information" do
it "should not create a opinion" do
expect { click_button "Отправить"... |
class LineItemsController < ApplicationController
# Setup @line_item.
before_action :set_line_item, only: [:update, :destroy]
# POST /line_items
def create
if params[:variant_id]
# The request includes the `:variant_id`.
@variant = Variant.find_by(id: params[:variant_id])
if @variant
... |
# describe "anagrams" do
# it "should be defined" do
# lambda { combine_anagrams([]) }.should_not raise_error(::NoMethodError)
# end
# it "should return an Array" do
# combine_anagrams([]).class.should == Array
# end
# end
def combine_anagrams(words)
# <YOUR CODE HERE>
hash = Hash.new
wo... |
require 'sinatra'
module Putit
module Integration
class IntegrationBase
class << self
attr_reader :endpoint
end
def self.on_webhook(&handler)
@handler = handler
end
def self.listen_for_webhook_on_url(endpoint)
@endpoint = endpoint
end
def self.... |
require 'dm-core'
require 'dm-migrations'
require 'dm-constraints'
require 'dm-validations'
require 'dm-timestamps'
require 'dm-transactions'
require 'dm-types'
require 'dm-serializer/to_json'
require 'dm-zone-types'
module Testor
def self.next_job(previous_jobs, status)
Persistence::Job.available(previous_jobs... |
# frozen_string_literal: true
require "spec_helper"
RSpec.describe BigintCustomIdIntRange do
let(:connection) { described_class.connection }
let(:schema_cache) { connection.schema_cache }
let(:table_name) { described_class.table_name }
describe ".primary_key" do
subject { described_class.primary_key }
... |
require 'hollywood'
class Actor
def in_a_movie?
false
end
def learnt_lines?
@learn_lines || false
end
def learn_lines character
@learn_lines = true
@character = character
end
def deposit fee
@money_in_the_bank = fee
end
attr_reader :character, :money_in_the_bank
end
class Age... |
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rspec'
require 'capybara/rails'
require 'shoulda/matchers'
require 'helpers/admin_helper'
require 'factories'
Act... |
module SportsDataApi
module Mlb
class Games
include Enumerable
attr_reader :games, :year
def initialize(xml)
xml = xml.first if xml.is_a? Nokogiri::XML::NodeSet
@year = xml['season_year']
@games = []
if xml.is_a? Nokogiri::XML::Element
xml.xpath('event'... |
# # Create a program that asks the user for their favorite 5 foods. Then display those foods as an array, using the “p” keyword.
# foods = []
# puts "What is the name of your five favorite foods?"
# 2.times do |i|
# puts "Number #{i + 1} is:"
# answer = gets.chomp
# foods << answer
# i += 1
# end
# #p foo... |
module Offers
module Searchable
extend ActiveSupport::Concern
included do
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
settings index: { number_of_shards: 1 } do
mappings dynamic: false do
indexes :id, type: :long
indexes :title, type: :t... |
require 'dalli'
module Twigg
module Cache
class Client
def initialize
options = {
compress: true,
expires_in: Config.cache.expiry,
value_max_bytes: Config.cache.value_max_bytes,
namespace: Config.cache.namespace,
}.delete_if { |key, ... |
# == Schema Information
#
# Table name: reports
#
# id :bigint(8) not null, primary key
# business_id :integer
# date :date
# sales :money
# expenses :money
# comments :text
# created_at :datetime not null
# updated_at :datetime not null
#
class Report < App... |
module Merb::Cache::ControllerInstanceMethods
# Mixed in Merb::Controller. Provides methods related to fragment caching
# Checks whether a cache entry exists
#
# ==== Parameter
# options<String,Hash>:: The options that will be passed to #key_for
#
# ==== Returns
# true if the cache entry exists, false ... |
class RenameColumnImage < ActiveRecord::Migration[5.2]
def change
rename_column :categories, :image, :image_url
end
end
|
class Attribution::Report
attr_accessor :portfolio, :start_date, :end_date, :securities,
:cumulative_security_performances, :cumulative_portfolio_performance, :cumulative_security_contributions,
:companies
def initialize( opts={} )
@portfolio = opts[:portfolio]
@start_dat... |
module ApplicationHelper
def bootstrap_class_for flash_type
case flash_type
when :success
"alert-success"
when :error
"alert-error"
when :alert
"alert-block"
when :notice
"alert-info"
else
flash_type.to_s
end
end
def resource_name
... |
class Node < ActiveRecord::Base
# belongs_to :parent, :class_name => Node
belongs_to :left, :class_name => Node, foreign_key: true
belongs_to :right, :class_name => Node, foreign_key: true
def insert(other)
newbie = Node.create(:value => other)
insert_node(newbie)
end
def insert_node(other)
if... |
# encoding: UTF-8
class Report < ActiveRecord::Base
# associations
belongs_to :project
belongs_to :service
# validations
# validates :comment, :date, :duration, :project_id, :service_id, :format => {:with => /^[^<>%&$]*$/}
validates :date, :presence => true
validates :duration, :presence => true
vali... |
require 'rails_helper'
describe Nib do
it { should have_valid(:nib_size).when('medium') }
it { should have_valid(:nib_type).when('oblique') }
it { should_not have_valid(:nib_type).when(nil, '') }
end
|
class TeslaCommand
include ActionView::Helpers::DateHelper
TEMP_MIN = 59
TEMP_MAX = 82
def self.command(cmd, opt=nil, quick=false)
new.command(cmd, opt, quick)
end
def self.quick_command(cmd, opt=nil)
return "Currently forbidden" if DataStorage[:tesla_forbidden]
TeslaCommandWorker.perform... |
class ChurchesController < ApplicationController
before_filter :authenticate_user!, :only => [:new, :edit, :create, :update, :destroy]
load_and_authorize_resource
respond_to :html, :json, :xml
def index
@churches = Church.page params[:page]
respond_with @churches
end
def geo
@churches = Chur... |
describe "SalariedEmployee" do
describe "#initialize" do
it "should instantiate properly" do
test = SalariedEmployee.new "Clay"
expect(test.name).to eq("Clay")
end
it "should set the default payrate" do
test = SalariedEmployee.new "Clay"
expect(test.payrate).to eq(50000)
end
... |
class AdvancedApplicationWindowLayout < Netzke::Basepack::BorderLayoutPanel
include AdvancedApplicationWindowLayoutHelper
def configuration
super.merge(
:header => false,
:border => false,
:tbar => [{
:xtype => 'buttongroup',
:title => 'Sample jobs... |
class Sub < ActiveRecord::Base
validates :title, :user_id, presence: true
belongs_to :moderator,
foreign_key: :user_id,
class_name: :User
has_many :original_posts,
class_name: :Posts
has_many :posts,
through: :post_subs,
source: :post
has_many :post_subs
end
|
# frozen_string_literal: true
if ENV['PARALLEL_WORKERS'].to_i != 1
ENV['PARALLEL_WORKERS'] = '1'
warn '**** PARALLEL_WORKERS has been disabled ****'
warn 'SimpleCov does not support Rails Parallelization yet'
end
return if ENV['RUBYMINE_SIMPLECOV_COVERAGE_PATH']
if defined?(Spring) && ENV['DISABLE_SPRING'].nil... |
class GuestsController < ApplicationController
def new
@guest = Guest.new
end
# if user is logged in, return current_user, else return guest_user
def current_or_guest_user
if current_user
if session[:guest_user_id] && session[:guest_user_id] != current_user.id
logging_in
# reload guest_user to... |
class IncidentsController < InheritedResources::Base
private
def incident_params
params.require(:incident).permit(:name, :duration)
end
end
|
class Statosaurus
def initialize(fields, logger)
@fields = fields.sort
values = {}
@logger = logger
@logger.info("# Fields: " + fields.join(" "))
end
def values
Thread.current[:values] ||= {}
end
def transaction_id
Thread.current[:transaction_id]
end
def measure(field, &bloc... |
class Collection < ApplicationRecord
belongs_to :user
has_many :items, dependent: :destroy
mount_uploader :image, ImageUploader
# validates :name, presence: true, unless: :image?
validate :image_present?
validate :name_present?
validate :explanation_present?
validates :name, :explanation, :image, :us... |
require 'spec_helper_acceptance'
describe 'singularity class:' do
context 'default parameters' do
it 'runs successfully' do
pp = <<-EOS
class { 'singularity':
# Avoid /etc/localtime which may not exist in minimal Docker environments
bind_paths => ['/etc/hosts'],
}
EOS
... |
module FakerioApi
class Internet
def self.emails(options = {})
request_parameters = {count: 1}.merge(options)
request_parameters.merge!({uuid: FakerioApi::Base.uuid, auth_token: FakerioApi::Base.token})
FakerioApi::Base.get("/api/v1/internet/emails.json", body: request_parameters).parsed_respon... |
=begin
output: all even numbers 1- 99 inclusive
steps:
1: puts all numbers 1-99
=end
(1..99).each do |number|
puts number if number.even?
end
number_range = (1..99).to_a
arr = number_range.select { |num| num % 2 == 0 }
arr.each { |num| p num } |
require File.dirname(__FILE__) + '/test_helper.rb'
class TestGoogleChart < Test::Unit::TestCase
context '#Line' do
context 'with hash parameters' do
setup do
@url = GoogleChart.Line(:size => '1000x300', :data => [[35, 41], [50, 33]], :scale => 0..61)
end
should 'return G... |
class NousarmicropostsController < ApplicationController
# GET /Nousarmicroposts
# GET /Nousarmicroposts.json
def index
@nousarmicroposts = Nousarmicropost.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @nousarmicroposts }
end
end
# GET /Nousarmicr... |
require 'zxcvbn'
require 'sqlite3'
require 'bcrypt'
password_file = 'password_dictionaries/10_million_password_list_top_10000.txt'
database_file = 'db/entropy.sqlite3'
tester = Zxcvbn::Tester.new
puts "Reading common passwords"
start_time = Time.now
entropies = File.readlines(password_file).map(&:chomp).each_with_ob... |
class OrdersController < ApplicationController
before_action :set_order, only: [:show, :edit, :update, :destroy, :review]
def show
authorize @order
end
def new
@order = Order.new
authorize @order
end
def create
@order = Order.new(order_params)
@order.user = current_user
@pastel =... |
module ReportsKit
module Reports
module Data
class ChartOptions
DEFAULT_COLORS = %w(
#1f77b4
#aec7e8
#ff7f0e
#ffbb78
#2ca02c
#98df8a
#d62728
#ff9896
#9467bd
#c5b0d5
#8c564b
#c49c94... |
class Remision < ActiveRecord::Base
attr_accessible :numero_remision, :centro_costo_id, :fecha_remision, :concepto_servicio_id, :estado_remision_id, :referencia
scope :ordenado_01, -> {order("fecha_remision desc")}
scope :ordenado_id_desc, -> {order("id desc")}
scope :con_salidas, -> { where("exists (select ... |
Rails.application.routes.draw do
get 'trainings/show'
get 'trainings/new'
get 'trainings/index'
root 'sessions#index'
#custom routes for login
#creating a new session
get '/login' => 'sessions#new'
post '/login' => 'sessions#create'
delete '/logout' => 'sessions#destroy' #this needs to be a delete ... |
class UsersController < ApplicationController
skip_before_action :authenticate_user!, only: :show
def show
@user = User.find(params[:id])
@bookings = current_user.bookings
end
def edit
@user = User.find(params[:id])
end
def update
current_user.update(user_params)
current_user.save
... |
#! /usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'optparse'
$LOAD_PATH.unshift( File.join( File.dirname( __FILE__ ), '..', 'lib' ))
require 'sip_notify'
opts_defaults = {
:port => 5060,
:user => nil,
:verbosity => 0,
:event => 'check-sync;reboot=false',
:spoof_src_addr => nil,
}
opts = {}
opts_parser = :... |
class ExternalActivity < ActiveRecord::Base
belongs_to :user
has_many :offerings, :dependent => :destroy, :as => :runnable, :class_name => "Portal::Offering"
has_many :teacher_notes, :as => :authored_entity
has_many :author_notes, :as => :authored_entity
acts_as_replicatable
include Changeable
includ... |
# coding: utf-8
# frozen_string_literal: true
require 'pp'
require './uri.rb'
# require 'uri'
# modify uri module to permit '|'
require 'eventmachine'
require 'em-http'
require 'nokogiri'
require 'open-uri'
require 'httpclient'
require 'mechanize'
require 'net/http'
require 'logger'
require 'sqlite3'
require 'capybara... |
class Api::V1::TagsController < ApplicationController
before_action :authenticate_with_token!, only: [:create, :update, :destroy]
respond_to :json
def index
unless params[:project].nil?
tags = Project.find(params[:project]).tags
end
render json: tags
end
def create
tag = Tag.new(create_... |
class IndexJob < ActiveJob::Base
queue_as :lagottino
def perform(obj)
logger = Logger.new(STDOUT)
obj.__elasticsearch__.index_document
logger.info "Indexing event #{obj.uuid}."
end
end |
class RenamePhotoUrlToImage < ActiveRecord::Migration[5.0]
def change
rename_column :users, :photourl, :image
end
end
|
class SpeaksController < ApplicationController
def new
@speak = Speak.new
end
def create
@speak = Speak.create(create_params)
unless @speak.save
render action: :new
end
end
def show
@speak = Speak.find(params[:id])
@comments = @speak.comments.order('created_at DESC')
end
... |
require 'test_helper'
class CallRoutesControllerTest < ActionController::TestCase
setup do
@call_route = call_routes(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:call_routes)
end
test "should get new" do
get :new
assert_response :s... |
require 'rubygems'
require 'highline/import'
class PersFizPage
def initialize(session)
@session = session
end
def fill_login_field
puts 'Enter your login: '
login = gets.chomp
@session.find(:xpath, "//input[@id='UserId']").set "#{login}"
end
def fill_password_field
password = ask("Ente... |
class CreateBookings < ActiveRecord::Migration[5.1]
def change
create_table :bookings do |t|
t.date :checked_in
t.date :checked_out
t.references :client, foreign_key: true
t.integer :guest
t.float :total_amount
t.references :booking_status, foreign_key: true
t.timestamps... |
require 'spec_helper'
describe Address do
it { should have_many(:users) }
it { should have_many(:snippets) }
it { should have_many(:languages) }
it { should validate_uniqueness_of(:ip) }
end
|
class TracksController < ApplicationController
resources_controller_for :track
before_filter :show_tracks
def edit
@track = find_resource
# if a current language version doesn't exist, clone, save and redirect...
if @track.language_id != @language_id.to_i
track = @current_conference.tracks.fi... |
# -*- coding: utf-8 -*-
require_relative 'utils'
require 'delayer'
require 'delayer/deferred'
require 'set'
require 'thread'
require 'timeout'
# 渡されたブロックを順番に実行するクラス
class SerialThreadGroup
QueueExpire = Class.new(Timeout::Error)
# ブロックを同時に処理する個数。最大でこの数だけThreadが作られる
attr_accessor :max_threads
@@force_exit =... |
require 'test_helper'
class FriendsControllerTest < ActionDispatch::IntegrationTest
setup do
@friend = friends(:one)
end
test "should get index" do
get friends_url, as: :json
assert_response :success
end
test "should create friend" do
assert_difference('Friend.count') do
post friends_... |
class AttachmentUploader < CarrierWave::Uploader::Base
include ActiveModel::Validations
storage :file
validates :name, presence: true
validates :attachment, presence: true
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def extension_white_list
%w(pdf doc htm h... |
class RenameDnsHostAaaaRecordToDnsHostIpAaaaRecord < ActiveRecord::Migration
def up
rename_table :dns_host_aaaa_records, :dns_host_ip_aaaa_records
end
def down
rename_table :dns_host_ip_aaaa_records, :dns_host_aaaa_records
end
end
|
class ChangeUserIdInMembershipsToInteger < ActiveRecord::Migration[6.0]
def change
remove_column :memberships, :user_id, :string
add_column :memberships, :user_id, :integer
end
end
|
class Location < ActiveRecord::Base
scope :first, -> { order('created_at').first }
scope :last, -> { order('created_at DESC').first }
belongs_to :category, foreign_key: 'category_uuid'
validates :category_uuid, presence: true
validates :name, presence: true
# validates_associated :category
def self.pe... |
require_relative '../errors'
module Tokenizer
module Reader
class BaseReader
def initialize
@chunk = ''
@line_num = 0
@output_buffer = []
@is_input_closed = false
end
def next_chunk(options = { consume?: true })
read until finished? ||... |
class ZoneController < ApplicationController
skip_before_action :verify_authenticity_token
attr_reader :zones
include ShippingZoneConcern
BODY = {name: "FBA Shipping by ByteStand",
type: "carrier_3",
settings: {carrier_options: {delivery_services: [], packaging: []}},
enabled... |
# == Schema Information
# Schema version: 58
#
# Table name: sds_sail_users
#
# id :integer(11) not null, primary key
# portal_id :integer(11)
# first_name :string(60) default(""), not null
# last_name :string(60) default(""), not null
# uuid :string(36) default(""), not null
# creat... |
Rails.application.routes.draw do
resources :subjects do |s|
member do
get :activate
get :deactivate
end
resources :groups do |g|
resources :instructor_answers
resources :posts do |p|
resources :discussions
end
end
resources :topics
end
root to: 'subjects#... |
class AddValidtimeToEeKonto < ActiveRecord::Migration
def change
add_column :EEKonto, :GueltigVon, :datetime
add_column :EEKonto, :GueltigBis, :datetime
end
end
|
class Payment < ApplicationRecord
validates_numericality_of :payment_amount, :greater_than => 0
end
|
require 'spec_helper'
Run.all :read_only do
describe Pacer::Wrappers::EdgeWrapper do
use_pacer_graphml_data :read_only
let(:e_exts) { [Tackle::SimpleMixin, TP::Wrote] }
let(:e_wrapper_class) { Pacer::Wrappers::EdgeWrapper.wrapper_for e_exts }
subject { e_wrapper_class }
it { should_not be_nil ... |
class CreateTempusers < ActiveRecord::Migration
def change
create_table :tempusers do |t|
t.string :pku_id
t.timestamps
end
end
end
|
module Fog
module Compute
class ProfitBricks
class Real
# Retrieves the attributes of a given Firewall Rule
#
# ==== Parameters
# * datacenter_id<~String> - UUID of the datacenter
# * server_id<~String> - UUID of the server
# * nic_id<~String> ... |
class OrderItem < ApplicationRecord
belongs_to :product
belongs_to :order
enum making_status: {
制作不可: 0,
制作待ち: 1,
制作中: 2,
制作完了: 3
}
end
|
require 'rails_helper'
feature 'Delete question', %Q{
As a user
I want to delete a question
So that I can delete duplicate questions
} do
# Acceptance Criteria
# - I must be able delete a question from the question edit page
# - I must be able delete a question from the question details page
# - All answ... |
require 'json'
require 'webrick'
class Flash
def initialize(req)
@req = req
found_cookie = find_cookie
@cookie = found_cookie ? JSON.parse(found_cookie.value) : {}
process_cookie
end
def process_cookie
@cookie = {} if @cookie["_flag"]
end
def find_cookie
@req.cookies.find { |cookie... |
# tell rails to use rspec format whenever it generates test code
Rails.application.config.generators do |g|
g.test_framework :rspec, :view_specs => false,
:controller_specs => false,
:request_specs => false,
:routing_specs => false
end
|
class UnitTestSetup
Version = '1.3.7'
def initialize
@name = "Gems"
super
end
def require_files
#HACK: this is loading up our defaults file which causes tests to fail.
#the global is to stop that loading
$utr_runner=true
require 'rubygems'
end
def gather_files
test_dir = F... |
module TextToNoise
class Player
include Logging
SOUND_DIR = File.expand_path File.join( APP_ROOT, 'sounds' )
class SoundNotFound < StandardError
def initialize( sound_name )
super "Could not locate '#{sound_name}' in #{Rubygame::Sound.autoload_dirs}"
end
end
def initi... |
class UsersController < ApplicationController
def show
@user=User.find(params[:id])
end
def new
@user=User.new
end
def Post
@user=User.new(user_params)
if @user.save
redirect_to users_new_path
else
render 'new'
end
end
private
def user_params
params.require(:user).permit(:first_name,:country,:last_... |
require 'rubygems'
require 'httpclient'
require 'yaml'
require 'CGI'
require 'json'
require 'parallel'
require File.dirname(__FILE__) + '/string_utils'
require File.dirname(__FILE__) + '/link_builder'
require File.dirname(__FILE__) + '/confluence_page'
require File.dirname(__FILE__) + '/feature_file'
require File.dirna... |
class ModifyStats < ActiveRecord::Migration[5.2]
def change
rename_column(:batting_stats, :player_id, :roster_id)
rename_column(:game_batting_stats, :player_id, :roster_id)
rename_column(:game_pitching_stats, :player_id, :roster_id)
remove_column(:batting_stats, :age)
execute 'ALTER TABLE "battin... |
class DeckCard < ApplicationRecord
belongs_to :deck
belongs_to :card
def as_json
{
# id: self.id,
# deck_id: self.deck_id,
card: self.card.as_json,
quantity: self.quantity
}
end
end
|
class Comic < ActiveRecord::Base
validates :title, presence: true
validates :price, presence: true
validates :image_id, presence: true
validates :comic_series_id, presence: true
validates :publisher_id, presence: true
validates :release_date, presence: true
belongs_to :comic_series
has_and_belongs_to_m... |
class AddingFacilitySysidField < ActiveRecord::Migration
def change
add_column :lsspdfassets, :u_facility_sys_id, :string
end
end
|
require_relative "numerical"
class StochasticVariables
# x - list of values
# p - array of probabilities for each value
def initialize x, p=nil
@x = x
@p = p
end
def d
return Math.sqrt(v)
end
def v
return @x.map { |i| (i.to_f - e)**2 }.reduce(:+) / @x.length
end
def e
return @... |
class CreateProperties < ActiveRecord::Migration
def change
create_table :properties do |t|
t.integer :number_of_bedrooms
t.integer :number_of_bathrooms
t.integer :rent_a_week
t.string :address
t.string :streetName
t.string :agentName
t.string :agentPhoneNo
t.string... |
$:.unshift File.dirname(__FILE__)
require 'pusher'
require 'grape'
require 'grape-entity'
require 'grape-swagger'
require 'models/metrics'
require 'models/metadata'
require 'models/dashboard'
require 'bothan/extensions/date_wrangler'
require 'bothan/helpers/metrics_helpers'
require 'bothan/helpers/auth_helpers'
re... |
# Gym Membership class that has AnnualMembership & MonthlyMembership
class Members
def AnnualMembership
raise NotImplementedError, 'AnnualMembership() must be defined in subclass'
end
def MonthlyMembership
raise NotImplementedError, 'MonthlyMembership() must be defined in subclass'
end
e... |
class SubjectsController < ApplicationController
layout 'application'
#layout 'admin'
def index
list
render('subjects/list')
#render('demo/hello') # Most common way to do it
# render('list')
end
def list
# @subjects = Subject.order("Subject.position ASC")
@subjects = Subject... |
# encoding: UTF-8
require_relative "../test_helper"
class CommentControllerTest < FunctionalTestCase
def setup
login
@post = Factory(:post)
end
def test_show_comments
make_comment
get "/post/#{@post.token}"
assert_equal 200, status
text = css(".post-comments .comment-block").children.f... |
# frozen_string_literal: true
module Domain
class Board
def initialize(state = [[:X, nil, nil],
[nil, nil, nil],
[nil, nil, nil]],
last_piece = :O)
@state = state
@last_piece = last_piece
end
def piece_at(x, y)
... |
Rails.application.routes.draw do
get '/' => redirect('/api-docs')
get '/api-docs' => "docs#index"
namespace :api do
resources :currencies, only: [:show]
end
match "*path" => "application#routing_error", via: :all
end
|
require 'formula'
class Subpro < Formula
homepage 'https://github.com/satoshun/subpro'
version 'v2.0.2'
url 'https://raw.githubusercontent.com/satoshun/subpro/v2.0.2/pkg/darwin/subpro'
sha256 '992a990ab150c29177627f93cae5414ca8055b32cf8cfb7ef1f4d7a9401655db'
def install
bin.install 'subpro'
system '... |
class Armor
include Mongoid::Document
field :name
field :key
field :type
field :icon
field :strength1
field :strength2
field :weakness1
field :weakness2
field :description
has_many :units, class_name: 'Unit::Base'
end |
class GameTeam
attr_reader :game_id,
:team_id,
:home_or_away,
:won,
:head_coach,
:goals,
:shots,
:hits,
:power_play_chances,
:power_play_goals
def initialize(info)
@game_id = info[:game_id]
@team_id = info[:team_id]
@home_or_away = info[:h... |
Pod::Spec.new do |s|
s.name = 'LRMocky'
s.version = '1.0'
s.license = 'MIT'
s.summary = 'A mock object library for Objective C, inspired by JMock 2.0'
s.homepage = 'http://github.com/lukeredpath/LRMocky'
s.authors = { 'Luke Redpath' => 'luke@lukeredpath.co.uk' }
s.source ... |
# 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 bin/rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# ... |
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
module Recliner
describe View do
context "with map option" do
subject { View.new(:map => 'my map function') }
it "should wrap map function in a ViewFunction::Map" do
subject.map.should be_an_instance_of(ViewFunc... |
class Indocker::EnvFileHelper
ENV_FILES_FOLDER = 'env_files'.freeze
class << self
def path(env_file)
File.expand_path(File.join(folder, File.basename(env_file.path)))
end
def folder
File.join(Indocker.deploy_dir, ENV_FILES_FOLDER)
end
end
end |
class QuizScoreSummary
def initialize(module_provider, quiz_score_provider)
@module_provider = module_provider
@quiz_score_provider = quiz_score_provider
end
def get_score_summary(user)
topics = []
@module_provider.get_all_topics.each do |topic|
next unless topic['questions']
top_... |
module Api
module V1
class EntitiesController < ApplicationController
skip_before_action :verify_authenticity_token
# action to create given entity and all its associated tags
def create
if not params.key? "ids" or params["ids"].nil?
r... |
# encoding: utf-8
control "V-52155" do
title "The DBMS must include organization-defined additional, more detailed information in the audit records for audit events identified by type, location, or subject."
desc "Information system auditing capability is critical for accurate forensic analysis. Audit record content... |
class AddTosSettingToSmoochBot < ActiveRecord::Migration[4.2]
def change
tb = BotUser.smooch_user
unless tb.nil?
settings = tb.get_settings.clone || []
settings.insert(-2, { name: 'smooch_message_smooch_bot_ask_for_tos', label: 'Message sent to user to ask them to agree to the Terms of Service (pl... |
class EasyGanttThemesController < ApplicationController
layout 'admin'
before_filter :require_admin
def index
@gantt_themes = EasyGanttTheme.all
end
def new
@gantt_theme = EasyGanttTheme.new
end
def create
@gantt_theme = EasyGanttTheme.new
@gantt_theme.safe_attributes = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.