text stringlengths 10 2.61M |
|---|
#
# Cookbook Name:: jenkins
# Based on hudson
# Resource:: server.rb
#
# Author:: Valeriu Craciun
#
actions :srestart, :reloadconfig
attribute :url, :kind_of => String
def initialize(name, run_context=nil)
super
@action = :srestart
@url = node[:jenkins][:server][:url]
end |
class Error < JSONError.base
translated_properties :message
end
|
require 'spec_helper'
include SplitIoClient
describe Engine::Parser::Evaluator do
let(:adapter) { Cache::Adapters::MemoryAdapters::MapAdapter.new }
let(:config) { SplitConfig.new }
let(:segments_repository) { Cache::Repositories::SegmentsRepository.new(adapter, config) }
let(:splits_repository) { Cache::Repos... |
module Roglew
module GLX
BUFFER_SWAP_COMPLETE_INTEL_MASK = 0x04000000
COPY_COMPLETE_INTEL = 0x8181
EXCHANGE_COMPLETE_INTEL = 0x8180
FLIP_COMPLETE_INTEL = 0x8182
end
end |
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
has_many :bookings
has_many :offers
validates :nam... |
# Problem 300: Protein folding
# http://projecteuler.net/problem=300
# In a very simplified form, we can consider proteins as strings consisting of hydrophobic (H) and polar (P) elements, e.g. HHPPHHHPHHPH.
# For this problem, the orientation of a protein is important; e.g. HPP is considered distinct from PPH. Thus, ... |
require 'rails_helper'
RSpec.describe User, type: :model do
it { should validate_presence_of(:email) }
it { should validate_presence_of(:username) }
it { should validate_length_of(:username).is_at_most(20) }
it { should have_valid(:username).when("FlyAmanita") }
it { should_not have_valid(:username).when(... |
require 'spec_helper'
describe Spree::FeedbackReviewsController do
let(:token) { 'some_token' }
let(:user) { create(:user) }
let(:product) { create(:product) }
let(:review) { create(:review, product: product, approved: true)}
before do
controller.stub :spree_current_user => user
controller.stub :spr... |
Gem::Specification.new do |spec|
spec.name = 'herbie'
spec.version = '0.0.2'
spec.date = '2011-09-22'
spec.summary = "herbie"
spec.description = "Lovable HTML view helpers for use with ERB."
spec.authors = ["Ben Darlow"]
spec.email = 'ben@kapowaz.net'
spec.files = D... |
# write a method that takes one argument, a positive integer
# and returns the sum of its digits
# Examples:
#
# puts sum(23) == 5
# puts sum(496) == 19
# puts sum(123_456_789) == 45
# tests above should print to true
# for a challenge, try writing this without any basic looping constructs
# such as loop, while, u... |
class ReservationBroadcastJob < ApplicationJob
queue_as :reservations
def perform(user_car_id)
user_car = UserCar.find_by(id: user_car_id)
if user_car
CarReservationService.send_reservations
else
puts("message not found with id: #{message_id}")
end
end
end
|
require 'rails_helper'
RSpec.feature 'article_create', type: :feature do
let!(:room) { FactoryBot.create(:room) }
background {
log_in_as
visit room_path(room.id)
fill_in "message_textarea", with: "message rspec"
find("#send-button").click
fill_in "message_textarea", with: "save msg rspec"
find("#send-bu... |
class ElectionsController < ApplicationController
def index
@elections = Election.all
end
def create
@user = User.new({
:name => election_params[:user_name],
:email => election_params[:user_email]
})
@user.save
@election = Election.new({
... |
class Note < ApplicationRecord
belongs_to :user
has_many :shares, dependent: :delete_all
has_many :contributing_shares, lambda { where(permission: :contributing) }, class_name: :Share
has_many :reading_shares, lambda { where(permission: :reading) }, class_name: :Share
has_many :interactors, through: :shares, ... |
require 'spec_helper'
describe Course do
describe '课程是客观存在的对象,和学期,教师,学生,均没有由它们带来的约束关系' do
end
let(:teacher_zhang) {FactoryGirl.create :user, :teacher}
let(:teacher_wang) {FactoryGirl.create :user, :teacher}
let(:teacher_li) {FactoryGirl.create :user, :teacher}
let(:teacher_zhao) {FactoryGirl... |
class CreateInvoices < ActiveRecord::Migration[5.0]
def change
create_table :invoices do |t|
t.string :payment_mode
t.string :payment_details
t.integer :price
t.timestamp :selling_date
t.timestamps
end
end
end
|
module CDI
module V1
class MultiplierStudentDeliverySerializer < SimpleStudentDeliverySerializer
has_one :learning_delivery,
serializer: SimpleLearningDeliverySerializer,
embed: :ids,
embed_in_root_key: :linked_data,
embed_in_root: true
has_one... |
class AddIndexesToUserGroupsUsers < ActiveRecord::Migration
def self.up
add_index :user_groups_users, [:user_group_id,:target_type], :name => 'index_user_groups_users_on_user_group_id_and_target_type'
end
def self.down
remove_index :user_groups_users, :name => 'index_user_groups_users_on_user_group_id_an... |
require 'account'
describe Account do
before(:each) do
subject.deposit(500)
end
context 'the account should accept a deposit' do
it 'a deposit should change the length of the account transactions array' do
expect(subject.account_transactions.length).to eq(1)
end
end
context 'the account s... |
class AddAmsEndpointsToEnvironment < ActiveRecord::Migration[5.0]
def change
add_column :environments, :ams_ip, :string
add_column :environments, :ams_port, :string
end
end
|
module Api
module V1
class GoalsController < ApplicationController
include ActionController::MimeResponds
before_action :authenticate_user
def index
@goals = current_user.goals.preload(:category).order(created_at: :desc)
end
def create
category = Category.find_by(na... |
require_relative "lib/blorgh/version"
Gem::Specification.new do |spec|
spec.name = "blorgh"
spec.version = Blorgh::VERSION
spec.authors = ["Paul Gallagher"]
spec.email = ["gallagher.paul@gmail.com"]
spec.homepage = "TODO"
spec.summary = "TODO: Summary of Blorgh."
spec.descript... |
# encoding: UTF-8
$:.push File.expand_path("../lib", __FILE__)
require 'open_project/revisions/version'
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "openproject-revisions"
s.version = OpenProject::Revisions::VERSION
s.authors = "Oliver Günther"
s.emai... |
class Pawn
attr_accessor :pos_x, :pos_y, :color
def initialize(pos_x, pos_y, color)
@pos_x = pos_x
@pos_y = pos_y
@color = color
end
def can_move?(dst_x, dst_y)
dx = (dst_x - @pos_x).abs
dy = (dst_y - @pos_y).abs
# => check for movement exceptions before giving boolean on regular move
if horizontal_mo... |
require 'spec_helper'
require_relative '../../lib/presenters/order_presenter.rb'
RSpec.describe OrderPresenter, type: :presenter do
let(:pricing_rule) { FactoryBot.create(:pricing_rule, :line_items) }
let(:item_a) { FactoryBot.create(:item, :a) }
let(:item_b) { FactoryBot.create(:item, :b) }
let(:order) { Fact... |
class CreateContests < ActiveRecord::Migration
def change
create_table :contests do |t|
t.string :name
t.text :introduction
t.datetime :start_time
t.datetime :end_time
t.timestamps
end
end
end
|
class Region < ActiveRecord::Base
has_many :countries
def to_param
url_name
end
end
|
require_relative "cards"
class Deck
attr_reader :cards
def initialize(num_stacks=1)
@cards = []
num_stacks.times do
self.deal_suit("C")
self.deal_suit("D")
self.deal_suit("H")
self.deal_suit("S")
end
end
def deal_suit(suit)
card_nums = ["A", 2, 3, 4, 5, 6, 7, 8, 9, 10, "J", "Q", "K"]
card_n... |
class JourneysController < ApplicationController
before_action :fetch_journey, only: %i[show edit update destroy archive]
def index
@journeys = policy_scope(Journey).order(created_at: :desc)
end
def show
end
def new
@journey = Journey.new
end
def create
connection_service = CreateConnect... |
#!/usr/bin/env ruby
require 'optparse'
options = { :times => false, :queries => true, :select_only => false }
parser = OptionParser.new do |opts|
nl = "\n" + ' ' * 37
opts.banner = "Usage: query_extractor [options] LOGFILE"
opts.separator ""
opts.separator "Options:"
opts.on("--times",
"Show times at w... |
class Interval < ApplicationRecord
has_many :experiences
has_many :users, through: :experiences
end
|
require 'rspec/core'
module Saki
module AcceptanceHelpers
extend ActiveSupport::Concern
def default_factory(name, opts = {})
Factory name, opts
end
def get_path(path)
if path.is_a? String
path
elsif path.is_a? Symbol
send path
else
path.call(self)
... |
class PagesController < ApplicationController
before_action :set_page, only: [:show, :edit, :update, :destroy, :delete_image, :add_image, :add_block, :remove_block]
include PageMeta
load_and_authorize_resource
# GET /pages
# GET /pages.json
def index
if @current_website.present?
@pages = @curren... |
class AccesskeyNginxModule < Formula
desc "Denies access unless the request URL contains access key"
homepage "http://wiki.nginx.org/NginxHttpAccessKeyModule"
url "http://wiki.nginx.org/images/5/51/Nginx-accesskey-2.0.3.tar.gz"
sha256 "d9e94321e78a02de16c57f3e048fd31059fd8116ed03d6de7180f435c52502b1"
bottle ... |
module SyflNewswireCache
class Connection
DEFAULT_OPTIONS = { host: 'localhost', port: 11211, compress: true }
class << self
undef_method :new
def establish!(config = {})
config = parse_config(config) unless config.is_a?(Config)
@current ||= Dalli::Client.new(config.host_with_por... |
class Movie < ApplicationRecord
has_many :reviews
belongs_to :user
validates :title, :image, presence: true
validates :title, uniqueness: true
has_one_attached :image
end
|
class AddResourceCountToBooks < ActiveRecord::Migration
def change
add_column :books, :resource_count, :int, :default => 0
add_index :books, :resource_count
end
end
|
#============================#
# tf2-server Cookbook
#============================#
# default game server user and group
default['tf2-server']['user'] = 'tf2-server'
default['tf2-server']['group'] = 'tf2-server'
# array of public keys to install under game server user
default['tf2-server']['ssh']['public_keys'] = [
... |
class BoggleBoard
attr_accessor :board
MAX_WORD_LENGTH = 6
def initialize()
@board = [
['A', 'A', 'B', 'A', 'A', 'A'],
['A', 'A', 'O', 'A', 'A', 'A'],
['A', 'A', 'G', 'A', 'A', 'A'],
['A', 'A', 'G', 'A', 'A', 'A'],
['A', 'A', 'L', 'A'... |
module Api
module V1
class ClientsController < ApplicationController
def index
client = Client.order("last_purchase")
render json: { status: "SUCCESS", message: "Client list.", data: client }, status: :ok
end
def show
client = Client.find(params[:id])
render json... |
class CreateApplyNows < ActiveRecord::Migration
def change
create_table :apply_nows do |t|
t.string :headline
t.string :button_url
t.string :button_text
t.references :category
t.boolean :is_active, default: true
t.timestamps null: false
end
end
end
|
class AddAnnotationToApplicationLetters < ActiveRecord::Migration
def change
add_column :application_letters, :annotation, :text
end
end
|
require 'rails_helper'
#require 'spec_helper'
describe PagesController do
render_views
before(:each) do
@basetitre = "Keepitup"
end
describe "GET 'home'" do
describe "quand pas identifié" do
before(:each) do
get :home
end
it "devrait réussir" do
expect(response).to be_success
... |
FactoryBot.define do
sequence(:name) { |n| "#{n}" }
factory :product do
name
price 10.0
description "Test description"
colour "blue"
image_url "braclet_1.jpg"
size "5"
end
end
|
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
has_many :sns_credentials
has_one :user_address
accepts_nested_attributes_for :user_address
has_many :credit_cards
has_many :products
has_many :com... |
require 'test_helper'
class WorkoutTransactionsControllerTest < ActionController::TestCase
setup do
@workout_transaction = workout_transactions(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:workout_transactions)
end
test "should get new" do... |
class PortfoliosController < ApplicationController
before_action :authenticate_photographer!
before_action :all_no_photographer_read_messages, only: [:new,:edit]
def new
@portfolio = Portfolio.new
@categories = Category.all
end
def create
@portfolio = Portfolio.new(portfolio_params)
if @port... |
Rails.application.routes.draw do
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
devise_for :users, skip: :registrations, controllers: { :omniauth_callbacks => "users/omniauth_callbacks" }
devise_scope :user do
get '/users/auth/:provider', to: "omniauth_callbacks#%{provider}", a... |
require 'logger'
module Advisor
describe Factory do
subject(:loggable) do
Advices::CallLogger.default_logger = default_logger
Class.new do
extend Loggable
log_calls_to :inc
def inc(number)
number + 1
end
def foo(*)
end
end
end
... |
class CsvResult
def initialize(r,h)
@r = r
@h = h
@amt_col = 8
@ban_col = 6
@bac_col = 2
@e2e_col = 10
@ban_name = 7
@ban_code = 0
end
def attributes
{
amount:{
currency: currency,
subunits: subunits
},
bank_account_name: bank_account_name,
... |
class CreateContributions < ActiveRecord::Migration
def change
create_table :contributions do |t|
t.belongs_to :bill, index: true
t.integer :from_user, null: false
t.integer :to_user, null: false
t.decimal :pay_amt, null: false
t.timestamps null: false
end
end
end
|
require 'spec_helper'
module Logical
module Naf
module LogParser
describe JobDownloader do
# Create a test file, making sure to not overwrite a current file.
let!(:test_record_id) { 3 }
let!(:test_file_path) { "#{::Naf::PREFIX_PATH}/#{::Naf.schema_name}/jobs/#{test_record_id}" }
... |
require 'rails_helper'
RSpec.describe 'supply_teachers/branches/_branch.html.erb' do
helper(TelephoneNumberHelper)
let(:supplier) { build(:supply_teachers_supplier) }
let(:branch_name) { 'Head Office' }
let(:branch_town) { 'Guildford' }
let(:telephone_number) { '01214960123' }
let(:contact_name) { Faker::... |
class OwnersController < ApplicationController
def index
group_id = UserGroup.group_id(current_user.id)
# 投票結果を集約して保存
aggregate(group_id)
# GroupItemのレコードを投票数でソートして取り出す
@owner_items = GroupItem.where(:group_id => group_id).order("vote_num DESC")
# 投票用のインスタンス
@new_group_item = GroupItem.... |
require 'spec_helper'
describe ArticlesController do
before do
@profile = Factory(:profile, :login => "user")
end
describe "login_required" do
before do
ArticlesController.before_filter :login_required
end
it "should be redirect to login page" do
get :index
response.s... |
class GpfsController < ApplicationController
# GET /gpfs
# GET /gpfs.json
def index
farmer_id = params[:farmer_id]
if farmer_id
@gpfs = Gpf.for_farmer(id)
else
@gpfs = Gpf.all
end
respond_to do |format|
format.html # index.html.erb
format.json { render json: @gpfs }
e... |
module LayoutsHelper
def admin?(current_profile)
current_profile && current_profile.admin?
end
end
|
class Jobs::PurgeUnassignedSequences < Jobs::AbstractJob
def do_perform
Biosequence.purge_unassigned_sequences
end
end
|
require 'bundler'
Bundler.require
require_relative 'lib/game'
require_relative 'lib/player'
def etat_des_joueurs(player1, player2)
puts "Voici l'état de nos joueur :"
player1.show_state
player2.show_state
end
def phase_attaque(player1, player2)
puts "Passons à la phase d'attaque :"
player1.attacks(player2)... |
module ApplicationHelper
def nav_link(title, path, link_options = {})
link_options = {
title: title
}.merge!(link_options)
content_tag(:li, class: (:active if current_page?(path))) do
link_to title, path, link_options
end
end
end
|
# frozen_string_literal: true
require "rails_helper"
RSpec.describe "create note", type: :system do
let(:user) { FactoryBot.create(:user) }
let(:subject) { FactoryBot.create(:subject, user: user) }
let(:course) { FactoryBot.create(:course, subject: subject) }
before { sign_in user }
describe "with empty e... |
class ProductsController < ApplicationController
before_action :set_product_path
def index
@products = Product.all
end
def show
@product = Product.find(params[:id])
@root_photo = @product.product_photos.first
@order = Order.find_by(session_id: session[:session_id])
end
private
def set_p... |
class Nante < ApplicationRecord
mount_uploader :image, ImageUploader
has_many :articles
has_many :restaus
has_many :commentaires
has_many :comments
validates :title, presence: true
acts_as_taggable_on :tags
end
|
source 'https://rubygems.org'
gem 'rails', '>= 5.0.0.beta1', '< 5.1'
gem 'pg'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'puma'
group :development do
gem 'byebug'
gem 'web-console', '~> 3.0' ... |
Buginabox::Engine.routes.draw do
resources :bugs do
resources :comments
member do
post "triage"
post "prioritize"
post "wait"
post "closed_no_bug"
post "close"
post "asssign"
post "start"
post "fixed"
post "resume"
post "pause"
end
end
root "... |
module UiChanged
class ScreenshotsControllerBase < ApplicationController
before_filter :authenticate
before_filter :screenshot_counts, only: [:index, :diffs, :compares, :controls, :tests, :ignored, :settings, :diff]
def screenshot_counts
@search = params[:search]
@diff_count = UiChanged::Scre... |
Rails.application.routes.draw do
root 'welcome#index'
get '/collect' => 'welcome#collect'
get '/collect/:id' => 'welcome#collect', :contraints => { :id => /\d*/ }, as: 'collectpage'
get '/categories' => 'welcome#categories_home', as: 'categorieshome'
get '/categories/:name' ... |
class Timer
attr_accessor :seconds
attr_accessor :minutes
def initialize(secs=0)
@seconds = secs
end
def time_string
seconds = @seconds % 60
h=(@seconds/3600).to_s.rjust(2, '0')
m = ((@seconds/60)%60).to_s.rjust(2, '0')
s = seconds.to_s.rjust(2, '0')
"#{h}:#{m}:#{s}"
end
end
|
class FontArkPixel12pxMonospaced < Formula
version "2022.12.20"
sha256 "b47daead8db52a37fac1f671245612f4cccf6a14504c6bbc14ccd88a4e75740c"
url "https://github.com/TakWolf/ark-pixel-font/releases/download/#{version}/ark-pixel-font-12px-monospaced-otf-v#{version}.zip"
desc "Ark Pixel 12px monospaced"
desc "Open ... |
class FriendListsController < ApplicationController
def create
@friendlist = FriendList.new(friend_list_params)
if @friendlist.save
flash[:success] = "Add friend success!"
redirect_to users_path
else
render 'new'
end
end
private
def friend_... |
require "simplemsg/version"
require 'thor'
module Simplemsg
class Application < Thor
desc 'hello NAME', 'Display greeting with given NAME'
option :wish
def hello(name = "Joe")
puts "Hello #{name}"
puts "My Wish: #{options[:wish]}" if options[:wish]
end
end
end
|
# 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 rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
class InstitutionportfoliosController < ApplicationController
before_action :authenticate_user!
before_action :is_a_processor, except: [:new, :create, :destroy, :autocomplete_institution_name]
before_action :is_a_student, only: [:destroy, :new, :create, :autocomplete_institution_name]
before_action :set_insti... |
# frozen_string_literal: true
module Refinery
module Caststone
class SubMenu < Refinery::BasePresenter
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::TagHelper
include ActiveSupport::Configurable
attr_accessor :collection, :context, :current_slug, :output_buffer
... |
Rails.application.routes.draw do
root 'static_pages#home'
get '/blog', to: 'static_pages#blog'
get '/contact', to: 'static_pages#contact'
get '/about', to: 'static_pages#about'
get '/participants', to: 'participants#index'
get '... |
details {
spell "less"
version "444"
source("#{spell}-#{version}.tar.gz") {
"http://www.greenwoodsoftware.com/#{spell}/#{source}"
gnu_mirror "/#{spell}/#{source}"
signature_source("#{spell}-#{version}.tar.gz.sig") {
"http://www.greenwoodsoftware.com/#{spell}/#{source}"
type :signature
... |
# The diamond exercise takes as its input a letter, and outputs it in a diamond shape. Given a letter, it prints a diamond
# starting with 'A', with the supplied letter at the widest point.
#
# Requirements
#
# - The first row contains one 'A'.
# - The last row contains one 'A'.
# - All rows, except the first and... |
module JackCompiler
module Parser
class NodeTransformer
def initialize(factory)
@factory = factory
end
def visit(root)
root.accept(self)
end
def visit_variable(node)
@factory.new(node.kind).build(
*node.children.map { |child|
child.acce... |
class CreateStudents < ActiveRecord::Migration[5.0]
def up
create_table :students do |t|
t.string :first_name, limit: 25
t.string :last_name, limit: 50
t.string :gender, limit: 1
t.string :email
t.text :intro, limit: 255
t.timestamps
end
add_index :students, :email, ... |
class Institution < ActiveRecord::Base
has_many :emails, :dependent => :destroy
has_many :addresses, :dependent => :destroy
has_many :phones, :dependent => :destroy
has_many :contacts, :dependent => :destroy
has_attached_file :logo
accepts_nested_attributes_for :addresses, :reject_if => lambda { |a| a[:des... |
class AddFileUidAndFileNameToDocuments < ActiveRecord::Migration
def change
add_column :documents, :file_uid, :string
add_column :documents, :file_name, :string
remove_column :documents, :file_path
rename_column :documents, :type, :file_type
end
end
|
require_relative '../../automated_init'
context "CLI" do
context "Parse Arguments" do
context "Output Styling" do
context "Short Form" do
parse_arguments = CLI::ParseArguments.new(['-s', 'on'])
parse_arguments.()
test do
assert(parse_arguments.writer.styling?)
en... |
class Order < ActiveRecord::Base
has_many :line_items, dependent: :destroy
belongs_to :order_status
has_many :order_items
before_create :set_order_status
before_save :update_subtotal
PAYMENT_TYPES = [ "Check", "Credit card", "Purchase order" ]
validates :name, :address, :email, presence: t... |
require 'minitest/autorun'
require 'minitest/focus'
require './running-median'
class TestRunningMedian
class TestCalcMedian < MiniTest::Test
def test_median_same_size
max_heap = Containers::MaxHeap.new [1,2,3,4]
min_heap = Containers::MinHeap.new [5,6,7,8]
assert_equal 4.5, calc_median(max_hea... |
class RentalsController < ApplicationController
def index
@categories = get_rentals
end
def show
@categories = get_rentals
@category = params[:cat]
@rentals = Dir.entries('app/assets/images/rentals/'+@category).sort.select { |file| !(file == '.' || file == '..') }
end
private
def get_r... |
class HeadsecsController < ApplicationController
def create
@course = Course.find_by_slug!(params[:course_id])
@headsec = Headsec.create(params[:headsec].permit(:name))
@headsec.course_id = @course.id
if @headsec.save
respond_to do |format|
format.html {redirect_to courses_path}
format.json
... |
shared_examples "a wsdl module with actions" do
it "should include wsdl actions" do
expect(subject.constants).to include(:Actions)
end
describe "the shared Actions of a Wsdl" do
before do
module subject::Actions
def self.test
@@test
end
def self.test=(val)
... |
$game_number = 0
$wallet = 100
class Game
attr_accessor :total, :turn, :game_number
def initialize
@total = 0
@dealer_total = 0
@turn = "player"
@result = ""
end
def deal_hand(hand, card_one, card_two)
hand.push(card_one)
hand.push(card_two)
end
def deal_card(hand, new_card)
ha... |
class ChangeItemVisibility
attr_reader :media_item, :new_visibility
def initialize(options)
@media_item = options.fetch(:media_item)
@new_visibility = options.fetch(:public)
end
def execute!
media_item.public = new_visibility
media_item.save!
end
end
|
require 'fox16'
require_relative 'scraper'
require 'open-uri'
include Fox
class Results < FXList
def initialize(parent, condition)
super(parent,
opts: LAYOUT_EXPLICIT | FRAME_NORMAL,
y: 300, width: 600, height: 300)
library = Scraper.new
@books = library.library
@selected = 0
... |
class CreateContents < ActiveRecord::Migration[5.1]
def change
create_table :contents do |t|
t.references :user
t.string :c_when
t.string :c_where
t.string :c_who
t.string :c_what
t.string :c_how
t.timestamps null: false
end
end
end
|
class MedicsController < ApplicationController
# GET /medics
# GET /medics.xml
def index
@medics = Medic.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @medics }
end
end
# GET /medics/1
# GET /medics/1.xml
def show
@medic = Medic.find(par... |
james_develin = PlayerCard.create do |card|
card.first_name = 'James'
card.last_name = 'Develin'
card.overall = 94
card.team_chemistry_id = Chemistry.by_team_city(:new_england).first.id
card.program = TEAM_OF_T... |
require 'spec_helper'
describe CronSpec::StepCronValue do
before(:each) do
@cv = CronSpec::StepCronValue.new(0, 32, 2)
end
it "should indicate effective if the values match the step" do
(0..32).each { | value | next unless (value % 2 == 0); @cv.is_effective?(value).should be true }
end
it "should ... |
class Tunnelbear < Cask
url 'https://tunnelbear.s3.amazonaws.com/downloads/mac/TunnelBear-2.1.4.zip'
homepage 'https://www.tunnelbear.com/'
version '2.1.4'
sha1 'acd4aea0225736ce6f40e41c03bf088256628d8b'
link 'TunnelBear.app'
end
|
class Question < ActiveRecord::Base
belongs_to :exam
acts_as_list :scope => :exam
attr_accessible :answer,:question, :choices, :position, :unit_score
validates :question_img, :length => {:maximum => 100*1024, :too_long => "should less than 100KB"}
validates :choices_img, :length => {:maximum => 100*1024, :too_lo... |
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Tikkie::Api::Clients::PaymentRequests do
subject(:client) { described_class.new(config) }
let(:config) { Tikkie::Api::Configuration.new(api_key: '12345', app_token: 'abcdef') }
describe 'error handling' do
context 'when response is HTTP 40... |
module Catlady
class Builder
require 'fileutils'
def self.build(distribution)
new(distribution).build
end
def initialize(distribution)
@distribution = distribution
@configuration = config["configuration"]
@sdk = config["sdk"]
@scheme = config["scheme"]
end
def ... |
require "rails_helper"
RSpec.describe Identity, type: :model do
it { is_expected.to have_one(:identity_counter) }
it { is_expected.to have_many(:documents) }
it { is_expected.to have_many(:project_roles) }
it { is_expected.to have_many(:clinical_providers) }
describe "#protocols" do
context "Identity... |
require 'spec_helper'
describe 'ProjectIdea' do
let(:idea) {ProjectIdea.create(title: 'Makers Website', content:'A really longwinded description.')}
it 'Has a Title' do
expect(idea.title).to eq 'Makers Website'
end
it 'Has content' do
expect(idea.content).to eq 'A really longwinded description.'
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.