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
e956bd6eb1a50ad14c8e892d589abd7fd39e6e1b
955
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
34.107143
74
0.757068
ab55ba580ebc78b17ab2f83a5c077101c0466fa5
374
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::IotHub::Mgmt::V2018_01_22 module Models # # Defines values for IotHubScaleType # module IotHubScaleType Automatic = "Automatic" Ma...
22
70
0.684492
acdd41b559272aaabad4b8ac58f911195693f9f1
93
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'passenger_memory_status'
31
58
0.774194
d539a9525f6871d3f0a5df04cf4f92669e0f5b9d
2,330
# -*- coding:utf-8; mode:ruby; -*- require 'rbindkeys' require 'revdev' include Rbindkeys describe CLI do describe '#.main' do context ', when ARGV is empty,' do before do @args = [] end it 'shoud exit with code 1' do expect { CLI::main @args }.to raise_error do |e| ...
29.871795
75
0.540343
ffd1bdbfbbe6d6c799580d73736678395a2cc090
819
require 'opbeat/filter' module Opbeat module DataBuilders class Error < DataBuilder def build error_message h = { message: error_message.message, timestamp: error_message.timestamp, level: error_message.level, logger: error_message.logger, culprit: ...
29.25
82
0.659341
ac3b77a42c8e3e092845d77814ebc8d481e19a69
143
class AddJourneysCountToCategories < ActiveRecord::Migration[6.1] def change add_column :categories, :journeys_count, :integer end end
23.833333
65
0.783217
ed64d899029b0182740fa221c4cabc0d2dcd381a
19,557
# frozen_string_literal: true require "abstract_unit" require "timeout" require "rack/content_length" class ResponseTest < ActiveSupport::TestCase def setup @response = ActionDispatch::Response.create @response.request = ActionDispatch::Request.empty end def test_can_wait_until_commit t = Thread.ne...
31.241214
149
0.674234
03ebb22c15072e5bd550d60c23f993ad52ebacde
1,001
# 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...
40.04
86
0.754246
ab3cb45dcd1e7dd875a3d5382ad24520fa55b5fa
1,027
require_relative '../../pipe/http' numpipes = 500 count = 0 unless ENV['COUNT'].nil? count = ENV['COUNT'].to_i end persec = 1 unless ENV['PER_SECOND'].nil? persec = ENV['PER_SECOND'].to_f end puts "#{persec}: #{count}" mux = Mutex.new buffer = Queue.new donebuffer = Queue.new threads = [] # threads << Thread.n...
16.836066
79
0.584226
338e97200b0333e4a7d0f7b0916ac98a8552cf54
235
module Rubicus; end $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) require 'rubicus/version' require 'rubicus/graph' require 'rubicus/layers'
29.375
94
0.744681
282e794c78cc656d3b910709363271a36286bc37
235
require File.dirname(__FILE__) + '/../../spec_helper' require File.dirname(__FILE__) + '/fixtures/classes' require File.dirname(__FILE__) + '/shared/replace' describe "Array#replace" do it_behaves_like(:array_replace, :replace) end
29.375
53
0.753191
1dd830c4e5d980e674e8e4eb0b796734cca0a9d2
2,845
class Scipy < Formula desc "Software for mathematics, science, and engineering" homepage "https://www.scipy.org" url "https://files.pythonhosted.org/packages/b4/a2/4faa34bf0cdbefd5c706625f1234987795f368eb4e97bde9d6f46860843e/scipy-1.8.0.tar.gz" sha256 "31d4f2d6b724bc9a98e527b5849b8a7e589bf1ea630c33aa563eda912c9...
41.231884
133
0.739543
f7753cbb8362869df5201ea2bd642e3583d49dbd
1,620
require 'rails/commands/commands_tasks' module Rails class Command #:nodoc: attr_reader :argv def initialize(argv = []) @argv = argv @option_parser = build_option_parser @options = {} end def self.run(task_name, argv) command_name = command_name_for(task_name) if com...
22.816901
85
0.624074
01c2995d449e27d27be3a0423a2323b8c543c9d2
1,351
require 'minitest/autorun' require_relative 'roman_numerals' # Common test data version: 1.0.0 070e8d5 class RomanNumeralsTest < Minitest::Test def test_1 # skip assert_equal 'I', 1.to_roman end def test_2 skip assert_equal 'II', 2.to_roman end def test_3 skip assert_equal 'III', 3....
14.072917
41
0.658031
b9c0966414000d5b5319d88296401ccd69d63eb5
11
replicas 1
5.5
10
0.818182
1cfe87175455164e39520c14cb493b87c270168a
5,094
# # Be sure to run `pod spec lint ReduxSwift.podspec' to ensure this is a # valid spec and to remove all comments including this before submitting the spec. # # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html # To see working Podspecs in the CocoaPods repo see https://github....
36.647482
122
0.599333
0352c24757e39e8f75937b9f75a7a8efab041030
970
class LoadNewItemJob < ApplicationJob queue_as :default def perform(new_news_location, hn_story_id) begin story_json = JSON.parse HTTP.get("https://hacker-news.firebaseio.com/v0/item/#{hn_story_id}.json?print=pretty").to_s if story_json.nil? return end item = Item.where(hn_id: h...
31.290323
122
0.686598
ed901f1a184a58b2d57a036f9bc1b29097623fb6
622
require 'test_helper' describe CacheWarp do before do WebMock.allow_net_connect! end after do WebMock.disable_net_connect! end describe "when cachewarp hits http://www.akamai.com/" do it "should report it as cached" do uri = 'http://www.akamai.com/' command = "bundle exec cachewarp ...
23.037037
58
0.655949
1c38d28c4fdf8e6da6288d865ce1a21f84bae18d
973
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'run_shell/version' Gem::Specification.new do |spec| spec.name = "run_shell" spec.version = RunShell::VERSION spec.authors = ["bruce"] spec.email = ["zth5906@g...
34.75
74
0.633094
28736fea3cc944a21b5728e45ba1ea4c4791a6f5
2,287
# # Cookbook:: hashicorp-vault # Resource:: config_listener # # 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 applicabl...
38.116667
160
0.771316
878fd4f8492d8af9a8e2b8c968864ad684b3e641
144
$:.unshift File.expand_path("../../lib/table2png", __FILE__) require 'bundler/setup' require 'imgkit' require 'chunky_png' require 'table2png'
20.571429
60
0.743056
e286543767956b6f5c6621a7b463f15ac0699d3c
10,352
class PaypalAccountsController < ApplicationController before_filter do |controller| controller.ensure_logged_in t("layouts.notifications.you_must_log_in_to_view_your_settings") end before_filter :ensure_paypal_enabled PaypalAccountForm = FormUtils.define_form("PaypalAccountForm") DataTypePermissions =...
35.452055
123
0.736862
2607f34dc2ea8fc77541d30a49e1f3aed97a4d81
305
if ActiveRecord::VERSION::MAJOR == 4 require 'activerecord-postgresql-expression/active_record/schema_dumper' require 'activerecord-postgresql-expression/active_record/connection_adapters/postgresql/schema_statements' else raise "activerecord-postgresql-expression supports activerecord ~> 4.x" end
43.571429
109
0.839344
018c5f3287b4bd7155cac9049358d9c4e1c07248
2,814
require File.expand_path('../boot', __FILE__) require 'rails/all' if defined?(Bundler) # If you precompile assets before deploying to production, use this line Bundler.require(*Rails.groups(:assets => %w(development test))) # If you want your assets lazily compiled in production, use this line # Bundler.requi...
44.666667
100
0.734542
9132e9db0ef457fcc5a44cfbbc09eb3fd82d1cea
165
def add(num1, num2) num1 + num2 end def multiply(num1, num2) num1 * num2 end puts add(2, 2) == 4 puts add(5, 4) == 9 puts multiply(add(2, 2), add(5, 4)) == 36
13.75
41
0.6
1a79b812df7670e35e9bd105ddd17ec5f6354d60
415
require 'test_helper' class GatewayTest < Test::Unit::TestCase def test_offline_gateway assert @gateway = ActiveMerchant::Billing::Gateway.factory(:offline) assert_equal @gateway.display_name, "Offline" end def test_braintree_vault_gateway assert @gateway = ActiveMerchant::Billing::Gateway.factory(...
29.642857
80
0.773494
bbd038ac9356f016fdbd8708e4e6b28281b288f6
55
class Link < ApplicationRecord belongs_to :batch end
13.75
30
0.8
62f500e8ebd8cc70c7db22301021e53be01ac9bb
5,079
## # This module requires Metasploit: http://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank = NormalRanking include Msf::Exploit::Remote::HttpClient include Msf::Exploit::CmdStager def initialize(in...
33.196078
130
0.541642
032bc1af6872d0afa6bf37160330d4c65985f884
3,744
## # This module requires Metasploit: https://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## class MetasploitModule < Msf::Auxiliary include Msf::Exploit::Remote::HttpClient def initialize(info = {}) super(update_info(info, 'Name' => 'Apple TV Image...
31.2
97
0.633814
38a9345d802fb0749ffa475d809aa03ad902e183
1,812
# frozen_string_literal: true require 'spec_helper' RSpec.describe Mutations::Boards::Issues::IssueMoveList do let_it_be(:group) { create(:group, :public) } let_it_be(:project) { create(:project, group: group) } let_it_be(:board) { create(:board, group: group) } let_it_be(:epic) { create(:epic, group: group) ...
30.711864
98
0.690949
ed8c316b7bddd6cf4887d8769e666ea4ffe776a4
948
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'nouislider/rails/version' Gem::Specification.new do |spec| spec.name = "nouislider-rails" spec.version = Nouislider::Rails::VERSION spec.authors = ["Charles Lee"] spe...
41.217391
193
0.681435
79556cd0e960eba82e4c169e07715a02691ad601
789
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
39.45
111
0.700887
d51b7e661901c51633345efe4a35944c4abb9c1d
2,319
# spin.rb -- # # This demonstration script creates several spinbox widgets. # # based on Tcl/Tk8.4.4 widget demos if defined?($spin_demo) && $spin_demo $spin_demo.destroy $spin_demo = nil end $spin_demo = TkToplevel.new {|w| title("Spinbox Demonstration") iconname("spin") positionWindow(w) } base_frame = T...
35.136364
75
0.640362
33835b141bfc31b6510fc3c959d7c93131f25220
721
Pod::Spec.new do |s| s.name = 'S2GeometrySwift' s.version = '1.0.2' s.license= { :type => 'MIT', :file => 'LICENSE' } s.summary = 'S2 Geometry library in Swift.' s.description = 'Swift port of S2 Geometry by Google.' s.homepage = 'https://github.com/philip-bui/s2-geometry-swift' s.author = { 'Philip Bui' ...
37.947368
97
0.662968
4aa474437ff1a61ffae220cc232d3c8d6f1b275e
123
class RemoveNsfFormFrom18fGsa < ActiveRecord::Migration def change remove_column :gsa18f_events, :nfs_form end end
20.5
55
0.796748
2662588e1bf8a7ddc4ef8a4407cfd39f1bd86071
45
module Abuelo VERSION = '0.1.0'.freeze end
11.25
26
0.688889
286f2349efe816c7a16f6557d1765e15ffc957f7
2,820
When(/^I upload a (\S+) file to \/(\S+)$/) do |size, uri| FileGenerator.with_lorem_file(convert_size(size)) do |file| S3Client[:source].s3_params = S3Manager.parse_s3_params(uri) S3Client[:source].expected_size = file.size S3Manager[:source].upload(file) S3Client[:source].actual_size = S3Manager[:so...
28.484848
88
0.698227
ac61054bb6a44b1e0ee4d446354e174aed7247dd
756
# -*- encoding: us-ascii -*- module Rubinius class Configuration def initialize end private :initialize def get_variable(name) Rubinius.primitive :vm_get_config_item raise PrimitiveFailure, "Rubinius::Configuration#get_variable primitive failed" end def get_section(section) ...
19.384615
85
0.642857
87edf9d19d8870a3b9b1f139807ab8826828ba29
1,320
require_relative 'lib/nba_advanced_stats/version' Gem::Specification.new do |spec| spec.name = "nba_advanced_stats" spec.version = NbaAdvancedStats::VERSION spec.authors = ["jessegan"] spec.email = ["jesse13579@gmail.com"] spec.summary = "Find out advanced statistics about...
45.517241
132
0.675758
08c9e45a73f650f62c6c7a64f2f584c723e8d9f5
839
module Astrails module Safe class Gpg < Pipe def compressed? active? || @parent.compressed? end protected def pipe if key rise RuntimeError, "can't use both gpg password and pubkey" if password "|gpg -e -r #{key}" elsif password "|gp...
19.511628
81
0.544696
acc6317c5f80b52a63470ab0756b496f5f76977d
1,352
module Cryptoexchange::Exchanges module Crytrex module Services class Market < Cryptoexchange::Services::Market class << self def supports_individual_ticker_query? true end end def fetch(market_pair) output = super(ticker_url(market_pair)) ...
32.190476
130
0.593935
e9d25aa29022d94cb8023c7e010437e6b140a22b
518
cask 'bitwig-studio' do version '3.1.2' sha256 '3245d845dd47ae71df6f403ad29fe6c517963ef1f5d153ea8c179bccad7fae83' url "https://downloads.bitwig.com/stable/#{version}/Bitwig%20Studio%20#{version}.dmg" appcast 'https://www.bitwig.com/en/download.html' name 'Bitwig Studio' homepage 'https://www.bitwig.com/' ...
28.777778
87
0.65251
ed51f22b5519f5dbb7752ee63777d82e48a910d5
2,078
class SuggestionsController < ApplicationController protect_from_forgery except: :index before_action :set_suggestion, only: [:show, :edit, :edit_request, :update, :report] before_action :new_image_manager_filter, only: [:show, :edit, :update, :new] def index @title = params[:title] @category = params...
27.706667
107
0.717517
e97c1e6597c6e79c5a2bfe9c3df65d05ee113c35
1,705
# Copyright 2014, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
46.081081
75
0.777713
62a6fd10cf079df8cff310e7c2ef0670f15346cd
754
class AdminController < ApplicationController include SessionHelper def index unless is_logged? head 401 return end unless current_user.kind == 'admin' head 403 return end render :index end def coaches unless is_logged? head 401 return end ...
15.08
45
0.616711
e8384e11c2e4621fe68f33f276db7dc76926e67a
966
require "logstash/namespace" require "logstash/event" require "logstash/plugin" require "logstash/logging" # This is the base class for logstash codecs. module LogStash::Codecs; class Base < LogStash::Plugin include LogStash::Config::Mixin config_name "codec" def initialize(params={}) super config_init(...
19.714286
71
0.694617
b9eee50887628166a9dc8db1912bc5ef7036e1fb
1,174
desc 'Creates a csv with all winners from a season' task export_winners: :environment do file = "#{Rails.root}/tmp/prizes.csv" winners = [] Season.where('season_number in (?)', [7, 8, 9]).each do |season| season.divisions.each do |div| if div.tier == 1 div.league_participants.each { |lp| winn...
30.102564
79
0.583475
91fb7ebb04d73109c9fb2ebce29011022a4bd3ae
1,308
# frozen_string_literal: true require "spec_helper" class Dummy include(::KaminariApiMetaData) end describe KaminariApiMetaData do describe "VERSION" do let(:current_version) { File.read("VERSION").split("\n").first } it "is set from the VERSION file" do expect(::KaminariApiMetaData::VERSION).to e...
24.679245
117
0.639908
01eb275343083342e2609f1dbcdd627832d2ccb8
99,942
require 'test_helper' class PostTest < ActiveSupport::TestCase def assert_tag_match(posts, query) assert_equal(posts.map(&:id), Post.tag_match(query).pluck(:id)) end def self.assert_invalid_tag(tag_name) should "not allow '#{tag_name}' to be tagged" do post = build(:post, tag_string: "touhou #{tag...
35.860065
149
0.607662
d5a5bb9038a55e5cb7052c6c9435c335036373fc
3,268
# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::Cosmosdb::Mgmt::V2020_04_01 module Models # # An Azure Cosmos DB MongoDB collection. # class MongoDBCollectionGetResults < A...
29.441441
70
0.452264
219291715ab0fadd4d72394eaa3aa2eea60ba52f
754
require 'spec_helper' describe 'cafe-core::common' do let(:chef_run) { ChefSpec::ServerRunner.new.converge(described_recipe) } it 'marks the common recipe as active' do expect(chef_run.node['cafe']['core']['common']['active']).to be true end cookbooks = %w(ntp zsh vim) cookbooks.each do |cookbook| ...
25.133333
74
0.672414
4a84e8dfa9a41ed5a5393f5e8a0ea83f8a9f817b
608
cask 'barxtemp' do version '1.3.2' sha256 '85c8347ab8e7cbc8e7cf639317f3ff5df75feb9420bf94596dcfa05ac5914d16' # github.com/Gabriele91/barXtemp was verified as official when first introduced to the cask url "https://github.com/Gabriele91/barXtemp/releases/download/#{version}/barXtemp.app.zip" appcast 'https://...
35.764706
93
0.777961
26a107b6404784d24b7e648f844af2f7f8e810e5
824
# -*- encoding: utf-8 -*- require File.expand_path('../lib/angular_material/rails/version', __FILE__) Gem::Specification.new do |s| s.name = "angular-material-rails" s.version = AngularMaterial::Rails::VERSION s.platform = Gem::Platform::RUBY s.authors = ["Alex Vangelov"] s.email = ["...
34.333333
75
0.651699
08fe17e700ea98f9af2dc10379d976514c458d52
416
# frozen_string_literal: true class CreateServiceAtLocations < ActiveRecord::Migration[5.2] def change create_table :service_at_locations, id: :uuid do |t| t.references :service, foreign_key: true, type: :uuid t.references :location, foreign_key: true, type: :uuid t.references :link_instance, f...
27.733333
65
0.709135
18e5610dca8bcae4ca05c9ed74714d00dae6336e
88
module WebConsole module REPL class Pry VERSION = "0.2.1" end end end
11
23
0.602273
6a6b705bc2959be06f0f6cf0d6de43afe22233c3
357
require 'ostruct' require 'representable/json' require 'viagogo/resource' module Viagogo class Geography < OpenStruct end module GeographyRepresenter include Representable::JSON property :id, as: :Id property :name, as: :Name property :country, as: :Country, extend: Viagogo::ResourceRepresenter...
21
99
0.739496
d5fe07b1fc2c76bb2cae36f733dc731558f5089f
69
class CommunityRecommendationsController < ApplicationController end
23
64
0.913043
f87ddd908e05c81c16a0f5c032dfcf0278f97db2
509
# @todo Hack until https://github.com/opscode-cookbooks/php/pull/111 is # included. node.override['php']['ext_conf_dir'] = "/etc/php5/mods-available" include_recipe 'php' include_recipe "apache2::mod_php5" pkgs = [ "php5-gd", "php5-mysql", "php5-mcrypt", "php5-curl", "php5-dev" ] pkgs.each do |pkg| pac...
18.851852
71
0.685658
ffee7ce717fa6176dec95620197b0fdec1af41e3
4,777
module Virtus # Instance methods that are added when you include Virtus module InstanceMethods module Constructor # Set attributes during initialization of an object # # @param [#to_hash] attributes # the attributes hash to be set # # @return [undefined] # # ...
21.912844
96
0.538623
5d717a3a72d8b08b7478f5843d39ad2fe703a722
934
cask 'flash-ppapi' do version '28.0.0.137' sha256 '46ed55fe6e464cdb2de97244cec77a26234ecb6c8de2e9a8d41a1e81e55ac5c6' url "https://fpdownload.adobe.com/pub/flashplayer/pdc/#{version}/install_flash_player_osx_ppapi.dmg" appcast 'http://fpdownload2.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_...
40.608696
104
0.745182
388b3985631279752cf3d5022018be07d967f52a
1,348
require_relative '../spec_helper' describe "Skatelog" do describe "inheritance" do it "inherits from ActiveRecord::Base" do expect(Skatelog < ActiveRecord::Base).to be true end end describe "associations" do before(:all) do Skatelog.destroy_all user = User.create(name:"Dramass", ...
24.962963
159
0.590504
1cef52234e8dd96f6ad099e36aace378ac13dab8
4,055
# frozen_string_literal: true require 'rubygems/test_case' require 'rubygems/doctor' class TestGemDoctor < Gem::TestCase def gem(name) spec = quick_gem name do |gem| gem.files = %W[lib/#{name}.rb Rakefile] end write_file File.join(*%W[gems #{spec.full_name} lib #{name}.rb]) write_file File.joi...
20.794872
68
0.687793
21ead02bbd859b0449099f1fbecfab542c71db8d
763
# frozen_string_literal: true module Facter # Filter inside value of a fact. # e.g. os.release.major is the user query, os.release is the fact # and major is the filter criteria inside tha fact class FactFilter def filter_facts!(searched_facts) filter_legacy_facts!(searched_facts) searched_fact...
27.25
79
0.630406
ed78ed46cae719b4799b5c5fecd9022aa540019e
3,370
# standard libraries require "bundler" require "digest" require "fileutils" require "forwardable" require "json" require "open3" require "pathname" require "set" require "strscan" require "tempfile" require "time" require "tmpdir" require "uri" require "yaml" require "erb" # 3rd-party libraries require "aws-sdk-s3" re...
28.083333
47
0.821662
acb8631a33480ab590befbfe06eb7e92b0cef5a3
2,343
# The MIT License (MIT) # Copyright (c) 2018 Mike DeAngelo Looker Data Sciences, Inc. # 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 r...
57.146341
139
0.691848
39febdec5e17b28c924dfcbb081bfa3b1f160583
727
require 'spec_helper' RSpec.describe Onesignal do describe '.configure' do before { Onesignal.configure } it 'creates a new instance of Configuration' do expect(Onesignal.configuration).to be_a(Configuration) end context 'when configuration exists' do it 'does not create a new instance'...
25.964286
90
0.686382
1d0ddf44db4c1b638d0e5c7e76dc112f5a4490c7
173
# frozen_string_literal: true class AddReadAuditsToRole < ActiveRecord::Migration[4.2] def change add_column :roles, :read_audits, :boolean, default: false end end
21.625
61
0.763006
79ae35ad5615ec56c7157930c3f8c84ac107eebb
2,858
# frozen_string_literal: true module Spree # Relatively simple class used to apply a {Spree::Tax::OrderTax} to a # {Spree::Order}. # # This class will create or update adjustments on the taxed items and remove # any now inapplicable tax adjustments from the order. class OrderTaxation # Create a new ord...
34.853659
92
0.683345
5dae558b6e02719aafa659b57e4900d1bbc0ee71
8,666
require 'test_helper' class MixinTestController < ActionController::Base end class MixinTest < ActionController::TestCase tests MixinTestController def test_set_tab controller.set_tab :footab assert_equal(:footab, controller.tab_stack[:default]) end def test_set_tab_with_namespace controller.set...
28.228013
112
0.718671
795a21d96cd2e360bd86d6a2d4a22286ffaab4f3
1,543
class TagsInput < ActiveAdminAddons::InputBase include ActiveAdminAddons::SelectHelpers def render_custom_input if active_record_select? return render_collection_tags end render_array_tags end def load_control_attributes load_data_attr(:model, value: model_name) load_data_attr(:meth...
27.553571
151
0.723914
4a4c20b3db6902d999a05966fa32c1bf38fe4ae4
416
require 'simplecov' cov_root = File.expand_path('..', File.dirname(__FILE__)) SimpleCov.start do #add_group('debug') { |src| print src.filename+"\n"; false } add_group('src') { |src| src.filename.start_with? "#{cov_root}/src" } add_group('test/src') { |src| src.filename.start_with? "#{cov_root}/t...
26
62
0.689904
bf0b0d7f2cc26bce13a7c575a8601c0373904bba
6,047
module TPPlus class Scanner def initialize end attr_reader :lineno, :col attr_reader :tok_line, :tok_col def scan_setup(src) @src = src @lineno = 1 @ch = " " @offset = 0 @col = 0 @rdOffset = 0 @prevDot = false # for groups @tok_line = 0 @tok_...
20.291946
115
0.401356
1852d3982046c8c1b315699962852494ae1a4d98
3,079
require './config/environment' require 'sinatra/flash' class ApplicationController < Sinatra::Base configure do set :public_folder, 'public' set :views, 'app/views' enable :sessions set :session_secret, ENV['SESSION_SECRET'] register Sinatra::Flash set :show_exceptions, false end error...
25.87395
167
0.662553
21351bca2d23add4ae97f028cc438bf48dd1d5d5
2,839
## # $Id$ ## ## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit # web site for more information on licensing and terms of use. # http://metasploit.com/ ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank ...
27.833333
82
0.611483
bb8bbeb3d17d244f8baf23ebe7e49028bfe2c765
1,841
# config valid for current version and patch releases of Capistrano set :application, "contentsearch" set :repo_url, "https://github.com/sul-dlss/content_search.git" # Default branch is :master ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call unless ENV['DEPLOY'] # Default deploy_to directory is /v...
33.472727
157
0.740902
21593762122ee68ef145fae10773288c1509f1f4
900
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'piliponi/version' Gem::Specification.new do |spec| spec.name = "piliponi" spec.version = Piliponi::VERSION spec.authors = ["Ace Dimasuhid"] spec.email = ["ace...
36
76
0.662222
1a3ff18bc4e3057ecc2fb24e4e9ee1d152881288
573
class CreateQuestions < ActiveRecord::Migration[5.0] def change create_table :question_templates do |t| t.integer :number t.integer :question_type t.integer :answers_type t.string :title t.string :subtitle t.json :answers t.json :true_answers t.json :data t...
21.222222
52
0.643979
3802f676d1dae5f142f6732671d0a79e89e4856c
182
class ChangeContentTypeToPods < ActiveRecord::Migration[5.2] def up change_column :pods, :content, :text end def down change_column :pods, :content, :string end end
18.2
60
0.714286
7ad1cd6891007bf861313c01d7b13ebe44d88dda
325
require 'bundler/setup' Bundler.setup require_relative '../lib/algorithmia.rb' def test_client expect(ENV['ALGORITHMIA_API_KEY']).to_not be_nil client = Algorithmia.client(ENV['ALGORITHMIA_API_KEY']); end RSpec.configure do |config| config.color = true config.tty = true config.formatter = :documentatio...
21.666667
60
0.756923
bfa53cbb0ef456e8f9c5b6d8ad0fb03054519e8d
372
module WebmoneyHq class Request < ApplicationRecord validates :daterequest, uniqueness: true has_many :items, primary_key: :daterequest, foreign_key: :daterequest, dependent: :destroy def operations oper = 0 self.items.each do |i| if i.canaggregate != false oper += i.count ...
20.666667
94
0.63172
ff2b283247797c4535b78e9cf63a8cf00f5095b6
1,135
# frozen_string_literal: true class ArticlesController < ApplicationController before_action :authenticate_user!, except: %i[index show] before_action :set_article, only: %i[show edit update destroy] def index @articles = Article.all respond_to do |format| format.html # index.html.erb forma...
18.606557
73
0.672247
9145d93aecaacc90ebfbac39a57b9f207d3daa09
274
module SupportInterface class ApplicationChoicesController < SupportInterfaceController def show choice = ApplicationChoice.find(params[:application_choice_id]) redirect_to support_interface_application_form_path(choice.application_form) end end end
30.444444
82
0.813869
9162c068068ba9492bcef90113760915d91cbcc9
566
require 'spec_helper' describe GroupMe::Likes do before do @client = GroupMe::Client.new(:token => 'TEST') end describe '.create_like' do it 'likes a message' do stub_post('/messages/3/5/like').to_return(:status => 200) response = @client.create_like(3, 5) expect(response).to eq(true...
18.866667
67
0.637809
33be53ff44bfad2a7bf25768944d4234180a4ec3
8,250
# frozen_string_literal: true module UiRules class PackingSpecificationItemRule < Base def generate_rules @repo = ProductionApp::PackingSpecificationRepo.new @bom_repo = MasterfilesApp::BomRepo.new @setup_repo = ProductionApp::ProductSetupRepo.new make_form_object apply_form_values ...
48.245614
111
0.505212
abbdf2e5b2ee49d1e7000453042383732ad9c058
635
class ValidIntValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) record.errors.add attribute, (options[:message] || "must be integer, array of integers, or range") unless valid_int?(value) end private def valid_int?(value) integer_array?(value) || integer_or_range...
25.4
109
0.672441
e852757385cbf5b3097645fba7f1d313c19c3589
1,398
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../fixtures/classes', __FILE__) describe IO, "#print" do before :each do @old_separator = $\ $\ = '->' @name = tmp("io_print") end after :each do $\ = @old_separator rm_r @name end it "writes $_.to_s fo...
25.418182
92
0.603004
614b0cc17b1d09e6aa1f482655bf20d5fba5f901
3,436
require "language/go" class Cosi < Formula desc "Implementation of scalable collective signing" homepage "https://github.com/dedis/cosi" url "https://github.com/dedis/cosi/archive/0.8.6.tar.gz" sha256 "007e4c4def13fcecf7301d86f177f098c583151c8a3d940ccb4c65a84413a9eb" license "AGPL-3.0" bottle do cella...
33.359223
93
0.701688
bb476c413c9c2ac23c9c72f3e40e83ca050d0e5b
535
class ScreenshotJob < ApplicationJob include SuckerPunch::Job def perform(sandbox) file = screenshot(sandbox) sandbox.screenshot.attach(io: file, filename: 'screenshot.jpg') sandbox.save! File.delete(file) end def screenshot(sandbox) browser = Ferrum::Browser.new(window_size: [600,300]) ...
24.318182
102
0.685981
ab7e3586e6a5c278a63ed331d5e6e7fc2e112eb5
725
class Admin::PricesController < Admin::ProductController before_action :_fetch_product def new @price = Price.new end def create @price = Price.new _price_params @price.product_id = @product.id if @price.save redirect_to admin_product_prices_path else render 'new' end end ...
20.714286
56
0.686897
f73b80b3c65e64260ea3a4b1c3d54dd898207b7e
9,657
# 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...
38.783133
115
0.623175
4a6f7ab3fcbb976495bc67e7602668a0084d6762
6,822
shared_examples 'sp handoff after identity verification' do |sp| include SamlAuthHelper include IdvHelper let(:email) { 'test@test.com' } context 'sign up' do let(:user) { User.find_with_email(email) } it 'requires idv and hands off correctly' do visit_idp_from_sp_with_ial2(sp) register_u...
31.293578
98
0.711228
bbbc2be14dc06965b3d841946ccf1cc2307fcde0
2,747
class Traefik < Formula desc "Modern reverse proxy" homepage "https://traefik.io/" url "https://github.com/traefik/traefik/releases/download/v2.6.1/traefik-v2.6.1.src.tar.gz" sha256 "06c24b339c8896cd8c2a88f85b1d6851ee2fcf9186169a7ff9df0ec87a0ed35e" license "MIT" head "https://github.com/traefik/traefik.git"...
35.217949
123
0.706589
08b935d3949f12bc926be4e3e421399f41042bca
1,081
# -*- coding: utf-8 -*- require 'helper' class TestRegressionTable06 < Test::Unit::TestCase def setup setup_dir_var end def teardown File.delete(@xlsx) if File.exist?(@xlsx) end def test_table06 @xlsx = 'table06.xlsx' workbook = WriteXLSX.new(@xlsx) worksheet = workbook.add_worksheet ...
25.738095
87
0.674376
7acb4f75119d281d76484296f75c0673e4cf379f
60,757
# Copyright (c) 2012-2020 Snowplow Analytics Ltd. All rights reserved. # # This program is licensed to you under the Apache License Version 2.0, # and you may not use this file except in compliance with the Apache License Version 2.0. # You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/li...
43.804614
253
0.620225
38b058a3c88d137b80cf250d1d9784b3f28b3755
777
require 'test_helper' require_relative '../examples/money_transfer' class TransferMoneyTest < MiniTest::Test def setup @account1= Account['A1', 50] @account2 = Account['B2', 100] end def test_deposit TransferMoney[to: @account1].deposit(10) assert_equal 60, @account1.balance end def test_wi...
25.064516
88
0.725869
61c2fd2abe6e9da49dac53a2e6980d91925f37d1
37
desc_ru=Сервер баз данных PostgreSQL
18.5
36
0.864865
e2cb6e5d809a72151c4346f281473c5470b49e0d
5,642
require 'digest' # gotta make sure that `clean_text` is the same for ads from both sources. that's the whole point. see below for examples for checking. # Ad.where("text ilike '%Charlotte on%'").first.text # => "Let's get organized! Team Warren will convene a volunteer training in Charlotte on Tuesday, October 1. \n...
47.813559
213
0.688231
ac1898b14035803ede5275be0e45de443670db8f
1,501
class UsersController < ApplicationController before_action :logged_in_user, only: [:index, :edit, :update, :destroy] before_action :correct_user, only: [:edit, :update] before_action :admin_user, only: :destroy def index @users = User.where(activated: true).paginate(page: params[:page]) end def show ...
20.561644
84
0.660227
08021e39841a2e2bcf7a1b9244dd003f97d99755
2,927
require 'helper' describe LinkedIn::Mash do describe ".from_json" do it "should convert a json string to a Mash" do json_string = "{\"name\":\"Josh Kalderimis\"}" mash = LinkedIn::Mash.from_json(json_string) mash.should have_key('name') mash.name.should == 'Josh Kalderimis' end en...
25.675439
124
0.611889
285d7e51a2d401a79051444d09cef0c8936d6029
269
class PopulateMemberRoles < ActiveRecord::Migration def self.up MemberRole.delete_all Member.all.each do |member| MemberRole.create!(:member_id => member.id, :role_id => member.role_id) end end def self.down MemberRole.delete_all end end
20.692308
77
0.710037