text stringlengths 10 2.61M |
|---|
Rails.application.routes.draw do
devise_for :users
resources :redirects
# TODO: Create a "home" controller and route there instead
root to: "redirects#index"
end
|
#
# Cookbook Name:: dadou-chef-recipes
# Recipe:: main
#
# Copyright 2012 Damien DUPORTAL <damien.duportal@gmail.com>
# https://github.com/dduportal/dadou-chef-recipes
#
## Add my supplementals repos (EPEL, etc.)
node[:dadou][:yum][:custom_repo].each do |customrepo|
cookbook_file "/etc/yum.repos.d/" + customrepo do
... |
class RemoveAttachmentColumnsFromDataChildren < ActiveRecord::Migration[5.1]
def change
remove_column :data_children, :img_file_name
remove_column :data_children, :img_content_type
remove_column :data_children, :img_file_size
remove_column :data_children, :img_updated_at
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 rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
require 'rails_helper'
RSpec.describe SessionsController, type: :controller do
# app/controllers/sessions_controller_spec.rb
describe "#create" do
context "no active session, User and Authorization do not exist" do
context 'register with github' do
before(:each) do
session... |
module Command
class << self
def get_test_informations
level = prompt("Type the desired start level (1 to 6) :\n".yellow).to_i
custom_file = prompt("Use custom data.json file path ? (Y/n)\n".yellow).upcase
if custom_file.eql?("Y") && (1..6).include?(level)
file_path = prompt("Type the... |
class Admins::BaseController < ActionController::Base
include Admins::ApplicationHelper
protect_from_forgery with: :exception
layout 'admins/layouts/application'
add_breadcrumb I18n.t('breadcrumbs.homepage'), :admins_root_path
end
|
class RedisDesktopManager < Cask
url 'https://github.com/uglide/RedisDesktopManager/releases/download/0.7.1/redis-desktop-manager-0.7.1.dmg'
homepage 'http://redisdesktop.com'
version '0.7.1'
sha1 'ca743be26f08a6127c89f8a59e1fe252cfc716cc'
link 'rdm.app'
end
|
# frozen_string_literal: true
# Bank serializer
class BankSerializer < ActiveModel::Serializer
type :bank
attributes :id, :name, :code
end
|
class Profile < ActiveRecord::Base
attr_accessible :google_plus_profile_url, :user_id
belongs_to :user
end
|
class PassengerPart < Part
def initialize(volume)
super(volume)
@type = 'пассажирский'
end
end
|
require 'test_helper'
class UsersSignInTest < ActionDispatch::IntegrationTest
def setup
@user = users(:first)
end
test "sign in layout" do
visit new_user_session_path
assert page.has_css?("form#new_user")
assert page.has_field?("Email", type: "email")
assert page.has_field?("Password", ty... |
# frozen_string_literal: true
require "rails_helper"
RSpec.describe "read note", type: :system do
let(:user) { FactoryBot.create(:user) }
let(:subject) { FactoryBot.create(:subject, user: user) }
let(:course) { FactoryBot.create(:course, subject: subject) }
let(:note) { FactoryBot.create(:note, course: course... |
class PetsController < ApplicationController
# GET /pets
def index
@pets = Pet.all
end
# GET /pets/1
def show
@pet = Pet.find(params[:id])
end
# GET /pets/new
def new
@pet = Pet.new
end
# GET /pets/1/edit
def edit
@pet = Pet.find(params[:id])
end
# POST /pets
def create
... |
Rails.application.configure do
# Lograge config
config.lograge.enabled = true
# This specifies to log in JSON format
config.lograge.formatter = Lograge::Formatters::Json.new
## Disables log coloration
config.colorize_logging = true
# Log to a dedicated file
config.lograge.... |
module UserConcerns
module ResourcesFeatured
extend ActiveSupport::Concern
included do
has_many :resources_featured, class_name: 'ResourceFeatured'
end
end
end
|
class ProjectsController < ApplicationController
def index
@pieces = (1..10).map do |i|
Piece.new({
id: i,
name: "project #{i}",
description: "This is a test project #{i}",
price: i * 10,
currency: "EUR",
type: "project",
image_url: "https://unsplash.i... |
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/../rspec_methods')
describe CandidateMailer do
include EmailSpec::Helpers
include EmailSpec::Matchers
include ActionController::UrlWriter
before(:each) do
@candidate_mailer = Candidat... |
module Types
class MutationType < Types::BaseObject
## It is possible
#field :create_author, AuthorType, null: true, description: 'Create an author' do
# argument :first_name, String, required: false #, camelize: false
# argument :last_name, String, required: false
# argument :yob, Int, requir... |
require 'httparty'
require 'ostruct'
require 'securerandom'
module Talis
# Extend this class when in order to interact with Talis HTTP APIs.
# Each sub class should set base_uri to whatever Talis primitive it needs
# to talk to.
class Resource
include HTTParty
format :json
headers 'User-Agent' => "... |
class PickOfTheWeekPresenter
def initialize(games)
@games = games.sort_by(&:delta)
end
def text
if multiple_picks?
"A tie! The #{winners} beat the #{losers} (respectively) by #{delta}"
else
"The #{winners} beat the #{losers} by #{delta}"
end
end
private
def winners
joined_... |
require 'puppet'
require 'yaml'
begin
require 'fog'
rescue LoadError => e
Puppet.info "You need the `fog` gem to use the CloudWatch report"
end
Puppet::Reports.register_report(:cloudwatch) do
configfile = File.join([File.dirname(Puppet.settings[:config]), "cloudwatch.yaml"])
raise(Puppet::ParseError, "CloudW... |
# Write a method that combines two Arrays passed in as arguments, and returns a new Array that contains all elements from both Array arguments, with the elements taken in alternation.
# You may assume that both input Arrays are non-empty, and that they have the same number of elements.
# reassign arrays?
# each
# fo... |
class UsersExchange < ActiveRecord::Base
belongs_to :users
belongs_to :books
attr_accessible :users_id_1, :users_id_2, :books_id_1, :books_id_2
validates :users_id_1, :presence => true
validates :users_id_2, :presence => true
validates :books_id_1, :presence => true
validates :books_id_2, :presence =>... |
class Event < ActiveRecord::Base
has_and_belongs_to_many :arts
has_and_belongs_to_many :artists
has_attached_file :poster, :styles => { :home => "350x1000>", :thumb => "150x150#" }
validates_attachment_content_type :poster, :content_type => /\Aimage\/.*\Z/
end
|
# This error is telling us that 2 things are "opened" (The method and then the if/else statement)
# but there is only 1 keyword 'end' present so only the if/e;se statement is closed.
# To fix: Add another 'end' on line 7.
|
require_relative "viewer"
require_relative "preset"
require_relative "guest"
class Runner
attr_reader :venue
def initialize()
@venue = Preset.new.setup()
@viewer = Viewer.new()
@alone = true
@users = []
@current_room = nil
@entry_fee_paid = false
end
def start()
@viewer.intro()... |
Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root 'app#index'
resources :walks
resources :teams
resources :walkers
#cust... |
class DiscoveriesController < ApplicationController
before_filter :admin_user, except: [:index, :show]
before_filter :increment_view_count, only: :show
before_action :set_discovery, only: [:show, :edit, :update, :destroy]
def index
@title = "Discovered Artists"
@discoveries = Discovery.page(params[:pag... |
FactoryBot.define do
factory :user do
email { "p@p.com" }
password { "asdfgh" }
end
factory :person do
fname { "p0" }
lname { "lp0" }
phone { }
user_id { 0 }
rating { 0 }
street { "sc" }
city { "New York" }
province... |
feature 'URI fragment conversion in query string', :js => true do
scenario 'with simple script in the view', :driver => :webkit do
visit '/webkit#something'
expect(page).to have_text(/Capybara-webkit test/)
expect(URI(current_url).query).to match(/fragment=something/)
end
end
|
require 'rails_helper'
describe "the admin path" do
it "allows an admin to sign in" do
user = FactoryGirl.create(:user)
visit '/'
click_on 'Sign in'
expect(page).to have_content "Sign in"
fill_in 'Email', :with => user.email
fill_in 'Password', :with => user.password
click_button 'Sign in... |
class Api::V1::UsersController < ApplicationController
before_action :find_user, only: [:show, :update, :destroy]
def index
render json: User.all
end
def show
if @user
render json: @user, include: { events: [:minutes, meditation: [:name]]}
else
render json: { message: "Could not find ... |
class RomanticDatesController < ApplicationController
before_action :find_romantic_date, only: [:show, :edit, :update, :destroy]
def index
@romanticdates = RomanticDate.all
end
def show
end
def new
@romanticdate = RomanticDate.new
end
def create
date = RomanticDate.create(date_params)
... |
# 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... |
# 從 lab 檔中 抽出 duration, acoustic states, basic acoustic states
require 'json'
require 'optparse'
require_relative 'question'
# options
options = {}
options[:gen] = false
options[:source] = false
options[:target] = false
OptionParser.new do |opts|
opts.on("-g", "--gen", "gen dab in the gen dir") do |v|
o... |
describe 'Matcher output' do
it { expect{ puts 'Bruno' }.to output.to_stdout }
it { expect{ puts 'Bruno' }.to output("Bruno\n").to_stdout }
it { expect{ puts 'Bruno' }.to output(/Bruno/).to_stdout }
it { expect{ warn 'Bruno' }.to output.to_stderr }
it { expect{ warn 'Bruno' }.to output("Bruno\n").to_stderr }... |
FactoryGirl.define do
factory :ballot do
name "rob"
ip_address "192.168.0.102"
topic_ids [1,2,3]
end
end
|
DocusignRest::Client.class_eval do
def create_envelope_from_document(options={})
ios = create_file_ios(options[:files])
file_params = create_file_params(ios)
post_body = {
emailBlurb: "#{options[:email][:body] if options[:email]}",
emailSubject: "#{options[:email][:subject] if options[:emai... |
class MessageDecorator < Draper::Decorator
delegate_all
def concurrent?(another)
return false unless another
another.sender_id == object.sender_id
end
end
|
class TerminalsController < ApplicationController
def index
@url = request.original_url
if @url.include? "hardware"
@bg = 'hardware'
elsif @url.include? "tmc"
@bg = 'tmc'
elsif @url.include? "features"
@bg = 'features'
else
@bg = 'peripheral'
end
@filterrific = initialize_filterrific(... |
require 'yahoo_finance_scraper'
describe YahooFinance::Scraper do
describe YahooFinance::Scraper::Company do
context 'company details' do
before do
@getter = mock :getter
@getter.stub(:get).with kind_of(String) do
File.read 'spec/fixtures/details.csv'
end
@scraper ... |
class FontPetemoss < Formula
head "https://github.com/google/fonts/raw/main/ofl/petemoss/Petemoss-Regular.ttf", verified: "github.com/google/fonts/"
desc "Petemoss"
desc "Inspired by the forms created using a pentel™ color brush"
homepage "https://fonts.google.com/specimen/Petemoss"
def install
(share/"fo... |
class AddBikeTypeToBikes < ActiveRecord::Migration[5.0]
def change
add_column :bikes, :bike_type, :integer
end
end
|
# frozen_string_literal: true
require "securerandom"
require "graphql/subscriptions/broadcast_analyzer"
require "graphql/subscriptions/event"
require "graphql/subscriptions/instrumentation"
require "graphql/subscriptions/serialize"
require "graphql/subscriptions/action_cable_subscriptions"
require "graphql/subscription... |
# This code is just using the Java code from:
# <http://code.google.com/p/java-ascii-table/> to print a simple little email
# table
require './jars/asciitable/btc-ascii-table-1.0.jar'
java_import com.bethecoder.ascii_table.ASCIITable
headers = ['Subject', 'From']
mails = [
["NOT SPAM WE PROMISE", "sirspamsalot@ho... |
def star1
x, y = 0, 0
map = {}
File.read("input").chars.each do |direction|
case direction
when '^'
y += 1
when '>'
x += 1
when 'v'
y -= 1
when '<'
x -= 1
end
map[y] = {} if map[y].nil?
map[y][x] = 1
end
map.sum { |y, x| x.sum { |k, v| v}}
end
def move(... |
# encoding: utf-8
require 'spec_helper'
describe Chain::DSL, '#use' do
subject { object.use(processor) }
let(:object) { described_class.new(env, chain) }
let(:env) { Spec::FAKE_ENV }
let(:chain) { Chain::EMPTY }
let(:processor) { Spec::FAKE_PROCESSOR }
its(:processors) { should include(proc... |
module Slickr
class Entity
class << self
attr_writer :behaviors
end
# Specify that an Entity should behave a certain way.
#
# @param behavior [Slickr::Behavior] The behavior to use.
# @param options [Hash] Default behavior values.
#
# @example A Hero can move about the world.
... |
=begin
#===============================================================================
Title: Class Changing
Author: Hime
Date: Sep 16, 2013
--------------------------------------------------------------------------------
** Change log
Sep 16, 2013
- fixed bug where new skills were not added when "keep skills"... |
require 'spec_helper'
module TestModule
extend BetfairApiNgRails::Api::RequestMethods
end
describe "listMarketCatalogue request method" do
it_behaves_like 'simple list filtering request', 'listMarketCatalogue' do
let(:method_name) { "list_market_catalogue" }
let(:result_class) { BetfairApiNgRails::Mark... |
class AddCampaignLinkToRecipientFamily < ActiveRecord::Migration
def change
add_reference :recipient_families, :campaign, index: true, foreign_key: true
remove_reference :recipients, :organization_campaign
end
end
|
# A collection of spelling blocks has two letters per block, as shown in this list:
# B:O X:K D:Q C:P N:A
# G:T R:E F:S J:W H:U
# V:I L:Y Z:M
# This limits the words you can spell with the blocks to just those words that do not use both letters from any given block. Each block can only be used onc... |
class User::QueryController < ApplicationController
require 'csv'
before_filter :check_session_variables
def consolidated
set_recent_queries(@user.id)
end
def history
@name = @user.name
set_recent_queries(@user.id, limit: 100)
end
def update_history
user_id = User.find_by_name(params... |
module Higan
class Rendered
attr_accessor :path, :body, :updated_at
def initialize(**params)
params.each_pair do |k, v|
self.send("#{k}=", v)
end
end
end
end |
describe "Models" do
describe "only use associations, no custom methods: " do
it "'def' does not appear in any model" do
models = ["cart", "line_item", "product", "store", "user"]
models.each do |model|
contents = read_file("app/models/#{model}.rb")
expect(contents).to_not include("def... |
class SurveyAttributeGroup < ActiveRecord::Base
belongs_to :survey
belongs_to :attribute_group
end
|
# frozen_string_literal: true
require_relative './config/environment.rb'
class App < Sinatra::Base
get '/' do
json foo: 'API Setup with Sinatra'
end
get '/reviews' do
# get all reviews
content_type :json
reviews = Review.all
json reviews: reviews
end
get '/reviews/:id' do
# get a s... |
class RenameBookIdToPlanIdOnRider < ActiveRecord::Migration
def change
rename_column :riders, :book_id, :plan_id
end
end
|
class CartController < ApplicationController
def show
@product_orders = current_order.product_orders
end
end
|
# encoding: UTF-8
# frozen_string_literal: true
FactoryGirl.define do
factory :site, class: Monologue::Site do
sequence(:name) { |i| "test site name #{i}" }
sequence(:domain) { |i| "127.0.0.#{i}.xip.io" }
locale :en
end
end
|
# [Enable whyrun]
def whyrun_supported?
true
end
|
# encoding: utf-8
# Detect the pixels belonging to the background:
# - detect the edges of the image
# - use a flood fill starting from all corners up to the edges
class Xi::DIP::Preprocess::FloodFillMask
CORNERS = [[0, 0], [0, -1], [-1, 0], [-1, -1]].freeze
# Extract a flood fill mask from an image
# @para... |
# frozen_string_literal: true
module Aid
module Scripts
class Help < Aid::Script
attr_reader :script
def initialize(*argv)
super
script_name = argv.first
@script = Aid::Script.scripts[script_name]
end
def self.description
'Displays help information'
... |
# frozen_string_literal: true
class Rogare::Commands::Help
extend Rogare::Command
extend Memoist
command 'help', hidden: true
aliases 'list'
match_command /.*/
match_empty :legacy
def bot_prefix
Rogare
.prefix
.to_s
.gsub(/(
^\(
| \)$
| \^
| \?-m... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/focal64"
config.vm.synced_folder "./", "/srv/"
config.vm.network "private_network", type: "dhcp"
# configure cpu,memory,videomemory,and enable vbox gui
config.vm.provider "virtualbox" do |v|
v.memory = 4... |
class Order < ApplicationRecord
belongs_to :user
has_many :products
has_one :address
end
|
class MasterScenarioSweeper < ActionController::Caching::Sweeper
observe MasterScenario
def after_save(master_scenario)
expire_cache_for(master_scenario)
end
def after_destroy(master_scenario)
expire_cache_for(master_scenario)
end
private
def expire_cache_for(master_scenario)
# Expire mas... |
require 'spec_helper'
describe Susanoo::VisitorsController do
describe "アクション" do
describe "GET attach_file" do
describe "正常系" do
context "広告画像の場合" do
let(:file_name) { 'rails.png' }
let(:file_path){ "#{Rails.root}#{Advertisement::IMAGE_DIR}/#{file_name}" }
before do
... |
class ServiceItemProduct < ActiveRecord::Base
has_many :service_item_product_auto_model_ships
has_many :auto_models, through: :service_item_product_auto_model_ships
end
|
module GravatarHelper
def gravatar_url(<%= name %>, size)
gravatar_id = Digest::MD5::hexdigest(<%= name %>.email).downcase
"http://gravatar.com/avatar/#{gravatar_id}.png?s=#{size}&d=mm"
end
end
|
require 'rspec'
require_relative '../model/calendario'
require_relative '../model/evento'
require_relative '../model/recurrencia'
describe 'EventoDiario Tests' do
let(:evento) { EventoDiario.new("Calendario1",
"testEvento",
"calse aydoo",
... |
# == Schema Information
#
# Table name: users
#
# anonymous :boolean default(FALSE)
# created_at :datetime
# current_sign_in_at :datetime
# current_sign_in_ip :string(255)
# device_id :integer
# email :string(255)
# encrypted_password :s... |
#
# Author:: Joe Williams (<j@boundary.com>)
# Cookbook Name:: apps
# Provider:: ruby
#
# Copyright 2011, Boundary
#
# 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.or... |
class ApplicationView
PAGE_WIDTH = `tput cols`.to_i
PAGE_HEIGHT = `tput lines`.to_i - 6
def initialize(locals = {})
@locals = locals
@body_line_count = 0
clear_terminal
end
def header
separator
puts '#' + 'MICROWEB'.center(PAGE_WIDTH - 2) + '#'
separator
line
end
def footer
... |
require 'zhivko_inject'
describe Array do
describe 'zhivko_inject' do
let(:array) { [10,2,5] }
let(:array2) { ['Hello', ' World', '!'] }
context 'when a block is passed without a parameter' do
it 'can add numbers' do
expect(array.zhivko_inject { |result, num| result += num }).to eq 17
... |
# -*- encoding : utf-8 -*-
class LanguagesController < ApplicationController
oauthenticate
respond_to :html, :mobile, :embedded, :json, :xml
# GET /languages
# GET /languages.json
def index
@languages = Language.all
@title = t("translate.title")
respond_with @languages
end
# GET /languages/1
# GET /la... |
# Write a method that takes a floating point number that represents an angle between 0 and 360 degrees and returns a String that represents that angle in degrees, minutes and seconds. You should use a degree symbol (°) to represent degrees, a single quote (') to represent minutes, and a double quote (") to represent se... |
class PreschoolsController < ApplicationController
before_action :move_to_index, only: [:edit, :update, :destroy]
before_action :set_preschool, only: [:show, :edit, :update, :destroy]
PER = 6
def index
@q = Preschool.ransack(params[:q])
@preschools = @q.result(distinct: true).page(params[:page]).per(PER... |
class Race < ActiveRecord::Base
has_and_belongs_to_many :riders
has_many :race_ranking
validates :name_race, :date_race, presence: true
def self.get_races
races = Race.all
picklist = [['-Please Select-', nil ]]
races.each do |race|
picklist << [race.name_race.to_s ,race.id]
end
pickl... |
# This migration comes from blog_management (originally 20131112045656)
class AddColumnBlogDateToPages < ActiveRecord::Migration
def change
add_column :pages, :blog_date, :date
end
end
|
class Api::V1::CustomerServiceDaysController < ApplicationController
before_action :authenticate, except: [:index,:show]
before_action :set_customerServiceDay, only: [ :show,:update,:destroy ]
before_action :set_business
before_action(only: [:update,:destroy,:create]) { |controlador| controlador.authenticate_owner(... |
# Removes TextBlocks which have explicitly been marked as "not content".
module Boilerpipe::Filters
class BoilerplateBlockFilter
def initialize(label)
@label_to_keep = label
end
INSTANCE_KEEP_TITLE = BoilerplateBlockFilter.new(:TITLE)
def process(doc)
combined = doc.text_blocks.delete_if... |
class TellMeImPretty
def initialize(name)
@name = name
end
def pretty
puts "#{@name} your so pretty"
end
end
|
require_relative '../../lib/command_lookup'
describe CommandLookup do
describe "#initialize" do
before :all do
module Commands
class Foo
def self.keys; ['foo']; end
end
end
end
it "should return a matching class from the Commands module" do
command_lookup = Co... |
require 'rails_helper'
feature 'Identity adds Procedure', js: true do
scenario 'and sees it in the appointment calendar' do
given_i_am_viewing_a_participants_calendar
when_i_add_a_procedure
then_i_should_see_the_procedure_in_the_appointment_calendar
end
scenario 'and sees that the Performed By sele... |
class PotentialClientsController < ApplicationController
before_action :set_potential_client, except:[:index, :create, :new]
def index
@potential_clients = PotentialClient.all.page(params[:page]).per(15)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @potential_... |
#
# Authors: Christopher M Wood (<woodc@us.ibm.com>)
# John F Hutchinson (<jfhutchi@us.ibm.com)
# © Copyright IBM Corporation 2015.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
#
require "rbvppc/version"
require "rbvppc/command_failure"
require "rbvppc/connectable_server"
require "rbvppc/hmc"
require "rb... |
module MakumbaImport
class Importer
@mdd_path = ""
@output_path = ""
def self.set_mdd_path(mdd_path)
@mdd_path = mdd_path
end
def self.set_output_path(output_path)
@output_path = output_path
end
def self.get_data(lines, mdd)
fieldRegexp = /^([a-zA-Z\_]+)\s*=\s*([^;... |
# -*- encoding: utf-8 -*-
lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib)
Gem::Specification.new do |s|
s.name = "rails3_acts_as_paranoid"
s.version = "0.0.1"
s.platform = Gem::Platform::RUBY
s.authors = "Gonçalo Silva"
s.email = "goncalossilva@gmail... |
class AssetsTest < Test::Unit::TestCase
context 'a file' do
setup do
@path = '/foo/bar/some_file.blah'
@asset = Hadupils::Assets::File.new(@path)
end
should 'have a path' do
assert_equal @path, @asset.path
end
should 'have a name' do
assert_equal ::File.basename(@path), @... |
class Gift < ActiveRecord::Base
# Remember to create a migration!
validates :name, presence: true, length: {minimum: 3}
belongs_to :user
end
|
class Shop < ApplicationRecord
validates :name, presence: true
has_many :stocks
has_many :books, through: :stocks
class BookAbsentError < StandardError; end
class TooLittleCopiesError < StandardError; end
def self.with_sold_books(publisher_id)
joins(stocks: :book)
.where("publisher_id = #{publi... |
##
# Maximilian Sparenberg | Max.Sparenberg@icloud.com | inf24
##
require_relative '../spec_helper'
describe 'ntp::centos' do
let (:chef_run) { ChefSpec::ServerRunner.new(platform:'centos', version:'7.0').converge 'ntp::default' }
it 'installs ntp' do
expect(chef_run).to install_package('ntp')
end
it 'sta... |
# frozen_string_literal: false
require "cgi"
require "rexml/document"
require_relative "rss-testcase"
require "rss/1.0"
require "rss/2.0"
require "rss/trackback"
module RSS
class TestTrackBack < TestCase
def setup
@prefix = "trackback"
@uri = "http://madskills.com/public/xml/rss/module/trackback/"... |
class Reaction < ApplicationRecord
belongs_to :user
belongs_to :photographer
enum status: { dislike: 0, like: 1 }
end
|
#Design elevator system
#Requirements: mulitple elevator
#Use cases
#User presses up or down button from a floor and one elevator takes the request
#User gets into elevator and presses the destination floor
#Elevator going down takes only requests from floors down to it
#Elevator going up takes only requests from fl... |
module CMS::ApplicationHelper
ALERT_ICONS = {
urgent_review: 'red warning sign',
review: 'orange warning sign',
recently_expired: 'warning sign',
expired: 'info circle',
}.freeze
PLACE_MODELS = %i[
countries
regions
areas
]
def floating_action text, icon = nil, url = nil, **args... |
class Libalac < Formula
desc "Apple Lossless Audio Codec (ALAC) Library"
homepage "https://macosforge.github.io/alac/"
url "https://github.com/macosforge/alac/archive/c38887c5c5e64a4b31108733bd79ca9b2496d987.tar.gz"
sha256 "98635ece42fb1c3fceb75eaa4b5164d866e09f0195b3e7ec4085f1123c5e272f"
head "https://github... |
class Api::V1::MoviesPresenter < Api::V1::V1Presenter
def self.backdrop_urls(resource)
return [] unless resource.backdrop_path.present?
Rails.configuration.the_movie_db.backdrop_sizes_urls.map do |url|
url.to_s + resource.backdrop_path
end
end
def self.poster_urls(resource)
return [] unles... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.