text stringlengths 10 2.61M |
|---|
require 'rails_helper'
RSpec.describe 'Data', type: :request do
describe 'GET /api/v1/data' do
before do
FactoryBot.create_list(:c14, 10)
get '/api/v1/data'
end
it 'returns all C14s' do
expect(json.size).to eq(C14.count)
end
it 'returns status code 200' do
expect(... |
namespace :export do
desc "Prints all ActiveModel data in seed.rb file."
task :seed_format => :environment do
Contract.order(:id).all.each do |contract|
#puts "Contract.create(#{contract.serializable_hash.delete_if {|key, value| ['created_at', 'updated_at', 'id'].include?(key)}.to_s.gsub(/[{}]/,"")})"
... |
class Group < ActiveRecord::Base
has_many :reservations
belongs_to :user
acts_as_paranoid
end
|
class Weight < ActiveRecord::Base
validates :weight, presence: {message: 'You must enter a weight'}
validates :date_weighed, presence: {message: 'You must enter a date for when you were weighed'}
end
|
require 'sketchup.rb'
require 'extensions.rb'
folder_path = '/Users/vivek/SkpDesk/Current'
folder_path = '/Users/vivek/Desktop/sdesk_lib'
loader = File.join(folder_path, 'skpdesk_loader.rb')
title = 'SKP Design Kit'
ext = SketchupExtension.new(title, loader)
ext.version = '1.0.0'
ext.copyrig... |
class SumOfMultiples
def self.to(limit)
new(3, 5).to(limit)
end
def initialize(*factors)
@factors = factors
end
def to(limit)
(1...limit).select do |int|
@factors.any? { |factor| int % factor == 0 }
end.sum
end
end
# Initial solution
# def to(limit)
# multiples = []
# (1...l... |
class CreateBoatCategories < ActiveRecord::Migration
def change
create_table :boat_categories do |t|
t.string :name, index: true
t.boolean :active, index: true, default: false
t.timestamps null: false
end
add_column :boats, :category_id, :integer, index: true, foreign_key: true
... |
class CreateCentralityNodes < ActiveRecord::Migration[5.1]
def change
create_table :centrality_nodes do |t|
t.string :label
t.integer :size
t.integer :x_pos
t.integer :y_pos
t.integer :results_id
t.integer :centrality_result_set_id
t.timestamps
end
end
end
|
class RestaurantsController < ApplicationController
before_action :set_restaurant, only: [:show, :edit, :update, :destroy, :edit_gallery, :add_photo]
before_action :set_restaurant_destroy_photo, only: [:destroy_photo]
before_action :set_location, only: [:new, :edit, :create]
before_action :authenticate_user!, e... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64"
# Forward a port from the guest to the host, which allows for outside
# computers to access the VM, whereas host only networking does not.
... |
class Leaders::EvaluationsController < ApplicationController
include ActionView::Layouts
include ActionController::MimeResponds
acts_as_token_authentication_handler_for User
before_action :leader?
before_action :set_evaluation, only: [:show, :update]
respond_to :json
def index
page = params[:page]... |
class Product < ApplicationRecord
belongs_to :supplier
scope :by_name, -> { order(:name) }
end
|
def number_to_digits(n)
n.to_s.split('').map(&:to_i)
end
def digits_to_number(arr)
arr.map(&:to_s).reduce(:+).to_i
end
def grayscale_histogram(image)
arr = (0..255).map { 0 }.to_a
image.flatten.each { |x| arr[x] += 1 }
arr
end
def sum_matrix(m)
m.flatten.reduce(:+)
end
def max_scalar_product(v1, v2)
s... |
require_relative 'boot'
require 'rails'
require 'active_model/railtie'
require 'active_job/railtie'
require 'active_record/railtie'
require 'active_storage/engine'
require 'action_controller/railtie'
require 'action_mailer/railtie'
require 'action_view/railtie'
# Require the gems listed in Gemfile, including any gems... |
class AddMissingImportsAttributes < ActiveRecord::Migration[4.2]
def change
add_column :imports, :publish, :boolean
add_column :imports, :default_namespace, :string
end
end
|
class Post < ActiveRecord::Base
validates :title, presence: true
validates :content, length: {minimum: 250}
validates :summary, length: {maximum: 250}
validates :category, inclusion: %w(Fiction Non-Fiction)
validate :contains_clickbait?
def contains_clickbait?
unless self.title == nil || self.title.mat... |
get '/' do
@posts = Post.order("created_at DESC").limit(10)
erb :index
end
get '/posts/:id/' do
@post = Post.find(params[:id])
@title = @post.title
@content = @post.content
erb :'posts/show'
end
get '/posts/new' do
@title = 'Create new post'
erb :'posts/create'
end
post '/posts/new' do... |
# -*- encoding: utf-8 -*-
require File.expand_path("../lib/js-client-bridge/version", __FILE__)
Gem::Specification.new do |s|
s.name = "js-client-bridge"
s.version = JsClientBridge::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ['Rolly Fordham']
s.email = ['rolly@luma.co.nz']
... |
class Composite < ActiveRecord::Base
has_many :composites_properties
has_many :properties, :through => :composites_properties
end
|
#
# Copyright 2009 Huygens Instituut for the History of the Netherlands, Den Haag, The Netherlands.
#
# This file is part of New Women Writers.
#
# New Women Writers is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundat... |
# == Schema Information
#
# Table name: choices
#
# id :bigint(8) not null, primary key
# motherboard_id :bigint(8)
# topic_id :string
# option_id :string
# created_at :datetime not null
# updated_at :datetime not null
#
require 'rails_helper'
RSpec.describe... |
class CreateBusinesses < ActiveRecord::Migration
def change
create_table :businesses do |t|
t.string :yelp_id
t.string :name
t.string :url
t.string :mobile_url
t.string :image_url
t.decimal :rating
t.string :rating_img_url
t.string :rating_img_url_small
t.stri... |
#!/usr/bin/env ruby
# ensure that there is a path (even a slash will do) after the script name
unless ENV['PATH_INFO'] and not ENV['PATH_INFO'].empty?
print "Status: 301 Moved Permanently\r\n"
print "Location: #{ENV['SCRIPT_URL']}/\r\n"
print "\r\n"
exit
end
$LOAD_PATH.unshift File.realpath(File.expand_path('... |
class RenamePositionIdToCompoundId < ActiveRecord::Migration[5.1]
def change
rename_column :related_positions, :position_id, :compound_id
end
end
|
# encoding: utf-8
require 'skiima/db/helpers/mysql' unless defined? Skiima::Db::Helpers::Mysql
require 'skiima/db/connector/active_record/base_connector' unless defined? Skiima::Db::Connector::ActiveRecord::BaseConnector
require 'active_record/connection_adapters/mysql2_adapter' unless defined? ActiveRecord::Connection... |
class PagesController < ApplicationController
before_action :authenticate_user!
layout 'page_layout'
def index
@workspaces = current_user.workspaces.all
if @workspaces
respond_to do |format|
format.json { render json: @workspaces }
format.html { render :index }
end
else
... |
#This is a dirty, imprecise way to dump some html for validation. We can probably do better, but
# this is okay for a start.
require 'singleton'
require 'set'
class HtmlDumper
include Singleton
attr_accessor :dump_number, :seen
cattr_accessor :active
attr_accessor :dump_number, :seen
def initialize()
... |
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :conference_room do
capacity 1
building "MyString"
vtc false
name "MyString"
end
end
|
class ProductsController < ApplicationController
before_action :authenticate_user! , only: [:new ,:show, :edit, :update, :destroy]
layout "index"
before_action :set_product, only: [:show, :edit, :update, :destroy]
# GET /products
# GET /products.json
def index
@products = Product.all.paginate(:page ... |
class DropTable < ActiveRecord::Migration
def down
drop_table :questions
drop_table :deparments
end
end
|
# == Schema Information
#
# Table name: searches
#
# id :integer not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# lat :float not null
# long :float not null
# radius :integer not null
#
class S... |
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
"https://github.com/#{repo_name}.git"
end
gem 'dotenv-rails', groups: %i[development test]
gem 'rails', '~> 5.0.3'
gem 'active_model_serializers', '~> 0.8.0'
gem 'bootstrap-sass... |
class CreateAttachedDocuments < ActiveRecord::Migration
def change
create_table :attached_documents do |t|
t.string :file
t.integer :container_id
t.string :container_type
t.string :filename
t.string :content_type
t.integer :size
t.references :user
end
add_index :a... |
# frozen_string_literal: true
# Copyright (c) 2019 Danil Pismenny <danil@brandymint.ru>
# Machines web controller (JSON)
#
#
# Использую haname-action только ради обработки ошибок
#
module Machines
HEADERS = {
'Content-Type' => 'application/json',
'X-App-Version' => AppVersion.to_s,
'X-App-Env' => ENV['... |
class AttackScore
OFFENSIVE_TRICK_MULTIPLIER = 100
BASE_SCORES = {
Card.suits[:spades] => 40,
Card.suits[:clubs] => 60,
Card.suits[:diamonds] => 80,
Card.suits[:hearts] => 100,
Card.suits[:no_suit] => 120
}
def initialize(attempted_number_of_tricks:, attempted_suit:, number_of_tr... |
# encoding: utf-8
class Product < ActiveRecord::Base
acts_as_taggable
after_initialize :default_values
after_update :delete_cache
attr_accessible :code, :description, :keywords, :name, :origin_price, :product_type, :sale_price, :view_num, :product_type, :click_num, :img_path, :user_name, :status, :effect_... |
class Animal #clase animal clase padre
attr_accessor :name #atributo accesor
def initialize (name) definir constructor
@name= name #asignarlo a la variable de instancia
end
end
class Cat < Animal #clase gato que va a heredar de naimal
def talk #definir metodo talk
"miaaaau" #sonido qu... |
class Show < ActiveRecord::Base
def Show::highest_rating
self.maximum(:rating)
end
def Show::most_popular_show
self.find_by(rating: highest_rating)
end
def Show::lowest_rating
self.minimum(:rating)
end
def self.least_popular_show
self.find_by(rating: lowest_rating)
... |
class MessagesController < ApplicationController
def contact
@message = Message.new
end
def create
@message = Message.new(message_params)
captcha_message = "Big Error!"
if verify_recaptcha(recaptcha_response: "There was a mistake in your captcha" ) && @message.valid?
MessageMailer.message_me(... |
class CreateComments < ActiveRecord::Migration
def change
create_table :comments do |t|
t.text :comment_body
t.boolean :anonymous_comment
t.references :user, index: true, foreign_key: 'user_id'
t.references :post, index: true, foreign_key: 'post_id'
t.timestamps null: false
end
... |
describe 'adapter_client' do
before :all do
start_server(Moneta::Adapters::Memory.new)
end
moneta_build do
Moneta::Adapters::Client.new
end
moneta_specs ADAPTER_SPECS
end
|
def reverse_each_word(sentence)
sentence.split(" ").collect {|word| word.reverse}.join(" ")
end
#def reverse_each_word(sentence)
# sentence_array = sentence.split(" ")
# reversed_array = sentence_array.collect do |word|
# word.reverse
# end
# reversed_array.join(" ")
#end
#def reverse_each_word(sentence)
# s... |
class CoordinateService
def self.for_location(location)
{
"Financial District, Milk and Kilby Streets" => "42.3571787,-71.0573071",
"Clarendon St at Trinity Church" => "42.3500752,-71.0776725",
"Financial District, Pearl Street at Franklin" => "42.3560843,-71.0570633",
"Stuart St. at Trini... |
class Editar_empregado < SitePrism::Page
element :pim_button, '#menu_pim_viewPimModule'
element :view_button, '#menu_pim_viewEmployeeList'
element :id_field, '#empsearch_id'
element :search_button, '#searchBtn'
element :result_link, :css, '#resultTable > tbody > tr > td:nth-child(2) > a'
eleme... |
require_relative '../support/helpers/helper'
RSpec.describe PagseguroRecorrencia do
let!(:payload) { new_plan_payload }
before(:each) do
new_configuration
end
context 'when call new_plan() method' do
it 'when request all fields return success' do
response = PagseguroRecorrencia.new_plan(payload)... |
class LinkedActivityValidator < ActiveModel::Validator
attr_accessor :activity, :error_translations
def validate(activity)
@activity = activity
@error_translations = I18n.t("activerecord.errors.models.activity.attributes.linked_activity_id")
return if activity.linked_activity.nil?
return unless v... |
# encoding: utf-8
#
control "V-72061" do
title "The system must use a separate file system for /var."
desc "The use of separate file systems for different paths can protect the
system from failures resulting from a file system becoming full or failing."
impact 0.3
tag "check": "Verify that a separate file syst... |
class PlanesController < ApplicationController
# Skip authentication for this controller
skip_before_action :authenticate_user!
def index
@address = params['user_input_autocomplete_address']
@range = params['range'].to_i
@planes=Plane.near(@address, @range)
# @booking = @pl.planes.build
@book... |
class CreateClubUsers < ActiveRecord::Migration[6.0]
def change
create_table :club_users, id: :uuid do |t|
t.references :club, foreign_key: true, type: :uuid, null: false
t.references :user, foreign_key: true, type: :uuid, null: false
t.integer :status, default: 0, null: false
t.boolean :a... |
require_relative 'interface.rb'
require_relative 'user'
require_relative 'gamer'
require_relative 'deck'
class Game
attr_reader :gamer, :interface, :dealer, :deck
ACTIONS_MENU = {
1 => :dealers_turn,
2 => :extra_card,
3 => :open_cards
}.freeze
def initialize
@interface = Inte... |
#rules: two arguments, positive integer and boolean, calculate the bonus.
#if boolean true, bonus will be half of integer
#if boolean is false, bonus should be 0
#input:boolean and integer. what if wrong input, what if empty?
#output: a integer 0 or positive
def calculate_bonus(salary, bonus)
bonus ? (salary/2) : 0
... |
require "minitest/autorun"
require "minitest/pride"
require "pry"
require "./lib/customer"
require "./spec/helpers/customer_helper"
class CustomerSpec < MiniTest::Spec
before do
@customer = CustomerHelper.customer
@customer2 = CustomerHelper.customer2
@product = @customer.product_loaned
Customer.dele... |
class FlashCard < ActiveRecord::Base
attr_accessible :word, :definition, :pronunciation
has_many :decks
def info
{:word => word, :definition => definition, :pronunciation => pronunciation, :usage => usage}
end
# add datestudied to the array of cards
# container for all cards
# access all cards
... |
class Rink < ActiveRecord::Base
has_many :rinkconditions
has_many :rinknotes
end
|
class AddFieldsToUser < ActiveRecord::Migration
def change
add_column :users, :facebook_image, :boolean, default: false
add_column :users, :usr_image, :string
end
end
|
class RegistrationsController < Devise::RegistrationsController
def edit
@users = User.all_except(current_user)
if current_user.facebook.access_token
if current_user.provider == "twitter"
@cover = current_user.avatar
else
@cover = current_user.facebook.get_object("me?... |
class SiteController < ApplicationController
# The main page
def index
# All the servers added in the database
@servers = Server.all
# The statuses that can be displayed
@statuses = Status.all
# Messages that are displayed as bootstrap notifications
@messages = Message.all
# The po... |
class AddCurrencyIncomeColumnsToUsersTable < ActiveRecord::Migration[5.1]
def change
add_column :users, :btc_net_income, :decimal, precision: 25, scale: 12, default: 0.0
add_column :users, :ltc_net_income, :decimal, precision: 25, scale: 12, default: 0.0
add_column :users, :bch_net_income, :decimal, preci... |
require File.dirname(__FILE__) + '/../test_helper'
class ExpenseTest < Test::Unit::TestCase
fixtures :expenses
def test_should_get_a_price
assert_equal expenses(:wnh).price, 29.95
end
def test_should_tag_expense
assert_difference Tag, :count, 2 do
assert expenses(:agile_web_dev).tag_list.empt... |
class ServiceLinkExistsValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
return unless value.present? && record.respond_to?(:template)
value.each do |link|
next if template_image_names_for(record).include? link['service']
record.errors[attribute] << 'linked service... |
# TODO: SHOULD USE 'REDIRECT BACK TO' FROM SESSIONS INSTEAD OF HARD CODING
class LineItemsController < ApplicationController
before_action :set_cart
before_action :set_line_item, only: [:show, :edit, :update, :destroy]
def index
@line_items = LineItem.all
end
def show
end
def new
@line_item... |
source 'https://rubygems.org'
ruby '2.3.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use jquery as the JavaScript library
gem 'jquery-rail... |
# filename: ex353.ru
PREFIX ab: <http://learningsparql.com/ns/addressbook#>
PREFIX d: <http://learningsparql.com/ns/data#>
DROP GRAPH <http://learningsparql.com/graphs/courses> ;
INSERT DATA
{
GRAPH <http://learningsparql.com/graphs/courses>
{
d:course34 ab:courseTitle "Modeling Data with RDFS... |
require File.dirname(__FILE__) + '/column'
module SQL
class Table
attr_accessor :name, :columns
def initialize(adapter, table_name)
@columns = []
adapter.query_table(table_name).each do |col_struct|
@columns << SQL::Column.new(col_struct)
end
end
def to_s
nam... |
class CreatePhotoInCollections < ActiveRecord::Migration
def change
create_table :photo_in_collections, :id => false do |t|
t.string :uuid, :limit => 36, :primary => true
t.references :collection
t.references :photo
t.timestamps
end
add_index :photo_in_collections, :collect... |
class KeywordsController < ApplicationController
respond_to :json
def index
respond_with Template.all_keywords
end
end
|
class CreateVehicles < ActiveRecord::Migration
def change
create_table :vehicles do |t|
t.string :stock_number
t.string :vin, :limit => 17
t.integer :year, :limit => 4 # 4 bytes enough to store a year
t.string :make, :limit => 50
t.string :model, :limit => 50
t.string :status, ... |
class SearchResult
attr_reader :full_title, :id, :title, :primary_artist
def initialize(full_title, id, title, primary_artist)
@full_title = full_title
@id = id
@title = title
@primary_artist = primary_artist
end
def self.all(query)
results = GeniusApiWrapper.list_search_results(query)
... |
xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", 'xmlns:news' => 'http://itunes.apple.com/2011/Newsstand' do
xml.updated @issues.collect(&:updated_at).max.xmlschema
@issues.each do |issue|
xml.entry do
xml.id issue.issue_id
xml.updated issue.updated_at.xmlschema
xml.published... |
class Song < ActiveRecord::Base
# add associations here
has_many :notes
belongs_to :artist
belongs_to :genre
def artist_name=(name)
self.artist = Artist.find_or_create_by(name: name)
end
def artist_name
self.artist ? self.artist.name : nil
end
def song_notes_content=(notes_array)
n... |
require 'test_helper'
class PostsControllerTest < ActionDispatch::IntegrationTest
test "should return successfully with required tags query and no optional parameters" do
get "/api/posts/?tags=tech"
assert_response :success
end
test "should error 200 on api call without query" do
... |
class AddStatusToLostAndFoundItems < ActiveRecord::Migration
def change
add_column :lost_items, :found, :boolean, :default => false
add_column :found_items, :found, :boolean, :default => false
end
end
|
#!/usr/bin/env ruby
require_relative '../lib/git_run'
require 'optparse'
OptionParser.new do |opts|
opts.banner = "Usage: git run [options] <revision> <command>"
opts.on("-h", "--help", "Show this message") do
puts opts
exit
end
if opts.default_argv.length < 2
puts opts
exit
end
end.parse!
... |
class CreateBackgrounds < ActiveRecord::Migration
def change
create_table :backgrounds do |t|
t.references :consultant, index: true
t.boolean :citizen, null: false
t.boolean :convicted, null: false
t.boolean :parole, null: false
t.boolean :illegal_drug_use, null: false
t.boolea... |
class Admin::ArticleController < Admin::BaseController
load_and_authorize_resource
ActionController::Base.prepend_view_path("app/themes/#{$layout}")
before_action :assign_search, only: [:index, :search]
before_action :fetch_article, only: [:edit, :update, :destroy, :show]
before_action :fetch_available_dat... |
require "rails_helper"
RSpec.describe TwilioCapabilityTokenGenerator do
describe "#call" do
it "creates a token" do
token = described_class.new("test-identifier").call
decoded_token = decode_token(token)
incoming_token, outgoing_token = decoded_token.split
expect(incoming_token).to inclu... |
class AddForiegnKeyToEpisode < ActiveRecord::Migration[5.0]
def change
add_column :episodes, :show_id, :integer
end
end
|
class App
generator_for :name, :start => 'App 000001'
end
|
class Game < ApplicationRecord
belongs_to :round
belongs_to :home_team, class_name: 'Team'
belongs_to :guest_team, class_name: 'Team'
has_one :game_result
scope :finished, -> { where(finished: true) }
scope :by_tournament, lambda { |tournament_id|
joins(:round).where(rounds: { tournament_id: tournament... |
class ChangeNullnessOnCategories < ActiveRecord::Migration[5.0]
def change
def disallow_null(column, type)
change_column :categories, column, type, :null => false
end
disallow_null :name, :string
change_column :categories, :description, :string, :null => false
rename_column :categories, :ma... |
require 'spec_helper'
describe "contracts/edit.html.erb" do
before(:each) do
@contract = assign(:contract, stub_model(Contract,
:customer_id => 1,
:collector_id => 1,
:account_id => 1,
:business_type_id => 1,
:number => "MyString",
:type => "",
:block_flag => false,
... |
# == Schema Information
#
# Table name: adventurer_chapters
#
# id :integer not null, primary key
# adventurer_id :integer
# chapter_id :integer
# created_at :datetime
# updated_at :datetime
#
require 'spec_helper'
describe AdventurerChapter do
let(:adventurer_chapter) {FactoryGirl... |
Spree::Product.class_eval do
belongs_to :supplier, touch: true
def add_supplier!(supplier)
self.supplier = supplier
self.save!
end
# Returns true if the product has a drop shipping supplier.
def supplier?
supplier.present?
end
end
|
require "rubygems"
require_relative "../Libraries/TweetTrawler"
require "date"
# Elizabeth Blair
# Last Edited: 3/14/14
# 3/10/14: Created
# 3/12/14: Added some error handling, fixed timer, added access info generation
# 3/14/14: Added code for search and user modes, moved parsing to individual subs
# 3/31/14: Fixed t... |
require 'spec_helper'
describe "kind_accounts/edit" do
before(:each) do
@kind_account = assign(:kind_account, stub_model(KindAccount,
:owner_name => "MyText",
:number => "MyText",
:bank_id => 1
))
end
it "renders the edit kind_account form" do
render
# Run the generator again ... |
require 'shared_examples/node'
shared_examples 'a collection node of' do |member_klass|
it_behaves_like 'a node'
it { expect(subject).to_not be_empty }
specify do
subject.each do |node|
expect(node).to_not be_nil
expect(node).to be_a_kind_of member_klass
end
end
end
|
require 'test_helper'
class ShipImagesControllerTest < ActionDispatch::IntegrationTest
setup do
@ship_image = ship_images(:one)
end
test "should get index" do
get ship_images_url, as: :json
assert_response :success
end
test "should create ship_image" do
assert_difference('ShipImage.count') ... |
class AddCreatedByUserToManufacturer < ActiveRecord::Migration
def change
add_reference :manufacturers, :created_by_user, index: true
add_reference :models, :created_by_user, index: true
add_reference :fuel_types, :created_by_user, index: true
add_reference :engine_manufacturers, :created_by_user, ind... |
require "rails_helper"
RSpec.describe Api::V3::UsersController, type: :controller do
require "sidekiq/testing"
let(:facility) { create(:facility) }
let!(:owner) { create(:admin, :power_user) }
let!(:supervisor) { create(:admin, :manager, :with_access, resource: facility.facility_group) }
let!(:organization_... |
require "vagrant/util/counter"
module VagrantPlugins
module Puppet
module Config
class Puppet < Vagrant.plugin("2", :config)
extend Vagrant::Util::Counter
attr_accessor :facter
attr_accessor :hiera_config_path
attr_accessor :manifest_file
attr_accessor :manifests_pa... |
class ChangeOnlineDefaultValueOnProducts < ActiveRecord::Migration
def change
change_column_default :products, :on_sale, false
end
end
|
## -*- Ruby -*-
## URLopen
## 1999 by yoshidam
##
## TODO: This module should be writen by Ruby instead of wget/lynx.
module WGET
PARAM = {
'wget' => nil,
'opts' => nil,
'http_proxy' => nil,
'ftp_proxy' => nil
}
def open(url, *rest)
raise TypeError.new("wrong argument type #{url.inspect}" ... |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
has_many :reviews, :dependent => :destroy
has_many :ratings, :dependent => :destroy
has_and_belongs_to_many :places
devise :database_... |
#
# Copyright (c) 2013, 2021, Oracle and/or its affiliates.
#
# 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/LICENSE-2.0
#
# Unless required by applicabl... |
require 'test_helper'
class Piece15sControllerTest < ActionController::TestCase
setup do
@piece15 = piece15s(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:piece15s)
end
test "should get new" do
get :new
assert_response :success
en... |
#encoding: UTF-8
xml.instruct! :xml, :version => "1.0"
xml.rss "xmlns:itunes" => "http://www.itunes.com/dtds/podcast-1.0.dtd", "xmlns:media" => "http://search.yahoo.com/mrss/", :version => "2.0" do
xml.channel do
xml.title "Radio Show"
xml.link radio_show_url
xml.language "en"
xml.itunes :title, 'Rad... |
require 'ocr/scanned_characters'
require 'ocr/errors'
module OCR
class ScannedNumber
include ScannedCharacters
attr_reader :scanned_lines
attr_reader :value
def initialize(lines)
@scanned_lines = lines
normalize_line_lengths
check_proper_number_of_lines
check_for_illegal_cha... |
class String
def self.mutable_primitive_instances?
true
end
end |
class CreateMeasures < ActiveRecord::Migration
def change
create_table :measures do |t|
t.string :name
t.string :abbreviation
t.text :description
t.string :units
t.decimal :value, :precision => 8, :scale => 2
t.integer :operator
t.integer :places, :default => 0, :n... |
class Section
include Mongoid::Document
has_one :site
belongs_to :directory, class_name: "AbstractDirectory"
belongs_to :parent, class_name: "Section"
has_many :children, class_name: "Section"
field :path
def sync!
directory.directories.each do |dir|
section_path = path + dir.name
section... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.