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 |
|---|---|---|---|---|---|
382ed4bb1d42fec302efd73e17563df6e8b01a3e | 1,777 | module VestalVersions
# Allows specific versions to be tagged with a custom string. Useful for assigning a more
# meaningful value to a version for the purpose of reversion.
module VersionTagging
extend ActiveSupport::Concern
# Adds an instance method which allows version tagging through the parent objec... | 34.173077 | 102 | 0.708497 |
332076debc72e504855b3bdd8f2239108f8ebb94 | 446 | require 'require_all'
require_all File.dirname(__FILE__) + '/data-scrapper/'
# -*- coding: utf-8 -*-
# how I run test for data-wrangler DataWrangler::Annotate::Compound.by_inchikey("BRMWTNUJHUMWMS-LURJTMIESA-N")
module DataScrapper
module Annotate
# autoload the compound annotation and protein annotation modul... | 34.307692 | 111 | 0.76009 |
62f3722a39296748ac4ced192b1c1b454fdc91ea | 8,018 | # frozen_string_literal: true
require "set"
RSpec.describe "The library itself" do
def check_for_git_merge_conflicts(filename)
merge_conflicts_regex = /
<<<<<<<|
=======|
>>>>>>>
/x
failing_lines = []
each_line(filename) do |line, number|
failing_lines << number + 1 if line ... | 32.330645 | 148 | 0.681841 |
bb84c2b960f4cbbf1225a93d202efe44f8e29f27 | 1,130 | class Dcled < Formula
desc "Linux driver for dream cheeky USB message board"
homepage "https://www.jeffrika.com/~malakai/dcled/index.html"
url "https://www.jeffrika.com/~malakai/dcled/dcled-2.2.tgz"
sha256 "0da78c04e1aa42d16fa3df985cf54b0fbadf2d8ff338b9bf59bfe103c2a959c6"
bottle do
cellar :any
sha256... | 36.451613 | 93 | 0.726549 |
628977ee8c7ff02698d34b4fd3355f281b96c475 | 403 | class CreateVersions < ActiveRecord::Migration[4.2]
def change
create_table :versions do |t|
t.string :item_type, null: false
t.integer :item_id, null: false
t.string :event, null: false
t.string :whodunnit
t.jsonb :object
t.jsonb :object_changes
t.date... | 26.866667 | 51 | 0.627792 |
ac9d5f4875bc96f18d737b4675d7bae0b9fc3fb9 | 825 | require 'minitest/autorun'
require 'exchange_rate_history'
require 'exchange_rate_history/source'
require 'exchange_rate_history/sources/ECB90Day'
require_relative 'exchange_rate_history/helpers.rb'
class ExchangeRateHistoryTest < Minitest::Test
def setup
# nothing
end
def teardown
# nothing
end
... | 23.571429 | 59 | 0.762424 |
4a864a007d6ba0e3f8c646235a5e16990dc3f7cc | 295 | shared_examples 'an idempotent resource' do
it 'should run with changes and no errors' do
expect(@result.exit_code).to eq 2
end
it 'should run a second time without changes' do
result = apply_manifest_on_with_exit(get_working_node, @pp)
expect(result.exit_code).to eq 0
end
end
| 26.818182 | 61 | 0.752542 |
1aecb40046f4e5f4740a02e38e343659e5849302 | 1,135 | require 'rmagick'
imgl = Magick::ImageList.new
imgl.new_image(400, 150) { self.background_color = 'white' }
gc = Magick::Draw.new
gc.stroke('black').stroke_width(15)
gc.fill_opacity(0)
gc.stroke_linecap('butt')
# Draw lines with miter join
gc.stroke_linejoin('miter')
gc.polyline(25, 100, 75, 25, 125, 100)
# Draw l... | 23.645833 | 60 | 0.701322 |
f736a7db774d0630aec42e7a40ce17ef15ee3089 | 1,622 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::SidekiqMiddleware::WorkerContext::Server do
let(:worker_class) do
Class.new do
def self.name
"TestWorker"
end
# To keep track of the context that was active for certain arguments
cattr_accessor(:contexts)... | 22.84507 | 92 | 0.673243 |
1c7c30cddc2df96643a2636d76d7aa937dc82ce6 | 330 | module Ecm
module Frontend
module Generators
class SimpleNavigationGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
def generate_config
template "config_navigation.rb", "config/navigation.rb"
end
end
end
end
en... | 23.571429 | 65 | 0.633333 |
ab96e0d0f0b3fec1fea0eef7abb746bd9b008be2 | 108 | class Aggregator < Thor
module Constants
SETTINGS = YAML.load_file('config/settings.yml')
end
end
| 13.5 | 52 | 0.722222 |
f76cafb4d1fcc72b8efe7b76761f1d1e7a4ec162 | 5,431 | # -*- encoding: utf-8 -*-
#
module Brcobranca
module Boleto
class Itau < Base # Banco Itaú
# Usado somente em carteiras especiais com registro para complementar o número do cocumento
attr_reader :seu_numero
validates_length_of :agencia, maximum: 4, message: 'deve ser menor ou igual a 4 dígitos.... | 40.834586 | 118 | 0.607807 |
f75314a48d8f8e03b71d7b60939daaf53b1d186e | 342 | str1 = "Qoo"
str2 = "Qoo"
# compare two string
if str1 == str2
puts "str1 == str2"
else
puts "NOT str1 == str2"
end
# compare two string
if str1.eql?(str2)
puts "str1.eql?(str2)"
else
puts "NOT str1.eql?(str2)"
end
# compare two String object
if str1.equal?(str2)
puts "str1.equal?(str2)"
else
puts "NOT ... | 14.869565 | 30 | 0.654971 |
012b4c8a7c0846d8e0fc9c17b70561f18f5ee942 | 149 | module Stupidedi
BlankSlate =
if RUBY_VERSION < "1.9"
require "blankslate"
::BlankSlate
else
::BasicObject
end
end
| 12.416667 | 27 | 0.597315 |
acee8ebc0bd7442781bd85db7e26457714e5218d | 1,031 | class SongsController < ApplicationController
def index
@songs = Song.all
end
def show
@song = Song.find(params[:id])
end
def new
@song = Song.new
end
def upload
CSV.foreach(params[:file].path, headers: true) do |song|
s = Song.create(title: song[0]) unless !song[0]
artist ... | 15.861538 | 70 | 0.621726 |
08db902ad040a277079b9195c90b94dd76bc74d4 | 1,674 | # encoding: utf-8
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# /spec/fixtures/responses/whois.centralnic.com/uy.com/status_available.expected
#
# and regenerate the tests with the following rake task
#
# $ rake genspec:parsers
#
require 'spec_helpe... | 23.577465 | 87 | 0.678614 |
e25a61a2991eede22235b52d7baf1f02082b3825 | 1,705 | require 'rails_helper'
module Logical
describe UrlCreator do
describe "#create" do
let(:new_url) { "http://www.url.com" }
let(:owner_identifier) { Logical::Uuid.generate }
it "creates a new small URL" do
expect { Logical::UrlCreator.new(new_url, owner_identifier).create }.
to... | 33.431373 | 92 | 0.639296 |
081196c1ad1bd487bb96ddf5c7921b08910aa994 | 1,167 | =begin
#Tatum API
## Authentication <!-- ReDoc-Inject: <security-definitions> -->
OpenAPI spec version: 3.9.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 3.0.31
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Tatum::ScryptaTxScriptSig
# Autom... | 24.829787 | 102 | 0.727506 |
3991b54c29aea80ac0cea5c9cfc8a8afee3cf17b | 5,194 | module Match
class Runner
attr_accessor :changes_to_commit
def run(params)
FastlaneCore::PrintTable.print_values(config: params,
hide_keys: [:workspace],
title: "Summary for match #{Match::VERSION}")
params[:wo... | 42.92562 | 170 | 0.665961 |
38975c7fdd5159054f67209548c5bb8d860c1f4a | 867 | require_relative "lib/h3/version"
Gem::Specification.new do |spec|
spec.name = "h3"
spec.version = H3::VERSION
spec.licenses = ["MIT"]
spec.summary = "C Bindings for Uber's H3 library"
spec.homepage = "https://github.com/StuartApp/h3_ruby"
spec.authors = ["Lachlan Laycock", "Sean Handley"]
spec.em... | 33.346154 | 62 | 0.687428 |
33924ee2f4e4acf01a04dd4e3079856489ab4532 | 10,349 | #%Header {
##############################################################################
#
# File adanaxis-data/spaces/level25/space.rb
#
# Copyright: Andy Southgate 2002-2007, 2020
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (t... | 29.48433 | 88 | 0.580926 |
4a510b766d2163a2ef8870c98ff489a80fdcbaa6 | 3,049 | require 'httparty'
require 'active_support/all'
require 'nokogiri'
require 'nokogumbo'
module CryptoNews
class BotNewsScraper
def initialize
@url = Rails.application.credentials.telegram[:news_api]
end
# scrape_articles takes in the time interval to scrape and returns
# a list of newly posted ... | 42.943662 | 163 | 0.706461 |
ab1092782eeee4730d4575e887b240b0bf3bcbc8 | 363 | RSpec::Matchers.define :be_uniq do
match do |actual|
values_match? actual.uniq, actual
end
failure_message do |actual|
diff = actual.to_a.dup
actual.uniq.each { |value| diff.delete_at diff.index(value) }
diff = diff.uniq
"expected that #{actual.inspect} to be uniq, but found the following rep... | 27.923077 | 108 | 0.705234 |
ac8ef4e1ff4696370f653ab3d514be2d356e93e9 | 1,114 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Cabbage
class Application < Rails::Application
# Settings in config/environments/* take prece... | 41.259259 | 99 | 0.733393 |
0158001ca416a81a01e52c7fde0b57b9a2353f32 | 1,238 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-swf'
spec.... | 38.6875 | 137 | 0.663166 |
28779a9671c43cfdc46f106f72f5c540b0844a2d | 39 | module Wso2soap
VERSION = "0.0.1"
end | 13 | 19 | 0.692308 |
acf9fe4df2aecf2842bf59c5e8d23b40efa9283d | 343 | cask "eaglefiler" do
version "1.9.2"
sha256 "79b864922d251186944a6fa147193b1ab4cbafc740bd204d9e826735380318c6"
url "https://c-command.com/downloads/EagleFiler-#{version}.dmg"
appcast "https://c-command.com/eaglefiler/help/version-history"
name "EagleFiler"
homepage "https://c-command.com/eaglefiler/"
ap... | 28.583333 | 75 | 0.763848 |
e28d9a57f2997608a1dcbf90d5e922ad2b313c67 | 612 | # frozen_string_literal: true
require "fbase_auth"
require "webmock/rspec"
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_pa... | 27.818182 | 93 | 0.732026 |
391e1756330afb3e77a670755775f7a7a62ffeca | 2,298 | # frozen_string_literal: true
module Cask
class Cmd
class List < AbstractCommand
option "-1", :one, false
option "--versions", :versions, false
option "--full-name", :full_name, false
option "--json", :json, false
def self.usage
<<~EOS
`... | 31.916667 | 106 | 0.585292 |
ac310d19045c1ce58d42886239c83eb6563f247e | 2,548 | require 'spec_helper'
require 'resource_helper'
describe DataPackage::Resource do
it "should initialize and serialize" do
resource = DataPackage::Resource.new(base_path, standard_resource)
resource.format.should == 'csv'
resource.name.should == 'standard'
resource.path.should == 'standard.csv'
... | 30.333333 | 101 | 0.669152 |
6a929093332a0c223e80c83bed5606748cd462c3 | 57 | name 'influxdb-test'
version '0.0.1'
depends 'influxdb'
| 11.4 | 20 | 0.719298 |
38b779dae4f6472fdeaa22732843dd9519bbb900 | 1,345 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'sengiri_yaml/version'
Gem::Specification.new do |spec|
spec.name = "sengiri_yaml"
spec.version = SengiriYaml::VERSION
spec.authors = ["sue445"]
spec.email = [... | 37.361111 | 78 | 0.701859 |
e2a57c010b301aa18f27c7d260f16d3f4b1c5c27 | 1,129 | module HtmlMockup::Release::Finalizers
class Zip < Base
attr_reader :release
# @option options :prefix Prefix to put before the version (default = "html")
# @option options :zip The zip command
def call(release, options = {})
if options
options = @options.dup.update(options)... | 26.880952 | 83 | 0.577502 |
b9bd5c7356f9eedebc78f0291062a88340b50e73 | 5,141 | #--
# Copyright (c) 2007-2009, John Mettraux, jmettraux@gmail.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... | 24.364929 | 79 | 0.596771 |
ffcd52346656dbf57a9fb1e842e45a9fa1ab8a62 | 1,886 | #encoding: utf-8
require 'rubygems'
require 'sinatra'
require 'sinatra/reloader'
require 'sinatra/activerecord'
set :database, "sqlite3:barbershop.db"
class Client < ActiveRecord::Base
validates :name, presence: true, length: { minimum: 3 }
validates :phone, presence: true, length: { in: 6..12 }
validates :barber,... | 19.645833 | 126 | 0.683457 |
bb652f2884e21b9b9728413d0c4f2a5b4f3ccf8a | 394 | class User < ApplicationRecord
has_secure_password
has_many :movie_logs
has_many :movies, through: :movie_logs
validates :name, presence: true
validates :email, presence: true, uniqueness: true
def self.from_omniauth(auth)
self.where(email: auth["info"]["email"]).first_or_create do |u|
u.name = a... | 26.266667 | 67 | 0.705584 |
e975ee5b52fa03368900d951aae0d93d88d5c749 | 4,677 | require_relative '../../../spec_helper_min'
require_relative '../../../support/helpers'
describe Carto::Superadmin::UserMigrationImportsController do
include HelperMethods
let(:superadmin_headers) do
credentials = Cartodb.config[:superadmin]
{
'HTTP_AUTHORIZATION' => ActionController::HttpAuthentica... | 32.706294 | 114 | 0.672653 |
613280bcc28c68fa4dca1125744f1b3419fb059b | 3,445 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Capybara::Selector::RegexpDisassembler do
it 'handles strings' do
verify_strings(
/abcdef/ => %w[abcdef],
/abc def/ => ['abc def']
)
end
it 'handles escaped characters' do
verify_strings(
/abc\\def/ => %w[abc\def],... | 21.942675 | 90 | 0.458926 |
333c4ddf1912b314dfef4ef14fc1fe8d6deb6862 | 403 | module APNS
class NotificationResponse
def initialize(response)
@response = response
end
def success?
@response.success?
end
def device_unsubscribed?
@response.validation_error? &&
@response.body['errors'] &&
@response.body['errors']['device'] &&
... | 19.190476 | 65 | 0.602978 |
eddd1846760a43f0ee6ac621d5854fb13c0e9eaa | 1,092 | # (c) Copyright 2017 Hewlett Packard Enterprise Development LP
#
# 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.0
#
# Unless required by applicable law... | 45.5 | 91 | 0.770147 |
ff75135481236764d08991ec2df044884fa69ff8 | 1,268 | require 'rails_helper'
RSpec.feature 'SMS appointment reminders' do
scenario 'Executing the SMS appointment reminders job' do
travel_to '2017-11-28 08:00 UTC' do
given_appointments_due_sms_reminders_exist
when_the_task_is_executed
then_the_required_jobs_are_scheduled
end
end
def given_... | 36.228571 | 107 | 0.746845 |
edfc80ef33c8e58f39cc1a9a3a842961e216ee1d | 305 | module ConcertoRemoteVideo
class RemoteVideoController < ConcertoRemoteVideo::ApplicationController
def preview
@video_data = RemoteVideo.preview({
video_vendor: params[:video_vendor],
video_id: params[:video_id]
})
render json: @video_data
end
end
end | 25.416667 | 74 | 0.688525 |
33dbd7cdda230a82622a174fc776743d9abea099 | 2,489 | require File.dirname(__FILE__) + '/../spec_helper'
module VoteSpecHelper
def valid_vote_attributes
{
:choice_id => choices(:topic_one_choice_one).id,
:irc_nick => '_matta_'
}
end
end
describe Vote do
fixtures :topics, :choices, :votes
include VoteSpecHelper
include UsersX... | 25.927083 | 98 | 0.686621 |
2116978bb3f01fdf638ad7d2dfb99de12234f241 | 116 | ENV['RAILS_ENV'] = 'test'
require_relative './dummy/config/environment'
Rails.backtrace_cleaner.remove_silencers!
| 19.333333 | 45 | 0.793103 |
ed8da6e970a0677312dc03b9bfb8ad7b155c1f7c | 4,748 | # 808b062e576afed924691af91bd7061f
# Generated: 2008-09-22 16:25:11
################################################################################
# require File.dirname(__FILE__) + '/../../spec_helper'
# require File.dirname(__FILE__) + '/fixtures/classes'
#
# describe "Array#zip" do
# it "returns an array of arr... | 33.914286 | 91 | 0.513479 |
398a728e8299d9a8c71bea9b68c9fa4d3f0bbf19 | 459 | # 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::V2020_05_01
module Models
#
# Defines values for VirtualNetworkGatewayConnectionType
#
module VirtualNetworkGatewayConnectionTy... | 25.5 | 70 | 0.716776 |
ab3e414df3c925f3e9d28818660727983b5c414b | 550 | require 'json'
require 'ginko/name_query'
module Ginko
class BankMap
include NameQuery
load_path = File.join(File.dirname(__FILE__), '../../data/banks.json')
@@data = JSON.parse(File.read(load_path)).freeze
def initialize
@result = {}
end
def find_by(k, v)
bank_data = data.select... | 16.666667 | 74 | 0.592727 |
ed2f76b47ffeb531614376966eb004eccb5c5ce7 | 1,024 | # encoding: utf-8
require 'test_helper'
class I18nLocaleTagSimpleTest < Test::Unit::TestCase
include I18n::Locale
test "returns 'de' as the language subtag in lowercase" do
assert_equal %w(de Latn DE), Tag::Simple.new('de-Latn-DE').subtags
end
test "returns a formatted tag string from #to_s" do
asser... | 31.030303 | 112 | 0.696289 |
115ea503f4452db62a856b3076b38955ba493926 | 7,928 | class User < ActiveRecord::Base
include Authorization::StatefulRoles
include Activities::User
COUNTERS_TO_RELEVANCE = {
"topicos_count" => "user_relevancia_peso_topicos",
"inspirations_count" => "user_relevancia_peso_inspiracoes",
"comments_count" => "user_relevancia_peso_comentarios",
"... | 26.965986 | 136 | 0.644551 |
5d20b4a58139be9ae56483d8d4471024888a4932 | 1,058 | cask "netnewswire" do
version "6.0.1"
sha256 "0b18c95a269ab1b1ea61fe4f7b74176c8a3fbc3abf89ec983e0bccfd38687e79"
url "https://github.com/brentsimmons/NetNewsWire/releases/download/mac-#{version}/NetNewsWire#{version}.zip",
verified: "github.com/brentsimmons/NetNewsWire/"
name "NetNewsWire"
desc "Free an... | 39.185185 | 111 | 0.76087 |
4a2ac69b04eb602a0a154749ce67b059835f0ddc | 6,589 | #--
# Copyright:: Copyright (c) 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | 25.440154 | 201 | 0.630293 |
39dff3205f937254a80361c6597d408b2e0b1769 | 753 | require 'rubygems'
gem 'rspec'
require 'folder_cleaner'
describe FolderCleaner do
before :each do
@path = "dirpath"
@dir_handler = mock("dir_handler").as_null_object
end
it "should remove an empty folder" do
set_directory_contents(@path, @dir_handler, [])
@dir_handler.should_receive(:delete).w... | 25.965517 | 79 | 0.722444 |
62c88bc047b859f33fc975b18243eb46997db1b7 | 1,124 | # frozen_string_literal: true
module RuboCop
module Cop
module RSpec
# Checks that right braces for adjacent single line lets are aligned.
#
# @example
#
# # bad
# let(:foobar) { blahblah }
# let(:baz) { bar }
# let(:a) { b }
#
#... | 23.914894 | 75 | 0.512456 |
33dd0da369d86294c9d1d20a64e2d9954191c43e | 586 | # This migration comes from acts_as_taggable_on_engine (originally 5)
# This migration is added to circumvent issue #623 and have special characters
# work properly
if ActiveRecord.gem_version >= Gem::Version.new('5.0')
class ChangeCollationForTagNames < ActiveRecord::Migration[4.2]; end
else
class ChangeCollationF... | 41.857143 | 159 | 0.803754 |
b96a63469fe526834cf0725c39dbc8f618722b2a | 522 | module Sector
def self.included(stocks)
stocks.extend(ClassMethods)
end
module ClassMethods
@@base_uri = "https://www.alphavantage.co/query?"
def get_sector_performance(apikey)
begin
response = HTTParty.get("#{@@base_uri}function=SECTOR&apikey=#{apikey}")
rescue
return "O... | 23.727273 | 94 | 0.66092 |
61b5e5df96f7ab4614fe381185093eb6a80eb15e | 455 | module HelperModule
def logged_in?
!current_user.nil?
end
def log_in(user)
session[:user_id] = user.id
end
def remember(user)
cookies.permanent.signed[:user_id] = user.id
end
def current_user
@current_user ||= User.return_current_user(session[:user_id]) if session[:user_id]
end
def... | 16.851852 | 86 | 0.692308 |
267d13381f4ab6ae94b8aa28fa5d3b7687993ced | 1,090 | module ActivityActionsHelper
def toggle_follow_action(activity_object)
action = activity_object.action_from(current_subject)
action ||= activity_object.received_actions.build :actor_id => current_subject.actor_id
action.follow ^= true
action
end
# Show the {SocialStream::Models::Subject Subject... | 30.277778 | 197 | 0.722018 |
b93afa0e7a5401d94e40ce8158d7c4f2fbd153db | 483 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::CloudHSMV2
class Resource
# @param options ({})
# @option options [Client] :client
de... | 20.125 | 74 | 0.670807 |
28536e359e51c538e3bbfc8fe2bedef816eb7a73 | 1,456 | class UploadsController < ApplicationController
skip_before_action :authenticate_user!
before_action :find_model, :authorize_access!
def show
uploader = @model.send(upload_mount)
unless uploader.file_storage?
return redirect_to uploader.url
end
unless uploader.file && uploader.file.exists... | 20.222222 | 59 | 0.649038 |
38824d06dae526ce9426f92518cd48e4b1a3d227 | 1,449 | # frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[6.1]
def change
create_table :users do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.stri... | 30.829787 | 104 | 0.648723 |
2894557b12b95f1bcb38ef9f7584240eebd25b07 | 232 | require 'alquran'
RSpec.describe Alquran::Edition do
describe 'index' do
before :all do
@editions = Alquran::Edition.fetch
end
it 'must have number' do
expect(@editions.size).to be(135)
end
end
end
| 16.571429 | 40 | 0.650862 |
f88233393c6ae7df0b9b7c737c5375e543ddd02f | 217 | class MoveComprehensionQuestionsToCohortExercises < ActiveRecord::Migration
def change
remove_reference :comprehension_questions, :exercise
add_reference :comprehension_questions, :cohort_exercise
end
end
| 31 | 75 | 0.83871 |
bbcbe0cf2a01ee0599c2d0ebec347f27220b8e9a | 407 | #!/usr/bin/env ruby
nkill = rand(5)
ngot = 0
done = false
args = ARGV.join(' ')
Signal.trap("INT") do
ngot += 1
end
puts "pid=#{$$},args=#{args}ngot=#{ngot}/#{nkill},state=entering"
while not done
sleep 1
if ngot < nkill
puts "pid=#{$$},args=#{args}ngot=#{ngot}/#{nkill},state=continuing"
else
puts... | 17.695652 | 71 | 0.597052 |
625e1076a54f1fe663f880d11f431aeb06cd5595 | 3,600 | # frozen_string_literal: true
# Usage data utilities
#
# * distinct_count(relation, column = nil, batch: true, start: nil, finish: nil)
# Does a distinct batch count, smartly reduces batch_size and handles errors
#
# Examples:
# issues_using_zoom_quick_actions: distinct_count(ZoomMeeting, :issue_id),
#
#... | 31.304348 | 134 | 0.6725 |
113caf0e498c3fd4a937cf5a720aae20a1f33375 | 5,224 | module Binance
module Api
class Order
class << self
def all!(limit: 500, orderId: nil, recvWindow: 5000, symbol: nil, api_key: nil, api_secret_key: nil)
raise Error.new(message: "max limit is 500") unless limit <= 500
raise Error.new(message: "symbol is required") if symbol.nil?
... | 51.722772 | 118 | 0.612366 |
28ffd9d395775ccbeb0f6779d4bfc8081c9a7c09 | 1,316 | module Chewy
class Type
module Observe
extend ActiveSupport::Concern
def self.update_proc(type_name, *args, &block)
options = args.extract_options!
method = args.first
Proc.new do
backreference = if method && method.to_s == 'self'
self
elsif me... | 24.37037 | 75 | 0.587386 |
38c2f5f23ba3772dff80a8aa7ae39969e78af228 | 1,831 | require 'rack'
require 'jasny_bundle/mime_types'
module JasnyBundle
class Middleware
def initialize(app, origin, options={})
@app = app
@origin = origin
@options = options
@mime_types = JasnyBundle::MimeTypes.new(Rack::Mime::MIME_TYPES)
end
def access_control_headers
{
... | 21.797619 | 83 | 0.587657 |
4a6b526dc91cdcdfa28121e09183b026dc0c2592 | 1,815 | class TeamMembersController < ApplicationController
layout 'team'
def send_welcome_email
@team_member = TeamMember.find(params[:id])
authorize @team_member
@team_member.send_welcome!(current_user.id)
redirect_to team_team_members_url(current_team), :notice => 'Welcome email sent'
end
def new
... | 27.5 | 113 | 0.734435 |
edaf1950bc79f109be0676a0d65ad5ffe5d8afd6 | 349 | module ResponsesHelper
def options_for_responses_select(issue)
responses = issue.available_responses
tags = "".html_safe
blank_text = "-- #{l(:label_responses)} --"
tags << content_tag('option', blank_text, :value => '') if responses.size > 1
tags << options_for_select(responses.map { |r| [r.name,... | 31.727273 | 81 | 0.670487 |
33165d5e81c28b01a4f1c933be45910d17f84fe0 | 1,307 | #!/home/software/ruby-1.8.7/bin/ruby -w
require 'RMagick'
imgl = Magick::ImageList.new
imgl.new_image(390, 240, Magick::HatchFill.new('white','lightcyan2'))
gc = Magick::Draw.new
# Draw path
gc.fill_opacity 0
gc.stroke 'red'
gc.stroke_width 3
gc.path "M20,120 C20,20 170,20 170,120 S320,220 320,120"
# Annotate
# Sho... | 20.107692 | 69 | 0.704667 |
1cdc438d2545ef421673e2bda63ecfef2f6b427d | 100 | module Spree
module Admin
class PriceFiltersController < ResourceController
end
end
end
| 14.285714 | 53 | 0.76 |
ab7b1b52017b36d31711cb7d9129d33d6f727fe2 | 14,445 | RSpec.describe UnifonicSms do
describe "Default Attributes" do
it "has a version number" do
expect(UnifonicSms::VERSION).not_to be nil
end
it "Can get base path based on method url" do
url = UnifonicSms.base_path("Messages/Send")
expect(url).not_to be "/rest/Messages/Send"
end
... | 40.125 | 121 | 0.407823 |
1d59f52abd06a9e14bcaa78152931c1046c8cf26 | 1,344 | require 'angular-rails-templates/compact_javascript_escape'
module AngularRailsTemplates
class Processor
AngularJsTemplateWrapper = Tilt::ERBTemplate.new "#{File.dirname __FILE__}/javascript_template.js.erb"
include CompactJavaScriptEscape
def self.instance
@instance ||= new
end
def sel... | 24.436364 | 106 | 0.668155 |
5d3407b3e43a4ac5fe1ffab752aadb50c19c47bd | 1,684 | # Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
#
# The MIT License (MIT)
#
# 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 limi... | 38.272727 | 79 | 0.720903 |
e214d943288c2c8afde783fd84f932538fb79393 | 2,007 | cask 'bluestacks' do
version '4.70.5.2403'
sha256 '423a56ea65d05f26d07606349ffae9f1719453fd71a8b066c35c1652b9c7edc9'
url "https://cdn3.bluestacks.com/downloads/mac/bgp_mac/#{version}/BlueStacksInstaller_#{version}.dmg"
appcast 'https://macupdater.net/cgi-bin/check_urls/check_url_redirect.cgi?url=https://cloud.... | 48.95122 | 170 | 0.671151 |
339dc3ab833351103ccbc4a933079a0107efa477 | 2,983 | require_relative '../../spec_helper'
describe 'osl-keepalived::haproxy_phpbb' do
before do
stub_data_bag_item('osl_keepalived', 'haproxy_phpbb').and_return(
id: 'haproxy_phpbb',
auth_pass: 'foobar'
)
end
ALL_PLATFORMS.each do |p|
context "#{p[:platform]} #{p[:version]}" do
cached(:c... | 33.144444 | 119 | 0.598056 |
912f3684168e0277db256f74f2e3724344d62786 | 355 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'abbyy'
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
... | 27.307692 | 69 | 0.721127 |
f7fdbc431204337f0eec3fffd095429feca7abf4 | 294 | module Spree::ShippingMethodDecorator
def self.prepended(base)
base.translates :name, fallbacks_for_empty_translations: true, versioning: :paper_trail
end
Spree::ShippingMethod.include SpreeGlobalize::Translatable
end
::Spree::ShippingMethod.prepend(Spree::ShippingMethodDecorator)
| 29.4 | 91 | 0.819728 |
284d712964c163e34671ffbd1dec6ee983f5704e | 2,989 | require 'rails_helper'
RSpec.describe '/accounts', type: :request do
let(:user) { create(:user, :with_accounts) }
let(:account) { user.accounts.first }
before do
sign_in user
end
describe 'GET /index' do
it 'renders a successful response' do
get accounts_url
expect(response).to be_succe... | 25.767241 | 80 | 0.645366 |
bb2a661a54b49bc71865f668bff66c5bb9e4e923 | 788 | require "rails_helper"
RSpec.describe AccidentOrIncidentTypeForm, :with_stubbed_opensearch, :with_test_queue_adapter do
# Default set of valid attributes
let(:type) { "Accident" }
let(:params) do
{
type: type
}
end
let(:form) { described_class.new(params) }
describe "validations" do
con... | 19.7 | 96 | 0.615482 |
ff2e2150fcbd7bb26777b85c8ed3d94252705b6e | 180 | class RemoveFileFromPassagesAndArtifacts < ActiveRecord::Migration[5.2]
def change
remove_column :artifacts, :file, :file
remove_column :passages, :file, :file
end
end
| 25.714286 | 71 | 0.755556 |
28585ca85a820bb6561c5aa10807d696efa85646 | 139 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_fifabot_session'
| 34.75 | 77 | 0.805755 |
ffc6d839295752d7ffc12ea99c7bbeb4d2406697 | 1,488 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'bomdb/version'
Gem::Specification.new do |spec|
spec.name = "bomdb"
spec.version = BomDB::VERSION
spec.authors = ["Duane Johnson"]
spec.email = ["duane.johnso... | 41.333333 | 103 | 0.62164 |
5da7803e09d9f8a3ea4e75dc737dc5356f3cff2a | 628 | require "knife_spec_helper"
describe Chef::Knife::TagList do
before(:each) do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::TagList.new
@knife.name_args = [ Chef::Config[:node_name], "sadtag" ]
@node = Chef::Node.new
allow(@node).to receive :save
@node.tags << "sad... | 26.166667 | 61 | 0.643312 |
6190dd5bc046a8ea66816502d7c1f221dccdad77 | 511 | require 'ebay_trading/types/store_vacation_preferences'
module EbayTrading # :nodoc:
module Types # :nodoc:
# == Attributes
# object_node :vacation_preferences, 'VacationPreferences', :class => StoreVacationPreferences, :optional => true
class StorePreferences
include XML::Mapping
include In... | 30.058824 | 118 | 0.739726 |
28cf795afab5a2f5110d9740b2cc7cb111321bb3 | 7,350 | # frozen_string_literal: true
require 'logger'
require 'memoize'
require 'obj'
require 'travis/yml/helper/obj'
Obj.include Memoize, Travis::Yml::Helper::Obj
require 'json'
require 'travis/yml/config'
require 'travis/yml/configs'
require 'travis/yml/errors'
require 'travis/yml/doc'
require 'travis/yml/docs'
require 't... | 36.029412 | 123 | 0.59415 |
7a0f37ca26f99ddf17782dbcd8d45d417b8b4c37 | 1,304 | require 'orel'
require 'stringio'
Orel.logger = Logger.new(File.dirname(__FILE__) + "/../../log/test.log")
Orel.logger.info "\n\nBeginning test #{Time.now}\n"
ActiveRecord::Base.establish_connection(
:adapter => 'mysql2',
:database => 'orel_test',
:username => 'root'
)
module Orel
module Test
def self.c... | 22.101695 | 72 | 0.575153 |
33b70d5f57f44c19dfb13d9191818bf714f9ad77 | 1,457 | class Newlisp < Formula
desc "Lisp-like, general-purpose scripting language"
homepage "http://www.newlisp.org/"
url "http://www.newlisp.org/downloads/newlisp-10.7.5.tgz"
sha256 "dc2d0ff651c2b275bc4af3af8ba59851a6fb6e1eaddc20ae75fb60b1e90126ec"
bottle do
sha256 arm64_big_sur: "24b3c02002fa7c832d9a817c552b... | 32.377778 | 92 | 0.738504 |
62077bb7185d0090191bb2bfe74a55498181bcde | 7,577 | require "rails_helper"
describe Courses::GenerateCourseNameService do
let(:service) { described_class.new }
let(:subjects) { [] }
let(:is_send) { false }
let(:level) { "primary" }
let(:course) { Course.new(level: level, subjects: subjects, is_send: is_send) }
let(:modern_languages) { find_or_create(:second... | 31.702929 | 122 | 0.623334 |
793095a5a3be596253ecbce7563047a99dcf4102 | 729 | #
# Copyright:: Copyright (c) 2012 Opscode, Inc.
# Copyright:: Copyright (c) 2014 GitLab.com
# 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
#
# ht... | 33.136364 | 74 | 0.748971 |
11434573b9397147b1169e64ece31c7b7b46050d | 269 | class Texmacs < Cask
version '1.99.1'
sha256 'b6aab5bcb263e847c97062824b8852380cab4159306b035fcca199f92d243d51'
url "http://www.texmacs.org/Download/ftp/tmftp/macos/TeXmacs-#{version}.dmg"
homepage 'http://www.texmacs.org/'
app "TeXmacs-#{version}.app"
end
| 26.9 | 78 | 0.754647 |
bb069ccd57990f172dcba99eb18565b5e105e5c5 | 1,415 | shared_examples 'ports::portmap' do
context 'portmap/rpcbind' do
describe port(111) do
it { should be_listening.with('tcp') }
it { should be_listening.with('udp') }
end
end
end
shared_examples 'services::portmap' do
context 'portmap/rpcbind' do
name = 'rpcbind'
check_enabled = true
... | 27.745098 | 69 | 0.619081 |
d5196d9eb72b0da0868bb9d3b915be45d38f8ecf | 476 | # pass a response object to the controller to set
# header status and content.
module Blix::Rest
class Response
attr_accessor :status
attr_reader :headers
attr_accessor :content
def initialize
@status = 200
@headers = {}
@content = nil
end
def set(status,content=nil... | 17.62963 | 49 | 0.647059 |
ab389cf85f8442cf65c380172c8a9d3681967663 | 240 | module Contacts
class Engine < ::Rails::Engine
isolate_namespace Contacts
config.to_prepare do
Dir.glob(Rails.root + "app/decorators/**/*_decorator*.rb").each do |c|
require_dependency(c)
end
end
end
end
| 21.818182 | 76 | 0.658333 |
6a66e81a78ad4904f397aaecc11fce85bc028286 | 982 | # Copyright 2011-2019, The Trustees of Indiana University and Northwestern
# University. 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.0
#
# ... | 40.916667 | 133 | 0.768839 |
1ab1e617485d4d2c2e5b5265c8ea24ce768c7c90 | 3,172 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(name: "Example User",
email: "user@example.com",
password: "foobar",
password_confirmation: "foobar")
end
test "should be valid" do
assert @user.vali... | 27.824561 | 117 | 0.672446 |
263f829f576ac9cda9e708424558f488045f1dd0 | 2,181 | require 'test_helper'
class UsersControllerTest < ActionDispatch::IntegrationTest
def setup
@base_title = "Ruby on Rails Tutorial Sample App"
@user = users(:michael)
@other_user = users(:archer)
end
test "should redirect index when not logged in" do
get users_path
assert_redirected_to login_url... | 29.08 | 78 | 0.640532 |
2656ce5d13980334d0e15819f413d2b576594b2f | 127 | json.extract! client, :id, :name, :address, :phone_number, :created_at, :updated_at
json.url client_url(client, format: :json)
| 42.333333 | 83 | 0.748031 |
f798f32b2cd8f0e616e7adc32af83064f80a9a14 | 544 | cask 'virtualhostx' do
version '8.7.13,80_62'
sha256 'd5dbb0dbbb7e4c5c6d13da6fd538358a717944dbd962273ac47796ae6c963c77'
# downloads-clickonideas.netdna-ssl.com/virtualhostx was verified as official when first introduced to the cask
url "https://downloads-clickonideas.netdna-ssl.com/virtualhostx/virtualhostx#{v... | 36.266667 | 113 | 0.786765 |
f7d530cfb5054de5f6c318695c3b547adbd70443 | 1,456 | # frozen_string_literal: true
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib"))
require "active_record_extended/version"
Gem::Specification.new do |spec|
spec.name = "active_record_extended"
spec.version = ActiveRecordExtended::VERSION
spec.authors = ["Ge... | 44.121212 | 104 | 0.648352 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.