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
3813abbbbbdae394d9932942ae04f5035a50089c
3,605
#!/usr/bin/env ruby gem 'minitest', '>= 5.0.0' require 'minitest/reporters' require 'minitest/autorun' require_relative 'kindergarten_garden' Minitest::Reporters.use! class GardenTest < Minitest::Test def test_alices_garden garden = Garden.new("RC\nGG") assert_equal [:radishes, :clover, :grass, :grass], gar...
22.961783
75
0.683495
01b45a8eaea8291c9dd7699320e192d4bc029739
1,565
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "bradfieldcoin/version" Gem::Specification.new do |spec| spec.name = "bradfieldcoin" spec.version = BradfieldCoin::VERSION spec.authors = ["Manoj Dayaram"] spec.email = ["m@n...
38.170732
111
0.682428
01d69ed75a4c99b8193b8341f6e3c3822ef6ef09
1,220
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "dynomatic/version" Gem::Specification.new do |spec| spec.name = "dynomatic" spec.version = Dynomatic::VERSION spec.authors = ["David Verhasselt"] spec.email = ["david@crowdw...
35.882353
95
0.678689
bbfd0e0595e433cbcd4e1fb281b296d3a169c323
1,207
module SoccerCli class Scraper # url = https://www.transfermarkt.us/serie-a/tabelle/wettbewerb/IT1/saison_id/2018 def self.scraper_table(url) output = [] doc = Nokogiri::HTML(open(url)) table = doc.css('.responsive-table').last table.search('tbody > tr').each do |tr| profile ...
34.485714
90
0.605634
bba435c525487e494ee737e2c5fe558b95467f75
22,785
require 'cloud_controller/app_observer' require 'cloud_controller/database_uri_generator' require 'cloud_controller/undo_app_changes' require 'cloud_controller/errors/application_missing' require 'cloud_controller/errors/invalid_route_relation' require 'repositories/runtime/app_usage_event_repository' require 'actions/...
30.832206
162
0.682115
28a935d66f97ce8ef36712584d1ef75500391a4f
592
Pod::Spec.new do |s| s.name = "RBTmpNetwork" s.version = "1.0.2" s.summary = "A lightweight iOS networking framework based on AFNetworking" s.homepage = "https://github.com/mcmengchen/RBTmpNetwork.git" s.license = "MIT " s.author = { "baxiang" => "baxiang@roboo.com" }...
31.157895
103
0.625
8750a08b152fa386ddd85f62321e7045fbd9fac5
170
class AddUserNameToUsers < ActiveRecord::Migration[5.1] def change add_column :users, :user_name, :string add_index :users, :user_name, unique: true end end
21.25
55
0.729412
03630f8ce8a2f4b30fc6dac4d797adb7eb004a5f
207
require "rails_helper" RSpec.describe HomeController, type: :controller do describe "#index" do it "renders successfully" do get :index expect(response).to be_successful end end end
18.818182
51
0.705314
39a2cff460130b0ad748041467041f8796b05833
2,650
#!/usr/bin/env ruby $: << File.join(File.dirname(__FILE__), '../lib') require 'irclogger' # This imports ZNC logs # might be identical to the mIRC log format too ARGV.each do |filename| DB.transaction do if File.basename(filename) =~ /^(\d{4}.\d{2}.\d{2}).log$/ puts "Importing #{$1}..." date = Dat...
34.868421
110
0.464906
33860d02768d0cd79b52022c40777f28412c3d14
33,561
## # This module requires Metasploit: http://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core' class Metasploit4 < Msf::Exploit::Remote Rank = GreatRanking include Msf::Exploit::Remote::Tcp def initialize(info = {}) super(update_inf...
42.536122
120
0.589941
62e42c78db5a9fedb92707aa96d628b459e42a70
2,136
class Compiler class TextGenerator @@method_id = 0 def initialize @text = "" @label = 0 @other_methods = {} @ip = 0 @file = "(unknown)" @line = 0 end attr_reader :text, :ip, :file, :line attr_accessor :redo, :retry, :break def advanced_si...
18.573913
58
0.476592
bf9b741c776f284e3f67f4b2297ae4b6dca6b85b
25,204
# encoding: utf-8 require 'helper' class TestPost < Test::Unit::TestCase def setup_post(file) Post.new(@site, source_dir, '', file) end def do_render(post) layouts = { "default" => Layout.new(@site, source_dir('_layouts'), "simple.html")} post.render(layouts, {"site" => {"posts" => []}}) end c...
33.967655
154
0.598397
8793ac16e505e98aa9e23a4e3352fea8f77dea8f
1,518
# 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...
34.5
86
0.725296
1d6aa094a8d0e202af8e9d972838b0b6aacc00d5
95
require 'spec_helper' require 'vigilem/dom' require 'vigilem/win32_api/dom/key_values_tables'
19
49
0.821053
1cb7a75e0da614f25a9a291d9afa531e4d289f5c
1,612
# frozen_string_literal: true require 'spec_helper' describe RubyRabbitmqJanus::Models::JanusInstance, type: :model, name: :janus_instance do before do instances first end let(:model) { described_class } let(:size) { (rand * 5).to_i + 1 } let(:firs...
33.583333
84
0.700372
79ad53fb07851f515577152ab33735b5892396a6
2,367
class MutateUsersController < ApplicationController def send_activation @user = User.find(params[:id]) UserMailer.delay.welcome(@user) flash[:success] = 'Activation email was sent successfully. You should receive it shortly.' redirect_to @user end def activate @user = User.find_by(activation_...
23.435644
105
0.639628
18cf56d0e134f3f00ceac2f213da5e5599c9f7d1
1,146
lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = 'challenge' spec.version = '0.0.0' spec.authors = ['iagox86'] spec.email = ['ron-git@skullsecurity.org'] spec.summary = 'A BSidesSF c...
34.727273
74
0.633508
389521bf493860b8f8293596c976cbc743d4bd43
2,160
require 'spec_helper' describe Feedjira::FeedUtilities do before(:each) do @klass = Class.new do include Feedjira::FeedEntryUtilities end end describe 'handling dates' do it 'should parse an ISO 8601 formatted datetime into Time' do time = @klass.new.parse_datetime('2008-02-20T8:05:00-01...
32.238806
74
0.675926
7a5865dbffa7d2347f7e5b842bd03aa6326fcce6
10,692
require "uri" require "rack" require "rack/mock_session" require "rack/test/cookie_jar" require "rack/test/mock_digest_request" require "rack/test/utils" require "rack/test/methods" require "rack/test/uploaded_file" module Rack module Test VERSION = "0.6.2" DEFAULT_HOST = "example.org" MULTIPART_BOUNDAR...
31.727003
101
0.587449
33f8414ae451c44ede189657abb5bf77705ee124
276
# encoding: UTF-8 class Survey < ActiveRecord::Base; end class UpdateBlankVersionsOnSurveys < ActiveRecord::Migration[4.2] def self.up Survey.where('survey_version IS ?', nil).each do |s| s.survey_version = 0 s.save! end end def self.down end end
19.714286
65
0.681159
2895c87db16e1a1beadc90d66b15de4106dbcb6f
404
cask 'wko' do version '553' sha256 '8e462b88c8ed3bb9fee567b9ec42cc8171690265d6e17b51f67df97f34717842' # wko4.com was verified as official when first introduced to the cask url "https://updates.wko4.com/TeQ2y43sOpz2/WKO5_OSX_#{version}.dmg" appcast 'https://updates.wko4.com/TeQ2y43sOpz2/wko5_osx_appcast.xml' ...
31.076923
75
0.769802
61df06abae35611a0aeddb3b69daeac994a3e215
278
class AccessConfirmationsController < ApplicationController def index if user_signed_in? @user = TwitterDB::User.find_by(screen_name: current_user.screen_name) @user = TwitterUser.latest_by(screen_name: current_user.screen_name) unless @user end end end
30.888889
87
0.769784
ff714e0f13946f6f022faf408ef1403e5e91fade
382
require 'sinatra' require 'tempfile' class Application < Sinatra::Base set :app_file, __FILE__ post '/' do temp = Tempfile.new('userInput') out = Tempfile.new('output') temp.write(request.env["rack.input"].read) temp.close content_type 'application/octet-stream' system("./encryptor key ...
22.470588
56
0.667539
acd13c1256a8c54f2c49d139b4aaa6efccacb205
1,649
require 'rspec/autoswagger/doc_part' module Rspec module Autoswagger class DocParts attr_reader :specification, :info, :paths, :definitions attr_accessor :output_path DEFAULT_OUTPUT_PATH = './tmp' def initialize @info = Parts::Info.generate_hash @paths = {} @defi...
27.949153
116
0.616737
1dec5955f69204cd2fc25cff881047e505977f89
482
class ApplicationController < ActionController::Base protect_from_forgery with: :exception before_action :current_user, except: [:home] before_action :require_logged_in, except: %i[new create home create_from_oath] helper_method :current_user def logged_in? !!current_user end private def require_...
22.952381
80
0.763485
ace5770deb9b0628aa4d91b2a8ea11cf020437cc
370
class CreateOydAnswers < ActiveRecord::Migration[5.1] def change create_table :oyd_answers do |t| t.integer :plugin_id t.string :name t.string :identifier t.string :category t.string :info_url t.text :repos t.integer :answer_order t.text :answer_view t.text :a...
20.555556
53
0.640541
e8a10cc86007cb9e006514b99ca912017861c96c
1,292
module Muffon module Profile class Posts class Post < Muffon::Profile::Posts def call data end private def data { id: post.id, profile: profile_data, content: post.content, images: images, track...
18.197183
51
0.462848
392dd7a54286b2662fc5b1130789b3d8521798e7
978
require File.expand_path("spec_helper", File.dirname(File.dirname(__FILE__))) describe "path_matchers plugin" do it ":extension matcher should match given file extension" do app(:path_matchers) do |r| r.on "css" do r.on :extension=>"css" do |file| file end end end ...
22.744186
77
0.574642
ffb1cf8e8302ae8e5476dfc7599e55dfa028f254
4,934
require "test_helper" class GraphQL::SchemaComparator::Diff::InputFieldTest < Minitest::Test def setup @type = GraphQL::InputObjectType.define do name "Input" end end def test_diff_input_field_type_change old_input_field = GraphQL::Argument.define do name "foo" type types.String ...
32.038961
108
0.732874
1d99bf22bf837257a8438509e910637b7cd3cbc5
496
# 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...
62
171
0.832661
626f782d6c40669e6b7d61170993c94761f94537
1,503
module Charty module TableAdapters class NMatrixAdapter def self.supported?(data) defined?(NMatrix) && data.is_a?(NMatrix) && data.shape.length <= 2 end def initialize(data, columns: nil) case data.shape.length when 1 data = data.reshape(data.size, 1) w...
25.913793
75
0.576181
bf812c9add72d444b3f8988f74e401a3b1ee8cd3
224
require "sidekiq/testing" # https://github.com/mperham/sidekiq/wiki/Testing#testing-worker-queueing-fake Sidekiq::Testing.fake! RSpec.configure do |config| config.before(:each) do Sidekiq::Worker.clear_all end end
20.363636
78
0.763393
d5c558a7d5ca361d23ad999b68122df2338aad42
69
json.extract! @code, :id, :assembly_source, :created_at, :updated_at
34.5
68
0.753623
e9b4850ec7906fe473333a10dbae9a729d233f23
1,243
Whendoigo3::Application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the we...
36.558824
85
0.771521
ac649925751fff6867239cd62764b19e649ed744
1,104
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Migrations Validation' do using RSpec::Parameterized::TableSyntax # The range describes the timestamps that given migration helper can be used let(:all_migration_classes) do { 2022_01_26_21_06_58.. => Gitlab::Datab...
33.454545
116
0.694746
e2f2bccb2e948771aaf9aeadd593c5bfaa93a3c7
1,877
# Copyright © 2011-2020 MUSC Foundation for Research Development~ # All rights reserved.~ # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:~ # 1. Redistributions of source code must retain the above copyright notice, this l...
46.925
146
0.784763
f7e11b6ae964f56ea341649596f423a7eab2d676
2,547
require File.dirname(__FILE__) + '/../spec_helper' describe "Intergration restart" do before :each do start_controller do @controller.load_erb(fixture("dsl/integration.erb")) end @processes.size.should == 3 @processes.map{|c| c.state_name}.uniq.should == [:up] @samples = @controller.all_gr...
27.989011
111
0.651355
283f7642f67f5770a68f283b986e3483edc8c176
1,227
Dir["#{Rails.root}/lib/api/*.rb"].each {|file| require file} module API class API < Grape::API version 'v3', using: :path rescue_from ActiveRecord::RecordNotFound do rack_response({'message' => '404 Not found'}.to_json, 404) end rescue_from :all do |exception| # lifted from https://gith...
26.673913
128
0.681337
01f8d990abea7b16ad8cd6e5e9bd65a98f9b204a
3,113
class PosInvoicePdf < Prawn::Document def initialize(pos_invoice) super({top_margin: 10, left_margin: 5, right_margin: 5, bottom_margin: 100}) text GlobalSettings.organisation_name, size: 30, style: :bold, align: :center text GlobalSettings.organisation_address, size: 20, align: :center text GlobalSet...
38.432099
205
0.648571
6a6e5e630c6d08dfae5ad941b251a7dad2b65a2e
1,156
# frozen_string_literal: true class CreateGithubWebhookWorker # rubocop:disable Scalability/IdempotentWorker include ApplicationWorker include GrapePathHelpers::NamedRouteMatcher feature_category :integrations worker_resource_boundary :cpu worker_has_external_dependencies! weight 2 attr_reader :project...
19.931034
79
0.705882
abeaa2a2c11606504f2461980185ac90a80a0898
192
class Perk < ActiveRecord::Base has_many :survivor_perks has_many :survivors, through: :survivor_perks has_many :killer_perks has_many :killers, through: :killer_perks end
27.428571
49
0.739583
3877b6ff063b65bc55fccac8b377f451421e23e9
286
class StockValueDecorator < Draper::Decorator include ActionView::Helpers::NumberHelper delegate_all def value_date return l(object.value_date, format: '%Y-%m-%d') if object.value_date '' end def value number_with_precision(object.value, precision: 2) end end
20.428571
72
0.730769
6a2523b5590592fc3df50260a581c46dda6db78b
1,599
set :port, 22 task :environment do end task :run_commands do commands.run(:remote) end task :reset! do reset! end task :debug_configuration_variables do if fetch(:debug_configuration_variables) puts puts '------- Printing current config variables -------' configuration.variables.each do |key, valu...
23.173913
103
0.639775
33873370242d6bc00155bf00b709c8580f1d9ec3
373
# typed: strict module Resolvers module SeriesResolvers class SeriesResolver < Resolvers::BaseResolver type Types::SeriesType, null: true description "Find a series by ID." argument :id, ID, required: true sig { params(id: T.any(String, Integer)).returns(Series) } def resolve(id:)...
20.722222
64
0.646113
ab97d54307f4118821fbeb7d5c69a82e35eee4eb
7,581
# Copyright 2016 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
40.978378
84
0.648331
3912ace13c1f0723f0857bf13342e09632f050de
1,484
########################################################################## # Copyright 2017 ThoughtWorks, Inc. # # 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/li...
39.052632
176
0.658356
e2076c26fe18a7536124b66bb2ab6e2a1ed416ad
941
require "flipper/adapters/sync/interval_synchronizer" RSpec.describe Flipper::Adapters::Sync::IntervalSynchronizer do let(:events) { [] } let(:synchronizer) { -> { events << now } } let(:interval) { 10 } let(:now) { subject.send(:now) } subject { described_class.new(synchronizer, interval: interval) } it...
27.676471
67
0.680128
ab3bbb83291eeed05d38e75f8e4136d91c73677c
257
module Sawyer VERSION = "0.8.2" class Error < StandardError; end end require 'set' %w( resource relation response serializer agent link_parsers/hal link_parsers/simple ).each { |f| require File.expand_path("../sawyer/#{f}", __FILE__) }
14.277778
67
0.684825
e2ad5a5c948b8e96b9bd94e0e03485a8fbf7019d
38
h = {}; 5000000.times {|n| h[n] = n }
19
37
0.447368
38d89554185b0db9e2273eec32457dfb581a3ff2
4,378
# -*- coding: utf-8 -*- # # frozen_string_literal: true module Rouge module Lexers class Lua < RegexLexer title "Lua" desc "Lua (http://www.lua.org)" tag 'lua' filenames '*.lua', '*.wlua' mimetypes 'text/x-lua', 'application/x-lua' option :function_highlighting, 'Whether to ...
26.533333
95
0.486524
79790cd7fccc1c8b273f46b9416315f750070a09
515
require 'abstract_unit' class IamUserToGroupAdditionTest < Minitest::Test def test_normal template = <<-EOS _iam_user_to_group_addition "test", group: "test1", users: [ "test2" ] EOS act_template = run_client_as_json(template) exp_template = <<-EOS { "TestUserToGroupAddition": { "Type": "AWS::I...
20.6
70
0.642718
6a2da1489d82ad88f7202794d1c2883910d962e8
4,640
module RedmineUndevGit module Services class Repo < Hashie::Dash property :id property :project, required: true property :url property :identifier property :is_default def to_s [id, project.identifier, identifier, url].join(';') end end class Mapping ...
27.784431
84
0.546552
380fe558bd0867d57672cc8a2b64d5c82fde5fc1
38
module Guard VERSION = "2.14.2" end
9.5
20
0.657895
1df886de1124d112260586e5ab95eeba4f13aa2e
1,738
# frozen_string_literal: true # Licensed to the Software Freedom Conservancy (SFC) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The SFC licenses this file # to you under the Apache License, Version 2.0...
35.469388
88
0.670311
1a95a96113f011bbd21382f6aeacbe141f936cff
735
module Contentful module Management # Abort if required environmental variables are not set if ENV["CONTENTFUL_MANAGEMENT_KEY"].nil? || ENV["CONTENTFUL_SPACE_ID"].nil? || ENV["CONTENTFUL_ENVIRONMENT"].nil? abort("Environmental variables CONTENTFUL_MANAGEMENT_KEY, CONTENTFUL_SPACE_ID or CONTENTFUL_ENVI...
27.222222
120
0.704762
f8a940d9ebc07bc8ab27f567cc7d20b9ed4d8b63
1,149
# -*- encoding: utf-8 -*- # stub: jasmine-junitreporter 0.0.1 ruby lib Gem::Specification.new do |s| s.name = "jasmine-junitreporter" s.version = "0.0.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["Jake Gould...
32.828571
105
0.653612
21edd0d05172d2a658553eda45f112e38761fa98
1,218
# frozen_string_literal: true # # Cookbook Name:: aws-parallelcluster # Attributes:: default # # Copyright 2013-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the # License. A copy of ...
48.72
121
0.780788
bf5b97fea0fe9da4a3404fd81a082e7091f05f11
5,349
class Commitizen < Formula include Language::Python::Virtualenv desc "Defines a standard way of committing rules and communicating it" homepage "https://commitizen-tools.github.io/commitizen/" url "https://files.pythonhosted.org/packages/b5/10/76f20499fd4966014ae742156efb94a9a37867fd1348f670463d33cf3cfe/commit...
48.627273
147
0.819219
abf0561587588d5a9a55f7803dd7d62e21606557
548
require_relative 'services_helper' module Kontena::Cli::Services class DeployCommand < Clamp::Command include Kontena::Cli::Common include Kontena::Cli::GridOptions include ServicesHelper parameter "NAME", "Service name" option '--force-deploy', :flag, 'Force deploy even if service does not have...
24.909091
92
0.687956
26eb174e341db6e13fad4e9223d16df8cb3bda48
2,078
require 'rails_admin/railties/extratasks' namespace :admin do desc "Populate history table with a year of data" task :populate_history do RailsAdmin::ExtraTasks.populateDatabase end desc "Populate history table with a year of data" task :populate_database do system("rails generate dummy:data --base-...
32.46875
108
0.641963
18f8f16e5ae4edbc377a83e6cff8886048a95d90
1,318
# # Copyright:: Copyright (c) 2012-2014 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/LICE...
32.146341
91
0.669954
7afb61182aee8de6e64fd5b70b2a8c794b4e0ea6
12,911
require File.expand_path(File.join(File.dirname(__FILE__), 'helper')) class TestCurbCurlMulti < Test::Unit::TestCase def teardown # get a better read on memory loss when running in valgrind ObjectSpace.garbage_collect end def test_new_multi_01 d1 = "" c1 = Curl::Easy.new($TEST_URL) do |curl| ...
26.565844
132
0.606769
b9d81e5b417abfa2af3cadf04b87c9f5b12babfa
893
class ProxychainsNg < Formula desc "Hook preloader" homepage "https://sourceforge.net/projects/proxychains-ng/" url "https://github.com/rofl0r/proxychains-ng/archive/v4.13.tar.gz" sha256 "ff15295efc227fec99c2b8131ad532e83e833a02470c7a48ae7e7f131e1b08bc" head "https://github.com/rofl0r/proxychains-ng.git" b...
35.72
93
0.756999
6ae48578db4ed439fe136f9aee38f7cd4802d7ff
12,785
#-- encoding: UTF-8 #-- copyright # OpenProject is an open source project management software. # Copyright (C) 2012-2020 the OpenProject GmbH # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProje...
29.256293
146
0.667657
7a0264d3607977d0aa864aaa2af384f25765b1af
118
require 'simplecov' SimpleCov.start $LOAD_PATH.unshift __dir__ require 'method_fallback' require 'minitest/autorun'
14.75
26
0.822034
ed0d7b1bca96cada8af19245b3d890757ba527ec
4,115
# typed: strict # frozen_string_literal: true module Yogurt class CodeGenerator # Root classes are generated for the root of a GraphQL query. class RootClass < T::Struct include DefinedClass extend T::Sig include Utils const :name, String const :schema, GRAPHQL_SCHEMA con...
31.412214
106
0.573755
6a09693ea9c8431177d18557b9dbfbd55629c466
2,754
# frozen_string_literal: true module Appsignal # @api private module Rack # JavaScript error catching middleware. # # Listens to the endpoint specified in the `frontend_error_catching_path` # configuration option. # # This is automatically included middleware in Rails apps if the # `fro...
34
79
0.640523
115f71e77d048480084ebb8cfd01257ebe07261c
1,313
#!/usr/bin/env ruby require 'json' require 'open3' data = JSON.parse(File.read("geometries.json")) result = {} def get_polygon_data(polygon) circle = 0 Open3.popen3("./max-circle.js skipinside") do |input, out, err| polygon[0].each do |c| input.puts "#{c[0]} #{c[1]}" end input.close data =...
20.2
89
0.597106
b9d48904c8a5d4247b5de2652ae54fa8cf8183c3
233
# frozen_string_literal: true # Copyright The OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 module OpenTelemetry module Instrumentation module ActiveModelSerializers VERSION = '0.18.0' end end end
16.642857
37
0.746781
217cf9d0ddbe47ce7ba98e3376b96b6d83002ce4
14,457
# frozen_string_literal: true # Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this key will render inv...
48.19
154
0.751262
6a575584344ca6ad020a89792a88d78b73a0dc51
946
# This method can be implemented at least in 6 ways in O(n) time. # Way 1: answer = current sum - minimum sum got def max_sub_array(nums) answer = sum = min_sum = nums[0] min_sum = 0 if nums[0] > 0 nums[1..-1].each do |n| sum += n answer = [ answer, sum - min_sum ].max min_sum = sum if sum < min_sum ...
22.52381
73
0.633192
b9989df3d53a905698b60930bd681d2a54706057
205
all exclude_rule 'MD002' # First header should be a top level header exclude_rule 'MD024' # Multiple headers with the same content exclude_rule 'MD041' # First line in file should be a top level header
41
71
0.77561
bf41d5e5271be0fd52392a9b13b2e439058e2e4b
239
class Transaction < ApplicationRecord belongs_to :user has_many :amount_relationships has_many :groups, through: :amount_relationships validates :name, presence: true, length: { in: 6..30 } validates :amount, presence: true end
26.555556
56
0.761506
ff52e94c32a3c4093dbdc704c2e4f68bcd036227
234
class AddAttachmentSolutionToAssignments < ActiveRecord::Migration def self.up change_table :assignments do |t| t.attachment :solution end end def self.down remove_attachment :assignments, :solution end end
19.5
66
0.739316
18c20a724e97336f655f0b8dde2788c0b82cac63
2,144
module ResetPasswordSteps attr_accessor :new_user # GIVEN # WHEN step 'I click forgot password link on login page' do LoginPage.open LoginPage.on { navigate_to_forgot_password_page } end step 'I fill and submit form on forgot password page with correct email data' do s = self ForgotPassw...
26.146341
101
0.708022
bf11e371faea6626596a194c4ff5c4a62ebd54ba
502
# frozen_string_literal: true require 'rakuten_web_service/resource' module RakutenWebService module Ichiba class TagGroup < Resource endpoint 'https://app.rakuten.co.jp/services/api/IchibaTag/Search/20140222' parser do |response| response['tagGroups'].map { |tag_group| TagGroup.new(tag_gro...
20.916667
81
0.659363
33046bba622ab1b472c4e7a3dffecbaec18edc5a
204
#!/usr/bin/ruby #get sting "One two three four five". transform it to sting "One Two Three Four Five" str = "One two three four five" str = str.split(' ') str.each {|x| x.capitalize!} puts str.join(" ")
25.5
85
0.671569
1ce47a1a24968a54382830de74d46a5144093e75
702
# frozen_string_literal: true # == Schema Information # # Table name: award_scribes # # id :integer not null, primary key # award_recipient_id :integer # person_id :integer # award_scribe_type_id :integer # created_at :datetime not null # updated_at ...
25.071429
70
0.666667
bf30fbdfdd6fa24182a24504ce8053293c4388d4
341
require 'spec_helper' describe "/node_classes/show.html.haml", :type => :view do include NodeClassesHelper describe "successful render" do before :each do assigns[:node_class] = @node_class = create(:node_class) render end it { rendered.should have_tag 'h2', :text => /Class:\n#{@node_clas...
22.733333
80
0.674487
79d4614647419164d0231e4aebc65b6230f7cdbb
5,479
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/monitoring/v3/uptime.proto require 'google/protobuf' require 'google/api/monitored_resource_pb' require 'google/protobuf/duration_pb' Google::Protobuf::DescriptorPool.generated_pool.build do add_message "google.monitoring.v3.InternalChecke...
50.731481
207
0.772404
18d77c7e899df8891853e62f67f13e8e9f42f633
699
Pod::Spec.new do |s| s.name = "PaymentKit" s.version = "1.0.0" s.summary = "Utility library for creating credit card payment forms." s.license = { :type => 'MIT', :file => 'LICENSE' } s.homepage = "https://stripe.com" s.author = { "A...
49.928571
97
0.529328
f7816d59fcac7a0f49f116b5a5fb3f7db2a06aba
226
class DropIsPrimaryFromAttendees < ActiveRecord::Migration def up remove_column :attendees, :is_primary end def down add_column :attendees, :is_primary, :boolean, { :null => false, :default => false } end end
22.6
87
0.716814
011e9760e0e63c691d8cfdb4e159e859285b9aca
9,971
require 'spec_helper' describe Barge::Resource::Droplet do include_context 'resource' it_behaves_like 'a resource' describe '#create' do it 'creates a droplet' do stubbed_request = stub_request!(:post, '/droplets') .to_return(body: fixture('droplets/create'), status: 202) options...
34.50173
78
0.661719
87222ce7389ac420110f7b8ebaafe424e77fac6f
1,719
class ProfileUserController < ApplicationController layout "profile_user" before_action :set_user, only: [:index, :show, :edit, :update, :pets, :duties, :feed, :friends] def index @user = ProfileUser.find_or_create_by(user_id: current_user.id) end def show end def edit end def update if ...
27.285714
117
0.652123
bf2e4e26f573bc097284636122743eab406cfaf0
29,925
# frozen_string_literal: true require 'rails_helper' require 'shared/api/v1/shared_expectations' require 'base64' RSpec.describe Api::V2::TransactionsController, type: :request do include RequestHelpers describe 'GET api/v2/transactions' do let(:application) { create(:application) } let(:team) { create :...
34.396552
115
0.523074
e256d777f01098795e732ade72c21f3caefbf0e0
5,987
# frozen_string_literal: true RSpec.describe Jekyll::Locale::Document do let(:collection) { "posts" } let(:doc_name) { "2018-10-15-hello-world.md" } let(:locale_id) { "en" } let(:metadata) { {} } let(:locale) { Jekyll::Locale::Identity.new(locale_id, metadata) } let(:locales_set) { %w(fr en j...
37.186335
110
0.559713
3960feb6de879346207c33bf7a973cb5d36bf290
982
require 'fragmenter/dummy_io' describe Fragmenter::DummyIO do it 'provies IO like access' do io = Fragmenter::DummyIO.new expect(io).to respond_to(:read) expect(io).to respond_to(:length) end describe '#content_type' do it 'defaults to application/octet-stream' do expect(Fragmenter::Dummy...
24.55
84
0.676171
87a6703e16a6d582208c0a94ea00c482d38dcd4a
2,969
require 'shellwords' # TODO: disable selinux ### rbenv include_recipe 'rbenv::system' execute 'add rbenv config' do command %( echo ' export RBENV_ROOT=/usr/local/rbenv export PATH="${RBENV_ROOT}/bin:${PATH}" eval "$(rbenv init -)" ' >> /etc/bashrc ) not_if 'grep RBENV_ROOT /etc/bashrc' end ### memcached packa...
20.060811
125
0.715392
21a210775349f2b23db3cccda8bf964506c974ee
78
module SmartAnswer module Question class Value < Base end end end
11.142857
22
0.692308
1de0bae326b1e3fd91b74cc218172ae560565b9f
289,985
# 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/master/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE module Aws::CodeCommit module Types # The specified Amazon Resource Name (...
37.172798
379
0.657182
ac81fdb03bedd2556f501a4446112218444e7190
1,143
module ExchangeRate::Storage class RecordNotFound < RuntimeError; end class Repository def initialize adapter @adapter = adapter end def create date:, code:, rate: build_record(@adapter.create( date: fdate(date), code: fcode(code), rate: rate )) end ...
20.410714
92
0.616798
87eccd53e1b740100e1c441fecedb5256d38c87d
1,237
require "test_helper" class ComponentGeneratorTest < Rails::Generators::TestCase tests MountainView::Generators::ComponentGenerator destination File.expand_path("../../tmp", __FILE__) setup :prepare_destination test "Assert all files are properly created" do # reset engines Rails.application.config.a...
34.361111
69
0.78173
f851de34ce3f2f842a76b0eaf038f95c6f1aeadb
58
class MovieLog < ApplicationRecord belongs_to :user end
14.5
34
0.810345
e8d0a3320273cf57cbf9045841edec72e4699bc2
2,160
class Mosquitto < Formula desc "Message broker implementing the MQTT protocol" homepage "https://mosquitto.org/" url "https://mosquitto.org/files/source/mosquitto-1.6.12.tar.gz" sha256 "548d73d19fb787dd0530334e398fd256ef3a581181678488a741a995c4f007fb" # dual-licensed under EPL-1.0 and EDL-1.0 (Eclipse Distrib...
28.8
108
0.665278
e8a7b579baed2cb133f624401e12b6d88e4c7e6c
36
json.partial! "logs/log", log: @log
18
35
0.666667
4a9f61c5e98dc730f0d7d180f0300b2fdc5d2570
907
module WillowRun class Status # data contains information about the wireless status, # e.g. signal info, BSSID, port type etc. provided # by the airport command. attr_reader :data # getinfo() get the current information associated # with the access point that the computer is already ...
28.34375
59
0.566703
28a96525ed3bf472a085f49e5f036b4bd10baf7c
5,843
$: << File.dirname(__FILE__) require 'atomic' require 'json' require 'eventmachine' require 'em-http-request' require 'cacheable_lookup' class FacebookFriendRank < CacheableLookup PROGRESSIVE_UPDATE_TTL = 30 # seconds def response(env) id = params['id'] token = params['token'] progr...
25.627193
100
0.565634
7a0dbb47634cbaef587992c4501b0c1a52914c2e
6,348
module ActsAsSolr #:nodoc: module InstanceMethods # Solr id is <class.name>:<id> to be unique across all models def solr_id "#{self.class.name}:#{record_id(self)}" end # saves to the Solr index def solr_save return true unless configuration[:if] if evaluate_condition(config...
39.185185
248
0.599086
d5f0e1321db2d5b243202e4db36ea43232235501
4,045
require 'spec_helper_acceptance' describe 'mongodb_database' do case fact('osfamily') when 'RedHat' version = "'2.6.6-1'" when 'Debian' version = "'2.6.6'" end shared_examples 'normal tests' do |tengen, version| context "when manage_package_repo is #{tengen} and version is #{version}" do de...
39.656863
131
0.517182
03fac6bec131d8e32ecaff639da64c130471d7c5
383
# frozen_string_literal: true class IdentifierPolicy < ApplicationPolicy attr_reader :user_identifier def initialize(user, users) raise Pundit::NotAuthorizedError, "must be logged in" unless user @user = user @users = users end def destroy? !user.nil? end class Scope < Scope def r...
14.185185
69
0.684073