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
ff83a474e6d9cab17fd6837fbed36e89eb74cfda
37
class Kicker VERSION = "3.0.0" end
9.25
19
0.648649
398a81497c2676a76ddd586da64f1c2c189e34fe
4,643
# frozen_string_literal: true # == Schema Information # # Table name: competitions # # id :bigint not null, primary key # champion :string # name :string # season :integer # created_at :datetime not null # updated_at :datetime not null # team_id :bigint # # Index...
30.953333
88
0.665949
791aa4f062f3418a5cbaa9086c4d3f799a78ce4b
1,319
require 'helper' class TestDiagnostic < Minitest::Test def setup @buffer = Parser::Source::Buffer.new('(string)') @buffer.source = 'if (this is some bad code + bugs)' @range1 = Parser::Source::Range.new(@buffer, 0, 2) # if @range2 = Parser::Source::Range.new(@buffer, 4, 8) # this end def test_v...
26.38
78
0.602729
28c7910f54793b8d17be548d6138180b5a265a68
96
CarrierWave.configure do |config| config.dropbox_access_token = ENV['DROPBOX_ACCESS_TOKEN'] end
32
58
0.833333
4a6c73bc6e83981b6d3cd9e2882d6460438e119b
1,187
cask 'fontexplorer-x-pro' do version '5.0.2' sha256 'ef86771fb2acf2eaa3c30b72d51594eda4ab2cd4c9a7454585184460d49b043a' url "http://fast.fontexplorerx.com/FontExplorerXPro#{version.no_dots}.dmg" name 'FontExplorer X Pro' homepage 'https://www.fontexplorerx.com/' depends_on macos: '>= :mountain_lion' app...
47.48
159
0.695872
62809adb24d6e438bed721519799923bf6dc2673
4,601
# This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, without a need to explicitly require ...
44.669903
129
0.743969
113faeb0d2ff9ffd9668729f2860f6b02dfb0844
401
# frozen_string_literal: true require 'spec_helper' RSpec.describe TodosDestroyer::DestroyedDesignsWorker do let(:service) { double } it 'calls the Todos::Destroy::DesignService with design_ids parameter' do expect(::Todos::Destroy::DesignService).to receive(:new).with([1, 5]).and_return(service) expect(...
26.733333
93
0.743142
1a6a65a6234223d722b480b83768050712e64f1c
5,346
## # This module requires Metasploit: https://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## class MetasploitModule < Msf::Exploit::Remote Rank = ExcellentRanking include Msf::Exploit::Remote::SSH def initialize(info={}) super(update_info(info, 'Name' ...
31.633136
162
0.596521
01b37bec6bac43ffb17a7ff3bd7ae5fc8b347d75
985
module Transmission class Arguments class TorrentSet < Transmission::Arguments ATTRIBUTES = [ {field: 'bandwidthPriority'}, {field: 'downloadLimit'}, {field: 'downloadLimited'}, {field: 'downloadLimit'}, {field: 'files-wanted'}, {field: 'files-unw...
28.970588
46
0.509645
6abb689c05fbbfd9fe201e3dbb1fbbc6a2a32da7
960
module Schools class CoursePolicy < ApplicationPolicy def index? # Can be shown to all school admins. user&.school_admin.present? && user.school == current_school end def authors? record.school == current_school && index? end alias attach_images? authors? alias delete_coach...
25.263158
66
0.701042
f86c2c34af63b851cf5b5902570c4e719fa0f6c3
8,611
require "spec_helper" require "json" RSpec.describe ChromeRemote do around(:each) do |example| # TODO should the library implement timeouts on every operation instead? Timeout::timeout(5) { example.run } end WS_URL = "ws://localhost:9222/devtools/page/4a64d04e-f346-4460-be97-98e4a3dbf2fc" before(:eac...
34.444
105
0.63744
911eee749bdd2725e08f31938d68c56009ef539b
719
Pod::Spec.new do |s| # 1 s.platform = :ios s.ios.deployment_target = '8.0' s.name = "NetworkConnectionManager" s.summary = "NetworkConnectionManager allows to send request and parse json response." s.requires_arc = true # 2 s.version = "0.0.1" # 3 s.license = { :type => "MIT", :file ...
19.972222
111
0.603616
d54222f5592e341747dae8ba612204ecae1af311
226
# This migration comes from spree (originally 20130718042445) class AddCostPriceToLineItem < ActiveRecord::Migration def change add_column :spree_line_items, :cost_price, :decimal, :precision => 8, :scale => 2 end end
32.285714
85
0.765487
e9c29fc228cf975d3499ffff9eb542b548d3387a
1,044
class RustcCompletion < Formula desc "Bash completion for rustc" homepage "https://github.com/roshan/rust-bash-completion" license "MIT" head "https://github.com/roshan/rust-bash-completion.git", branch: "master" stable do url "https://github.com/roshan/rust-bash-completion/archive/0.12.1.tar.gz" sha...
33.677419
125
0.768199
380911b6bcc5932ddf98bb07572f27b7714abde6
968
autoload :YAML, 'yaml' module Crayola CURRENT_DIR = File.expand_path(File.dirname(__FILE__)) require_relative 'crayola/scraper' require_relative 'crayola/color' class Crayola class << self attr_reader :series, :colors def init crayola = load_build_file || Scraper.build @series =...
21.043478
66
0.585744
f7a057cbef951922afd96304a1fb05cbc2063287
185
# Adds a convenience method calling both flash and redirect. # This is primarily intended to DRY up controller actions module Respondable def respond flash redirect end end
20.555556
60
0.767568
918eddaa53a906844ab13dfb9f50b8f186e6ce62
1,216
require_relative 'base_service' class DeleteBranchService < BaseService def execute(branch_name) repository = project.repository branch = repository.find_branch(branch_name) unless branch return error('No such branch', 404) end if branch_name == repository.root_ref return error('Can...
23.843137
60
0.686678
bf647e083bb732433609800413e226959de24d8f
405
require_relative "../lib/person" describe Person do describe "#full_name" do it "returns the first and last names concatenated" do person = Person.new(first_name: "Franklyn", last_name: "Smith") expect(person.full_name).to eq "Franklyn Smith" person = Person.new(first_name: "Frankie", last_na...
25.3125
69
0.691358
01fb2fe2872d00665b71c863dcd8b9bc5af65c29
306
require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) task :default => :spec namespace :spec do if RUBY_VERSION > '1.9' && RUBY_PLATFORM =~ /java/ require 'coveralls/rake/task' Coveralls::RakeTask.new task :ci => [:spec, 'coveralls:push'] else task :ci => [:spec] end end
20.4
52
0.650327
6ac4422ca6c4f5f645d0a17f601934e20bb6985e
3,775
require "rest-client" class IssuesController < ApplicationController include IssueGraphicHelper before_action :set_authorization, except: [:update_assignees] before_action :set_project def index client = Adapter::GitHubIssue.new(request) @issues = client.list_issues(@project.github_slug) conver...
24.673203
165
0.681325
e2f84f5e5d88af4f6fc0b1010da13f334e468fc5
730
module QuestionsHelper def available_loop_types section types = [] section.self_and_ancestors.each do |s| if s.loop_item_type types += [ s.loop_item_type ] end end types end def get_matrix_answer_query_results answer_part answer_results = {} answer_part.answer_part_ma...
25.172414
66
0.667123
2109bc1b71ee034e8d48ec1191ead96e9c713894
141
class CreateIms < ActiveRecord::Migration def change create_table :ims do |t| t.string :im t.timestamps end end end
14.1
41
0.64539
4aeaa25b4c8a4644b0ba7164a49213abca2b2710
5,534
require 'rails_helper' # This spec was generated by rspec-rails when you ran the scaffold generator. # It demonstrates how one might use RSpec to specify the controller code that # was generated by Rails when you ran the scaffold generator. # # It assumes that the implementation code is generated by the rails scaffold...
38.971831
124
0.726238
397b69535771b6bc486a7a242043be8e8209ffbf
1,846
module Carto class RateLimitValues extend Forwardable delegate [:<<, :[], :[]=, :all, :clear, :each, :empty?, :flat_map, :first, :length, :pop, :present?, ...
22.512195
106
0.586674
b95b9ac64e52c589fdecc6a2bf549b6ef59fe84c
1,111
require 'spec_helper' describe RegistrationsController, type: :controller do describe 'GET regenerate_api_key' do # Get an 'Could not find devise mapping for path "/regenerate_api_key".' # error without this. before { @request.env['devise.mapping'] = Devise.mappings[:user] } context 'with a signed-i...
31.742857
77
0.666967
ac30f3c011dfab1dff4fe78fd0adde6805b3ad0a
255
# Preview all emails at http://localhost:3000/rails/mailers/account class AccountPreview < ActionMailer::Preview # Preview this email at http://localhost:3000/rails/mailers/account/not_account def not_account AccountMailer.not_account end end
25.5
81
0.788235
288a136ff41e2df345fd0f77432af1b12087408c
1,198
exclude :test_alias, "needs investigation" exclude :test_attr, "needs investigation" exclude :test_classpath, "needs investigation" exclude :test_const_get_invalid_name, "UTF-16 invalid name is accepted as ok, unfinished in initial 2.6 work, #6161" exclude :test_const_set_invalid_name, "UTF-16 invalid name is accepted ...
70.470588
144
0.838898
bb7047f2e43ce2fc8b10e6b387a2f781ddd54399
3,288
module Candidates class SchoolPresenter include TextFormattingHelper attr_reader :school, :profile delegate :name, :urn, :coordinates, :website, to: :school delegate :availability_preference_fixed?, to: :school delegate :experience_details, :individual_requirements, to: :profile delegate :d...
27.630252
87
0.689477
bb5b3e8fd0cf349a1cb48245c3e0a62b5c36dd5d
41
class Occupation < ApplicationRecord end
13.666667
36
0.853659
6acb852646493998cc98951c0289c3fb86e5bb9f
894
module EPlusOut module Relations class Relation attr_reader :gateway, :mapper def initialize(gateway, mapper) @gateway = gateway @mapper = mapper end def name_field raise NotImplementedError, 'Must be implemented by child class' end def clauses ...
21.285714
94
0.600671
ed90af042ce6fa6d0132ffa1c57274ff016d0c15
12,386
require 'rubygems' require 'rubygems/dependency_list' require 'rubygems/package' require 'rubygems/installer' require 'rubygems/spec_fetcher' require 'rubygems/user_interaction' require 'rubygems/source_local' require 'rubygems/source_specific_file' require 'rubygems/available_set' ## # Installs a gem along with all i...
31.198992
117
0.633134
91be82a2259af65c89f87cff9a557aa2f4f7cd50
2,503
class FontNotoSerifLao < Formula head "https://noto-website-2.storage.googleapis.com/pkgs/NotoSerifLao-unhinted.zip" desc "Noto Serif Lao" homepage "https://www.google.com/get/noto/#serif-laoo" def install (share/"fonts").install "NotoSerifLao-Black.ttf" (share/"fonts").install "NotoSerifLao-Bold.ttf" ...
54.413043
85
0.745106
ab581da0159e519385e63b03090e31ada16475b5
267
require 'rails_helper' RSpec.describe "users/show", type: :view do before(:each) do @user = assign(:user, User.create!( username: "Username" )) end it "renders attributes in <p>" do render expect(rendered).to match(/Username/) end end
17.8
43
0.640449
5d285456d752cacd8ffeff83f554b740e4cef8cd
1,490
class Openfst < Formula desc "Library for weighted finite-state transducers" homepage "http://www.openfst.org/twiki/bin/view/FST/WebHome" url "http://openfst.org/twiki/pub/FST/FstDownload/openfst-1.7.9.tar.gz" sha256 "9319aeb31d1e2950ae25449884e255cc2bc9dfaf987f601590763e61a10fbdde" license "Apache-2.0" li...
28.113208
104
0.638255
01d4ab17b077f3ccc1327731e935294423079289
9,311
=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.442509
273
0.638492
f7ac466fa2cc5f4a5361e4e6a829cc9ab341281d
356
# frozen_string_literal: true class ProtocolTest < ProtocolTestBase def setup add_random_operations(1) end def analyze assert_equal(@backtrace.last[:operation], 'complete') rval = @backtrace.last[:rval] test_row = ["P1", "P1", 16, 17, 18, 19, "P2", "P2", 20, 21, 22, 23] assert_equal(rval[:l...
23.733333
71
0.671348
035dc08ed98fd9b170adc1b376d400418fdcc9a6
428
# Be sure to restart your server when you modify this file. # Avoid CORS issues when API is called from the frontend app. # Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests. # Read more: https://github.com/cyu/rack-cors Rails.application.config.middleware.insert_before 0, Rac...
25.176471
92
0.712617
878a87af7b1879a7acf328c3c2011e745e55577b
451
module OpenAgenda module InheritableAttribute def inheritable_attr(name) instance_eval <<-RUBY def #{name}=(v) @#{name} = v end def #{name} @#{name} ||= InheritableAttribute.inherit(self, :#{name}) end RUBY end def self.inherit(klass, name) ...
22.55
94
0.594235
7967176d76b385c6a7887e3b7e0c9d05506ed5ea
277
ark 'test_dump' do url 'https://github.com/burtlo/ark/raw/master/files/default/foo.zip' checksum 'deea3a324115c9ca0f3078362f807250080bf1b27516f7eca9d34aad863a11e0' path '/usr/local/foo_dump' creates 'foo1.txt' owner 'foobarbaz' group 'foobarbaz' action :dump end
27.7
77
0.772563
62d183bf7576f79382bbf551187d2b7872d3e658
1,081
# frozen_string_literal: true # 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. # # This file is the source Rails uses to define yo...
43.24
86
0.774283
33653716adba0c78fea4d74c0ae31b2f91ff473b
295
class UpdateMenuDeleteObject < ActiveRecord::Migration[4.2] def self.up permission = Permission.find_by_name('administer assignments') site_controller = SiteController.create(name: 'delete_object', permission_id: permission.id) Role.rebuild_cache end def self.down; end end
24.583333
96
0.766102
7901261c3fa3a60caa82a22dae1689edcceb7cbf
2,830
#Name: TimeCode #Author: Kai Kousa #Description: Encapsulates TimeCodes and provides tools to convert #string representations to more useful formats. Stores the time in #milliseconds and in string-representation. class TimeCode attr_reader(:time_code_str, :milliseconds) def initialize(time_code) if ti...
25.044248
97
0.633569
1c07e912e62b175a2e81a2c7f15fce64c6d6c970
10,103
# frozen_string_literal: true require "anyway/optparse_config" require "anyway/dynamic_config" module Anyway # :nodoc: using RubyNext using Anyway::Ext::DeepDup using Anyway::Ext::DeepFreeze using Anyway::Ext::Hash using(Module.new do refine Object do def vm_object_id() = (object_id << 1).to_s(16...
25.772959
119
0.621499
1847089082b7041611748c6f77f6c06f43d29175
2,602
# frozen_string_literal: true require "rspec" require "chapter2/linked_lists" describe "SingleLinkedList#remove_dups!" do example "{1,1,1,1,1} should return {1}" do list = ADT::SingleLinkedList.new 5.times do list.add(1) end expect(list.size).to eq(5) expect(list.to_a).to eq([1, 1, 1, 1, 1...
23.441441
75
0.622982
1a40cec184ae73614837b7e35025c4be4b29aace
431
require_relative 'command.rb' module DBP::BookCompiler::TexToMarkdown class ExitEnvironment include Command attr_reader :text def initialize @name = 'end' @pattern = /{([[:alpha:]]+)}/ @text = '</div>' end def write(writer, _) writer.write(text) end def transiti...
16.576923
39
0.600928
01a73b9a62154957e362229cb76a31f82f11b461
1,644
class Gromacs < Formula desc "Versatile package for molecular dynamics calculations" homepage "http://www.gromacs.org/" url "https://ftp.gromacs.org/pub/gromacs/gromacs-2020.1.tar.gz" sha256 "e1666558831a3951c02b81000842223698016922806a8ce152e8f616e29899cf" bottle do sha256 "72d49c0e34e42499f3f415d2eb094...
31.615385
93
0.707421
210d6531913d85e75df3d9b9a2d46850d90563ba
1,058
require 'json' module Wowaddon class Config def initialize create_config unless config_exists? end def data return @data if defined? @data raw_data = JSON.parse(File.read(file)) rescue {} @data = OpenStruct.new default_config.merge(raw_data) end def dir @config_dir...
19.236364
95
0.60586
1d09f346eb7fda9c2ff14d1f423a229c0abae2bd
5,119
require 'httparty' module RTM # Acts as the endopint to RTM actions, providing a means to separate the API's behavior # with interaction with RTM. class Endpoint NO_TIMELINE = { "rtm.contacts.getList" => true, "rtm.groups.getList" => true, "rtm.lists.getList" => true, "rtm.reflection....
34.823129
154
0.627271
7ac574d8fa86e68bfdb91e8ffc3048b88dafb19b
461
# frozen_string_literal: true # require 'spec_helper' # # to re-record a rtm_start fixture run with # SLACK_API_TOKEN=... CONCURRENCY=async-websocket rspec spec/slack/real_time/rtm_start_spec.rb # edit rtm_start.yml and remove the token, fix wss:// path (run specs, fix failures) # # RSpec.describe Slack::RealTime::Cl...
30.733333
94
0.733189
f75860daee18396f52cff0f5d391dd7fec254ede
645
module Fog module Image class OpenStack class V2 class Real def remove_tag_from_image(image_id, tag) request( :expects => [204], :method => 'DELETE', :path => "images/#{image_id}/tags/#{tag}" ) end en...
24.807692
57
0.514729
f829c70e038d362cc87bbae64b85a19d471a9141
3,418
class Tm < Formula desc "TriggerMesh CLI to work with knative objects" homepage "https://triggermesh.com" url "https://github.com/triggermesh/tm/archive/v1.3.0.tar.gz" sha256 "643cb0d24886bcca4a01dd2e65aa5da235ed0599a575ffa67ba46b095bcea9f4" license "Apache-2.0" head "https://github.com/triggermesh/tm.git" ...
36.752688
122
0.697484
7a2872b57827a69ff15f03bfee6f2caaa0a184c8
3,405
# frozen_string_literal: true # ----------------------------------------------------------------------------- # # Common methods for LineString features # # ----------------------------------------------------------------------------- module RGeo module ImplHelper # :nodoc: module BasicLineStringMethods # :nodo...
22.401316
96
0.53069
7aa0d0ebb45e5877f0489db1ff895ac6b7c48e0f
103
class DropUserGroups < ActiveRecord::Migration[4.2] def change drop_table :user_groups end end
17.166667
51
0.757282
18ec996c3df75c65cc3f2dace9049281025885e0
1,157
# frozen_string_literal: true # Concern handling functionality around deciding whether to send notification # for activities on a specified branch or not. Will be included in # Integrations::BaseChatNotification and PipelinesEmailService classes. module NotificationBranchSelection extend ActiveSupport::Concern de...
27.547619
82
0.690579
e9717577fa13dc556b4cf0805e7282d2183a21ed
3,617
# General derivative service for NewspaperWorks, which is meant to wrap # and replace the stock Hyrax::FileSetDerivativeService with a proxy # that runs one or more derivative service "plugin" components. # # Note: Hyrax::DerivativeService consumes this, instead of (directly) # consuming Hyrax::FileSetDerivativ...
31.452174
81
0.721869
b9be6890d85b57d5d22b6c879b416a47d41b5a79
393
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::EdgeGateway::Mgmt::V2019_03_01 module Models # # Defines values for AlertSeverity # module AlertSeverity Informational = "Informational"...
23.117647
70
0.699746
1c813e36dab2551f453791c4539fffd90184804e
3,301
# # tkextlib/tcllib/swaplist.rb # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # # * Part of tcllib extension # * A dialog which allows a user to move options between two lists # require 'tk' require 'tkextlib/tcllib.rb' # TkPackage.require('swaplist', '0.1') TkPackage.require('swapl...
21.860927
75
0.581036
abf16a126c6e479c31ee2f28356e72d51e4920a7
281
class CreateGalleries < ActiveRecord::Migration def self.up create_table :galleries do |t| t.references :photographer t.string :title end add_index :galleries, :photographer_id, :unique => false end def self.down drop_table :galleries end end
18.733333
60
0.69395
39984fd49b4e3a0427d7f487183615ea711c14e4
1,207
# # Copyright:: Copyright (c) 2014 Opscode, 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 # #...
32.621622
114
0.739022
7aac2df18802644335a6f4210fb8c01ef63551cd
198
class CreatePipeExecs < ActiveRecord::Migration def self.up create_table :pipe_execs do |t| # t.column :name, :string end end def self.down drop_table :pipe_execs end end
16.5
47
0.681818
79ce74d70a502e9e3d3a2f2b50c791e91cff4be4
149
# Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, key: '_rails-boilerplate_session'
37.25
87
0.812081
ed4d806801cccd659387981b02e1fca2ef8972f2
950
class Horse < ActiveRecord::Base extend Slug::ClassMethods include Slug::InstanceMethods belongs_to :user has_many :prizes has_many :horseshows, through: :prizes validates :name, format: { with: /\A[a-zA-Z\s\d]+\z/ }, uniqueness: { case_sensitive: false } def point_total #sums the point_tot...
32.758621
99
0.685263
bfc746ccd06f6b8576047de2b4b902b85d7f2fe5
27
json.partial! @observation
13.5
26
0.814815
3988a02c43eac80d9391b5f2a2cd64fa97dd7421
708
module Rake #################################################################### # The NameSpace class will lookup task names in the the scope # defined by a +namespace+ command. # class NameSpace # Create a namespace lookup object using the given task manager # and the list of scopes. def initi...
25.285714
70
0.612994
b91680c83a849dd549688ed756805415bec2e182
1,745
require 'rails_helper' RSpec.feature "Departments", type: :feature do # vars for existing let(:building) { FactoryBot.create(:building_seed) } let(:building_complete) { FactoryBot.create(:building_seed_complete, name: 'Jumping Joes Crab Shack') } let(:department) { FactoryBot.create(:department_seed, building:...
37.934783
105
0.744986
edb766837ba8ebb459935056f1ec13659b7d77de
684
module Berkshelf # Used to communicate with a remotely hosted [Berkshelf API Server](https://github.com/berkshelf/berkshelf-api). # # @example # client = Berkshelf::APIClient.new("https://api.berkshelf.com") # client.universe #=> [...] module APIClient require_relative "api_client/version" requi...
27.36
114
0.69152
384ccea7021d0956176b762b63b3a1b3d4b2a2ff
510
class UsersController < ApplicationController before_action :already_login?, only: [:new, :create] before_action :login?, only: :show def new @user = User.new end def create user = User.new(user_params) if user.save session[:user_id] = user.id redirect_to user_path, notice: "アカウント作成に...
18.888889
82
0.67451
f8ad61a777ddddcbb888e218570cf8ebf01707c8
1,086
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'video_thumb/version' Gem::Specification.new do |spec| spec.name = "video_thumb" spec.version = VideoThumb::VERSION spec.authors = ["Tolga Gezginiş"] spec.email ...
40.222222
85
0.665746
f86ccb494c9b9f48358ebc5497fd263b916e92b5
885
# frozen_string_literal: true # Mover class class Mover include Processing::Proxy attr_reader :acceleration, :mass, :velocity, :location G = 0.4 def initialize(location:, mass:) @location = location @velocity = Vec2D.new(0, 0) @acceleration = Vec2D.new(0, 0) @mass = mass end def apply_f...
18.061224
57
0.636158
7aa607bcd06ceba4a63c8fad1c0554733216b99b
77
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'felomvc'
25.666667
58
0.727273
26596620d3f4301e35186278eaced8fb8e6dd589
505
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attac...
63.125
180
0.835644
088e7b1d9bfb33ad872c29a6d830c18578c67286
8,312
describe Metric::CiMixin::Capture do require File.expand_path(File.join(File.dirname(__FILE__), %w(.. .. .. tools telefonica_data telefonica_data_test_helper))) before :each do _guid, _server, @zone = EvmSpecHelper.create_guid_miq_server_zone @mock_meter_list = Telefon...
44.449198
119
0.670115
391bc471c178df23c84479dfc603844173bfe4b5
1,553
require 'evertils/common/entity/notebooks' module Evertils module Common module Entity class Notebook < Entity::Base # # @since 0.2.0 def find(name) @entity = nil notebooks = Notebooks.new.all @entity = notebooks.detect { |nb| nb.name == name } ...
21.873239
97
0.508049
3874f4fe7b52cc93d09052ca319eb5de327db519
7,129
require 'spec_helper' module Spree describe Api::V1::VariantsController, :type => :controller do render_views let!(:product) { create(:product) } let!(:variant) do variant = product.master variant.option_values << create(:option_value) variant end let!(:base_attributes) { Api:...
36.558974
104
0.567822
871fd5ed0cf69a9b7dc1e7952126bc78364c243b
1,401
# frozen_string_literal: true lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "graphql/anycable/version" Gem::Specification.new do |spec| spec.name = "graphql-anycable" spec.version = GraphQL::Anycable::VERSION spec.authors = ["Andrey N...
36.868421
87
0.66738
ac328e1bf39fb69c0b86242d72e5e6b8e71abf26
1,968
require "#{File.dirname(__FILE__)}/helper" class ReconnectionsTest < Test::Unit::TestCase include WaderTest def test_raises_after_max_reconnect_attempts Mockingbird.setup(:port=>8080) do # Success on first connection on_connection(1) do 10.times do send '{"foo":"bar"}' ...
23.152941
64
0.646341
ace15ed76f2b672ba9d3493b5a945d7560704c8d
471
class Deadweight module Rack class CapturingMiddleware def initialize(app, dw) @app = app @dw = dw end def call(env) response = @app.call(env) process(response) response end def process(rack_response) status, headers, response = rack...
17.444444
49
0.549894
7a8dbdca3b6ca48c382d85fd7b34dcc837e71854
582
Pod::Spec.new do |s| s.name = 'SwiftShield' s.module_name = 'SwiftShield' s.version = '3.3.3' s.license = { type: 'MIT', file: 'LICENSE' } s.summary = 'A tool that protects Swift iOS apps against class-dump attacks.' s.homepage = 'https://github.com/rockbruno/swiftshield' s.authors = { 'Bruno Rocha' => 'b...
44.769231
112
0.687285
5d0d9126339686d17ec1331dc723b6d47a38f7a9
153
class AddHomeUrlToOauthApplications < ActiveRecord::Migration def change add_column :oauth_applications, :home_url, :string, null: false end end
25.5
67
0.79085
b9aeadf75d134f0681118f711beba622fa06c98d
1,360
class Re2 < Formula desc "Alternative to backtracking PCRE-style regular expression engines" homepage "https://github.com/google/re2" stable do url "https://github.com/google/re2/archive/2015-08-01.tar.gz" version "20150801" sha256 "0fd7388097dcc7b26a8fc7c4e704e2831d264015818fa3f13665f36d40afabf8" ...
32.380952
92
0.675
39017e3c54629dfa0026b3f9a08d938e941040bc
525
require 'test_helper' class UserTest < ActiveSupport::TestCase test "can create post" do p = Post.create(title: "Some Title", body: "Some body.") puts 'Post created.' end test "can create post for user" do u = User.create(email: 'test@email.com') puts 'User created.' p = Post.create(title: "...
25
60
0.634286
f80ed565683bcae4c6a26e1a333e4fed58111a1c
1,637
# 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...
44.243243
126
0.744655
03711ee1e0772d8fc1354b4816bf5356bbd6627e
1,951
#!/usr/bin/env ruby # { terriblefs filename => [build dir filename, convert_linefeeds, num sectors] } FILES = { "MSRBTRCD" => :mbr, "KERN_BIN" => ["kernel-commandline.bin", false, 4], "BEEMOVIE" => ["bee-movie.txt", true, 128], "BEEMVIE2" => ["back-to-back-bee-movie.txt", true, 256], "TEST_BIN" => ["test.bin"...
25.337662
116
0.597642
61f1fa19a38c34634dcc1de397a34df3634e6ba9
6,003
## # Turns text into CompiledMethods class Compiler Config = Hash.new ## # Compiler error subclass. class Error < RuntimeError end def self.process_flags(flags) flags.each { |f| Config[f] = true } if flags end def self.parse_flags(stream) to_clear = [] stream.each do |token| if ...
21.287234
84
0.614693
ffd3c19da2c9abff8777039468cc968971cf64e6
1,938
# 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. # # This file is the source Rails uses to define your schema when running `bin/rai...
40.375
86
0.72033
87cdba884bd5d6906fcebb72c8a31c40ebfb940e
796
require 'spec_helper' describe "many to many associations" do it "it is time to count some comments" do React::IsomorphicHelpers.load_context ReactiveRecord.load do TodoItem.find_by_title("a todo for mitch").comments.count end.then do |count| expect(count).to be(1) end end it "is ti...
25.677419
74
0.693467
e963412e06fe4620ad0ad3d05311fb6a3c30d43d
2,552
# frozen_string_literal: true RSpec.describe DataEntryGroup do subject { DataEntryGroup.new(data_entry_nodes) } let(:data_entry_nodes) { [node_1, node_2] } describe '#min_distance_from_start' do let(:node_1) { DataEntryNode.new(min_distance_from_start: 2000) } let(:node_2) { DataEntryNode.new(min_distan...
34.486486
87
0.677116
f8a1bbd21382cbe63f38ae2c297838a2c7da3872
1,616
# frozen_string_literal: true require_relative 'lib/dc/metrics/version' Gem::Specification.new do |spec| spec.name = 'dc-metrics' spec.version = Dc::Metrics::VERSION spec.authors = ['Lucas Braz', 'Thiago May'] spec.email = ['dev.ti@deliverycenter.com'] spec.summary = "Rub...
38.47619
92
0.670173
4a1e0a97c498526999a4af6726bac73121b00e73
22,287
# frozen_string_literal: true require "stringio" require "uri" require "rack/test" require "minitest" require "action_dispatch/testing/request_encoder" module ActionDispatch module Integration #:nodoc: module RequestHelpers # Performs a GET request with the given parameters. See ActionDispatch::Integrati...
32.63104
116
0.614349
4a8fdbefdacd6e094d58529c72735f23a880fd90
434
class AddUsergroups < ActiveRecord::Migration def self.up create_table :usergroups do |t| t.string :name t.boolean :is_admin end create_table :usergroups_users, :id => false do |t| t.integer :usergroup_id t.integer :user_id end Usergroup.find_or_create_by(:name => 'Admins'...
22.842105
69
0.675115
bf16b19be6250db067bac812cf44abb84e2ba5b5
1,448
require_relative 'test_helper' class TestFakerCode < Test::Unit::TestCase def setup @tester = Faker::Code end def test_npi_regexp assert @tester.npi.match(/[0-9]{10}/) end def test_deterministic_npi Faker::Config.random = Random.new(42) v = @tester.npi Faker::Config.random = Random.new(...
18.564103
52
0.616022
089e55a7523e4b2dab944f7f5a26eccd05a46e6c
2,923
module AbAdmin module Controllers module Callbacks extend ActiveSupport::Concern protected def create_resource(object) run_create_callbacks(object) {save_resource(object)} end def save_resource(object) run_save_callbacks(object) {object.save} end def u...
28.656863
102
0.530277
2191182451e9e66d22b9bd809398de81ce0b11df
196
desc "Update user data usage records from Twilio" task :update_user_data_usage_records => [:environment] do |t| User.all.each do |u| FetchDataUsageRecordsWorker.perform_async(u.id) end end
32.666667
61
0.770408
21e93c7504ee434e44b0965926644a0c8c1735a0
859
# -*- coding: utf-8 -*- %w[xot rays reflex] .map {|s| File.expand_path "../../../#{s}/lib", __FILE__} .each {|s| $:.unshift s if !$:.include?(s) && File.directory?(s)} require 'reflex' class HelloWindow < Reflex::Window def initialize () super title: "Hello Reflex!", frame: [100, 100, 320, 240] p =...
18.276596
67
0.575087
d5b4a02c77a3ec0ff8c55b7cbeefa6bde0e2a7d3
1,575
describe 'datadog::redisdb' do expected_yaml = <<-EOF init_config: instances: - host: localhost port: 6379 db: 0 password: mypassword socket_timeout: 5 tags: - optional_tag1 - optional_tag2 keys: - key1 - key2 warn_on_missing_keys: Tru...
25
97
0.527619
1c3f590be2e6bf16de774002a37e5b45167d38d2
512
# The Book of Ruby - http://www.sapphiresteel.com module MagicThing attr_accessor :power end module Treasure attr_accessor :value attr_accessor :owner end class Weapon attr_accessor :deadliness end class Sword < Weapon include Treasure include MagicThing attr_accessor :name end s = Sword.new s.name =...
14.628571
49
0.744141
1a69773346c90841b1d05b00d9268b5ab398fd17
251
module CSVImporter # A Column from a CSV file with a `name` (from the csv file) and a matching # `ColumnDefinition` if any. class Column include Virtus.model attribute :name, String attribute :definition, ColumnDefinition end end
22.818182
77
0.721116
33444c2a7dc1b30ccc84bca6ad1b1f4773a6e5bd
862
# frozen_string_literal: true module Users class ActivityService LEASE_TIMEOUT = 1.minute.to_i def initialize(author, activity) @user = if author.respond_to?(:username) author elsif author.respond_to?(:user) author.user end @user = nil...
21.02439
72
0.602088
7991405bfe08b70a91b715039fcb239b6773e9fe
652
require 'green_shoes' TEXT =<<EOS Lorem ipsum dolor sit amet, consectetur adipisicing elit, \ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris \ nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in \ reprehenderi...
31.047619
78
0.742331
b9ff3f2ccb17c4a9f3e8ea080c0b9252dc1914c9
405
include_attribute 'deploy' default[:sidekiq] = {} node[:deploy].each do |application, deploy| unless node[:sidekiq][application] next end default[:sidekiq][application.intern] = {} default[:sidekiq][application.intern][:restart_command] = "sudo /sbin/restart workers" default[:sidekiq][application.intern...
27
88
0.728395