text stringlengths 10 2.61M |
|---|
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "crudable"
s.version = "0.0.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygem... |
class FontLobsterTwo < Formula
head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/lobstertwo"
desc "Lobster Two"
homepage "https://fonts.google.com/specimen/Lobster+Two"
def install
(share/"fonts").install "LobsterTwo-Bold.ttf"
(share/"fonts"... |
class Book < ActiveRecord::Base
validates :title, presence: :true
has_many :chapters
end
|
class SlackUsersManagerWorker
include Sidekiq::Worker
extend Sidekiq::Scheduler::Extension
configure every: '5m', queue: :slack
create_schedule!
sidekiq_options retry: 5, backtrace: true
Logger = Sidekiq.logger.level == Logger::DEBUG ? Sidekiq.logger : nil
def perform
logger.debug [:slack, 'Checking ... |
class PublicationMailer < ActionMailer::Base
default from: APP_CONFIG['mail_settings']['from_email']
default to: APP_CONFIG['mail_settings']['to_email']
def feedback_email(from:, publication_id:, message:)
@message = message
@from = from
@publication_id = publication_id
subject = "GUP- Meddelande... |
class Comment < ActiveRecord::Base
belongs_to :user
belongs_to :commentable, polymorphic: true, touch: true
validates :content, :user_id, presence: true
end
|
require 'test_helper'
class GameTest < ActiveSupport::TestCase
test "Game should have the necessary required validators" do
game = Game.new
assert_not game.valid?
assert_equal [:player, :opponent, :played_at, :player_score, :opponent_score], game.errors.keys
end
test "Game should have numeric scores... |
require 'ember_script'
module Middleman
module Emberscript
class << self
def registered(app, options={})
sprocket_extension = "em"
sprocket_extension = options[:emblem_ext] if options.has_key?(:emblem_ext)
::Sprockets.register_engine ".#{sprocket_extension}", EmberScript::Em... |
require 'test_helper'
require 'minicomic-backend/filter'
class TestFilter < Test::Unit::TestCase
def setup
@filter = Filter.new
end
def test_recalc_pixels
@filter.config = {}
assert_raise RuntimeError do
@filter.config = {'print' => true}
end
assert_raise RuntimeError do
@filte... |
#Used for generation of images from source bitmap file
#files generated are Flat View, Front Side Back View, and Client Approved PDF
require 'json'
require 'rmagick'
require 'aws-sdk-s3'
require './colorFunctions.rb'
require './attributeFunctions.rb'
def lambda_handler(event:, context:)
#initialize s3 bucket
buck... |
class SaleDatatable
delegate :current_user, :content_tag, :check_box_tag, :params, :link_to, :number_to_currency, to: :@view
delegate :url_helpers, to: 'Rails.application.routes'
delegate :session, to: :@view
include ApplicationHelper
def initialize(view)
@view = view
end
def as_json(options = {})
... |
class AddIdToPuppies < ActiveRecord::Migration
def change
add_column :puppies, :porte_id, :string
end
end
|
class NewsletterSubscriptionsController < ApplicationController
before_filter :require_user, :except => [:new, :create]
# GET /newsletter_subscriptions
# GET /newsletter_subscriptions.xml
def index
@newsletter_subscriptions = NewsletterSubscription.all
respond_to do |format|
format.html # i... |
require File.join(File.dirname(__FILE__), 'test_helper')
class EncodedPathTests < Test::Unit::TestCase
def setup
@path = Hyrarchy::EncodedPath(5, 7)
end
def test_next_farey_fraction
assert_equal(Rational(3, 4), @path.send(:next_farey_fraction))
end
def test_mediant
assert_equal(Rational(15, 20)... |
class ChangeShortDescriptionDataTypeForMealInfos < ActiveRecord::Migration
def change
change_column :meal_infos, :short_description, :text
end
end
|
require 'rails_helper'
describe FantasyPlayer do
# Associations
it { should have_many(:fantasy_teams).through(:roster_positions) }
it { should have_many(:final_rankings).dependent(:destroy) }
it { should have_many(:roster_positions).dependent(:destroy) }
it { should have_many(:roster_transactions).through(:t... |
RSpec.describe Crawler::RobotsTxt::Definition do
let(:definition) { described_class.new(robots_txt) }
let(:robots_txt) do
<<~ROBOTSTXT
a
b
c
# commenct
User-Agent: *
Disallow: /root # comment
Crawl-Delay: 100
user-agent: Bot
disallow: /admin/*.php
allow: /pa$th
... |
# frozen_string_literal: true
require 'sample_agent_test_configuration'
require 'utils/agent_runner'
describe RangeBreakAgent do
include_context 'use data_builder'
let(:runner) { Utils::AgentRunner.new }
before(:example) do
runner.register_agent_file(
'sample_agents/src/range_break_agent.rb')
... |
class ResuploadsController < ApplicationController
before_action :set_resupload, only: [:show, :edit, :update, :destroy]
respond_to :html
def index
@resuploads = Resupload.all
respond_with(@resuploads)
end
def show
@suggestions = Suggestion.where(:resupload_id => params[:id])
respond_with(@... |
module Omniship
module Base
mattr_accessor :mode
self.mode = :production
def self.carrier(name)
Omniship::Carriers.all.find {|c| c.name.downcase == name.to_s.downcase} ||
raise(NameError, "unknown carrier #{name}")
end
end
end
|
class Admin::HotelsController < Admin::BaseController
before_action :find_hotel, only: [:edit, :update, :destroy, :show]
def new
@hotel = Hotel.new
prior_data
end
def index
@hotels = Hotel.all
end
def create
@hotel = Hotel.new(hotel_params)
if @hotel.save
redirect_to admin_hote... |
class RemoveAbstractFromDeposits < ActiveRecord::Migration
def change
remove_column :deposits, :abstract, :text
end
end
|
class GroupByProblem
def self.test_suites
exercise = Exercise.new(:group_by)
exercise << Problem.new(
"group_words_by_length",
{"words" => ["sue", "alice", "steve", "sally", "adam", "fort", "tops", "dog", "cat"]},
{"grouped" => {3 => ["sue", "dog", "cat"], 4 => ["adam", "fort", "tops"], 5 =... |
require "nokogiri"
require "open-uri"
require "selenium-webdriver"
require "timeout"
module GridHelper
class << self
def for(*args)
remote(*args) if args.include?(:remote)
return Selenium::WebDriver.for(*args)
end
private
def remote(bridge, opts = {})
timeout = opts.delete(:tim... |
class FontKhyay < Formula
head "https://github.com/google/fonts/raw/main/ofl/khyay/Khyay-Regular.ttf", verified: "github.com/google/fonts/"
desc "Khyay"
homepage "https://fonts.google.com/earlyaccess"
def install
(share/"fonts").install "Khyay-Regular.ttf"
end
test do
end
end
|
class Contribution < ActiveRecord::Base
belongs_to :subtype
validates :subtype_id, :commercial_rate, :premium_value, :fosyga,
:subtotal_premium_value_fosyga, :runt, :total_value, presence: true
end
|
require 'lgame/game.class'
module Lgame
describe Game do
before do
@game = Game.new("Knuckleheads")
@turns = 3
@initial_health = 100
@player = Player.new("moe", @initial_health)
@game.add_player(@player)
end
it "w00ts the player if a high number is rolled" do
allo... |
class CreatePolls < ActiveRecord::Migration
def change
create_table :polls do |t|
t.datetime :opened_at
t.datetime :closed_at
t.references :event, null: false
t.boolean :public, null: false, default: false
t.timestamps null: false
end
end
end
|
require 'spec_helper'
shared_examples_for 'a non-ubuntu platform' do
it 'installs the lxc package' do
expect(chef_run).to install_package('lxc')
end
end
describe 'docker::lxc' do
context 'when running on debian' do
it_behaves_like 'a non-ubuntu platform' do
let(:chef_run) do
ChefSpec::Solo... |
# frozen_string_literal: true
class Config::Authorization::Response < OpenStruct
def authorized?
raise NotImplementedError, __method__
end
class Authorized < self
def authorized?
true
end
end
class Unauthorized < self
def authorized?
false
end
end
end
|
# Encoding: utf-8
describe "Mobile Login - Inventory Control", :depth => 'shallow' do
let(:mobile) { @formula_lab.mix('mobile') }
it 'Inventory Control - Move Pallet' do
mobile.login
mobile.keypad_present.should be_true
mobile.click_keypad_keys '0000'
mobile.nav_title... |
class AddStyleUrLsToRequests < ActiveRecord::Migration
def change
add_column :requests, :styleURL, :string
end
end
|
require 'helper'
class TestUser < Test::Unit::TestCase
def new_user(attribs = {})
Minstrel::User.new({
:name => 'foo'
}.merge(attribs))
end
test "subclass of Sequel::Model" do
assert_equal Sequel::Model, Minstrel::User.superclass
end
test "requires name" do
user = new_user(:name => ni... |
#--
# Copyright (c) 2013 Michael Berkovich, tr8nhub.com
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, ... |
class QuotesController < ApplicationController
def index
@quotes = Quote.all
end
def show
@quote = Quote.find(params[:id])
end
def new
@quote = Quote.new
end
def create
@quote = Quote.new(quote_params)
if @quote.save
... |
class Queens
attr_accessor :board_rep
def initialize(white: [0, 3], black: [7, 3])
@white_queen_position = white
@black_queen_position = black
raise ArgumentError if @white_queen_position == @black_queen_position
whole_board_arr
end
def white
@white_queen_position
end
def whole_boar... |
feature "Proposal - Create" do
context 'Visitor' do
scenario "Access invalid" do
visit new_proposal_path
expect(current_path).to eq new_session_path
end
end
context 'Admin' do
let(:user) { create :user}
background do
login user.email, us... |
# frozen_string_literal: true
require 'client'
describe 'ユーザー情報の設定' do
before(:example) do
@client = Jiji::Client.instance
end
it 'PUT /settings/user/password でパスワードを変更できる' do
r = @client.put('/settings/user/password', {
'old_password' => 'test',
'password' => 'test2'
})
expect(r.st... |
class OutboxesController < ApplicationController
before_filter :require_current_user!
def show
all_items = current_user.posts
sorted_items = all_items.sort_by do |post|
post.id
end
@outbox_items = all_items.reverse
respond_to do |format|
format.html { render :show }
# format... |
module Configrr::Cli
module Generate
def self.command
@cmd ||= Cri::Command.define do
name 'generate'
usage 'generate [options]'
description 'Generate app specific configuration.'
summary 'Generate app specific configuration.'
required :t, :type, "Generate type", :ar... |
class FontAutocompletesController < ApplicationController
def index
render json: FontAutocomplete.terms_for(params[:term])
end
end
|
module Structura::Class
# @group Use Only Inner
private
def _attrs(name)
self::MEMBER_DEFINES[name]
end
def _names
self::MEMBER_DEFINES.keys
end
def _alias_member(aliased, original)
self::MEMBER_DEFINES[aliased] = original
_attrs[original][:aliases] << aliased
end
def _origina... |
class PaymentsController < ApplicationController
def index
@users = User.all
@events = Event.all
payments = Payment.all
if params[:filter_by_event] && params[:filter_by_event] != 'none'
payments = payments.reject { |p| p.item.event.id != params[:filter_by_event].to_i }
end
if params[:f... |
module Alchemy
module Page::PageNaming
extend ActiveSupport::Concern
include NameConversions
RESERVED_URLNAMES = %w(admin messages new)
included do
before_validation :set_urlname,
if: :renamed?,
unless: -> { systempage? || redirects_to_external? || name.blank? }
validate... |
class Api::V1::SubredditSerializer < ActiveModel::Serializer
attributes :id, :name, :description, :excerpt, :recent_posts
has_many :posts, serializer: Api::V1::PostSerializer
def excerpt
object.description.truncate(20)
end
def recent_posts
object.posts.limit(3).reverse
end
end |
class RemoveVersionNumberAndReleaseNumberFromVersions < ActiveRecord::Migration
def change
remove_column :versions, :version_number
remove_column :versions, :release_number
remove_column :versions, :status
end
end
|
class CreateModelTable < ActiveRecord::Migration[5.0]
def self.up
create_table "channels", primary_key: "guid", id: :uuid, default: nil, force: :cascade do |t|
t.string "name", limit: 50
t.uuid "owner"
t.uuid "org_id"
t.boolean "is_private"
t.text "state"
... |
class SessionsController < ApplicationController
def new
end
def create
staff = Staff.find_by(email: params[:session][:email].downcase)
if staff && staff.authenticate(params[:session][:password])
flash[:success] = t('.login')
log_in staff
redirect_to root_path
else
flash[:da... |
class OnlineEvent < Event
# Associations
belongs_to :area
acts_as_mappable through: :area
# Scopes
default_scope { online }
scope :with_location, -> (country_code) { joins(:area).where_country(country_code) }
scope :where_country, -> (country_code) { where(areas: { country_code: country_code }) if countr... |
# encoding: UTF-8
module API
module Helpers
module V1
module LearningCyclesHelpers
extend Grape::API::Helpers
def serialized_learning_cycle(learning_cycle, options = {})
options = { serializer: :learning_cycle }.merge(options)
serialized_object(learning_cycle, options)... |
RSpec.describe UrlTrackingApiClient do
it 'has a version number' do
expect(UrlTrackingApiClient::VERSION).not_to be nil
end
end
|
Gem::Specification.new do |s|
s.name = 'redline13'
s.version = '0.3.1'
s.date = '2017-06-21'
s.summary = "Interface to Redline13 API"
s.description = "Currently supports the execution of a JMeter load-test"
s.authors = ["Matt Williams"]
s.email = 'matt@williams-tech.net'
... |
require 'plane'
require 'airport'
describe Plane do
let(:plane) { Plane.new }
it "should have a flying status after being created" do
plane.fly!
expect(plane).to be_flying
end
it "should be able to land" do
plane.fly!
plane.land!
expect(plane).to be_grounded
end
it "should be able t... |
require_relative '../../../../spec_helper'
describe 'govuk_safe_to_reboot', :type => :class do
context '#yes' do
let(:params) {{ }}
it { is_expected.to contain_class('govuk_safe_to_reboot::yes').with_reason('Not flagged specifically so assuming safe to reboot') }
end
context '#no with blank r... |
module Hanover
class Persistence
attr_reader :key, :content
def initialize(content, key = nil)
@content = content
@key = key
@klass = @content.class
save
end
def respond_to?(name)
methods.include?(name) || @content.respond_to?(name)
end
def method... |
class DecksController < ApplicationController
before_action :set_deck, only: [:show, :edit, :update, :destroy]
def next_card
@deck = Deck.find(1)
card = Card.find(params[:card_id])
puts '*********************************'
puts params[:card_id]
puts @deck.next_card.front
p '*****************... |
module ApplicationHelper
def error_messages_for(object)
render 'layouts/error_messages_for', object: object
end
def link_to_add_fields(name, f, association)
new_object= f.object.class.reflect_on_association(association).klass.new
fields= f.fields_for(association,new_object, child_index: "new_#{asso... |
class ArtistStyle < ApplicationRecord
belongs_to :style
belongs_to :artist
end |
test_name "Install Puppet on dev machine"
# NOTE: pinning to old agent version because there is a bug that
# breaks the voxpupuli archive module on puppet-agent 1.5.0
install_puppet_agent_on(jenkins, :puppet_agent_version => "1.4.1")
|
$:.unshift File.join(File.dirname(__FILE__),'lib')
require 'klin/data_structures'
require 'klin/pairer'
require 'klin/partition'
require 'klin/swap_scorer'
require 'klin/gain_maximiser'
require 'klin/node_weightings'
def Node(node)
if node.respond_to? :to_node
node.to_node
else
Klin::Node.new(node)
end
... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
BOX = "bento/centos-7.5"
VAGRANTFILE_API_VERSION = "2"
cluster = {
"master" => { :ip => "192.168.33.10", :cpus => 1, :mem => 3096, :p80 => 180, :p443 => 1443, :p2300 => 2300, :p8080 => 18080 },
"slave1" => { :ip => "192.168.33.11", :cpus => 1, :mem => 3096, :p80 => 181, ... |
module Handles
class Update
include ApplicationHelper
@@batch_size = 10
@@query = "desc_metadata__identifier_tesim:*"
def get_batch(start)
fields = "id desc_metadata__identifier_tesim"
remote_solr.get('select', params: {q: @@query, fl: fields, start: start, rows: @@batch_size})
end
... |
class OrdersController < ApplicationController
# skip_before_action :authenticate_user!, only: :cancel
def index
# @orders = Order.where(user: current_user)
# @orders = current_user.orders.order(created_at: :desc)
@orders = policy_scope(Order).order(created_at: :desc) # -> this would give us the same re... |
class Api::V1::ProductsController < ApiController
before_action :authenticate_token
def index
products = @current_user.products.filtered_products.custom_sort(params)
paginate json: products, option_name: @current_user
end
def total_spent
products = @current_user.products.most_money_spent
rende... |
class ChallengeResponse < ActiveRecord::Base
belongs_to :challenge, foreign_key: "challenge_id", class_name: "Challenge"
belongs_to :user, foreign_key: "user_id", class_name: "User"
has_many :comments, class_name: "Comment"
end
|
#!/usr/bin/env ruby
require 'fileutils'
require 'pathname'
SYMBOLS = [
"__system_property_get",
"dladdr",
"pthread_mutex_lock_timeout_np",
"pthread_mutex_timedlock",
]
TOPDIR = File.realpath(File.join(File.dirname(__FILE__), '..'))
DSTFILE = File.join(TOPDIR, 'src', 'include', 'crystax', 'details', '... |
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# File Uploader
mount_uploader :profile_image, UserP... |
class Admin::MembersController < Admin::ResourcesController
private
def permitted_params
params.permit(member: [:name, :role])
end
end
|
class CreateCustomerPayments < ActiveRecord::Migration
def self.up
create_table :customer_payments do |t|
t.string :payment_gateway
t.string :transaction_code
t.string :status_code
t.boolean :rejected
t.datetime :date_processed
t.float :amount
t.references :customer
... |
class CreateRecruits < ActiveRecord::Migration[5.0]
def change
create_table :recruits do |t|
t.integer :user_id
t.string :sports_name
t.string :title
t.text :content
t.date :event_date
t.date :limit_date
t.string :erea
t.string :prefecture
t.time... |
require File.expand_path File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
describe XMLPipes::Source::Schema do
before(:each) do
@schema = XMLPipes::Source::Schema.new(:spec, :index)
end
describe '#indexes' do
it 'defines a field' do
@schema.indexes :summary
@schema.indexes :con... |
require 'rails_helper'
RSpec.describe RoundsController, type: :controller do
context "before last round of tournament" do
before do
@tournament = create(:tournament)
end
describe "GET show" do
it "renders the :show view" do
round = create(:round)
get :show, { id: round, tou... |
class ProductPolicy < ApplicationPolicy
%i(index? create? new? update? edit? destroy?).each do |action|
define_method(action) { admin? }
end
private
def admin?
user.has_role?(:admin)
end
end
|
require 'test_helper'
class ResBoardsControllerTest < ActionController::TestCase
setup do
@res_board = res_boards(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:res_boards)
end
test "should get new" do
get :new
assert_response :succe... |
#this tableless class is to generate transport employee form
class TransportEmployeeForm < Tableless
column :department_id, :integer
has_many :route_employees
accepts_nested_attributes_for :route_employees, :allow_destroy => true,
:reject_if => proc {|attributes| attributes[:task].blank? && attrib... |
class PrivateGroupMembership < ActiveRecord::Base
belongs_to :faculty
belongs_to :private_group
end
|
module SessionsHelper
# Loga o usuário
def log_in(usuario)
session[:usuario_id] = usuario.id
end
# Lembra um usuário em uma sessão
def lembrar(usuario)
usuario.lembrar
cookies.permanent.signed[:usuario_id] = usuario.id
cookies.permanent[:lembrar_token] = usuario.lembrar_token
end
def usu... |
require 'spec_helper'
describe ItemUpdater do
let(:client) do
Auctionet::Client.new.tap do |client|
allow(client).to receive(:perform_request).and_return File.open("spec/assets/item.json").read
end
end
subject(:updater) { ItemUpdater.new(client) }
let!(:item) { Fabricate :watched_item, id: 100529... |
#
# A utility class that can be used for extracting sync message from an existing billing record in db
#
# Usage (in Rails console):
# > load 'db/sync_message_extractor.rb'
# > message = SyncMessageExtractor.get_message '11-22123'
# or
# > hash = SyncMessageExtractor.get_message '11-22123', true
#
# With extra... |
require "rails_helper"
RSpec.describe ShiftRequirementsController do
describe "PATCH update" do
it "renders edit if the shift requirements could not be updated" do
stub_signed_in_user
shift = create :shift
shift_params = {
id: shift.id,
shift: {
monday: nil,
... |
class LoansController < ApplicationController
before_action :load_loan, only: [:show]
def create
@loan = Loan.new(loans_params)
@loan.pmt
@loan.save!
render json: { id: @loan.id, pmt: @loan.pmt } if @loan.persisted?
rescue StandardError
render json: { errors: { message: @loan.errors.full_mes... |
module Endpoints
class Password < Base
namespace "/password" do
post do
user = User[email: body_params[:email]]
raise Pliny::Errors::NotFound unless user
user.send_password_token
status 201
encode Hash.new
end
put do
user = User[email: body_params... |
module CompilerHelpers
VERSION_OUTPUTS = {
:gcc => {
"4.2.1-freebsd" => %Q{Using built-in specs.\nTarget: i386-undermydesk-freebsd\nConfigured with: FreeBSD/i386 system compiler\nThread model: posix\ngcc version 4.2.1 20070831 patched [FreeBSD]\n},
"4.9.0" => %Q{Using built-in specs.\nCOLLECT_GCC=c++\... |
require_relative 'tic_tac_toe'
class TicTacToeNode
attr_reader :board, :next_mover_mark, :prev_move_pos
def initialize(board, next_mover_mark, prev_move_pos = nil)
@board = board
@next_mover_mark = next_mover_mark
@prev_move_pos = prev_move_pos
end
def losing_node?(evaluator)
##base case
... |
class Reason < ActiveRecord::Base
has_many :awards, :dependent => :destroy
end
|
require_relative './gameObject'
# Decoração para o cenario.
class Rock < GameObject
attr_reader :movCoolDownTimer, :movCoolDownTimerH
def initialize(name, x, y)
@movCoolDownTimer = 0
@name = name
@sprite = Sprite.new('./rocks/' + name + '.png')
@hitbox = Hitbox.new(x, y, [0], 0, 0)
end
def upd... |
require 'rails_helper'
RSpec.describe Course, type: :model do
context "associations" do
it "can belong to an educator" do
educator = create(:educator)
course = create(:course, educator: educator)
expect(course.educator).to eq educator
end
it "can have students" do
course = create... |
module Korekto
class Statement
attr_reader :code,:title,:regexp,:section,:statement_number
# rubocop: disable Metrics/ParameterLists
def initialize(statement,code,title,section,statement_number,context)
@statement,@code,@title,@section,@statement_number,@context =
statement,code,title,section,statement... |
require File.dirname(__FILE__) + "/spec_helper"
describe GitRevisionNumber do
describe "head" do
before :each do
@librarian = mock(GitRevisionNumbers::MasterCommitLibrarian)
GitRevisionNumbers::MasterCommitLibrarian.stub!(:new).and_return @librarian
end
it 'should return the revision num... |
class Address < ApplicationRecord
validates :post_code, :prefecture_id, :city, :house_number, :phone_number ,presence: true
extend ActiveHash::Associations::ActiveRecordExtensions
belongs_to :user, optional: true
belongs_to_active_hash :prefecture
validates :prefecture, presence: true
validates :pos... |
class GenerateCriticalCssJob < ApplicationJob
queue_as :default
CSS_SEMAPHOR_NAMESPACE = 'critical-path-css-semaphor'.freeze
def perform(route)
return if route.nil?
return if Rails.cache.exist?(route, namespace: CSS_SEMAPHOR_NAMESPACE)
return unless CriticalPathCss.fetch(route).empty?
Rails.cach... |
class ChangeUsernamesController < ApplicationController
before_action :signed_in_user
def edit
@user = User.find_by_id!(params[:id])
end
def update
@user = User.find_by_id!(params[:id])
if @user.update_attributes(user_params)
redirect_to edit_user_url(@user), :notice => "Username has been changed... |
require 'rails_helper'
RSpec.describe 'api/v1/EmployeesController' do
context 'DELETE /api/v1/companies/:id/employees' do
it "should delete the company_id on use" do
company = create(:company)
employee = create(:employee, company: company)
delete "/api/v1/companies/#{company.id}/employees/#{em... |
require 'spec_helper'
describe "sensors not reporting spec", type: :feature do
let!(:user) { login_as_admin }
before do
create_sensor("A001", 5.minutes.ago)
create_sensor("A002", 5.hours.ago)
create_sensor("A003", 7.hours.ago)
create_sensor("A004", 10.hours.ago)
create_sensor("A005", 5.months.... |
class User < ActiveRecord::Base
has_many :users_bets
has_many :bets, through: :users_bets
has_many :wins, :class_name => "Winner", :foreign_key => :winner_id
has_many :losses, :class_name => "Loser", :foreign_key => :loser_id
has_many :entries, through: :bets
has_many :confirmations, through: :entries
en... |
class Matches
def initialize
puts " " * 31 + "23 MATCHES"
puts "This is a game called '23 Matches'."
puts "When it is your turn, you may take one, two, or three"
puts "matches. The object of the game is not to have to take"
puts "the last match."
puts "Let's flip a co... |
require 'match_symbol'
# purpose:
# from regex-syntax-tree build NFA (interpreter pattern)
# initial state = 0
# final state = 1000
#
# issues:
# * assumes that the number of NFA states
# is less than 1000. If you need more
# you will have to adjust Context#dest
# to a more appropriate value.
class Re... |
class TournamentSynchronizer < Synchronisable::Synchronizer
has_many :stages
remote_id :tour_id
unique_id { |attrs| attrs[:name] }
mappings(
:eman => :name,
:eman_trohs => :short_name,
:gninnigeb => :beginning,
:gnidge => :ending,
:tnerruc_si => :is_current
)
only :name, :b... |
class Asset < ActiveRecord::Base
#include Ckeditor::Orm::ActiveRecord::AssetBase
#include Ckeditor::Backend::Paperclip
self.table_name = 'assets'
has_attached_file :data,
url: '/upload/attachments/:id/:filename',
path: ':rails_root/public/upload/attachments/:id/:filenam... |
Rails.application.routes.draw do
devise_for :admins,controllers:{
sessions: 'admins/sessions'
}
devise_for :customers, controllers:{
sessions: 'customers/sessions'
}
root 'homes#top'
get 'home/about' => 'homes#about'
# For details on the DSL available within this file, see http://guides.rubyonrai... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.