hexsha stringlengths 40 40 | size int64 2 1.01M | content stringlengths 2 1.01M | avg_line_length float64 1.5 100 | max_line_length int64 2 1k | alphanum_fraction float64 0.25 1 |
|---|---|---|---|---|---|
5dc62d72d4e579a9e47d90b16b55d1f75b8bf5a6 | 1,625 | require "rails_helper"
RSpec.describe CsvFileUpload do
let(:csv) do
<<~CSV
foo,bar,baz
1,2,3
CSV
end
let(:file) { double("File") }
let(:params) do
{
csv: file,
}
end
let(:upload) { described_class.new(params, :csv) }
context "when the file is present" do
before do
... | 19.817073 | 92 | 0.539077 |
f7ceb5753dcbdbc69ef4ed336b51459107e90363 | 4,351 | # Author:: Daniel DeLeo (<dan@kallistec.com>)
# Copyright:: Copyright (c) 2009 Daniel DeLeo
# License:: Apache License, Version 2.0
#
# 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
#
# htt... | 31.078571 | 101 | 0.72558 |
b9d352dfea9db8e727cc56b45a42c0c28197d139 | 3,180 | require File.dirname(__FILE__) + '/../spec_helper'
describe SourceParser::Ical, "when parsing VVENUE" do
before(:each) do
@location = SourceParser::Ical.to_abstract_location(<<-HERE)
BEGIN:VVENUE
X-VVENUE-INFO:http://evdb.com/docs/ical-venue/draft-norris-ical-venue.
html
UID:V0-001-001423875-1@eventful.com
N... | 35.333333 | 157 | 0.730818 |
b9671bc716d26c818ac3e16fa98470889ccd5789 | 2,896 | # typed: false
require 'spec_helper'
require_relative '../../lib/quarantine/cli'
describe Quarantine::CLI do
context '#initialize' do
it 'options are set with their default value' do
cli = Quarantine::CLI.new
expect(cli.options[:test_statuses_table_name]).to eq('test_statuses')
end
end
cont... | 27.065421 | 102 | 0.615677 |
edc96838374b676c2063f12d5bcad8e6f52843ae | 365 | # frozen_string_literal: true
module Capybara::Cuprite::Network
class Error
def initialize(data)
@data = data
end
def id
@data["networkRequestId"]
end
def url
@data["url"]
end
def description
@data["text"]
end
def time
@time ||= Time.strptime(@dat... | 14.038462 | 60 | 0.575342 |
33b578a7cc02b26098390db41f40e3cb07bb0ed4 | 4,418 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::DataFactory::Mgmt::V2017_09_01_preview
module Models
#
# Linked service for MySQL data source.
#
class MySqlLinkedService < ... | 30.895105 | 77 | 0.448846 |
6212a446a190f8bddf9ab2c523e89d0bbb4fa414 | 642 | Pod::Spec.new do |s|
s.name = 'Typhoon'
s.version = '1.2.0'
s.license = 'Apache License, Version 2.0'
s.summary = 'A dependency injection container for Objective-C. Light-weight, yet flexible and full-featured.'
s.homepage = 'http://www.typhoonframework.org/'
s.author = { 'J... | 40.125 | 116 | 0.602804 |
f7205591177905e520b931679b0e10804744cf62 | 1,037 | Shindo.tests('Fog::Compute[:brightbox] | server type requests', ['brightbox']) do
tests('success') do
tests("#list_server_types") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].list_server_types
@server_type_id = result.first["id"]
data_matches_schema(Brightbox::Compute::Fo... | 29.628571 | 120 | 0.681774 |
33bccb7c5812921ba3b81500d78d173b195b030b | 780 | cask 'cityofzion-neon' do
version '0.1.4'
sha256 '0e5ce25c0bd46f9a43b103fbdc75a6fdcaaf06088dd5e5781807fb1cf29cb5ce'
url "https://github.com/CityOfZion/neon-wallet/releases/download/#{version}/Neon-#{version}.Mac.dmg"
appcast 'https://github.com/CityOfZion/neon-wallet/releases.atom',
checkpoint: 'c66b... | 39 | 102 | 0.698718 |
2650be53677926d96bf9de9be1aacc92e901c9a2 | 637 | module SessionsHelper
def log_in(user)
session[:user_id] = user.id
end
def log_out
session.delete(:user_id)
@current_user = nil
end
def current_user
if session[:user_id]
@current_user ||= User.find_by(id:session[:user_id])
end
end
def current_user?(user)
user == current_... | 17.216216 | 67 | 0.692308 |
accbefd8912491936d7b499077e05795bce93296 | 1,162 | require 'test_helper'
class UsersIndexTest < ActionDispatch::IntegrationTest
def setup
@admin = users(:michael)
@non_admin = users(:archer)
@non_active_user = users(:non_activated)
end
test "index including pagination and delete links" do
log_in_as(@admin)
get users_path
assert_template... | 26.409091 | 68 | 0.696213 |
1c5793f203328da3476b8065572bcf4d111d5292 | 940 | require File.dirname(__FILE__) + '/../spec_helper'
require "win32ole"
# Basic tests. MRI includes deeper tests
describe "win32ole" do
before :each do
@fs = WIN32OLE.new "Scripting.FileSystemObject"
end
it "supports enumeration" do
tmp = tmp("")
Dir.mkdir(tmp + "/a_folder")
begin
tem... | 26.857143 | 117 | 0.675532 |
28e1041830cce0c379c717412df2d407311b0c13 | 168 | class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :nom
t.string :email
t.timestamps
end
end
end
| 15.272727 | 43 | 0.642857 |
2851ef1bf1f411f650c4e5fcc0318adf5edb39c9 | 1,069 | CloudFormation do
DESCRIPTION ||= 'lambda description'.freeze
Description DESCRIPTION
Parameter('Role') { Type 'String' }
Resource('LambdaFunction') do
Type 'AWS::Lambda::Function'
Property('Handler', 'index.handler')
Property('Role', Ref('Role'))
Property('Code',
S3Bucket: 'lamb... | 31.441176 | 128 | 0.661366 |
796c963a29fbb3532d81b7a9169c33fdc4443e49 | 2,480 | # coding: utf-8
require 'spec_helper'
require 'fileutils'
require 'image_size'
shared_context 'icon' do |path, px|
before :all do
@image_size = ImageSize.path(path)
end
it 'should exist' do
expect(File.exists? path).to be true
end
it 'format should be png' do
expect(@image_size.format).to eq :... | 25.050505 | 94 | 0.543145 |
1876f1d9bf3709187083bcede79cde1f1bedf2b9 | 3,879 | module Rankers
class ShipCombosRanker
attr_reader :ship_combos, :ships, :number_of_tournaments, :number_of_squadrons
def initialize(ranking_configuration, ship_id: nil, ship_combo_id: nil, pilot_id: nil, upgrade_id: nil, limit: nil)
start_date = ranking_configuration[:ranking_start]
end_dat... | 47.304878 | 165 | 0.661253 |
f75c20135a05e7f1774ea2ec77f8122143cda65a | 69 | module Wikimapia
module Geometries
VERSION = "0.0.1"
end
end
| 11.5 | 21 | 0.681159 |
f8bb942f2919fe8f5063616d90f1d5e85d9fab1b | 1,216 | # frozen_string_literal: true
module Sipity
##
# A proxy for something that can take an action.
#
# * A User can be an agent
# * A Group can be an agent (though Group is outside the scope of this system)
class Agent < ActiveRecord::Base
self.table_name = 'sipity_agents'
ENTITY_LEVEL_AGENT_RELATIONS... | 33.777778 | 119 | 0.720395 |
4ab2d7e7ec7b6148ac71811ba6c9d3152e8a112e | 2,542 | require 'test/unit'
require 'yaml'
require_relative '../../lib/cloudstack_ruby_client'
class SystemVmTest < Test::Unit::TestCase
def setup
config = YAML.load_file("test/config.yml")
_host = config['cloudstack']['host']
_port = config['cloudstack']['port']
_admin_port = config['cloud... | 21.913793 | 80 | 0.676633 |
62cf669992b67697632840c0c82a929b9644b048 | 220 | class RiverEvents::Month
@@all = []
attr_accessor :name
def initialize(name)
@name= name
save
end
def self.all
@@all
end
def save
@@all << self
end
end
| 11.578947 | 24 | 0.495455 |
3338699292994bffcd7738a167f319842bc8f68e | 2,323 | module FilterableMixin
extend ActiveSupport::Concern
module ClassMethods
def find_filtered(options = {})
filters = options.delete(:tag_filters)
mfilters = filters && filters["managed"] ? filters["managed"] : []
bfilters = filters && filters["belongsto"] ? filters["belongsto"] : []
optio... | 32.71831 | 113 | 0.632802 |
1d204d02e84f60f6f02238147295bf9e37359120 | 196 | Spree::Core::Engine.routes.draw do
namespace :admin do
resources :pages
end
constraints(Spree::StaticPage) do
get '/(*path)', :to => 'static_content#show', :as => 'static'
end
end
| 21.777778 | 65 | 0.658163 |
262ee19c8dce4fce64cca3d063a167be05b5f0c0 | 871 | #
# Cookbook:: st2
# Recipe:: _repo
#
# Copyright (c) 2017 Brian Clark <brian@clark.zone>
include_recipe 'apt'
## Read:
## http://blog.packagecloud.io/eng/2016/03/21/apt-hash-sum-mismatch/
## https://packagecloud.io/computology/apt-backport
# package 'apt' do
# version '1.2.10'
# action :nothing
# end
#
# execu... | 28.096774 | 112 | 0.69116 |
915d339fbce9c035d6004c10e0667478bb7a013b | 538 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/google_ads/v1/resources/keyword_view.proto
require 'google/protobuf'
require 'google/api/annotations_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "google.ads.googleads.v1.resources.KeywordView" do
optiona... | 33.625 | 128 | 0.799257 |
28e0cdc8cc7a29fb790cdee70c090aa5fea3c85a | 922 | # frozen_string_literal: true
module Mutations
module MergeRequests
class Base < BaseMutation
include Mutations::ResolvesProject
argument :project_path, GraphQL::ID_TYPE,
required: true,
description: "The project the merge request to mutate is in"
argument :iid, ... | 26.342857 | 75 | 0.638829 |
26205dbd8e43fd3b94761754116e895a58c98dde | 195 | # frozen_string_literal: true
module Faker
class Music
class RockBand < Base
class << self
def name
fetch('rock_band.name')
end
end
end
end
end
| 13.928571 | 33 | 0.574359 |
f704bdcbf346c7571104c77fd00d09d0494bd2a8 | 553 | # -*- encoding: utf-8 -*-
require_relative '../../spec_helper'
describe "Symbol#upcase" do
it "returns a Symbol" do
:glark.upcase.should be_an_instance_of(Symbol)
end
it "converts lowercase ASCII characters to their uppercase equivalents" do
:lOwEr.upcase.should == :LOWER
end
it "capitalizes all Un... | 25.136364 | 76 | 0.683544 |
03b7b96326ed5e81e72f490fe903cd86d60235e4 | 2,260 | # encoding: utf-8
class City < ActiveRecord::Base
belongs_to :region
has_many :clients
has_many :city_firms
has_many :firms, through: :city_firms
has_many :t_firms #Temp Firms
attr_accessible :name, :region_id, :latitude, :longitude, :wedding_city
geocoded_by :full_name
extend FriendlyId
friendly_i... | 26.27907 | 108 | 0.656195 |
184babcb2d9b784da7554f607e8971cd39c2385b | 3,994 | require 'game'
require 'ranking'
require 'setting'
class Bot
def add(mytyping_id)
g = Game.scrape(mytyping_id)
return {result: :ng, error: "faled to scpara for #{mytyping_id}"} unless g
return {result: :ng, error: g.errors.full_messages} unless g.save
g.as_json
end
def list
Game.all.order(:i... | 27.170068 | 136 | 0.580621 |
e97e2b5f0243546b705dc3c0e72cd179dbe61c33 | 1,149 | require 'rails_helper'
RSpec.describe 'Users API', type: :request do
let(:user) { create(:user) }
let(:headers) { valid_headers.except('Authorization') }
let(:valid_attributes) do
attributes_for(:user)
end
# User signup test suite
describe 'POST /api/signup' do
context 'when valid request' do
... | 27.357143 | 108 | 0.64752 |
d5ad58fb3dcf369f75daee9117d35ba329cb64a7 | 226 | class CreateClients < ActiveRecord::Migration[6.1]
def change
create_table :clients do |t|
t.text :name
t.text :phone
t.text :datestamp
t.text :barber
t.text :color
t.timestamps
end
end
end
| 15.066667 | 50 | 0.646018 |
ff4abc50e98a8515c372eaf01a9f39f65a54c38c | 128 | class RenameColumns < ActiveRecord::Migration[6.0]
def change
rename_column :users, :password, :password_digest
end
end
| 21.333333 | 53 | 0.757813 |
b9b0030672e180680939e69645f669dee2a8e8ce | 10,222 | require 'rails_helper'
RSpec.describe "Trigger questions", type: :request do
include RSpecHtmlMatchers
let!(:responsible_person) { create(:responsible_person) }
let!(:notification) { create(:notification, responsible_person: responsible_person) }
let(:component) { create(:predefined_component, notification: n... | 44.443478 | 240 | 0.690374 |
0839bcfb6e2526d2161b13d632b01ac9faa84ae1 | 1,621 | class Topic < ActiveRecord::Base
stampable
acts_as_taggable
acts_as_votable
has_paper_trail
acts_as_nested_set parent_column: 'parent_topic_id', counter_cache: :children_count
include EventMessage
extend FriendlyId
friendly_id :name, :use => :slugged
has_many :sub_topics, -> { order 'position, id'... | 30.584906 | 138 | 0.709439 |
5de43817280d14969a5575809b33fcf6351853bd | 1,115 | # frozen_string_literal: false
# Modified/forked from https://github.com/inspec/inspec-gcp
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ------------------------------------------------------------------------... | 31.857143 | 78 | 0.521076 |
01e6d437891a7fe3e2f719157ceb36a66dea1ce6 | 1,751 | require 'test_helper'
module ShopifyCli
class APITest < MiniTest::Test
def setup
super
@mutation = <<~MUTATION
mutation {
fakeMutation(input: {
title: "fake title"
}) {
id
}
}
MUTATION
@api = API.new(
ctx: @cont... | 28.704918 | 94 | 0.555111 |
b95296bbe61ef1995fb750313cfb21e240055b16 | 7,323 | =begin
#Datadog API V2 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://openapi-generator.tech
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
This product... | 30.260331 | 219 | 0.633074 |
6149dd5a4edb02c11c1eb5d90dfe991c39edd074 | 4,849 | # Copyright 2011-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | 31.283871 | 78 | 0.52052 |
264fca812bb16ac67b9219f6b4e6f09d9faa65fc | 964 | $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "search/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "search"
s.version = Search::VERSION
s.authors = ["Manoel Quirino Neto"]
s.email = ["contato@manoel... | 33.241379 | 85 | 0.660788 |
d5a4a72bb0a6f12ec09863f5f2960d045909a427 | 146 | require 'rails_helper'
describe Exercise do
it { should validate_presence_of :name }
it { should validate_presence_of :calories_burned }
end
| 20.857143 | 53 | 0.787671 |
796842ec9823110ecd57522cb2ced58591e2e7d8 | 4,893 | #!/usr/bin/ruby
# Gem Dependency Checker
# Print out Gem/Gemspec/Gemfile dependencies, highlighting
# missing dependencies and those that are remotely
# available in various locations including koji,
# git, fedora, bodhi, rhn, etc.
#
# Pass -h to the script to see command line option details
#
# User is responsible for... | 28.447674 | 94 | 0.60842 |
4a0742e44b399f85d532887b7867182349830df6 | 6,775 | module Intrigue
module Task
class UriCheckApiEndpoint < BaseTask
include Intrigue::Task::Browser
def self.metadata
{
:name => "uri_check_api_endpoint",
:pretty_name => "URI Check API Endpoint",
:authors => ["jcran"],
:description => "This task uses a variety of heuristics to determine ... | 29.329004 | 233 | 0.572399 |
2197029fa1ebef791f179e2c91ef8480331d2419 | 1,224 | require 'spec_helper'
describe Overviews::GridRegistration do
let(:user) { FactoryBot.build_stubbed(:user) }
let(:project) { FactoryBot.build_stubbed(:project) }
let(:grid) { FactoryBot.build_stubbed(:overview, project: project) }
describe 'writable?' do
let(:allowed) { true }
before do
allow(us... | 27.818182 | 103 | 0.645425 |
6a369d67654ee81b7a7c3baff1d4c35b05ddf205 | 3,130 | # Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{aasm}
s.version = "2.1.5"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_ruby... | 33.297872 | 117 | 0.653355 |
7af279603157d887a238e9f0d3bd0440e337d606 | 127 | class ContactSerializer < ActiveModel::Serializer
attributes :department, :email, :id, :name, :title
has_many :phones
end
| 21.166667 | 52 | 0.755906 |
0345d434c59031ae0a5a841921ebeb8b3f4e2494 | 4,440 | module PostSets
class Post < PostSets::Base
MAX_PER_PAGE = 320
attr_reader :tag_array, :public_tag_array, :page, :raw, :random, :post_count, :format
def initialize(tags, page = 1, per_page = nil, options = {})
tags ||= ''
@public_tag_array = Tag.scan_query(tags)
tags += " rating:s" if C... | 25.227273 | 158 | 0.62973 |
626658a877c9270e7f023f386839db6a9be82f63 | 160 | # frozen_string_literal: true
FactoryBot.define do
factory :user_group do
name { Faker::Lorem.word }
description { Faker::Lorem.sentence }
end
end
| 17.777778 | 41 | 0.71875 |
113ac7c710360d9758aa635fb6391a547ea65685 | 610 | module TelephoneNumber
class GeoLocationDataImporter
def self.load_data!
Dir.glob("data/geocoding/**/*.txt").each { |file| process_file(file) }
end
def self.process_file(file_path)
master_data = {}
bin_file_path = "#{File.dirname(file_path)}/#{File.basename(file_path, '.txt')}.dat"
... | 29.047619 | 90 | 0.627869 |
4afdc26836bf96bea3b44b2063fa1e24d0c9efd8 | 625 | class Oracle::QuestionMailer < ActionMailer::Base
def close_question_request(question)
publisher = question.user
@recipients = "#{publisher.email}"
@from = Tog::Config["plugins.tog_core.mail.system_from_address"]
@subject = 'Please pick a suitable answer'
@body[:asker_name] = publish... | 36.764706 | 82 | 0.6816 |
b9314fcdce586fee26a10e93f9a3881d966a0048 | 121 | require 'test_helper'
class SynonymTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.125 | 43 | 0.702479 |
ffa7f73978588dc12cb7631b8aaa9304bd5e977d | 692 | # frozen_string_literal: true
namespace :msw do
desc 'Update forecast from MagicSeaweed'
task update: %w[environment forecasts:get_batch] do
include ActionView::Helpers::DateHelper
start_time = Time.current
Rails.logger.info 'Updating MagicSeaweed data...'
hydra = Typhoeus::Hydra.new(max_concurre... | 31.454545 | 153 | 0.734104 |
1a1e47367574fa9d2c03ecf92c8f1b49d2804152 | 2,212 | #
# Author:: Sander Botman <sbotman@schubergphilis.com>
# Cookbook Name:: windows
# Provider:: font
#
# Copyright:: 2014, Schuberg Philis BV.
#
# 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
#... | 31.6 | 90 | 0.749096 |
ff190422311de6544c0a69a8732f417adc7cb67a | 731 | # encoding: utf-8
require 'spec_helper'
describe Function::Connective::Disjunction, '.call' do
subject { object.call(left, right) }
let(:object) { described_class }
context 'when left is true and right is true' do
let(:left) { true }
let(:right) { true }
it { should be(true) }
end
context '... | 19.236842 | 54 | 0.606019 |
b93a209a0befc555878f1df430ea36cefd426f2f | 106 | class Game < ActiveRecord::Base
has_many :game_reviews
has_many :users, through: :game_reviews
end | 26.5 | 43 | 0.754717 |
ace6c00ff4a90339b9529d40e2147ec3de7071da | 746 | require_relative '../../../spec_helper'
require 'socket'
describe "Addrinfo#ip_port" do
describe "for an ipv4 socket" do
before :each do
@addrinfo = Addrinfo.tcp("127.0.0.1", 80)
end
it "returns the port" do
@addrinfo.ip_port.should == 80
end
end
describe "for an ipv6 socket" do
... | 20.162162 | 68 | 0.616622 |
ed1824c33c01e93167e4bd8c0fc9b147acb2b235 | 335 | cask :v1 => 'asepsis' do
version '1.5.1'
sha256 '3bf6c1bd9c2a4bb81d05c8142595e552681e45ee44abd96994168a7001f46807'
url "http://downloads.binaryage.com/Asepsis-#{version}.dmg"
name 'Asepsis'
homepage 'http://asepsis.binaryage.com/'
license :bsd
pkg 'Asepsis.pkg'
uninstall :pkgutil => 'com.binaryage.pk... | 23.928571 | 75 | 0.734328 |
f736e11554d4a3f814ae4d675d088327ed12f9a8 | 100 | # frozen_string_literal: true
json.array! @additions, partial: 'additions/addition', as: :addition
| 25 | 68 | 0.77 |
bbc9c61603e41d8413a126d8a081e17fd647656e | 1,164 | # -*- encoding: utf-8 -*-
# stub: jquery-nested-rails 0.0.2 ruby lib
Gem::Specification.new do |s|
s.name = "jquery-nested-rails"
s.version = "0.0.2"
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Anup Paree... | 34.235294 | 109 | 0.674399 |
7a0eb9ed3e6f71d7c90867cada7c56f9c4925329 | 1,876 | =begin
#Hydrogen Integration API
#The Hydrogen Integration API
OpenAPI spec version: 1.3.1
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.21
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for IntegrationApi::Ca... | 28.424242 | 102 | 0.746269 |
7a74c467c3b2db4d1d555b376518caf98af0e550 | 1,382 | # Copyright 2017 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 30.711111 | 78 | 0.676556 |
1a35db257af7c9221e443a77af712612d1f08580 | 2,301 | # encoding: UTF-8
# frozen_string_literal: true
class KLineService
extend Memoist
POINT_PERIOD_IN_SECONDS = 60.freeze
# Point period units are calculated in POINT_PERIOD_IN_SECONDS.
# It means that period with value 5 is equal to 5 minutes (5 * POINT_PERIOD_IN_SECONDS = 300).
AVAILABLE_POINT_PERIODS = [1, ... | 23.721649 | 96 | 0.676228 |
e81f5dc9958088c3e5403ec80aea2af11c11c747 | 319 | class CreateUserSubmittedReplays < ActiveRecord::Migration[5.2]
def change
create_table :user_submitted_replays do |t|
t.integer :user_id, null: false
t.string :hsreplay_id, null: false
t.timestamps
end
add_index :user_submitted_replays, [:user_id, :hsreplay_id], unique: true
end
end
| 29 | 77 | 0.721003 |
f8dbb8a705c4c40a2f8d559de1fbf7221b929658 | 1,425 | # frozen_string_literal: true
# Fetches the system metrics dashboard and formats the output.
# Use Gitlab::Metrics::Dashboard::Finder to retrive dashboards.
module Metrics
module Dashboard
class SystemDashboardService < ::Metrics::Dashboard::BaseService
SYSTEM_DASHBOARD_PATH = 'config/prometheus/common_met... | 24.568966 | 106 | 0.652632 |
33351c86d2c1ebb2b8b86648170ad22d4f840978 | 130 | class AddItemTitleToRequests < ActiveRecord::Migration[4.2]
def change
add_column :requests, :item_title, :string
end
end
| 21.666667 | 59 | 0.761538 |
abd2d3df453fe98ad9487be34e7e48ceef30c3a8 | 182 | class AddPositionToSprint < ActiveRecord::Migration
def self.up
add_column :sprints, :position, :integer
end
def self.down
remove_column :sprints, :position
end
end
| 18.2 | 51 | 0.736264 |
21bbfcd3e6e29593440e4a67aa49ff2fa2fe7b51 | 14,300 | # frozen_string_literal: true
module MasterfilesApp
class FruitSizeRepo < BaseRepo
build_inactive_select :basic_pack_codes,
alias: :basic_packs,
label: :basic_pack_code,
value: :id,
order_by: :basic_pack_code
... | 46.129032 | 152 | 0.663007 |
e88787360f854453f261cebbf6818d178c0ae454 | 638 | require 'sinatra'
require 'concurrent'
$semaphore = Mutex.new
$is_spinning = false
class Spinner < Sinatra::Base
get '/spin' do
set_spinning true
Thread.new do
while spinning?
# be nice
sleep 0.0001
# spin!
end
end
task = Concurrent::TimerTask.new(execution_interval: params[:spin_ti... | 14.177778 | 79 | 0.675549 |
7a0534610f0cac045bce6ad63599880677f719ef | 314 | class CreateAlbumArtists < ActiveRecord::Migration
def change
create_table :album_artists do |t|
t.integer :album_id, null: false
t.integer :artist_id, null: false
t.timestamps null: false
end
# add_index :album_artists, :artist_id
add_index :album_artists, :album_id
end
end
| 26.166667 | 50 | 0.707006 |
33832710e5db7bd30949255d8d329478446e1c36 | 15,776 | require "download"
# These are methods dealing with getting the image and generating the thumbnail.
# It works in conjunction with the image_store methods. Since these methods have
# to be called in a specific order, they've been bundled into one module.
module Post::FileMethods
def self.included(m)
m.before_val... | 28.788321 | 170 | 0.66037 |
017b7221f5be4870142970865aa91a9d0a6307f3 | 1,965 | module SCSSLint
# Checks that all properties in a rule set are on their own distinct lines.
class Linter::SingleLinePerProperty < Linter
include LinterRegistry
def visit_rule(node)
yield # Continue linting children
single_line = single_line_rule_set?(node)
return if single_line && config... | 31.693548 | 87 | 0.656489 |
ac28f2cac98fad0bd7f550013b10a09960a92321 | 739 | require 'cgi'
require 'restclient'
# A million thanks to Filip Tepper for https://github.com/filiptepper/facebook-oauth-example
class AccessToken
OAUTH_BASE = 'https://graph.facebook.com/oauth/access_token'
def self.get(app_id, app_secret, oauth_base=OAUTH_BASE)
response = RestClient.get(
oauth_base... | 23.83871 | 92 | 0.658999 |
bb28e8225e75b8d21368fae849d4864e364cc865 | 1,591 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use... | 34.586957 | 100 | 0.714016 |
5d25d805af3204deb407fb743bfbcffb80a5fd30 | 547 | require 'ruby-nfc'
WAITING_FOR_TAG = "Waiting for tag..."
PROMPT = "%s < "
OUTPUT = "%s > %s"
puts WAITING_FOR_TAG
NFC::Reader.all[0].poll(IsoDep::Tag) do |tag|
begin
loop do
print PROMPT % uid_hex
apdu = $stdin.readline.gsub(/\s+/, '')
case apdu
when /exit|quit/
puts "Bye!"
exit!
when /^... | 18.233333 | 45 | 0.605119 |
1de8525c8e1ce97525c7f09a7c4af9ddd8dedeec | 132 | # frozen_string_literal: true
module CartProcessing
module Errors
class UnavailableSourceType < StandardError; end
end
end
| 16.5 | 52 | 0.795455 |
e9446287a1f1f1580d876d69b6d33bfdb8ea9fdf | 1,354 | #
# Author: Hans Chris Jones <chris.jones@lambdastack.io>
# Copyright 2017, Bloomberg Finance L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | 32.238095 | 109 | 0.742984 |
bb423b796dcc8e070b69353e6ef23573d63abfac | 18,823 | #!/usr/bin/env rspec
require 'spec_helper'
module MCollective
module DDL
describe Base do
before :each do
Cache.delete!(:ddl) rescue nil
@ddl = DDL.new("rspec", :agent, false)
@ddl.metadata(:name => "name", :description => "description", :author => "author", :license => "license", ... | 44.185446 | 174 | 0.584338 |
21bb88e9de1e15caea8116a6eaa511c0fea8463f | 786 | # frozen_string_literal: true
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 27.103448 | 74 | 0.732824 |
ff17c27e5293c2d9b27961bcfd63e8e51a2ff53d | 18,717 | require 'addressable/uri'
require 'open-uri'
require 'pathname'
require 'bigdecimal'
require 'digest/sha1'
require 'date'
require 'thread'
require 'yaml'
require 'json-schema/errors/schema_error'
require 'json-schema/errors/json_parse_error'
module JSON
class Validator
@@schemas = {}
@@cache_schemas = fal... | 31.563238 | 235 | 0.615002 |
1a2664e10e6f8c736c644f74d42d3d0bb0826fb7 | 124 | class List < ActiveRecord::Base
has_many :selections
has_many :restaurants, through: :selections
belongs_to :user
end
| 20.666667 | 45 | 0.774194 |
2604f56c39802c1e4b7768694ed4e4d0abdc4e4b | 5,484 | require "spec_helper"
describe Api::BackupsController, type: :request do
let(:tarball) { Rails.root.join("spec", "fixtures", "crowbar_backup.tar.gz") }
let(:restore_status) { Rails.root.join("spec", "fixtures", "backup_restore_status.json") }
let(:created_at) { Time.zone.now.strftime("%Y%m%d-%H%M%S") }
let!(:b... | 35.153846 | 98 | 0.681984 |
1d2e6634748b832a9c791ddcea49150bb3f088b4 | 269 | class AgregandoBoardsPrueba < ActiveRecord::Migration
def change
=begin
b = Board.create(breed_id_id:1)
b2 = Board.create(breed_id_id:1)
g = Game.find(1)
g.board1_id_id = b.id
g.board2_id_id = b2.id
g.save # => no olvidar esto!!!!!
=end
end
end
| 20.692308 | 53 | 0.669145 |
f7f138f410a8508b5514bea2c2a705b736740e5e | 447 | # frozen_string_literal: true
require 'spec_helper'
describe FrederickAPI::V2::AutomationStep do
it_behaves_like 'v2_resource'
it_behaves_like 'belongs_to :location'
describe 'class attributes' do
describe 'read_only_attributes' do
it 'has right read only attributes' do
expect(described_class... | 23.526316 | 59 | 0.720358 |
1c93e979a1e374936cf1a7f4914fc41aa46b3764 | 1,996 | Forum::Application.routes.draw do
resources :user_sessions
match 'login' => "user_sessions#new", :as => :login, via: [:get]
match 'logout' => "user_sessions#destroy", :as => :logout, via: [:get]
resources :users # give us our some normal resource routes for users
resource :user, :as => 'account' # a ... | 28.927536 | 84 | 0.642285 |
1a2f2a5c1ddc5b65a6913e6f1676327364ac801a | 458 | module Grapi
module Response
def respond_with(target, template=nil, options=nil)
if target.class == Mongolow::Cursor
{ data: target.all.map{|post| post.template(template, options)} }
elsif target.respond_to? 'template'
if target.errors?
status 422
{ errors: target.... | 26.941176 | 73 | 0.611354 |
1d668afd8b2dfc7172b19e5bba134073e3c94e0f | 790 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Proxy, type: :model do
let(:partition_provider) { create :partition_provider }
let(:proxy) { create :proxy, partition_provider_guid: partition_provider.guid }
it 'requires a partition_provider_guid' do
expect { described_class.create! }.to ... | 31.6 | 107 | 0.775949 |
d5af06b04ad773b36e3a0786075d623efc4ed6fd | 863 | # frozen_string_literal: true
# This migration comes from spree (originally 20160420181916)
class MigrateCreditCardsToWalletPaymentSources < ActiveRecord::Migration[4.2]
class CreditCard < ActiveRecord::Base
self.table_name = 'spree_credit_cards'
end
class WalletPaymentSource < ActiveRecord::Base
self.... | 26.96875 | 77 | 0.709154 |
87a3613b095edd506c8bef84ed89f6c0cb642064 | 8,779 | require 'fog/core'
module Fog
module OpenStack
extend Fog::Provider
module Errors
class ServiceError < Fog::Errors::Error
attr_reader :response_data
def self.slurp(error)
if error.response.body.empty?
data = nil
message = nil
else
... | 35.116 | 123 | 0.591639 |
7aabc1f3689b85a48c0fd7b4e1d9305676f3aa6f | 3,329 | require 'spec_helper'
describe FbGraph::Node do
describe '.new' do
it 'should setup endpoint' do
FbGraph::Node.new('matake').endpoint.should == File.join(FbGraph.root_url, 'matake')
end
it 'should support access_token option' do
FbGraph::Node.new('matake', :access_token => 'access_token').a... | 36.582418 | 126 | 0.647342 |
0105e7e7c283a1f22bcd51bc9e35e0d68fa8400b | 1,243 | # encoding: utf-8
require 'simplecov'
SimpleCov.start
require 'dotenv'
require 'rspec'
require 'vcr'
require 'webmock/rspec'
# Include our code
require 'chef/handler/datadog'
# Load credentials from .env
Dotenv.load
API_KEY = ENV['API_KEY']
APPLICATION_KEY = ENV['APPLICATION_KEY']
RSpec.configure do |confi... | 25.367347 | 77 | 0.734513 |
ff57ac00cf40ce6c39ef5eeae1c8fc6c38da8e81 | 299 | class Docrb::App::Test
include Docrb::IncludeA
include Docrb::IncludeB
def self.test_1
true
end
class << self
def self.test_2
false
end
end
def test_3
true
end
end
class << Docrc::App::Test
def self.test_4
false
end
def test_5
true
end
end
| 10.310345 | 25 | 0.622074 |
1c6d6c797d9d96e75832bfd02b808698f9712012 | 123 | #in next rails version
# class PresenceForceIdStrValidator < ActiveModel::Validator
# def validate(record)
# end
# end
| 20.5 | 60 | 0.756098 |
6a14beeb950794c381991ee513ba64a42b65cf71 | 2,280 | # encoding: utf-8
require "spec_helper"
require "pluginmanager/util"
require "gems"
describe LogStash::PluginManager do
let(:plugin_name) { "logstash-output-elasticsearch" }
let(:version_data) do
[ { "authors"=>"Elastic", "built_at"=>"2015-08-11T00:00:00.000Z", "description"=>"Output events to elasticsearch"... | 53.023256 | 131 | 0.689035 |
7abd9fc484a3dc8f126c4841e6a3e5b1a49e03a0 | 54,687 | # frozen_string_literal: true
require_relative 'spec_helper'
describe 'Asciidoctor::PDF::Converter - Image' do
it 'should not crash when converting block image if theme is blank' do
image_data = File.binread example_file 'wolpertinger.jpg'
pdf = to_pdf <<~'EOS', attribute_overrides: { 'pdf-theme' => (fixtur... | 39.146027 | 242 | 0.641853 |
1a4c2ca4bbd323e98f6ca3faaed0a1a775e1e722 | 668 | require 'lightrail/version'
if ['--version', '-v'].include?(ARGV.first)
puts "Lightrail #{Lightrail::VERSION}"
exit(0)
end
if ARGV.first != "new"
ARGV[0] = "--help"
else
ARGV.shift
railsrc = File.join(File.expand_path("~"), ".railsrc")
if File.exist?(railsrc)
extra_args_string = File.open(railsrc).rea... | 25.692308 | 73 | 0.688623 |
01ce9d869715c5cfe271769747af86125c62b6a2 | 246 | Rails.application.routes.draw do
get 'static_pages/home'
get 'static_pages/help'
get 'static_pages/about'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root 'static_pages#home'
end
| 30.75 | 101 | 0.764228 |
79b586dfa01f95a5f18ad04278e1113f2e058658 | 445 | # frozen_string_literal: true
# (see Ruby::ClassVariableHandler)
class YARD::Handlers::Ruby::Legacy::ClassVariableHandler < YARD::Handlers::Ruby::Legacy::Base
HANDLER_MATCH = /\A@@\w+\s*=\s*/m
handles HANDLER_MATCH
namespace_only
process do
name, value = *statement.tokens.to_s.split(/\s*=\s*/, 2)
regis... | 27.8125 | 93 | 0.694382 |
87c8f140aac51152f0f6e194a5830081e7e73cb8 | 1,121 | class Pspg < Formula
desc "Unix pager optimized for psql"
homepage "https://github.com/okbob/pspg"
url "https://github.com/okbob/pspg/archive/3.1.2.tar.gz"
sha256 "f88fe56b08ec00ec4894aa370f90677817af85581154642dd155466e9d64a465"
license "BSD-2-Clause"
head "https://github.com/okbob/pspg.git"
bottle do
... | 28.74359 | 93 | 0.698483 |
f806fa5594bd184f0370724fb1cafec428be7bbe | 1,036 | require 'spec_helper'
describe I18n::Backend::EMobility do
let(:i18n_options) { {} }
before do
I18n.backend = described_class.new
store_translations(:en,
the_application: {
title: 'The Application',
start_page_title: 'The Start Page',
the_brand: {
start_page_headin... | 21.583333 | 71 | 0.614865 |
330641e3584e36b84770a276a781e68a4f7d3487 | 451 | class Opendata::Agents::Tasks::Node::IdeaCategoriesController < ApplicationController
include Cms::PublicFilter::Node
def generate
node_path = @node.path
node_url = @node.url
Opendata::Node::Category.and_public.where(site_id: @node.site_id).each do |cate|
path = "#{node_path}/#{cate.basename}/i... | 30.066667 | 85 | 0.689579 |
ac68bc28c9fcbd67d3d4953940fc6fafa46a7590 | 2,916 | require 'spec_helper'
shared_examples 'package::init' do |es_version,plugins|
describe user('elasticsearch') do
it { should exist }
end
describe service('node1_elasticsearch') do
it { should be_running }
end
describe package('elasticsearch') do
it { should be_installed }
end
describe fil... | 26.509091 | 122 | 0.684499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.