text stringlengths 10 2.61M |
|---|
class RenameCategoryTagsTableToCategoriesTags < ActiveRecord::Migration
def change
rename_table :category_tags, :categories_tags
end
end
|
require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.allocate_address' do
before(:all) do
@ec2 = Fog::AWS::EC2.gen
end
after(:all) do
@ec2.release_address(@public_ip)
end
it "should return proper attributes" do
actual = @ec2.allocate_address
actual.body['requestId'].should b... |
class User < ActiveRecord::Base
enum role: [:user, :admin]
after_initialize :set_default_role, :if => :new_record?
has_many :user_genres
has_many :genres, through: :user_genres
has_many :movies
validates :name, :email, presence: true
validates :email, uniqueness: true, :if => :new_record?
has_secure_p... |
class Api::V1::OrdersController < ApplicationController
def index
@orders = Order.all
render json: @orders, include: :purchaseditems
end
def show
@order = Order.find(params[:id])
render json: @order, include: :purchaseditems
end
def create
# byebug
... |
# frozen_string_literal: true
audit = command(
"/usr/bin/apt-config dump --no-empty --format '%f=%v%n' Unattended-Upgrade"
).stdout
options = {
assignment_regex: /^\s*([^=]*?)\s*=\s*(.*?)\s*$/,
multiple_values: true
}
control 'Apt unattended upgrades' do
title 'should be configured'
describe file('/etc/ap... |
class Animal < ApplicationRecord
has_many :reviews, dependent: :destroy
belongs_to :category
belongs_to :user
has_many :likes, dependent: :destroy
has_many :users, through: :likes
def like_for(le_user)
likes.find_by_user_id le_user
end
# validates :title, presence: true #, uniqueness: true
end
|
cask :v1 => 'sage' do
version '6.4.1'
sha256 '3ae99dbddd5609271aa87ef38db58dd53fe2add3a58abed3b80750884100391e'
url "http://boxen.math.washington.edu/home/sagemath/sage-mirror/osx/intel/sage-#{version}-x86_64-Darwin-OSX_10.10_x86_64-app.dmg"
name 'Sage'
homepage 'http://www.sagemath.org/'
license :gpl
a... |
class AddImageToEnemies < ActiveRecord::Migration
def change
add_column :enemies, :image, :string
end
end
|
require "test_helper"
class QuizScopeTest < ActiveSupport::TestCase
context "Given context" do
setup do
create_organizations
create_events
create_quizzes
end
should "list quizzes by room" do
assert_equal [@acac_e1_s1_r1, @acac_e1_s1_r2, @acac_e3_s1_r1, @acac_e3_s1_r2,
... |
# Teskal
# Copyright (C) 2007 Teskal
class RedCloth
# Patch for RedCloth. Fixed in RedCloth r128 but _why hasn't released it yet.
# <a href="http://code.whytheluckystiff.net/redcloth/changeset/128">http://code.whytheluckystiff.net/redcloth/changeset/128</a>
def hard_break( text )
text.gsub!( /(.)\n... |
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe Stanford::Indexer do
describe "#new" do
it "should have all relative stuff initilized" do
@mock_zotero_index = double("ZoteroIndex")
@mock_indexer_repo = double("Stanford::Repository")
... |
# Structure for temporary game data
# Feel free to customize and extend this class
module SDC
class Game < SDC::BaseGame
def initialize
# Initialize base game values
super
# Gravity
@gravity = SDC::Coordinates.new(0, 30.0) * (@meter / @second**2)
end
end
end |
class BinarySequence < Enumerator
def initialize
super do |y|
i = 0
total_ones = 0
loop do
total_ones += i.to_s(2).each_char.map(&:to_i).inject(&:+)
y << total_ones
i += 1
end
end
end
end
|
require 'rails'
require 'landlord/tenant'
module Landlord
class Railtie < Rails::Railtie
#
# Set up our default config options
# Do this before the app initializers run so we don't override custom settings
#
config.before_initialize do
Landlord.configure do |config|
config.tena... |
require 'test_helper'
class SendPeriodicEmailsJobTest < ActiveSupport::TestCase
def setup
@val = Seek::Config.email_enabled
Seek::Config.email_enabled=true
Delayed::Job.delete_all
end
def teardown
Delayed::Job.delete_all
Seek::Config.email_enabled=@val
end
test "exists" do
assert !... |
class AugmentAdverseEvents < ActiveRecord::Migration
def change
add_column :adverse_events, :date_of_occurrence, :date
change_column :adverse_events, :reason, :string, :null => true
rename_column :adverse_events, :reason, :event_type
end
end
|
class CreateSlots < ActiveRecord::Migration
def change
create_table :slots do |t|
t.string :queries
t.string :image_url
t.string :sql_prepend
t.string :filters_humanized
t.timestamps null: false
end
end
end
|
class Admin::UserCoursesController < ApplicationController
layout "admin_application"
before_action :authenticate_user!
before_action :verify_admin
before_action :load_course, only: [:show, :update]
load_and_authorize_resource
def show
@course.build_user_courses @course.users
end
def update
@c... |
require_dependency "lost_link_check/application_controller"
module LostLinkCheck
module Susanoo
class LostLinksController < ApplicationController
before_action :login_required
before_action :set_lost_link, only: [:destroy]
#
#=== リンク切れ一覧
#
def index
lost_links = LostL... |
module HiarisHelper
def simple_time(time)
time.strftime("%Y-%m-%d %H:%M ")
end
def convert2Reliability(num)
case num
when 1 then
return "低"
when 2 then
return "中"
when 3 then
return "高"
else
return "高"
end
end
def default_meta_tags
{
... |
class Post < ApplicationRecord
validates :content, presence: true, length: {maximum: 140}
validates :user_id, presence: true
belongs_to :user
# searchメソッドの定義
# searchにはparams[:keryword]が入っている
def self.search(search)
if search
Post.where('content LIKE(?)', "%#{search}%")
else
Post.all
... |
module Lumber
# Include this module to add a logger accessible from both class and instance methods.
# A logger heirarchy will be created if the class including this module is nested
module LoggerSupport
def self.included(receiver)
receiver.class_eval do
class_inheritable_accessor :logger
... |
class AppDelegate
attr_accessor :window
attr_accessor :joinViewController
attr_accessor :upDownController
attr_accessor :host
attr_accessor :port
attr_accessor :partyId
def application(application, didFinishLaunchingWithOptions:launchOptions)
NSLog("app delegate")
self.window = UIWind... |
# frozen_string_literal: true
module LocaleDetection
protected
def switch_locale
locale = params[:locale] || cookies[:locale]
I18n.locale = allowed_locale?(locale) ? locale : default_locale
cookies[:locale] = {
value: locale,
expires: 1.year.from_now,
domain: request.domain,
}
... |
class CreateRecipes < ActiveRecord::Migration
def change
create_table :recipes do |t|
t.string :name
t.string :category
t.boolean :private, default: false
t.string :prep_time
t.string :cook_time
t.text :ingredients
t.text :instructions
end
end
end
|
require 'rails_helper'
describe Exam do
describe ".difficulty" do
it 'rounds up theta value to nearest 0.5 multiply' do
expect(Exam.difficulty(1.4)).to eq(1.5)
end
it 'rounds the maximum value to 3' do
expect(Exam.difficulty(3.6)).to eq(3)
end
it 'rounds the minimum value to -3' do
... |
class AddStartsDefaultToDeals < ActiveRecord::Migration
def change
change_column :deals, :starts, :datetime, :default => Time.zone.now
end
end
|
require_relative "../spatial"
module PdfExtract
module Titles
Settings.declare :title_slop, {
:default => 0.2,
:module => self.name,
:description => "Regions of text whose font size is less than :title_slop percent of the largest font size in a PDF will be disregarded as candidate titles. Valu... |
require 'rails_helper'
RSpec.describe ChangeSchoolResponsibleBodyService, type: :model do
let(:service) { described_class.new(moving_school, new_rb) }
let(:new_rb) { create(:local_authority, :manages_centrally, :vcap_feature_flag) }
describe '#call' do
context 'when the school cannot be updated for some rea... |
class CompetitionsController < ApplicationController
load_and_authorize_resource
def index
@competitions = Competition.where("parent_competition_id is ?", nil).order("ends desc")
end
def show
@competition = Competition.find(params[:id])
@subcompetitions = Competition.where('parent_competition_id... |
class User
include Mongoid::Document
include Mongoid::Timestamps
has_many :pitchfiles
field :box_user_id, type: Integer
validates_presence_of :box_user_id
end |
require 'rails_helper'
describe Home do
it { should have_many(:rooms)}
it { should validate_presence_of :name }
it { should validate_presence_of :address }
end
|
namespace :racecards do
desc "Get todays racecards"
task import: [:environment] do
require 'open-uri'
doc = Nokogiri::HTML(open("https://beta.racingpost.com/racecards/"))
racecards = doc.css('.ui-accordion__row')
racecards.each do |racecard|
url = racecard.css('.RC-meetingList__showAll').fir... |
FactoryGirl.define do
factory :server do
name "MyString"
ip_address "MyString"
association :company, factory: :company, strategy: :build
end
end
|
class ApplicationController < ActionController::Base
protect_from_forgery
include ApplicationHelper
def authorise
unless signed_in?
store_location
redirect_to signin_path, :notice => "Please sign in to access this page."
end
end
def authoriseAdmin
unless signed_in? && ... |
class CreateDiachis < ActiveRecord::Migration[5.0]
def change
create_table :diachis do |t|
t.string :sonha
t.string :duong
t.string :phuong
t.string :quan
t.string :thanhpho
t.references :thanhvien, foreign_key: true
t.timestamps
end
end
end
|
require 'test_helper'
class RecipeTest < ActiveSupport::TestCase
def setup
@user = users(:michael)
@recipe = @user.recipes.build(name: "Food",
ingredients: "salt, meat, cheese",
directions: "mix it all together, cook it",
user_id: @u... |
module FullRecordXmlHelper
# Renders a modal div with the contents of the MODS datastream if there is a MODS datastream present
def render_full_record(curation_concern)
ds = curation_concern.datastreams["MODS"]
unless ds.nil? || ds.empty?
content_tag :div, {class:"modal fade", id:"fullRecord", tabin... |
class Api::PeopleController < Api::ApiController
expose :people, -> { @active_company.people }
expose :person, id: ->{ params[:slug] }, scope: ->{ @active_company.people.includes_associated }, find_by: :slug
# GET api/people/options
def index
render json: people.includes_associated.render
end
# GET ap... |
#!/usr/bin/env ruby
require 'ruby-mpd'
require 'diff/lcs/array'
class Enslaver
def initialize(master_host, slave_host)
@linked = false
@master_host = master_host
@idle = MPD.new @master_host
@master = MPD.new @master_host
#@master.on :playlist do |pl|
# playlist
#end
#@master.on :vo... |
class UserMailer < ApplicationMailer
default from: 'admin@co.jp'
def reset_password_email(user)
@user = User.find(user.id)
@url = edit_password_reset_url(@user.reset_password_token)
mail(to: user.email, subject: 'パスワードリセット')
end
end
|
FactoryGirl.define do
sequence(:email) { |n| "user#{n}@example.com" }
factory :user do
email
password "bananastand"
first_name "Bob"
last_name "Lawblaw"
admin false
end
factory :admin, class: User do
email
password "funkytown"
admin true
first_name "Admin"
last_name "Jones"
end
end |
require 'movie'
describe "movie" do
let(:a_movie) { Movie.new("War Stars")}
it "has a title" do
a_movie.title.should_not be_empty
end
it "has at least one rating" do
a_movie.ratings.size.should be > 0
end
it "has a movie id" do
a_movie.id.should_not be_empty
end
end
|
class AddressesSerializer < BaseAddressSerializer
attribute :price, &:calculating_average_price
attribute :lands_count, &:calculating_lands_count
end
|
#!/usr/bin/env ruby
require_relative './config/environment'
require 'thor'
require 'codecal'
require_relative './app/services/transfer_in_import'
require_relative './app/services/transfer_out_import'
require_relative './config/fiat_config'
require_relative './service/fiat-mailer'
require_relative './util/fiatd_logger'
... |
class Warden < ActiveRecord::Base
belongs_to :employee
belongs_to :hostel
validates_presence_of :hostel_id, :employee_id
validates_uniqueness_of :employee_id, :scope => :hostel_id
HUMANIZED_COLUMNS = {:employee_id => "#{t('wardens.warden')}"}
def self.human_attribute_name(attribute)
HUMANIZED_COLUMNS[... |
# Hack to check against one type from http://stackoverflow.com/a/3028378/452684
# because Ruby doesn't have a single boolean class
module Boolean; end
class TrueClass; include Boolean; end
class FalseClass; include Boolean; end
module JsonTableSchema
module Types
class Boolean < Base
def name
'boo... |
# ActiveModel Matchers
# Matchers to test validations and mass assignments:
describe Post do
it { should validate_uniqueness_of(:title) }
it { should validate_presence_of(:body).with_message(/wtf/) }
it { should validate_presence_of(:title) }
it { should validate_numericality_of(:user_id) }
it { should valid... |
class MovePublicToRightTable < ActiveRecord::Migration
def change
remove_column :events, :public
add_column :calendars, :public, :boolean, default: false
end
end
|
class AuthorJsonDecorator < ApplicationDecorator
decorates :author
# This article does a great job explaining why this is as_json:
# http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/
def as_json(options = nil)
author_decorator = AuthorDecorator.decorate(author)
{
:username => author.use... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
around_action :authenticate_user!
rescue_from JsonApiClient::Errors::NotAuthorized, with: :not_authorized!
private
def authenticate_user!
BaseResource.authenticate_with(session[:email], session[:auth_token]) do... |
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :statuses
def full_name
first_name + " " + last_name
end
end |
# frozen_string_literal: true
class FloatPlan < ApplicationRecord
include Concerns::FloatPlan::Formatting
belongs_to :user, optional: true
has_many :float_plan_onboards
accepts_nested_attributes_for :float_plan_onboards
validates :float_plan_onboards, presence: true
after_create { generate_pdf }
has_... |
# -*- coding: UTF-8 -*-
#
# Author:: lnznt
# Copyright:: (C) 2011 lnznt.
# License:: Ruby's
#
require 'gmrw/extension/extension'
module GMRW::Extension
mixin Array do
def to_hash
Hash[ *flatten(1) ]
end
def cons(*a)
Array(a) + self
end
def rjust(len, pad=nil)
cons *(len > len... |
class GeoCache < ApplicationRecord
belongs_to :cacher, class_name: 'User', counter_cache: true
has_many :comments, dependent: :destroy
has_many :reacted_on, class_name: 'Reaction', foreign_key: "reacted_on_id", dependent: :destroy
validates :title, length: { minimum: 3, maximum: 150 }, presence: true
validat... |
$:.push File.expand_path("../lib", __FILE__)
require 'madeleine/version'
Gem::Specification.new do |s|
s.name = 'madeleine'
s.version = Madeleine::VERSION
s.summary = "Madeleine is a Ruby implementation of Object Prevalence"
s.description = "Transparent persistence of system state using logging and snapshots"
... |
# class ABR
# # this function will be auto call on object creation code ABR.new
# def initialize
# puts "Hello ABR"
# puts "Hahahahahahaha"
# puts "Hahahahahahaha"
# puts "Hahahahahahaha"
# a = rand(0..50)
# puts a
# puts "Hahahahahahaha"
# puts "Hahahahahahaha"
# puts "Hahahahah... |
module NewRelic::RedshiftPlugin
# Register and run the agent
def self.run
# Register this agent.
NewRelic::Plugin::Setup.install_agent :redshift, self
# Launch the agent; this never returns.
NewRelic::Plugin::Run.setup_and_run
end
class Agent < NewRelic::Plugin::Agent::Base
agent_guid ... |
class AddMesTrfStsToPoReceipt < ActiveRecord::Migration
def change
add_column :po_receipt, :mes_trf_sts, :string, default: ' '
add_index :po_receipt, :mes_trf_sts
end
end
|
class Genre < ActiveRecord::Base
attr_accessible :name, :description
has_many :movies
end |
json.array! @data do |g|
json.id g.id
json.email g.email
json.created_at g.created_at
json.languages g.languages do |l|
json.id l.id
json.code l.code
end
json.activities g.activities do |a|
json.id a.id
json.name a.name
end
end
|
class CreateMenuItemServingSizes < ActiveRecord::Migration
def change
create_table :menu_item_serving_sizes do |t|
t.integer :serving_size_id
t.integer :menu_item_id
t.boolean :is_available
end
end
end
|
# frozen_string_literal: true
module Jiji::Composing::Configurators
class TradingConfigurator < AbstractConfigurator
include Jiji::Model
include Jiji::Model::Trading
include Jiji::Model::Trading::Internal
def configure(container)
configure_base_components(container)
configure_rmt_compon... |
=begin
(Problem):
Write a method that returns true if the string passed as an argument is a palindrome, false otherwise.
A palindrome reads the same forward and backward. For this exercise, case matters as does punctuation and spaces.
(Understand the Problem):
• (Inputs): String
• (Outputs): Boolean
• (Questions):... |
Rails.application.routes.draw do
get '/project' => 'pages#project'
get '/stage' => 'pages#stage'
get '/about' => 'pages#about'
get '/reviews/download' => 'reviews#download'
resources :reviews, shallow: true do
resources :replies
end
resources :pages, :only => :index
root 'pages#index'
end
|
require 'spec_helper'
RSpec.configure do |c|
c.os = 'Debian'
end
describe kernel_module('lp') do
it { should be_loaded }
its(:command) { should eq "lsmod | grep ^lp" }
end
describe kernel_module('invalid-module') do
it { should_not be_loaded }
end
|
class Building
attr_reader :units
def initialize
@units = []
end
def add_unit(new_unit)
@units << new_unit
end
def renters
total_renters = []
@units.map do |unit|
if unit.renter != nil
total_renters << unit.renter.name
end
end
total_renters
end
def averag... |
module Fog
module Compute
class Brkt
class Real
def create_cloudinit(name, deployment_type = "DEFAULT", attributes = {})
attributes = {
:name => name,
:deployment_type => deployment_type,
}.merge(attributes)
request(
:ex... |
# frozen_string_literal: true
require 'json'
# Represents overall group information for JSON API output
class ErrorRepresenter < Roar::Decorator
include Roar::JSON
property :code
property :message
ERROR = {
already_exist: 422,
not_found_in_DB: 404,
not_found_on_Spotify: 400,
cannot_process: 5... |
class Api::TicketsController < ApplicationController
def index
@tickets = Ticket.all
render "index.json.jbuilder"
end
def show
@ticket = Ticket.find_by(id: params[:id])
render "show.json.jbuilder"
end
def create
@user = User.find_by(email: params[:email])
if !@user
@user = Us... |
module Roark
module Aws
module Ec2
class InstanceStatus
def initialize(connection)
@connection = connection
end
def status(id)
@connection.ec2.instances[id].status
end
end
end
end
end
|
class RenamePositiveCurrencyConstraint < ActiveRecord::Migration
def up
execute "ALTER DOMAIN positive_currency RENAME CONSTRAINT non_negative TO positive;"
end
def down
execute "ALTER DOMAIN positive_currency RENAME CONSTRAINT positive TO non_negative;"
end
end
|
require "forwardable"
class GenericItem
extend Forwardable
def_delegators :@item, :name, :quality, :quality=, :sell_in, :sell_in=
MAXIMUM_QUALITY = 50
def initialize item
@item = item
end
def adjust_quality
self.quality = [0, quality - quality_decrement_rate].max
end
def decrease_sell_in
... |
class CreateTaskAuths < ActiveRecord::Migration
def self.up
create_table :task_auths do |t|
t.integer :author_id
t.integer :task_id
t.datetime :updated_at
t.datetime :created_at
end
add_index :task_auths, :author_id
add_index :task_auths, :task_id
end
def self.down
... |
class EsCategoriesSync
def self.sync(overwrite_model)
from = 0
size = 1000
loop do
sources = Category.search(size: size, from: from).results.to_a
sources.each do |source|
attributes = source._source
id = attributes.id
record = Category.find_by(id: id)
if re... |
class Child
include Lotus::Entity
attributes :name, :birthdate, :age, :grade
def birthdate=(birthdate)
return if birthdate.nil?
@birthdate = birthdate
now = Time.now.to_date
@age = now.year - @birthdate.year - \
(@birthdate.to_date.change(:year => now.year) > now ? 1 : 0)
end
end
|
# encoding: utf-8
Encoding.default_internal = Encoding.default_external = Encoding::UTF_8 if RUBY_VERSION >= '1.9.0'
require 'rubygems'
require 'bacon'
$:.unshift './lib'
require "populate_me/ext"
describe 'Integer' do
describe '#to_price_string' do
should 'Display numbers correctly' do
4595.to_price_stri... |
json.array!(@consulta) do |consultum|
json.extract! consultum, :id, :Cliente, :Marca, :anio
json.url consultum_url(consultum, format: :json)
end
|
class CreateSyojis < ActiveRecord::Migration[5.1]
def change
create_table :syojis do |t|
t.string :title_syo
t.string :artist
t.integer :color_id
t.string :title_j
t.date :release
t.string :image_syo
t.binary :image_binary
t.string :image_type
t.text :memo_syo... |
class CreateCollegeCourses < ActiveRecord::Migration[5.0]
def change
create_table :college_courses do |t|
t.integer :college_id, null: false
t.integer :course_id, null: false
t.string :with_subjects
t.integer :no_of_seats
t.timestamps null: false
end
add_index :college_cours... |
require 'minitest/autorun'
require_relative '../lib/engine'
class OrderItemTest < Minitest::Test
def setup
@today = Date.today.strftime('%m/%d/%Y')
@four_months_ago = Date.today.prev_month.prev_month.prev_month.prev_month.strftime('%m/%d/%Y')
@item_hash = {"name"=>"tooth paste", "frequency"=>"4 months",... |
class Booking < ApplicationRecord
belongs_to :offer
belongs_to :professional, class_name: 'User'
belongs_to :consumer, class_name: 'User'
end
|
require "rbconfig"
# Renders output to the console
class ConsoleRenderer
# Are we running on a Windows machine?
WIN_OS = Config::CONFIG["host_os"] =~ /mswin|mingw/
# Standard puts functionality for adhoc text output
def output(text)
puts text
end
# Clears the terminal (OS safe)
def clear
WIN_... |
##
# La classe représente un bouton dans la grille du jeu
##
# * +couleur+ la couleur actuellement appliquée au bouton
# * +boutton+ Instance de la classe Gtk::Button
class Boutton_grille
##
# * +css+ Le css a appliquer sur le boutton à l'init
def Boutton_grille.creer(css)
new(css)
end
... |
module WaitForAjax
def wait_for_ajax
wait_for 'all ajax requests to complete' do
finished_all_ajax_requests?
end
end
private
def finished_all_ajax_requests?
page.evaluate_script('window.$ !== undefined') &&
page.evaluate_script('$.active').zero?
end
end
RSpec.configure do |config|
... |
require 'rubygems'
require 'gosu'
Dir["./lib/*.rb"].each {|file| require file}
class GameWindow < Gosu::Window
attr_accessor :width, :height
def initialize
@width = 800
@height = 600
super @width, @height, false
self.caption = 'Pong Game'
@ball = Ball.new(self)
@left_paddle = Paddle.new(self, 0) #postio... |
class Equip < ApplicationRecord
has_and_belongs_to_many :user_equips
validates :name, uniqueness: true
end |
require 'nokogiri'
require 'open-uri'
require 'pry'
class Scraper
def self.scrape_index_page(index_url)
students_array = []
html = open(index_url)
doc = Nokogiri::HTML(html)
student_names = doc.css(".student-name")
student_names.each do |element|
students_array << {name: element.text}
... |
class Team < ApplicationRecord
has_many :inscriptions
has_many :team_players
has_many :users, through: :team_players
has_many :tournaments, through: :inscriptions
# has_many :users, through: :team_players
end
|
class Manage::UsersController < ApplicationController
layout 'admin'
in_place_edit_for :user, 'friendly_name'
in_place_edit_for :user, 'email'
def index
restrict('allow only admins') or begin
@doctor = Doctor.find_by_id(params[:doctor_id])
@users = User.find_all_by_doctor_id(params[:doctor_id])... |
class Recipe < ActiveRecord::Base
has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>", :preserve_files => "false" }, :default_url => "/images/:style/missing.png"
attr_accessor :remove_avatar
before_validation { avatar.clear if remove_avatar == '1' }
validates_attachment_content_typ... |
pg_host = input('pg_host')
login_user = input('login_user')
pg_dba = input('pg_dba')
pg_dba_password = input('pg_dba_password')
pg_db = input('pg_db')
approved_packages = input('approved_packages')
control "V-73011" do
title "Unused database components which are integrated in PostgreSQL and
cannot be uninstal... |
require "spec_helper"
describe Scrabble::Scrabble do
describe "#score" do
it "only takes characters that are letters" do
expect(Scrabble::Scrabble.score("")).to eq "That is not a valid word."
expect(Scrabble::Scrabble.score("83uejd9w0220330")).to eq "That is not a valid word."
expect(Scrabble::... |
class Api::V1::CategoriesController < ApplicationController
before_action :find_category, only: [:update, :destroy, :show]
#GET api/v1/categories
def index
@categories = Category.all
end
#GET api/v1/categories/:id
def show
unless @category.nil?
@category
end
end
# POST api/v1/categ... |
json.array!(@fundraisers) do |fundraiser|
json.extract! fundraiser, :id, :name, :description, :length, :amount
json.url fundraiser_url(fundraiser, format: :json)
end
|
# == Schema Information
#
# Table name: groups
#
# id :integer not null, primary key
# key_word_id :integer not null
#
class Group < ActiveRecord::Base
belongs_to :key_word, class_name: 'Word'
has_and_belongs_to_many :words, join_table: 'groupings'
validates_presence_of :key_word_i... |
class AddColumnCountdownToPuzzles < ActiveRecord::Migration
def self.up
add_column :puzzles, :countdown, :integer, :null => false, :default => 15
end
def self.down
remove_column :puzzles, :countdown
end
end
|
require 'spec_helper'
describe 'vault::config', :type => :class do
context "On a Debian OS" do
let :facts do
{
:osfamily => 'Debian',
:operatingsystemrelease => '7',
:concat_basedir => '/tmp',
:lsbdistid => 'Debian',
}
end
c... |
class PostsController < ApplicationController
def index
@page_name = "posts"
posts = Post.all.map do |post|
DataFormer.new(post)
.url(:update_url)
.url(:delete_url)
.data
end
@component_data = {
posts: posts,
create_url: posts_path
}
render "/react/p... |
source 'https://rubygems.org'
gem 'puppet', ENV['PUPPET_GEM_VERSION'], require: false
group :deployment, optional: true do
gem 'pdk', require: false if ENV.key?('DEPLOY')
end
group :development do
gem 'fuubar', require: false
gem 'mdl', require: false
gem 'metadata-json-lint', require: false
gem 'puppet-bl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.