text
stringlengths
10
2.61M
class AddActivitiesRefToSteps < ActiveRecord::Migration[5.2] def change remove_column :steps, :activity_id add_reference :steps, :activity end end
class Api::V1::CausesController < Api::V1::ApiController def index current_page = causes.page(page_number).per(page_size) render json: current_page end def create current_user.causes = Cause.find(params[:id]) render json: current_user.causes, status: :created rescue ActiveRecord::ActiveRecordEr...
ActionController::Routing::Routes.draw do |map| map.devise_for :users map.root :controller => :meetings, :action => :index map.resources :meetings end
# A grid that overrides the `get_data` endpoint in order to send a command to the client class GridWithFeedbackOnDataLoad < Netzke::Basepack::Grid def configure(c) super c.model = 'Book' end endpoint :server_read do |params,this| super(params,this) this.netzke_feedback "Data loaded!" end end
# Author: Jim Noble # jimnoble@xjjz.co.uk # # Anagramalam.rb # # A program that takes a list of words and outputs an array of anagram # arrays # class Anagramalam @longest_word @input @anagrams @output # * Find the longest word in the dictionary. # # * Create an array of arrays, one for every possible ...
require 'rails_helper' RSpec.describe Site, type: :model do before { @site = build(:site) } subject { @site } it { should respond_to(:name) } it { should respond_to(:address) } it { should be_valid } describe 'when name is not present' do before { @site.name = ' ' } it { should_not be_valid } ...
class AddScoreAndResultToUser < ActiveRecord::Migration def change add_column :users, :score, :float add_column :users, :result, :string end end
class RestaurantMailer < ActionMailer::Base default from: 'Happy Dining <admin@happydining.fr>' def new_reservation reservation, email @reservation = reservation @time = reservation.time.strftime("%d/%m/%Y, à %H:%M") @user = reservation.user @phone = reservation.phone @user_contribution = @reserv...
class Roadtrip < ActiveRecord::Base #attr_accessible :title belongs_to :user validates :title, :presence => true, :length => { :maximum => 140 } validates :user_id, :presence => true end
class Post < ApplicationRecord has_many :comments belongs_to :user has_attached_file :image, styles: { large: '600x 600>', medium: '300x300>', thumb: '150x150#' } validates_attachment_content_type :image, content_type: /\Aimage\/.*\z/ def self.search(search) if search where('title LIKE ?', "%#{sear...
FactoryGirl.define do factory :trivia, :class => 'Trivia' do sequence(:question) {|n| "Question #{n}"} category { build(:category) } trait :with_options do options { build_list :trivia_option, 3 } correct_option { options.first } end end end
# frozen_string_literal: true class Permission < ApplicationRecord belongs_to :role belongs_to :operation end
class TwoBucket class Error < StandardError def initalize(msg = "Source cannot be empty while other is full !") super end end class Bucket attr_accessor :quantity, :size, :name def initialize(size, name) @size = size @name = name @quantity = 0 end def full? ...
# encoding: utf-8 describe Faceter::Functions, ".ungroup" do let(:arguments) { [:ungroup, :baz, Selector.new(options)] } it_behaves_like :transforming_immutable_data do let(:options) { {} } let(:input) do [{ qux: :QUX, baz: [{ foo: :FOO, bar: :FOO }, { foo: :BAR, bar: :BAR }] }] end let(:...
require 'rails_helper' describe AuditFieldsController do describe '#index' do let!(:field1) do create(:audit_field, name: 'first field', value_type: 'integer') end let!(:field2) do create(:audit_field, name: 'second field', value_type: 'picker') end let!(:enumeration1) do create...
require 'simplecov' SimpleCov.start 'rails' do add_filter '/channels/' add_filter '/mailers/' end SimpleCov.minimum_coverage 85 require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' require 'vcr' ENV['RAILS_ENV'] = 'test' OmniAuth.config.test_mode = true VCR.configure do |confi...
# == Schema Information # # Table name: pictures # # id :integer not null, primary key # slug :string # description :string default("") # lesson_id :integer # created_at :datetime not null # updated_at :datetime not null # ...
class EloAdjustment def initialize(victor:, loser:, matches:) @victor = victor @loser = loser @victor_player = Elo::Player.new(rating: victor.elo, games_played: matches.merge(victor.matches).count) @loser_player = Elo::Player.new(rating: loser.elo, games_played: matches.merge(loser.matches).count) e...
## -*- Ruby -*- ## XML::DOM::Visitor ## 1998 by yoshidam ## ## Oct 23, 1998 yoshidam Fix each ## =begin = XML::DOM::Visitor == Module XML =end module XML =begin == Module XML::DOM (XML::SimpleTree) =end module DOM =begin == Class XML::DOM::Visitor Skelton class of Visitor. You can override the following meth...
class Service < ActiveRecord::Base belongs_to :company validates_presence_of :name, :company_id, :price_in_cents validates_presence_of :duration, :if => :duration_required? validates_presence_of :capacity validates_numericality_of :capacity validates_inclusion_of :d...
module Octopress module Date # Returns a datetime if the input is a string def datetime(date) if date.class == String date = Time.parse(date) end date end # Returns an ordidinal date eg July 22 2007 -> July 22nd 2007 def ordinalize(date) date = datetime(date) ...
# -*- mode: ruby -*- # vi: set ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure("2") do |config| # The most co...
require 'formula' class Cdrtools < Formula homepage 'http://cdrecord.org/' stable do url "https://downloads.sourceforge.net/project/cdrtools/cdrtools-3.00.tar.bz2" bottle do sha1 "497614205a68d26bcbefce88c37cbebd9e573202" => :yosemite sha1 "d5041283713c290cad78f426a277d376a9e90c49" => :maveric...
class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable belongs_to :coloc has_many :carotte_cards has_man...
# frozen_string_literal: true # This is a prepend intended to be used with AttachFilesToWorkJob. # Removes each queued file after it is added to the work. module PrependedJobs::WithQueuedFiles def perform(work, uploaded_files) super QueuedFile.where(work_id: work.id).destroy_all end end
class FavoritesController < ApplicationController before_action :authenticate_user_admin! before_action :set_shop, only: %i[create destroy] def index if user_signed_in? @shops = current_user .favorite_shops .order('favorites.updated_at DESC') .page(params[:page]) ...
#-- # Copyright (c) 2007 by Mike Mondragon (mikemondragon@gmail.com) # # Please see the README.txt file for licensing information. #++ module Hurl PATH = File.expand_path("#{File.dirname(__FILE__)}/../") ## # we are defining our own Hurl#render rather than Hurl::Views#layout # so that we can support Erb ren...
describe Metacrunch::ULBD::Transformations::AlephMabNormalization::AddIsbn do transformation = transformation_factory(described_class) context "secondary forms isbns" do context "for a RDA record" do subject do mab_xml = mab_xml_builder do datafield("649", ind2: "1") do subf...
class Exercise < ActiveRecord::Base has_many :exercise_workouts has_many :workouts, :through => :exercise_workouts, dependent: :destroy def name_of_exercise "#{name}" end end
log 'Installing log4j' do level :info end # Define variables for attributes account_username = node['vnc']['account_username']; account_home = "/home/#{account_username}"; jar_filename = 'log4j-1.2.17.jar' tarball_filename= 'log4j.tar.gz' tarball_filepath = "#{Chef::Config['file_cache_path']}/#{tarball_filename}...
class DishesController < ApplicationController def index @dishes = Dish.all.page(params[:page]) end end
# frozen_string_literal: true class CommonComponents::EditButton < ViewComponent::Base def initialize(identifier:, path:, tooltip_content:) @identifier = identifier @path = path @tooltip_content = tooltip_content end end
require_relative '../spec_helper' describe InvestmentEntry do before(:each) do @investment_entry = InvestmentEntry.new # this enables us to use the same piece of code inside our # test. So I dont have to create a new cart everytime inside # my it blocks end describe 'associations' do ...
$LOAD_PATH.unshift(File.expand_path('../', __FILE__)) require 'spec_helper' require 'netlink' class TestAttribute < Netlink::Attribute::Base def encode_value(value) value end def decode_value(raw_value) raw_value end end describe Netlink::Attribute::Base do describe '#initialize' do it 'should ...
require 'spec_helper' describe SubCategory do fixtures :businesses, :sub_categories, :businesses_sub_categories, :categories_sub_categories, :categories before(:each) do @valid_attributes = { :sub_category => "chemist"} end it "should create a new instance given valid attributes" do SubCategory.c...
class MerchantName < ActiveRecord::Base self.table_name = "merchant" include AnuBase class<<self def search name MerchantName.where("MATCH(mname) AGAINST ('*#{name}*' IN BOOLEAN MODE) ").select('mname').distinct().limit(50).pluck(:mname) end end end
require 'rails_helper' RSpec.describe Condition, type: :model do describe 'condition登録機能' do before do user = FactoryBot.create(:user) group = FactoryBot.create(:group, owner_id: user.id) @pet = FactoryBot.create(:pet, group_id: group.id) end context '入力機能' do it "is valid with a ...
class CreateCards < ActiveRecord::Migration def change create_table :cards do |t| t.text :name t.text :civilization t.integer :cost t.integer :mana_val t.string :avatar t.string :type t.boolean :shield_trigger t.integer :power t.text :race t.boolean :evo...
# frozen_string_literal: true class ProjectsController < ApplicationController before_action :set_project, only: %i[show edit update destroy] before_action :set_company require 'date' load_and_authorize_resource def set_company Project.set_company(@company.short_name) end # GET /projects # GET /...
require 'test_helper' class UserTest < ActiveSupport::TestCase test "new user" do orig_count = User.count u = User.new(:email => "foo@example.com", :password => SecureRandom.uuid, :username => "foobar") u.skip_confirmation! assert u.save, "User should have saved! #{u.errors.messages}" assert User...
# frozen_string_literal: true module Saucer class Options W3C = %i[browser_name browser_version platform_name accept_insecure_certs page_load_strategy proxy set_window_rect timeouts strict_file_interactability unhandled_prompt_behavior].freeze SAUCE = %i[access_key appium_version avoid_proxy bu...
require 'csv' class Baby < ApplicationRecord SEVERE_STUNTED_HEIGHT = [43,48,51,52.5,54.5,57.5,59,60.5,62,63,64,65,66,67,68,69,70,71,72,73,73.5,75,76,76.5,77,77.5,78,78.5,79.5,80,80.5,81,82,82.5,83,83.5,84,84.5,85,85.5,86,86.5,87,87.5,88,88.5,89,89,90,90.5,91,91.5,92,92.5,93,93.5,94,94,94.5,95] MODERATE_STUNTED_...
class AssistanceValue ASSISTANCE = "asistencia" ABSENCE = "inasistencia" ALLOWED = "permiso mesa directiva" JUSTIFIED = "justificada" IN_COMISSON = "oficial comision" DOCUMENT = "cedula" def self.to_i(string) if string.to_s.to_i > 0 value = new(string.to_i) else ...
module Haenawa class Command include ::Encryptor COMMANDS = { assertConfirmation: Haenawa::Commands::NilCommand, chooseCancelOnNextConfirmation: Haenawa::Commands::NilCommand, chooseOkOnNextConfirmation: Haenawa::Commands::NilCommand, doubleClick: Haenawa::Commands::NilCommand, ...
require('rspec') require('dealership') require('bicycle') describe(Dealership) do before() do Dealership.clear() end describe('#name') do it('it returns the name of the dealership') do test_dealership = Dealership.new("Recycled Cycles") expect(test_dealership.name()).to(eq("Recycled Cycles")...
class Admin::BaseController < Common::LoginSystemBaseController before_filter :check_redirect_login_page def check_redirect_login_page redirect_to login_url unless check_admin_login? end #检查是否是管理员用户 def check_admin_login? admin_user = login_user return false if admin_user.nil?||!admin_user ...
require 'spec_helper' RSpec.describe Indocker::Launchers::ContainerRunner do before { setup_indocker(debug: true) } subject { Indocker::Launchers::ContainerRunner.new( Indocker.logger ) } it "runs containers" do expect(Indocker::Docker).to receive(:run).once subject.run(configuration: Indock...
# The is_bad_version API is already defined for you. # @param {Integer} version # @return {boolean} whether the version is bad # def is_bad_version(version): # @param {Integer} n # @return {Integer} def first_bad_version(n) binSearch(1, n) end def binSearch(left, right) return left if is_bad_versi...
%w[rubygems sinatra json haml librmpd dm-core].each { |lib| require lib } %w[models/album models/song models/nomination models/vote].each { |model| require model } require 'lib/mpd_proxy' require 'config' # ----------------------------------------------------------------------------------- # Helpers # ---------------...
class Playedgame < ActiveRecord::Base self.per_page = 30 belongs_to :player, counter_cache: true belongs_to :game, counter_cache: true scope :by_name, -> { joins(:game).order('games.name') } scope :by_achievement_count, -> { joins(:game).order('games.achievements_count DESC')} scope :by_time_played, -> { order...
require 'spec_helper' describe FactorSelection do it {should belong_to(:user)} it {should belong_to(:factor)} it {should validate_presence_of(:factor_id)} it {should validate_presence_of(:user_id)} end
# require gems require 'sinatra' require 'sqlite3' db = SQLite3::Database.new("students.db") db.results_as_hash = true # write a basic GET route # add a query parameter # GET / get '/' do "#{params[:name]} is #{params[:age]} years old." end # write a GET route with # route parameters get '/about/:person' do pers...
class Api::V4::TeleconsultationMedicalOfficerTransformer class << self include Memery memoize def to_response(medical_officer) medical_officer .slice("id", "full_name") .merge(teleconsultation_phone_number: medical_officer.full_teleconsultation_phone_number) end end end
class CreateBadgesFeats < ActiveRecord::Migration def self.up create_table :badges_feats do |t| t.integer "badge_id" t.integer "feat_id" t.integer "threshold" t.timestamps end add_index :badges_feats, :badge_id add_index :badges_feats, :feat_id end def sel...
module Baison class Params attr_accessor :site, :key, :secret, :format, :v, :sign_method, :page_size, :shop_code def initialize(key, secret, shop_code) @site = "http://openapi.baotayun.com/openapi/webefast/web/?app_act=openapi/router" @format = "json" # @timestamp = Time.now.strftime('%Y-...
require 'spec_helper' describe Listen::Adapter::Linux do if linux? let(:listener) { double(Listen::Listener) } let(:adapter) { described_class.new(listener) } describe ".usable?" do it "returns always true" do expect(described_class).to be_usable end end describe '#initializ...
class RequestsController < ApplicationController authorize_resource before_action :set_request, only: [:show, :edit, :update, :destroy] respond_to :html, :json def index @requests = Request.all respond_with(@requests) end def show respond_with(@request) end def new @request = ...
class AddBillStreetPrefixToBills < ActiveRecord::Migration def change add_column :bills, :bill_streetprefix, :string end end
Given(/^Open the homepage as usual$/) do @homepage = HomePage.new @homepage.load sleep 2 end Given(/^Click the delete button behind the first bookmark$/) do @bookmark = @homepage.titleText @homepage.deleteBookmark end Given(/^Search the bookmark which you deleted$/) do @homepage.search @bookmark end G...
require_relative 'formats' class OrderItem def initialize(input) props = input.match(/(?<quantity>\d+) (?<format>\w+)/) raise StandardError, 'Invalid input' unless props @quantity = Integer(props[:quantity]) @format = props[:format].downcase raise StandardError, 'Invalid format' unless FORMATS[...
# **************************************************************************** # # Copyright (c) Microsoft Corporation. # # This source code is subject to terms and conditions of the Apache License, Version 2.0. A # copy of the license can be found in the License.html file at the root of this distribution. If # you ...
require 'pry' class Triangle attr_reader :length_one, :length_two, :length_three def initialize (length_one, length_two, length_three) @length_one = length_one.to_f @length_two = length_two.to_f @length_three = length_three.to_f @lengths = [@length_one, @length_two, @length_three].sort end ...
# frozen_string_literal: true require "rails_helper" # rubocop:disable Metrics/BlockLength RSpec.describe DeliveriesController, type: :routing do describe "routing" do it "routes to #index" do expect(get: "/deliveries").to route_to("deliveries#index") end it "routes to #new" do expect(get: ...
namespace :migrations do # desc "For migration: update trust to be 10x what it was before" # task update_trust: :environment do # User.all.each { |u| u.update(trust: u.trust * 10)} # Question.all.each { |q| q.update(vote_total: q.vote_total * 10) } # Answer.all.each { |a| a.update(vote_total: a.vote_t...
class HomeController < BaseController def index @current_user = current_user @root = true end end
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception helper_method :current_user,:current_user?,:current_account def require_authantication if current_user.nil? || c...
ChildSupport::Application.routes.draw do # authenticated :user do # root :to => 'home#index' # end root to: 'home#index' devise_for :users get "/pages/*id" => 'pages#show', as: :page, format: false namespace :api, default: {format: :json} do resources :genders, only: [:index] resources :recor...
class CreateNonUserParticipants < ActiveRecord::Migration[5.0] def change create_table :non_user_participants do |t| t.date :date_of_birth t.string :gender t.string :recruitment_method t.date :recruitment_date, null: false t.belongs_to :study, index: true t.timestamps end...
class ReviewForwardsAddSenderFields < ActiveRecord::Migration def self.up add_column :review_forwards, :sender_email, :string, :null => true, :limit => ReviewForward::SENDER_EMAIL_MAX_LENGTH add_column :review_forwards, :sender_name, :string, :null => true, :limit => ReviewForward::SENDER...
require "formula" class Argus < Formula homepage "http://qosient.com/argus/" url "http://qosient.com/argus/src/argus-3.0.8.tar.gz" sha1 "fe9833c7f8ea4cdf7054b37024e5d007613f9571" bottle do cellar :any sha1 "5b8ca09efc8f4f84d78883f3f866628da061928b" => :yosemite sha1 "c96587d47409a7cb961450ade0b765...
class AddDepthToCallForward < ActiveRecord::Migration def change rename_column :call_forwards, :hops, :depth end end
class CreateHorariosorteots < ActiveRecord::Migration[5.0] def change create_table :horariosorteots do |t| t.string :nombre t.datetime :lunes t.datetime :martes t.datetime :miercoles t.datetime :jueves t.datetime :viernes t.datetime :sabado t.datetime :domingo ...
module AssetGallery class HomeController < ::AssetGallery::ApplicationController def index @sets = AssetGallery::Set.published.is_public.page(params[:page] || 1).per(12) end end end
require File.join(File.dirname(__FILE__), "..", 'spec_helper.rb') describe Authentication::Session do before(:all) do Merb::CookieSession.send(:include, Authentication::Session) end before(:each) do @session = Merb::CookieSession.new( "", "sekrit") end def clear_strategies Authenticati...
class Ability include CanCan::Ability def initialize(user) @user = user || User.new if user.has_role? :administrator can :manage, :all end ############################################## if user.has_role? :admission_manager can :manage, Student end if user.has_role? :stu...
# -*- encoding: utf-8 -*- require './lib/s3mpi/version' Gem::Specification.new do |s| s.name = 's3mpi' s.version = S3MPI::VERSION::STRING.dup s.summary = 'Upload and download files to S3 using a very convenient API.' s.description = %(Passing objects between Ruby consoles can be cumbersome if th...
class AddIndexToComparsionsUserId < ActiveRecord::Migration[6.0] def change add_index :comparsions, :user_id end end
module Jshint::Reporters # Outputs a basic lint report suitable for STDOUT class Default # @return [String] the report output attr_reader :output # Sets up the output string for the final report # # @param results [Hash] Key value pairs containing the filename and associated errors def ini...
require_relative "piece" require_relative "slideable" class Bishop < Piece include Slideable def symbol "B" end def moves_dirs diagonal_dirs end end
#coding: utf-8 class Sequence < ActiveRecord::Base validates :value, uniqueness: {scope: :name} class<<self def gen seq_prefix, corp_code day = Time.now.strftime '%y%m%d' "#{seq_prefix}#{corp_code.to_s.rjust 4, '0'}#{day}#{Sequence.next "#{corp_code.to_s.rjust 4, '0'}-#{seq_prefix}-#{day}", 4}" ...
# n Place a value n in the "register". Do not modify the stack. # PUSH Push the register value on to the stack. Leave the value in the register. # ADD Pops a value from the stack and adds it to the register value, storing the result in the register. # SUB Pops a value from the stack and subtracts it from the register v...
class CLI attr_accessor:game_mode, :token def greeting puts "" puts "Welcome to Tic Tac Toe!" puts "Enter 1 to play against another human." puts "Enter 2 to play against the computer." puts "Enter 3 or wargames to pit two computer players against each other."...
class ChangeUpSources < ActiveRecord::Migration def up remove_index :sources, :abbr remove_column :sources, :abbr add_column :sources, :url, :string, null: false, default: 0 change_column :sources, :url, :string, null: false add_index :sources, :url, unique: true end def down rai...
class CatRentalRequest < ActiveRecord::Base STATUSES = [ "PENDING", "APPROVED", "DENIED" ] validates :cat_id, :start_date, :end_date, :status, presence: true validates :status, inclusion: STATUSES validate :overlapping_approved_requests, unless: :denied? validate :dates_in_correct_order belo...
class UsersController < ApplicationController before_action :logged_in_user, only: [:edit, :update] def index @users = User.all end def new @user = User.new end def show @user = User.find(params[:id]) @courses = @user.courses end def create @user = User.new(user_params) ...
# Create a route to DEFAULT_WEB, if such is specified; also register a generic route def connect_to_web(map, generic_path, generic_routing_options) if defined? DEFAULT_WEB explicit_path = generic_path.gsub(/:web\/?/, '') explicit_routing_options = generic_routing_options.merge(:web => DEFAULT_WEB) map.con...
class CreateStocks < ActiveRecord::Migration def change create_table :stocks do |t| t.integer :total_quantity t.decimal :total_price, :null => false t.references :purchase t.references :product t.timestamps end add_index :stocks, :purchase_id add_index :stocks, :product_...
# frozen_string_literal: true require_relative '../csv_parsing/csv_parser.rb' require './csv_parsing/length_determinant.rb' # Class to create lines for console output class LinesBuilder < LengthDeterminant def max_length_hash define_max_length end def count_length_line chars_count = 0 (0..max_lengt...
In Ruby, strings are objects of the String class, which defines a powerful set of operations and methods for manipulating text (e.g., indexing, searching, modifying, etc.). Here are a few easy ways to create Strings: my_string = "Hello." # create a string from a literal my_empty_string = String.new # create an empty s...
require 'syro' require_relative '../service/anagrams' require_relative '../service/anagrams_plus' # Guideline: Return an empty array when possible for sad cases class AnagramsAdapter < Syro::Deck def self._ensure_anagrams unless @anagrams raise "Need to add words before we can make anagram magic." end ...
class Card < ApplicationRecord #validates :name, presence: { strict:true, message:"admin"} #validates_presence_of(:name,:number,:message=>"姓名和账号不能为空") #validates_uniqueness_of(:name,:message=>"名称不能重复") #validates_size_of(:name,:maximum=>4,:message=>"长了") #validate :validate #validates_format_of(:number,with...
class AccountingType < ActiveRecord::Base has_many :accounting_categories end
class CreateSubcontractEquipmentDetails < ActiveRecord::Migration def change create_table :subcontract_equipment_details do |t| t.integer :article_id t.string :description t.string :brand t.string :series t.string :model t.date :date_in t.integer :year t.float :pric...
feature 'new' do scenario 'you can add a new listing' do visit '/' click_on 'Sign up' fill_in('first_name', with: 'Theodore') fill_in('last_name', with: 'Humpernickle') fill_in('username', with: 'ttotheh') fill_in('email', with: 'theodore@humpernickle.com') fill_in('password', with: 'ilove...
# encoding: UTF-8 require 'forwardable' module MongoMapper module Plugins module Querying module PluckyMethods extend Forwardable def_delegators :query, :where, :filter, :fields, :ignore, :only, :limit, :paginate, :per_page, :...
class AddAvatarsCacheToUsers < ActiveRecord::Migration def up add_column :users, :easy_avatar, :string, {:length => 255, :null => true} end def down remove_column :users, :easy_avatar end end
puts ":seedling: Seeding spices..." # Seed your database here # This will delete any existing rows from the game and User tables # so you can run the seed file multiple times without having duplicate entries in your database puts "Deleting old data..." Game.destroy_all User.destroy_all GameLibrary.destroy_all puts "Cr...
# frozen_string_literal: true require 'json' require 'rest-client' require 'timeout' class GemnasiumClient attr_reader :api def initialize api_key = Settings.GEMNASIUM_API_TOKEN @api = "https://X:#{api_key}@api.gemnasium.com/v1" end def all_projects_and_counts advisories = {} all_projects.ea...
class SummaryController < ApplicationController def show @riders_count = Rider.count @stages = StageDecorator.decorate_collection(Stage.order("id")) # Stage results stage = Stage.last_stage || Stage.order("number").first if stage.nil? redirect_to :action => :not_found and return end ...
# # Cookbook:: managed_directory # Recipe:: test # # A simple demonstration of managed_directory, also used by chefspec. testdir = '/tmp/bar' # Setup the test. # 1. Create the directory for our test files, during the compile phase. directory testdir do action :nothing end.run_action(:create) # 2. Put some files in...