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 |
|---|---|---|---|---|---|
26f66c2e24503f79cff183ff7264f6553ea6dd19 | 921 | # encoding: utf-8
$:.push File.expand_path('../lib', __FILE__)
Gem::Specification.new do |gem|
gem.name = "fluent-plugin-multi-format-parser"
gem.description = "Multi format parser plugin for Fluentd"
gem.homepage = "https://github.com/repeatedly/fluent-plugin-multi-format-parser"
gem.summary = g... | 40.043478 | 85 | 0.64278 |
91cd251d0c1a209507cc58621b63ea5b3b31c36f | 150 | class RemoveDefaultFromSongName < ActiveRecord::Migration[5.2]
def change
change_column_default :songs, :name, from: "Title", to: nil
end
end
| 25 | 63 | 0.746667 |
abfd16937f5e169c34e34bd79bb0c5b1cb9f2ecb | 241 | class CreateZipBoundaries < ActiveRecord::Migration
def change
create_table :zip_boundaries do |t|
t.string :name
t.string :zip_type
t.text :bounds, limit: 4294967295
t.timestamps null: false
end
end
end
| 20.083333 | 51 | 0.680498 |
d5b953646ed8f13b8d2f42539593bf06c59fd9ca | 191 | # frozen_string_literal: true
module Spina
module Admin
module Conferences
module Accounts
class ApplicationJob < ActiveJob::Base
end
end
end
end
end
| 14.692308 | 46 | 0.65445 |
03b9bd2687f608002c86b15006423afb6cf53bfb | 36,353 | # Copyright 2021 Google LLC
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
#
# frozen_string_literal: true
require_relative "../mock_server/spanner_mock_server"
require_relative "../test_helper"
require_relative "mode... | 62.894464 | 651 | 0.730531 |
ab288458b2e10e6b0ee90b1c65d7920a70805c77 | 1,021 |
module Applocale
module ParseXLSXModule
class Helper
def self.collabel_to_colno(collabel)
if collabel.match(/^(\d)+$/)
return collabel.to_i
end
number = collabel.tr("A-Z", "1-9a-q").to_i(27)
number -= 1 if number > 27
return number
end
end
en... | 27.594595 | 104 | 0.670911 |
187b002086bf46e5fe9dbd7b69f87e5296b9d355 | 125 | class RemoveTitleFromEvents < ActiveRecord::Migration[6.1]
def change
remove_column :events, :title, :string
end
end
| 20.833333 | 58 | 0.752 |
ac7b9a52d9178cb83c9dc502dc9a2736b4fcf6a2 | 273 |
require './tl_installer'
class SetupError < StandardError; end
if $0 == __FILE__
begin
ToplevelInstaller.invoke
rescue SetupError
raise if $DEBUG
$stderr.puts $!.message
$stderr.puts "Try 'ruby #{$0} --help' for detailed usage."
exit 1
end
end
| 17.0625 | 62 | 0.67033 |
21e88d78dcbe2fd778b1d93520d743208cbf6024 | 450 | RSpec::Matchers.define :be_allowed_to do |ability, resource|
match do |api_user|
api_user.may?(ability, resource)
end
description do
"have the ability to #{ability} #{resource}"
end
failure_message_for_should do
"expected user to have the ability to #{ability} #{resource}, but it didn't."
end
... | 25 | 82 | 0.711111 |
ab18a2d999058765bce7f3975a2d237f444bd5ba | 934 | require 'yaml'
module DogWatch
module Model
##
# Manages API configuration. Currently handles
# credential only.
##
class Config
attr_accessor :api_key
attr_accessor :app_key
attr_accessor :timeout
# @param [String] api_key
# @param [String] app_key
# @param [... | 23.35 | 68 | 0.600642 |
f88fef848b1613eaaaa874d0b13de0e35c9b525b | 384 | module FilterChain
class FilterChainError < RuntimeError; end
class NextFilterMissingError < FilterChainError; end
class MissingCollectorError < FilterChainError; end
class UnknownFormatError < FilterChainError; end
class MissingRequiredOptError < FilterChainError; end
class InvalidStateError < FilterChain... | 42.666667 | 55 | 0.828125 |
269e160d43a15fba0120722df95b5c2174d08353 | 1,552 | #
# Author:: John Keiser (<jkeiser@chef.io>)
# Copyright:: Copyright 2012-2016, Chef Software Inc.
# 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
#
# ... | 33.73913 | 120 | 0.661727 |
08476ad69660084f39dce9d4ba110436e0f40ea6 | 329 | class CreateProfiles < ActiveRecord::Migration
def change
create_table :profiles do |t|
t.string :name
t.text :biography
t.references :user, index: true, null: false
t.text :neuron_ids, array: true, default: []
t.timestamps null: false
end
add_foreign_key :profiles, :users
... | 23.5 | 50 | 0.662614 |
5d37c82148465fbe831a832557a181d9023071b2 | 204 | cask "phonetrans" do
version :latest
sha256 :no_check
url "https://dl.imobie.com/phonetrans-mac.dmg"
name "PhoneTrans"
homepage "https://www.imobie.com/phonetrans/"
app "PhoneTrans.app"
end
| 18.545455 | 48 | 0.715686 |
bbb8c81b88352fa91a94579bb87d9f99e1d11186 | 2,479 | require 'nokogiri/xml/pp'
require 'nokogiri/xml/parse_options'
require 'nokogiri/xml/sax'
require 'nokogiri/xml/searchable'
require 'nokogiri/xml/node'
require 'nokogiri/xml/attribute_decl'
require 'nokogiri/xml/element_decl'
require 'nokogiri/xml/element_content'
require 'nokogiri/xml/character_data'
require 'nokogiri... | 32.618421 | 94 | 0.713191 |
f77cf47fb71fe3df8c90c8d8d833ba204017d4f9 | 6,184 | # encoding: utf-8
require 'cases/helper'
require 'models/topic'
require 'models/person'
require 'bigdecimal'
class NumericalityValidationTest < ActiveModel::TestCase
def teardown
Topic.clear_validators!
end
NIL = [nil]
BLANK = ["", " ", " \t \r \n"]
BIGDECIMAL_STRINGS = %w(12345678901234567890.123456... | 31.712821 | 165 | 0.717658 |
ffa41ba07e4edfcfc213ca310bf6935955ab4ab9 | 74 | Chronic::Parser::DEFAULT_OPTIONS[:endian_precedence] = [:little, :middle]
| 37 | 73 | 0.77027 |
61923910cae4564fb3363104264633665b26278e | 390 | class AddRegistrationClosedAtToParliament < ActiveRecord::Migration
class Parliament < ActiveRecord::Base; end
def up
add_column :parliaments, :registration_closed_at, :datetime
parliament = Parliament.first!
parliament.update!(registration_closed_at: "2017-05-22T23:59:59.999999+01:00")
end
def d... | 26 | 82 | 0.771795 |
1a7a2ec1adf066b1be387ee8836306814868741c | 260 | class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :first_name
t.string :last_name
t.string :email
t.string :password_digest
t.timestamps null: false
end
end
end
| 21.666667 | 43 | 0.623077 |
6abade48df800e1fa24bb1a6b832ad81c0bc9847 | 319 | module Bootswitch
module Helpers
def themes
Bootswitch.configuration.themes
end
def theme_name
send(Bootswitch.configuration.theme_method) || Bootswitch.configuration.default_theme
end
def theme_stylesheet_link_tag
render(partial: 'theme/stylesheet_link_tag')
end
end
end | 21.266667 | 91 | 0.736677 |
4a9330cbb8ad87fbd68cbd91440f884c02ae74c9 | 2,975 | class EventsController < ApplicationController
after_action :create_notifications, only: [:create], if: -> { @event.persisted? }
def edit
@event = Event.find(params[:id])
end
def create
@trip_location = TripLocation.find(params[:trip_location_id])
@event = Event.new(event_params)
@event.trip_l... | 40.753425 | 276 | 0.676639 |
1113fb2abb43ee287c073c1520c4a354dff1fc98 | 1,458 | require 'simplecov'
SimpleCov.start
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'll_pay'
LlPay.oid_partner = '201103171000000000'
LlPay.rsa_pri_key = <<-EOF
-----BEGIN PRIVATE KEY-----
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANa4zOJbVHFp7T2c
fpiAbTYrghTpcPGt1ZetPeSoWa5d27+RofmV8QjhJq/P... | 38.368421 | 64 | 0.886145 |
1c6f9bd842007f450d6d5708a8065effa7a8239e | 1,038 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/weibo_2/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["simsicon"]
gem.email = ["simsicon@gmail.com"]
gem.description = %q{WeioOAuth2 is a Ruby gem that provides a wrapper for interacting with sina weibo's v2 API,
... | 39.923077 | 115 | 0.66185 |
ff2c60ad0eca6709ac7542d70b9854502f994c39 | 559 | FactoryGirl.define do
factory :iiiflayer, class: Trifle::IIIFLayer do
transient do
image nil
end
sequence(:title) { |n| "Layer #{n}"}
sequence(:description) { |n| "test description #{n}" }
width '1000'
height '2000'
sequence(:image_source ) { |n| "oubliette:testtest#{n}" }
sequ... | 29.421053 | 91 | 0.652952 |
f8fe9547e566af9411aa8249f2b43a0eff7b7e95 | 316 | module Miam
class AuthenticationHandler
Error = Class.new(StandardError)
AuthResult = Struct.new(
:account_id,
:owner_type,
:owner_name,
:policy_name,
:statement
)
def initialize(token)
@token = token
end
def allow!
raise Error
end
end
end
| 15.047619 | 36 | 0.598101 |
f8de99268d62da887bbb8127728b69a665a89206 | 221 | # frozen_string_literal: true
FactoryBot.define do
factory :eve_type_dogma_attribute, class: Eve::TypeDogmaAttribute do
association :type, factory: :eve_type
sequence(:attribute_id)
value { 1 }
end
end
| 18.416667 | 70 | 0.742081 |
03c59bfccb1f04ed4e92ef5e8fee132bf144d013 | 5,108 | require 'bigdecimal'
#
#--
# Contents:
# sqrt(x, prec)
# sin (x, prec)
# cos (x, prec)
# atan(x, prec) Note: |x|<1, x=0.9999 may not converge.
# log (x, prec)
# PI (prec)
# E (prec) == exp(1.0,prec)
#
# where:
# x ... BigDecimal number to be computed.
# |x| must be small enough to get... | 24.676329 | 80 | 0.540525 |
7aeec39e070cfc54b8764dd8c823c975cd903b7f | 1,585 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | 35.222222 | 86 | 0.735647 |
18ebe5499886dc69600a7618a63f47c63447bfd7 | 1,649 | # 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::Network::Mgmt::V2018_06_01
module Models
#
# Parameters that define the retention policy for flow log.
#
class RetentionPoli... | 26.596774 | 76 | 0.532444 |
e9c00624a4fb7b36f9418e2fca69a43169357de4 | 2,187 | class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
has_many :posts, dependent: :destroy
has_many :comme... | 28.402597 | 120 | 0.769547 |
f7b59b96cda2cd163194bc6eeef61f5358dae128 | 851 | Pod::Spec.new do |s|
s.name = 'KeenClient'
s.version = '3.2.1'
s.license = 'MIT'
s.platform = :ios
s.summary = 'Keen iOS client library.'
s.homepage = 'https://github.com/keenlabs/KeenClient-iOS'
s.author = { 'Daniel Kador' => 'dan@keen.io' }
s.source = { :git => 'https://github.com/keenlabs/... | 38.681818 | 90 | 0.611046 |
bf610bcba1f422b52c078cd80c9e500c6ef5ce59 | 401 | RSpec.describe LastFM::Top::Artists do
subject { described_class }
describe 'successful processing' do
context 'when no primary args' do
let(:output) do
VCR.use_cassette 'services/lastfm/top/artists/success' do
subject.call(limit: 5, page: 2, profile_id: 1)
end
end
... | 25.0625 | 68 | 0.653367 |
18e62f6b2fd9b7fe3b506fbcd9363c1346bba183 | 174 | module QuizzesHelper
def flash_message
if flash[:message]
flash[:message]
end
end
def user_created_quiz?
@quiz.user_id == current_user.id
end
end
| 13.384615 | 36 | 0.678161 |
ed04849092e050bcec0b4f4778f5be9c88080797 | 141 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_many2many_session'
| 35.25 | 79 | 0.808511 |
d582d654d0bc94f8bc87655e6a8f8a5411249e41 | 937 | # Shared specs for testing CORS headers
module Spec
module Support
module SharedExamples
module Requests
module CorsHeadersSpec
def self.included(base)
describe 'CORS headers' do
it 'sets the allowed origins' do
assert_equal 'http://localhost',
... | 28.393939 | 80 | 0.562433 |
e99986e76ee15e207b92eff80baecfcc195d8601 | 247 | class CreateRepositories < ActiveRecord::Migration[4.2]
def change
create_table :repositories do |t|
t.string :uri
t.string :name
t.timestamps null: false
end
add_index :repositories, :name, unique: true
end
end
| 20.583333 | 55 | 0.676113 |
ed1a10759f58e021807947ce8383beb85b6df2d1 | 1,090 | require 'redis/distributed'
class Redis
class DistributedStore < Distributed
@@timeout = 5
attr_reader :ring
def initialize(addresses, options = { })
nodes = addresses.map do |address|
::Redis::Store.new _merge_options(address, options)
end
_extend_namespace options
@rin... | 21.372549 | 59 | 0.610092 |
7a48418192fbf11b520013b6c4118213f9cbf839 | 984 | # -*- coding: utf-8 -*-
class User < ActiveRecord::Base
before_destroy :check_all_events_finished
has_many :created_events, class_name: 'Event', foreign_key: :owner_id, dependent: :nullify
has_many :tickets, dependent: :nullify
has_many :participating_events, through: :tickets, source: :event
def self.find_... | 28.114286 | 92 | 0.698171 |
39a10b07fbad3fb05c32b7b4437062ed062c7b56 | 466 | class CreateBookmarkRatingRubrics < ActiveRecord::Migration[4.2]
def self.up
if table_exists?(:bookmark_rating_rubrics) == false
create_table :bookmark_rating_rubrics do |t|
t.column 'display_text', :string, null: false
t.column 'minimum_rating', :integer, null: false
t.column 'maxim... | 27.411765 | 64 | 0.690987 |
611a992d7a975844273ce2d062e6e5f93b7829c5 | 802 | class CreateBlockReportNotFollowingMessageWorker
include Sidekiq::Worker
include ReportErrorHandler
include WorkerErrorHandler
sidekiq_options queue: 'messaging', retry: 0, backtrace: false
def unique_key(user_id, options = {})
user_id
end
def unique_in(*args)
3.seconds
end
# options:
def... | 26.733333 | 69 | 0.75187 |
9186c64e220d07e30c32f02d7c4d56ee11851352 | 89 | class Users::UnlocksController < Devise::UnlocksController
layout 'authentication'
end
| 22.25 | 58 | 0.820225 |
d5647626cd91eba1dc78f89ba3c2b6dc57702380 | 986 | require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "action_cable/engine"
require "sprockets/railtie"... | 30.8125 | 82 | 0.778905 |
4a5f1aae1683dd3823e4b707b68d0e067671b4df | 8,237 | =begin
#Selling Partner APIs for Fulfillment Outbound
#The Selling Partner API for Fulfillment Outbound lets you create applications that help a seller fulfill Multi-Channel Fulfillment orders using their inventory in Amazon's fulfillment network. You can get information on both potential and existing fulfillment orde... | 32.175781 | 268 | 0.64186 |
f84f48b2ff65dfbf63f40261e1565cf977a3e440 | 85 | Rails.application.routes.draw do
mount Alchemy::JsonApi::Engine => "/jsonapi/"
end
| 21.25 | 47 | 0.741176 |
f83e89a47c6bdc49c361c6e3d6cd5238df81a30a | 50,426 | module ApplicationHelper
include_concern 'ViewsShared'
include_concern 'Flash'
include_concern 'Listnav'
include_concern 'Navbar'
include_concern 'PageLayouts'
include_concern 'Tasks'
include Sandbox
include JsHelper
include StiRoutingHelper
include ToolbarHelper
include TextualSummaryHelper
inc... | 34.872752 | 170 | 0.633979 |
082201cb166cde420b15fe8b4f681d4c190950b7 | 4,245 | if databases.count > 1
puppetdb_query_url = "http://localhost:8080/pdb/query"
test_name "test database fallback" do
step "clear puppetdb databases" do
databases.each do |database|
clear_and_restart_puppetdb(database)
end
end
with_puppet_running_on master, {'master' => { 'autosign' ... | 35.974576 | 114 | 0.620024 |
1d1a2c55cecb3ad2616d18dbef8df9fe4f83df99 | 954 | # Encoding: utf-8
# frozen_string_literal: true
require 'chefspec'
require 'chefspec/berkshelf'
require 'fauxhai'
ChefSpec::Coverage.start!
require 'chef/application'
# rubocop:disable all
LOGLEVEL = :fatal
SUSE_OPTS = {
:platform => 'suse',
:version => '12.3',
:log_level => LOGLEVEL,
}
REDHAT_OPTS = {
:plat... | 18.705882 | 68 | 0.649895 |
1a46be4714ec1d9426c7ed79a19fe8f43bcdf267 | 188 | require 'togostanza'
require_relative '../stanza'
FaStanza::Stanza.root = File.expand_path('../..', __FILE__)
TogoStanza.sprockets.append_path File.expand_path('../../assets', __FILE__)
| 26.857143 | 75 | 0.739362 |
1d494829c982248768664039a2a3a42fbaaca147 | 7,396 | =begin
Copyright (c) 2019 Aspose Pty Ltd
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, merge, publish, distribu... | 32.725664 | 107 | 0.657112 |
3992419a274e6c97bd2e6bb31e0dce782ec4f058 | 266 | class FetchSourceCitation < ApplicationJob
def perform(source)
if source.source_type == 'PubMed'
Scrapers::PubMed.populate_source_fields(source)
elsif source.source_type == 'ASCO'
Scrapers::Asco.populate_source_fields(source)
end
end
end
| 26.6 | 53 | 0.736842 |
1a7beb513feeb33b2c5161c1fd4bab792856771a | 361 | require "bundler/setup"
require "grate"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_with :rspec... | 24.066667 | 66 | 0.750693 |
1c83a643c83ebfcba94ae8dc957b1d8107f04f7f | 352 | class ActsAsSolr::ParserInstance
include ActsAsSolr::ParserMethods
include ActsAsSolr::CommonMethods
attr_accessor :configuration, :solr_configuration
def table_name
"documents"
end
def primary_key
"id"
end
def find(*args)
[]
end
public :parse_results, :reorder, :parse_query,... | 18.526316 | 76 | 0.721591 |
87bde509a5f1b0eb6449541eae8757c060d83ca2 | 7,403 | #
# Author:: Adam Jacob (<adam@opscode.com>)
# Author:: Nuo Yan (<nuo@opscode.com>)
# Author:: Christopher Brown (<cb@opscode.com>)
# Copyright:: Copyright (c) 2009 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file excep... | 26.629496 | 138 | 0.617452 |
87a813af3dbba8436ba448b58a2bb3325a18c957 | 1,249 | # frozen_string_literal: true
require 'prime' # Ruby Prime
module PrimeMultiplier
# class that generates the first `count` prime numbers
class Prime
class << self
def generate(count)
return [] if count < 1
# this is used to obtain the last prime number so we can set it as
# the ... | 27.755556 | 82 | 0.619696 |
4a69252dec27acf11dc1c1edd00c3b350e6995f5 | 1,650 | # -*- encoding: utf-8 -*-
# stub: unf 0.1.4 ruby lib
Gem::Specification.new do |s|
s.name = "unf".freeze
s.version = "0.1.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Akinori MUSHA".freeze]
... | 40.243902 | 114 | 0.676364 |
611820f8e8c6451c405b0d1d216b4098c6b7b210 | 1,126 | require File.dirname(__FILE__) + '/spec_helper'
describe "Transfigr.presenter(obj)" do
before(:each) do
Transfigr.add(:active_presenter_format) do
def format!(o)
:presenter_format_formatted
end
end
Transfigr.activate!(:active_presenter_format)
end
it "should setup a presente... | 28.871795 | 100 | 0.728242 |
bbcb5096121decc6e04bafa87a5e7a9baa45903f | 252 | #!/usr/bin/env ruby
# encoding: utf-8
require_relative '../../environment.rb'
include Sinatra::Mimsy::Helpers
name = "Granfelt, C.E."
Catalog.where(collector: name).find_each do |catalog|
catalog.collector = "Granfelt, Carl-Eric"
catalog.save
end | 22.909091 | 53 | 0.72619 |
7aa789bc123f003ef40c1da0a1d05b317cbda197 | 7,175 | require "spec_helper"
describe Mongoid::Attributes::Readonly do
describe ".attr_readonly" do
after do
Person.readonly_attributes.clear
end
context "when providing a single field" do
before do
Person.attr_readonly :title
end
it "adds the field to readonly attributes" d... | 26.378676 | 90 | 0.585784 |
1803e6a18544e61dd99489b2dca4d04256fb84e0 | 1,523 | require 'spec_helper'
describe Keyword do
it { should have_many :wordcounts }
it { should have_many(:articles).through :wordcounts }
it { should respond_to :name }
it { should respond_to :metaphone }
it { should respond_to :stem }
it { should respond_to :synonyms }
let(:keyword) { FactoryGirl.create :k... | 33.108696 | 391 | 0.655942 |
ff6180c28fe76370c62596e15d196c2bb53e8813 | 5,688 | describe Ansible::Runner do
let(:uuid) { "201ac780-7bf4-0136-3b9e-54e1ad8b3cf4" }
let(:env_vars) { {"ENV1" => "VAL1", "ENV2" => "VAL2"} }
let(:extra_vars) { {"id" => uuid} }
let(:tags) { "tag" }
describe ".run" do
let(:playbook) { "/path/to/my/playbook" }
before { expect(File).to receiv... | 38.174497 | 130 | 0.611287 |
f73ae53fd7be16d48d94b55fab7caf72cc0e53d8 | 33 | require_relative "./concurrent"
| 16.5 | 32 | 0.787879 |
e22468fc8eb7a6bce8814527d2e889d711f63268 | 389 | require('rspec')
require('word_count')
describe('word_count') do
it("counts the number of times a word has been repeated in a sentence") do
expect(("crazy people are crazy").word_count("crazy")).to eq(2)
end
it ("checks if it counts word that are part of a larger world") do
expect(("monkeys... | 32.416667 | 78 | 0.670951 |
2102d2026a8f5d6bede37bd12bd11a67556be823 | 566 | # frozen_string_literal: true
class Ability
include CanCan::Ability
def initialize(user)
@user = user
can :read, [Book, Article, TeamMember, Bookstore, Author, Series]
return if user.blank? # user is a guest
user_abilities
admin_abilities if user.is_a?(Admin)
end
private
def admin_abi... | 20.962963 | 98 | 0.710247 |
5dba2f21d9f54023f87fd6e0b86294f97b8c04d1 | 1,661 | class Interact::AttitudesController < Interact::BaseController
before_action :set_attitude, only: [:create, :like, :dislike, :cancel]
def index
@attitudes = Attitude.page(params[:page])
render json: @attitudes
end
def new
@attitude = Attitude.new
end
def create
@attitude.opinion = params... | 20.256098 | 72 | 0.666466 |
398b198f6d68736c7989038593125975298d7ae6 | 92 | class CommentSerializer < ActiveModel::Serializer
attributes :body, :rating, :user_id
end
| 23 | 49 | 0.793478 |
f7b5941005850fbfe5c203176d0e9653bcc90ad9 | 99 | class WelcomeController < ApplicationController
layout "application"
def index
end
end
| 12.375 | 47 | 0.747475 |
7a37621c784cdd8f9e2aea8db9d388aa5522c5cf | 1,252 | module Factory
def self.create_user(params = {})
User.create!(params.reverse_merge({
email: "test@example.com",
name: "Test User",
password: "password",
password_confirmation: "password",
provider: "email",
confirmed_at: DateTime.now
}))
end
def self.create_admin(param... | 23.185185 | 63 | 0.634185 |
bf5e70f43588487b8496e86abaaee25213f39b50 | 473 | require 'telephone_appointments/version'
require 'telephone_appointments/api'
require 'telephone_appointments/response'
require 'telephone_appointments/summary_document_activity'
require 'telephone_appointments/dropped_summary_document_activity'
require 'active_support/core_ext/module/attribute_accessors'
module Tel... | 24.894737 | 66 | 0.839323 |
28d67f86cec4fcebd8ecf2202c81f3306e15dca8 | 4,275 | # frozen_string_literal: true
require "spec_helper"
module Family
RSpec.describe CelebrityFamily, type: :model, versioning: true do
it "should utilise the suffix properly" do
expect(PaperTrail::Version.friendly_item_type_from_class(described_class)). to eq("Celebrity Family")
end
describe "#reify... | 42.326733 | 107 | 0.601404 |
387fbd445cb757df6709d71409020142a4c41644 | 684 | $:.push File.expand_path("../lib", __FILE__)
require "basecustom/version"
Gem::Specification.new do |s|
s.name = 'basecustom'
s.version = BaseCustom::VERSION
s.licenses = ['MIT']
s.summary = "Define your own numeric base!"
s.description = "Define your own numeric base! Highly advanced and ... | 38 | 111 | 0.646199 |
28357e073be25b58cb82d343038bff6453a9754c | 2,239 | # frozen_string_literal: true
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "computed_model/version"
Gem::Specification.new do |spec|
spec.name = "computed_model"
spec.version = ComputedModel::VERSION
spec.authors = ["Masaki Hara", "M... | 44.78 | 104 | 0.703439 |
333bdd5078a3de61d5c1e3dc0b0ebdf20fbd2569 | 3,000 | require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
# This package tracks debian-unstable: http://packages.debian.org/unstable/vim
url 'http://ftp.de.debian.org/debian/pool/main/v/vim/vim_7.3.923.orig.tar.gz'
sha1 'f308d219dd9c6b56e84109ace4e7487a101088f5'
head 'https://vim.googlecode.com/hg... | 40 | 100 | 0.643667 |
f8d68e05247ecaa7fae480491f031b696e45541d | 6,332 | module Sequel
class Database
# ---------------------
# :section: 5 - Methods that set defaults for created datasets
# This methods change the default behavior of this database's datasets.
# ---------------------
# The default class to use for datasets
DatasetClass = Sequel::Dataset
@iden... | 35.977273 | 170 | 0.686829 |
1c8b890a2db9c38883f8346558abe0ad7361c5e6 | 875 | class UsersController < ApplicationController
def index
if params[:query]
@users = User.where('username LIKE ?', "%#{params[:query]}%")
else
@users = User.all
end
render json: @users
end
def create
@user = User.new(user_params)
if @user.save
render json: @user, status: ... | 19.021739 | 76 | 0.64 |
18678c01dc75f20edfc3f45bfacae690f57b9112 | 5,457 | require File.dirname(__FILE__) + '/helper'
class BacktraceTest < Test::Unit::TestCase
should "parse a backtrace into lines" do
array = [
"app/models/user.rb:13:in `magic'",
"app/controllers/users_controller.rb:8:in `index'"
]
backtrace = HoptoadNotifier::Backtrace.parse(array)
line = b... | 33.27439 | 93 | 0.669782 |
5d2170c91c13ad0d373aa928ac4fd8156e00f3d7 | 4,472 | # encoding: utf-8
require File.dirname(__FILE__) + '/../../spec_helper'
describe SendGrid4r::REST::Stats::Subuser do
describe 'integration test', :it do
before do
Dotenv.load
@client = SendGrid4r::Client.new(api_key: ENV['SILVER_API_KEY'])
@subuser = ENV['SUBUSER2']
@email1 = ENV['MAIL']
... | 37.579832 | 78 | 0.584526 |
1102df483853298d25b5f5af2cb089e29e62f2aa | 3,235 | # encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true
require_relative 'instrumentation'
module NewRelic::Agent::Instrumentation
module Curb
module Chain
def ... | 34.784946 | 93 | 0.671406 |
1c3bcf7640ca09f9c4c7ce0913fc1fed3e1ddc61 | 5,905 | # encoding: UTF-8
require File.expand_path('../test_helper', __FILE__)
class TestNode < Minitest::Test
def setup
@file_name = "model/bands.utf-8.xml"
# Strip spaces to make testing easier
XML.default_keep_blanks = false
file = File.join(File.dirname(__FILE__), @file_name)
@doc = XML::Document.f... | 25.452586 | 125 | 0.683827 |
1cb3a8fc50b90cbfe999e2b46ad11095ac1c8552 | 1,036 | require 'spec_helper'
describe 'datadog_agent::integrations::system_core' do
context 'supported agents' do
ALL_SUPPORTED_AGENTS.each do |agent_major_version|
let(:pre_condition) { "class {'::datadog_agent': agent_major_version => #{agent_major_version}}" }
if agent_major_version == 5
let(:con... | 35.724138 | 104 | 0.661197 |
f84b6c2f2ac38aedd8bc94d0c66da40e491ab759 | 2,723 | module ActsAsCached
module Config
extend self
@@class_config = {}
mattr_reader :class_config
def valued_keys
[ :store, :version, :pages, :per_page, :ttl, :finder, :cache_id, :find_by, :key_size ]
end
def setup(options)
config = options['defaults']
case options[RAILS_ENV]
... | 27.785714 | 125 | 0.660668 |
e209c4bb45746c619f8c5e9d906c22f82481ed91 | 1,129 | class Cc65 < Formula
desc "6502 C compiler"
homepage "https://cc65.github.io/cc65/"
url "https://github.com/cc65/cc65/archive/V2.19.tar.gz"
sha256 "157b8051aed7f534e5093471e734e7a95e509c577324099c3c81324ed9d0de77"
license "Zlib"
head "https://github.com/cc65/cc65.git"
bottle do
sha256 "d0010fe7f4b58d... | 30.513514 | 95 | 0.728078 |
2621c05018c4004e4e0721545f6995ff3d3ca4a0 | 1,544 | module CandidateInterface
class OfferReviewComponent < SummaryListComponent
def initialize(course_choice:)
@course_choice = course_choice
end
def rows
rows = [
provider_row,
course_row,
location_row,
]
rows << conditions_row if @course_choice.offer.conditio... | 23.753846 | 163 | 0.628238 |
336f7713538ab17f353f8d765b64bed5437bf4da | 4,041 | # frozen_string_literal: true
require 'rails_helper'
include Warden::Test::Helpers
# NOTE: If you generated more than one work, you have to set "js: true"
RSpec.feature 'Create a DenverImage' do
let(:user) { User.new(email: 'test@example.com') { |u| u.save(validate: false) } }
let(:admin_set_id) { AdminSet.find_or... | 39.617647 | 179 | 0.693145 |
ac663ab69d7125283ead8df6f2e338a8c1df7721 | 3,648 | module DeviseActiveDirectoryAuthenticatable
class InstallGenerator < Rails::Generators::Base
source_root File.expand_path("../templates", __FILE__)
class_option :user_model, :type => :string, :default => "user", :desc => "User model to update"
class_option :group_model, :type => :string, :default => ... | 32.864865 | 191 | 0.676809 |
ab1b7b92ecc60ca9b1c60a2c258a5256b6217d63 | 40 | module KamiText
VERSION = "0.1.0"
end
| 10 | 19 | 0.675 |
acc31da65b13d120faa53859ea5caaf1c6c30277 | 380 | # A job that downloads and generates thumbnails in the background for an image
# uploaded with the upload bookmarklet.
class UploadPreprocessorDelayedStartJob < ApplicationJob
queue_as :default
queue_with_priority(-1)
def perform(source, referer_url, uploader)
UploadService::Preprocessor.new(source: source, ... | 34.545455 | 101 | 0.807895 |
289d4f547511eaa5feb9f3f5a06c1b90bfef4a5b | 1,309 | # == Schema Information
#
# Table name: element_value_identifier_contents
#
# id :integer not null, primary key
# value :integer
# type :string(255)
# created_at :datetime
# updated_at :datetime
#
require 'spec_helper'
describe ElementValue::PulldownVocabulary do
let(:content){creat... | 23.8 | 77 | 0.667685 |
38ca7e325b1f96e7b82b91c2fa07473ace11991b | 610 | require 'test_helper'
class UsersHelperTest < ActionView::TestCase
test 'roles' do
assert_respond_to roles, :each
end
test 'roles label' do
assert_match /href/, roles_label
end
test 'user taggings' do
@user = users :franco
assert_equal @user.taggings, user_taggings
@user = User.new
... | 16.486486 | 48 | 0.690164 |
f70c5428dff9af0522f24da904b59db6654eff5a | 1,364 | class Bcftools < Formula
desc "Tools for BCF/VCF files and variant calling from samtools"
homepage "https://www.htslib.org/"
url "https://github.com/samtools/bcftools/releases/download/1.11/bcftools-1.11.tar.bz2"
sha256 "3ceee47456ec481f34fa6c34beb6fe892b5b365933191132721fdf126e45a064"
license "MIT"
livech... | 35.894737 | 94 | 0.708944 |
acda1aaf20f28e8232968d12705e90f66648ce69 | 152 | class UsersController < ApplicationController
def index
@users = User.all
end
def show
@user = UserDecorator.find(params[:id])
end
end
| 15.2 | 45 | 0.697368 |
b9eab9de2c768624bab7052ad4e8e2c9ae75aaea | 715 | # == Schema Information
#
# Table name: partners
#
# id :bigint not null, primary key
# email :string
# name :string
# send_reminders :boolean default(FALSE), not null
# status :integer default("uninvited")
# created_at :datetime ... | 26.481481 | 70 | 0.581818 |
e956d9c8fe5d8b94b58d2210b41a40abc86f28da | 546 | cask "deepstream" do
version "5.2.1"
sha256 "3a51f7bb5f730367a37b560afc58ca14934af9dfdbd147179f9916809c95db93"
url "https://github.com/deepstreamIO/deepstream.io/releases/download/v#{version}/deepstream.io-mac-#{version}.pkg",
verified: "github.com/deepstreamIO/deepstream.io/"
appcast "https://github.com... | 28.736842 | 117 | 0.754579 |
d53932877775f421f192bf3cd425cd94a7e7d1e0 | 401 | class CreateEvents < ActiveRecord::Migration[5.1]
def self.up
create_table :events do |t|
t.string :name
t.text :description
t.date :occurs_at
t.string :picture
t.string :url
t.string :twitter
t.references :user
t.date :starts_votes_at
t.date :end_votes_at
... | 18.227273 | 49 | 0.625935 |
1c0cc2fb5b2fca3b6e88024117b6ef7a18d3de68 | 625 | require 'rails_helper'
describe "when removing a user's account" do
context "as the user" do
describe "on their profile page" do
before do
user = FactoryGirl.create(:user)
log_in user
visit edit_user_path(user)
end
it "deletes their account", js: true do
c... | 26.041667 | 102 | 0.6512 |
fff817f7721b513e65f2f45a6dafa9908a7fad37 | 928 | class CatController < ApplicationController
rescue_from ActiveRecord::RecordInvalid, with: :creation_error
def index
response = HTTParty.get('http://thecatapi.com/api/images/get?format=xml')
parsed_response = Hash.from_xml(response.body)
if format_data(parsed_response).present?
image = format_da... | 23.794872 | 77 | 0.659483 |
f7352b67e9dac1f5fa01e74c04829891c30187ff | 4,580 | require File.expand_path('../../test_helper.rb', __FILE__)
require File.expand_path('../memory_profiler.rb', __FILE__)
class MemoryProfilerTest < Test::Unit::TestCase
# Stub the plugin instance where necessary and run
# @plugin=PluginName.new(last_run, memory, options)
# date ha... | 42.803738 | 137 | 0.641048 |
e9e3ddf83af233083abb982118364a2681a11bcd | 6,142 | #!/usr/bin/env rackup -s thin
#
# async_chat.ru
# raggi/thin
#
# Created by James Tucker on 2008-06-19.
# Copyright 2008 James Tucker <raggi@rubyforge.org>.
# Uncomment if appropriate for you..
EM.epoll
# EM.kqueue # bug on OS X in 0.12?
class DeferrableBody
include EventMachine::Deferrable
def initiali... | 24.766129 | 111 | 0.564311 |
1a13563cb5354d598bb7ddd360fa73bd3ef7fb80 | 198 | class <%= class_name %>Processor < ApplicationProcessor
subscribes_to :<%= singular_name %>
def on_message(message)
logger.debug "<%= class_name %>Processor received: " + message
end
end | 24.75 | 66 | 0.712121 |
ed3c35662e884767b2de1eaaf53fe6be2229378c | 5,746 | # frozen_string_literal: true
# == Schema Information
#
# Table name: tags
#
# id :integer not null, primary key
# name :string(255) default("latest"), not null
# repository_id :integer not null
# created_at :datetime not null
# updated_at :datetime ... | 32.834286 | 84 | 0.678559 |
1de7a2e86fb4a69d87c41b1aa150df28b8091a6f | 2,828 | module Kabu
include Numo
class PatternStrategy < Strategy
def initialize
@length = 102
end
def set_env
@closes = Soks.parse(@soks[0..-2], :close)
@open = @soks[-1].open
@soks = @soks[0..-2]
end
def decide(env)
buy_patterns = [Pattern.double_bottom1,
... | 25.709091 | 83 | 0.51662 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.