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
b9fa2f6908d8a8e0184241063cd5d9b77975e73f
789
require_relative "../../lib/commands/rotate" require_relative "../../lib/tt_robot" require_relative "../../lib/tt_robot/robot" require_relative "../../lib/tt_robot/output" RSpec.describe Rotate do let(:output) { Output.new } let(:robot) { Robot.new(output) } let(:rotate) { described_class.new(robot) } context...
27.206897
69
0.656527
e9b1f97ad61bf07df464b0b2867b3515f344d157
384
# encoding: UTF-8 require "rubygems" require "bundler" Bundler.require(:default) Bundler.require(Sinatra::Base.environment) require 'load_path' LoadPath.configure do add sibling_directory('lib') add sibling_directory('config') end require 'logging.cfg' require 'db' require 'controllers/redi...
21.333333
46
0.757813
abd3742816540d42f7d0111fecb3c099160fb0a9
257
spec('2.0.0') do configuration('my-configuration') do override 'OVERRIDE', '1' type 'debug' end target('my-target') do type :application source_dir 'support_files/abc' configuration do end end variant('$base') do target(123) do end end end
18.357143
37
0.696498
2150adc45e4051eb285b4b025dc77d170992ef7a
599
require 'spec_helper' describe "time_chunks/new" do before(:each) do assign(:time_chunk, stub_model(TimeChunk, :source_id => "MyString", :date_time => "" ).as_new_record) end it "renders new time_chunk form" do render # Run the generator again with the --webrat flag if you want to u...
28.52381
87
0.687813
6292cc62b73614f807cf9efe35ce952840536272
1,170
class UsersController < ApplicationController get '/signup' do if !session[:user_id] erb :'users/create_user' else redirect to ('/trackers') end end post '/signup' do @user = User.new(params) if !@user.save # binding.pry ...
22.5
57
0.493162
21f9445ac31ba97071a11a60f7bae0ca7890b395
1,168
require 'puppet_labs/trello/trello_issue_job' require 'puppet_labs/github/controller' module PuppetLabs module Github class IssueController < Controller attr_reader :issue def initialize(options = {}) super(options) if issue = options[:issue] @issue = issue end end ## # run processes the ...
27.162791
115
0.65411
62b5b6f70787bf87511b95bf59ac5cd6c84ec90e
100
json.extract! @hydroponic, :id, :fecha, :descripcion, :costo, :materiales, :created_at, :updated_at
50
99
0.74
1ce53ff57a200da8d8a39a06f94435ad9108ed9b
135
# Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, key: '_src_session'
33.75
73
0.8
e8e9ba49f20557daaa98612ef05d775530b229d8
1,133
describe :net_httpheader_set_form_data, :shared => true do before(:each) do @headers = NetHTTPHeaderSpecs::Example.new end describe "when passed params" do it "automatically set the 'Content-Type' to 'application/x-www-form-urlencoded'" do @headers.send(@method, "cmd" => "search", "q" => "ruby", "m...
41.962963
89
0.597529
e2bb378f663c3adf71a6dfb0dffbeab5d3c34d37
2,795
require 'spec_helper' describe Gitlab::Ci::Status::Build::Play do let(:user) { create(:user) } let(:project) { create(:project, :stubbed_repository) } let(:build) { create(:ci_build, :manual, project: project) } let(:status) { Gitlab::Ci::Status::Core.new(build, user) } subject { described_class.new(status)...
25.409091
81
0.638283
d5289bf5c39b77468d148abc4a33332b61160bbb
358
class CreateRelationships < ActiveRecord::Migration[5.1] def change create_table :relationships do |t| t.integer :follower_id t.integer :followed_id t.timestamps end add_index :relationships, :follower_id add_index :relationships, :followed_id add_index :relationships, [:follower_id, ...
25.571429
70
0.731844
ac0ced0775d2cf1b6d2b2520f3a25ab18786bd9e
682
require 'chefspec' describe 'gem_package::upgrade' do platform 'ubuntu' describe 'upgrades a gem_package with an explicit action' do it { is_expected.to upgrade_gem_package('explicit_action') } it { is_expected.to_not upgrade_gem_package('not_explicit_action') } end describe 'upgrades a gem_package w...
34.1
91
0.755132
9102763041b13e4c1ade81f1e0fbb0ab1fd8d3db
1,066
require "language/node" class Eslint < Formula desc "AST-based pattern checker for JavaScript" homepage "https://eslint.org" url "https://registry.npmjs.org/eslint/-/eslint-5.9.0.tgz" sha256 "5efa81dfad297759368bb859b87682bc9655414d62da39fba92816ae60b03c33" bottle do cellar :any_skip_relocation sha2...
34.387097
93
0.748593
6a3c293eeaf393cfeb9cd30dfb5031462c207a62
1,057
cask "telegram" do version "7.2.1,207127" sha256 "c24b7754e6273eec85b495f42433d902fea7f5782ed29c04ecc2082d9001a78f" url "https://osx.telegram.org/updates/Telegram-#{version.before_comma}.#{version.after_comma}.app.zip" appcast "https://osx.telegram.org/updates/versions.xml" name "Telegram for macOS" desc "...
37.75
104
0.74456
f8962a1c043f0073b28f9709534595cd3cda1020
1,672
# # Be sure to run `pod lib lint PerformanceLibWynk.podspec' to ensure this is a # valid spec before submitting. # # Any lines starting with a # are optional, but their use is encouraged # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name = '...
38.883721
115
0.653708
2197efb0750803475cc3f9b0b169ed8e9691fd39
6,719
module GatewayOptionsStubs def successful_gateway_options_response StubResponse.succeeded <<-XML <gateways> <gateway> <gateway_type>paypal</gateway_type> <name>PayPal</name> <auth_modes> <auth_mode> <auth_mode_type>signature</auth_mode_type> ...
45.398649
195
0.577467
91d3611131bb4c4534faa073480ef79b4e25be9e
628
class LikesController < ApplicationController before_action :find_likeable before_action :authenticate_user! respond_to :js def create @likeable.liked_by current_user @likeable.create_activity(:like, owner: current_user) end def destroy @likeable.disliked_by current_user activity = PublicA...
27.304348
117
0.770701
1c8bed2036f0844917d51d2705a6e0fd06820531
3,404
require 'mittsu' module Mittsu class PerspectiveCamera < Camera attr_accessor :zoom, :fov, :aspect, :near, :far def initialize(fov = 50.0, aspect = 1.0, near = 0.1, far = 2000.0) super() @type = 'PerspectiveCamera' @zoom = 1.0 @fov = fov.to_f @aspect = aspect.to_f @nea...
26.80315
95
0.56698
bb9af19157183338d82f63f78a84ae435ca71568
521
Pod::Spec.new do |s| s.name = 'hhxNewProperty' s.version = '0.1.0' s.summary = 'hhxNewProperty is a library for personal use.' s.homepage = 'https://github.com/13760770758/hhxNewProperty' s.license = 'MIT' s.author = { 'hhx' => '921094044@qq.com' } s.platform ...
37.214286
107
0.600768
e9c18be0b33bc627720e48f01ee7bbeec93a8e7a
1,492
class GitFixup < Formula desc "Alias for git commit --fixup <ref>" homepage "https://github.com/keis/git-fixup" url "https://github.com/keis/git-fixup/archive/v1.1.1.tar.gz" sha256 "1843caf40fb54bfd746f966fc04fac68613fe8ec2f18b2af99f9d32a40ea0809" head "https://github.com/keis/git-fixup.git", :branch => "mas...
36.390244
107
0.723861
28feb10d5b5713d1feed1e7cda4e463536face30
677
Pod::Spec.new do |spec| spec.name = "LBRichTextView" spec.version = "0.0.3" spec.summary = "支持各种自定义类型输入的强大RichTextView" spec.description = "一个可以支持图片输入,视频输入,语音输入,类似于iOS系统自带的备忘录,可以定义View输入的强大富文本RichTextView。" spec.homepage = "https://github.com/A1129434577/LBRichTextView" spec.license ...
45.133333
112
0.649926
28eb4c11746df936ec9084775315d6f942c20bf5
2,466
# frozen_string_literal: true module Enums module Ci module Pipeline # Returns the `Hash` to use for creating the `failure_reason` enum for # `Ci::Pipeline`. def self.failure_reasons { unknown_failure: 0, config_error: 1, external_validation_failure: 2, ...
30.825
87
0.609084
8798e989e9214ad18223b0e86177e08192a38af9
41
module HerokuSan VERSION = "4.4.0" end
10.25
19
0.682927
011bc936f9c7ce8b1e32c674af49b550e3f54cf0
3,068
#!/usr/bin/env ruby # # check-stale-results.rb # # Author: Matteo Cerutti <matteo.cerutti@hotmail.co.uk> # require 'net/http' require 'json' require 'sensu-plugin/utils' require 'sensu-plugin/check/cli' require 'chronic_duration' class CheckStaleResults < Sensu::Plugin::Check::CLI include Sensu::Plugin::Utils op...
27.392857
126
0.571056
91a80b32afb6a63d5cc8483e87fdd0436dc6a9bc
418
action :test do ruby_block "interior-ruby-block-1" do block do # doesn't need to do anything end notifies :run, "ruby_block[interior-ruby-block-2]", :immediately end ruby_block "interior-ruby-block-2" do block do $interior_ruby_block_2 = "executed" end action :nothing end ...
16.72
68
0.662679
212e42273b2b92e62d2242ce7e0e2d5eb6710398
1,210
# frozen_string_literal: true module View module Game class Bank < Snabberb::Component include Lib::Color needs :game needs :layout, default: nil def render if @layout == :card render_card else props = { style: { 'margin-bott...
22.830189
80
0.456198
1dc0a8f65e8ac131a844d945eed7069db5701fec
457
class Producto < ActiveRecord::Base belongs_to :solicitud belongs_to :proveedor belongs_to :compra before_save :precio_total, :total def precio_total if self.cantidad && self.precio self.total = self.cantidad * self.precio end end def total ...
20.772727
73
0.617068
d5a26ca17be41917ceece396e3549b80bbe5abe2
295
# frozen_string_literal: true module Drivers module Appserver class Null < Drivers::Appserver::Base adapter :null allowed_engines :null output filter: [] def configure; end alias after_deploy configure alias after_undeploy configure end end end
18.4375
41
0.684746
f83172e5eddeafcf7f37e08d8083aaa82935990c
1,538
# frozen_string_literal: true require 'ckeditor' # Use this hook to configure ckeditor Ckeditor.setup do |_config| # ==> ORM configuration # Load and configure the ORM. Supports :active_record (default), :mongo_mapper and # :mongoid (bson_ext recommended) by default. Other ORMs may be # available as additional...
35.767442
106
0.698309
ff8949d32673368c4202c0ac95d9d4212877f046
770
module Exchanger # SOAP Client for Exhange Web Services class Client delegate :endpoint, :timeout, :username, :password, :debug, :insecure_ssl, :ssl_version, :to => "Exchanger.config" def initialize @client = HTTPClient.new @client.debug_dev = STDERR if debug @client.set_auth nil, usernam...
36.666667
118
0.709091
26b98afa52588bbc015e7284b25e0777b6d63b6a
8,524
# # Author:: Adam Jacob (<adam@opscode.com>) # Author:: Tim Hinderliter (<tim@opscode.com>) # Author:: Christopher Walters (<cw@opscode.com>) # Author:: Daniel DeLeo (<dan@getchef.com>) # Copyright:: Copyright 2008-2014 Chef Software, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, V...
35.966245
121
0.65955
e9cbde5873bbd9fabb1ba21d48ac05f3ea1b8934
648
module VagrantPlugins module SyncedFolderNFSGuest module ProviderVMwareFusion module Cap def self.read_host_ip # In practice, we need the host's IP on the vmnet device this VM uses. # It seems a bit tricky to get the right one, so let's allow all. return `for N in $(ifc...
32.4
137
0.611111
7a47eeeb4ee22fe36117f47268ec18474a84ab3b
6,665
require 'spec_helper' module Spree describe StockLocation do subject { create(:stock_location_with_items, backorderable_default: true) } let(:stock_item) { subject.stock_items.order(:id).first } let(:variant) { stock_item.variant } it 'creates stock_items for all variants' do subject.stock_ite...
30.295455
90
0.623106
6a45c69d44483c78aa0c437a789960323b9c22bc
10,066
require_relative '../../config/environment' require 'rack-flash' class BooksController < ApplicationController use Rack::Flash get '/books' do if Helpers.is_logged_in?(session) @books = Book.all erb :'books/index' else erb :'sessions/authentication_error', :layout => false end end ...
32.262821
141
0.591993
0316d5699bfed264a7e5019e3174ee436ece5243
357
require 'cinch' class Messenger include Cinch::Plugin match /msg (.+?) (.+)/ def execute(m, receiver, message) User(receiver).send(message) end end bot = Cinch::Bot.new do configure do |c| c.server = "irc.freenode.org" c.nick = "CinchBot" c.channels = ["#cinch-bots"] c.plugins.plugins...
15.521739
35
0.630252
6a3add543cbc23e216ee8d32f706ab424fa4b422
2,577
# frozen_string_literal: true module Fireblocks class API class Transactions class << self EXTERNAL_WALLET = 'EXTERNAL_WALLET' VAULT_ACCOUNT = 'VAULT_ACCOUNT' VALID_TRANSACTION_KEYS = %i[ amount assetId source destination destination...
24.542857
94
0.500194
333751637ba5b9e874fbee895ef8fae6fd1fa535
353
class CreateAddresses < ActiveRecord::Migration def change create_table :addresses do |t| t.string :zip_code t.string :type_address t.string :address t.string :number t.string :complement t.string :neighborhood t.string :city t.string :state t.text :note ...
19.611111
47
0.631728
1c7b544c5bd6732acdd5a00246511cbdce59d01e
544
# frozen_string_literal: true require_relative "graphql/cop" require_relative "graphql/argument_description" require_relative "graphql/argument_name" require_relative "graphql/extract_input_type" require_relative "graphql/extract_type" require_relative "graphql/field_definitions" require_relative "graphql/field_descr...
34
49
0.876838
bbfca84b0397c9b4d0b2515ea75d5724ebcffe86
774
class ParseDGSResponse < Faraday::Response::Middleware def on_complete(env) if env[:body] reencode_body(env) handle_errors(env) end end private def reencode_body(env) env[:body].encode('UTF-8', invalid: :replace, undef: :replace) end def handle_errors(env) if had_login_errors?...
23.454545
114
0.686047
e9cf2ed9d2711fb828c9f9498ddbd6809d775011
1,171
# # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. # Run `pod lib lint geolocator.podspec' to validate before publishing. # Pod::Spec.new do |s| s.name = 'geolocator_apple' s.version = '1.2.0' s.summary = 'Geolocation iOS plugin for Flutter.' s.d...
46.84
110
0.64304
1a0e39a2372ae48ef530ba75002361306c1df643
3,842
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::DataMigration::Mgmt::V2018_07_15_preview module Models # # Model object. # # class MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputMigr...
28.671642
129
0.495055
5d9d5a86374834659bdca9c57b4aeb92a8138aea
3,615
require 'rails_helper' RSpec.describe SmsNotificationService do let!(:facility_name) { 'Simple Facility' } let!(:appointment_scheduled_date) { Date.new(2018, 1, 1) } let!(:appointment) do create(:appointment, facility: create(:facility, name: facility_name), scheduled_date: appointment_...
52.391304
138
0.559613
7ae845f508dff8beecc820674720a4c50908cde8
352
describe file('/opt/chef/embedded/etc/gemrc') do it { should exist } its('type') { should eq :file } its('owner') { should eq 'root' } its('group') { should eq 'root' } its('mode') { should eq 420 } its('content') { should match(%r{":sources":\n- http://rubygems.org/}) } its('content') { should match(%r{g...
35.2
74
0.596591
e21738c6c1486261e0fa066a49ec5b0a9e1c7565
445
class Bob def hey(msg) capital_l, lower_l = msg.scan(/[A-Z]/), msg.scan(/[a-z]/) numbers, last_sym = msg.scan(/[0-9]/), msg.gsub(/\n/, '').scan(/[\?!\.]$/) if (capital_l + lower_l + numbers + last_sym).empty? 'Fine. Be that way!' elsif lower_l.empty? && capital_l.empty? == false 'Whoa, chi...
27.8125
78
0.550562
39d120cac331a3270dbb100e34c9f1e9dc1ff895
163
Rails.application.routes.draw do # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html root 'trellos#index' end
32.6
102
0.779141
0125238e7ae8446ecb48a31312a71aae1b72b7ec
8,331
=begin #NSX-T Data Center Policy API #VMware NSX-T Data Center Policy REST API OpenAPI spec version: 3.1.0.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.19 =end require 'date' module NSXTPolicy # BGP neighbor learned/advertised route details. class BgpNeighb...
29.027875
149
0.614212
618c0ab28756296f5c27ce9492db2ebee0a331e5
426
module Swift module Gist end end require "swift/gist/cli" require "swift/gist/file_watcher" require "swift/gist/format_swift_module" require "swift/gist/generate_project" require "swift/gist/generate_project_art" require "swift/gist/runner" require "swift/gist/spm_package_creator" require "swift/gist/spm_project_c...
25.058824
41
0.819249
5dac53c1792c65d05c06d7201234c99f093a1a3c
2,554
## # This module requires Metasploit: https://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'metasploit/framework/hashes/identify' class MetasploitModule < Msf::Post include Msf::Post::File include Msf::Post::Linux::Priv include Msf::Auxiliary::Report def...
28.065934
119
0.618246
5d75a95e31a59769d669a8237ff93c250a4bf71f
254
RSpec.describe Supabase do it 'has a version number' do expect(Supabase::VERSION).not_to be nil end end RSpec.describe Supabase::Error do it "descends StandardError" do expect(Supabase::Error.ancestors).to include(StandardError) end end
21.166667
63
0.751969
6af6b32208989b2946d3bbc5bc099fba24d0fa60
18,411
#!/usr/bin/env ruby # encoding: utf-8 require 'test/unit' require File.join(File.dirname(__FILE__), 'setup_variant') require 'stringio' require 'tempfile' require 'ostruct' unless Array.method_defined?(:permutation) begin require 'enumerator' require 'permutation' class Array def permutation ...
33.71978
229
0.588616
1ccdb264c31df43ff238a9b8f67d5dc010ef922b
4,892
describe "Time Spiral block" do include_context "db", "tsp", "tsb", "plc", "fut" it "is:future" do assert_search_include "is:future", "Dryad Arbor" assert_search_exclude "is:new", "Dryad Arbor" assert_search_exclude "is:old", "Dryad Arbor" assert_search_results "is:future is:vanilla", "Blade ...
40.766667
144
0.717089
ffa0eed91f5a145183935ace9cc0bd483dc1b28a
1,403
=begin #TextMagic API #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: 2 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.8 =end require 'spec_helper' require 'json' require 'date' # Unit tests...
25.981481
102
0.735567
1ac62ac09efaf60fafedde677ce209cda6426467
176
class DomainTerm < ActiveRecord::Base # TODO we should add an index on this join table and remove the uniq query has_and_belongs_to_many :local_authorities, -> {uniq} end
29.333333
76
0.772727
e90eeee2b15d0959dd354cc1ec802e50127badda
146
require 'test_helper' module Annex class BlockTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end end
14.6
43
0.664384
6ae8a2cea33cd648c37dbe3a5eb53a12d0a2da58
552
require "pathname" require "json" require "ri_cal" require "addressable/uri" require "faraday" require "faraday_middleware" require "active_support/cache" require "almanack/base" require "almanack/version" require "almanack/configuration" require "almanack/calendar" require "almanack/serialized_transformation" require...
27.6
44
0.835145
e9f9c558414c676d90031623bcf63bfb32ba8593
2,113
class EquipamentosController < ApplicationController before_action :set_equipamento, only: [:show, :edit, :update, :destroy] # GET /equipamentos # GET /equipamentos.json def index @equipamentos = Equipamento.all end # GET /equipamentos/1 # GET /equipamentos/1.json def show end # GET /equipame...
28.173333
109
0.687175
26d561b99a5fadacab041bb1b31eb6f22264b379
417
module EPlusOut module Relations class CoolingPeakConditions < Relation def initialize(gateway, mapper = Mappers::PeakConditionMapper.new) super(gateway, mapper) end def name_field :report_for_string end def clauses { table_name: "Cooling Peak Co...
18.130435
72
0.592326
33e754e55a7739e03937c909c05fced5826308b3
1,070
# # Cookbook:: my_cookbook # Spec:: default # # Copyright:: 2018, The Authors, All Rights Reserved. require 'spec_helper' describe 'my_cookbook::pandbprod01' do context 'When all attributes are default, on Ubuntu 16.04' do let(:chef_run) do # for a complete list of available platforms and versions see: ...
29.722222
82
0.7
abe53a2f59bec2174f46408d37f7a90c2141c4f8
84
module Furigana module Util module Lists extend self end end end
9.333333
17
0.642857
62164164d590d2405415957ec8cf849f3533c02c
528
class Project < ApplicationRecord belongs_to :user include PgSearch::Model has_many :volunteers, dependent: :destroy has_many :volunteered_users, through: :volunteers, source: :user, dependent: :destroy acts_as_taggable_on :skills acts_as_taggable_on :project_types pg_search_scope :search, against: %i...
24
100
0.761364
1d2b870e2789afd09f7269d0ff87bd3cfa986dc1
2,166
class FdkAacEncoder < Formula desc "Command-line encoder frontend for libfdk-aac" homepage "https://github.com/nu774/fdkaac" url "https://github.com/nu774/fdkaac/archive/v1.0.1.tar.gz" sha256 "ce9459111cee48c84b2e5e7154fa5a182c8ec1132da880656de3c1bc3bf2cc79" license "Zlib" bottle do sha256 cellar: :any...
32.818182
106
0.663897
384152463c63a6e6214192bb281ad07521ef0669
1,548
require "spec_helper" describe MaropostApi::Journeys do before do @client = MaropostApi::Client.new(auth_token: TOKEN, account_number: ACCOUNT_ID) end describe "#start", vcr: true do context "with correct params" do it "sends start request with provided params" do journey_id = "12429" ...
29.207547
89
0.669897
79f8097afcf18ed883c82ac987cb1140883b85c8
6,844
# frozen_string_literal: true # WARNING ABOUT GENERATED CODE # # This file is generated. See the contributing guide for more information: # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE module Aws::Glacier class Account extend Aws::Deprecations # @ove...
28.164609
79
0.602425
0896cd5992dc8d5e8f9faf4ed1a3fa7489295193
1,546
# -*- encoding: utf-8 -*- # stub: addressable 2.7.0 ruby lib Gem::Specification.new do |s| s.name = "addressable".freeze s.version = "2.7.0" s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Bob Aman"...
41.783784
256
0.697283
7ac1bd58edee2a829b09e0ec105a45f40b55dee5
1,816
# frozen_string_literal: true module SystemCheck # Used by gitlab:sidekiq:check rake task class SidekiqCheck < BaseCheck set_name 'Sidekiq:' def multi_check check_sidekiq_running only_one_sidekiq_running end private def check_sidekiq_running $stdout.print "Running? ... " ...
27.938462
94
0.633811
6a19b0b218cdeb26dbb8a804c5247020a899b945
133,619
# encoding: US-ASCII $TESTING = true # :stopdoc: require "minitest/test" require "sexp_processor" # for deep_clone # key: # wwtt = what were they thinking? class Examples attr_reader :reader attr_writer :writer def a_method x; x+1; end alias an_alias a_method define_method(:bmethod_noargs) do x + 1 ...
42.771767
359
0.323726
6137fb49043cdb65aa56de6b1950cec37df33714
296
def get_grade(g1, g2, g3) grade = (g1 + g2 + g3) / 3.0 case grade when 90..100 then "A" when 80..90 then "B" when 70..80 then "C" when 60..70 then "D" when 0..60 then "F" end end puts get_grade(90, 90, 89.99999999999999999999)# == "A" puts get_grade(50, 50, 95) #== "D"
21.142857
55
0.577703
4a167ed78e85fdd78092dbb919153bf79e0e31c5
401
class UpdateBotsDescription < ActiveRecord::Migration[4.2] def change b = BotUser.smooch_user unless b.nil? b.set_description = 'Connect Check with Facebook Messenger, WhatsApp and Twitter to create tiplines.' b.save! end b = BotUser.keep_user unless b.nil? b.set_description = 'A...
26.733333
107
0.688279
33fe625c90f4feb229d8b4b6a83f303d371acc69
621
class ApplicationHelper::Toolbar::TimelineCenter < ApplicationHelper::Toolbar::Basic button_group('timeline_downloading', [ button( :timeline_txt, 'fa fa-file-text-o fa-lg', N_('Download this Timeline data in text format'), nil, :url => "/render_txt"), button( :timeline_csv...
27
84
0.597424
3846eb0a69ba60bfe619eeb2c505078a3b5d139a
9,570
# frozen_string_literal: true require "acceptance_helper" describe "Logidze meta", :db do include_context "cleanup migrations" before(:all) do Dir.chdir("#{File.dirname(__FILE__)}/../dummy") do successfully "rails generate logidze:install" successfully "rails generate logidze:model user --only-tri...
27.579251
106
0.598642
d5d84c7f5f3adb92fcbdca9d0cdfc03784c149cd
380
module VagrantPlugins module Proxmox module Action # set env[:result] to :is_created class IsCreated < ProxmoxAction def initialize app, env @app = app end def call env env[:result] = env[:machine].state.id != :not_created # env[:result] = $machine_state[env[:machine].name] = :not...
18.095238
71
0.65
01a6ddd6e064f491709b3bfdc4731bb05ec45db4
468
require "spec_helper" require "fog/brightbox/models/compute/account" describe Fog::Brightbox::Compute::Account do include ModelSetup subject { service.accounts.new } describe "when asked for collection name" do it "responds 'accounts'" do assert_equal "accounts", subject.collection_name end end...
22.285714
54
0.726496
08fc31d76771c4a939f36dc0d95ec78958be1dfa
1,811
module Megam class TextFormatter attr_reader :data attr_reader :ui def initialize(data, ui) @ui = ui @data = if data.respond_to?(:display_hash) data.display_hash elsif data.kind_of?(Array) data elsif data.respond_to?(:to_hash) data.to_ha...
28.296875
79
0.538929
1c60c88804b1acc9cf456d3f7aaf36fd956be8ac
3,642
# 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::CDN::Mgmt::V2020_09_01 module Models # # Defines the parameters for QueryString match conditions # class QueryStringMatchCon...
31.669565
104
0.500275
2164443563237f7d3f86eaf7e073b89bd6f7d50a
2,578
module Erp::Products class Comment < ApplicationRecord belongs_to :product, class_name: 'Erp::Products::Product' belongs_to :parent, class_name: "Erp::Products::Comment", optional: true belongs_to :user, class_name: "Erp::User" has_many :children, class_name: "Erp::Products::Comment", foreign_key: "pa...
25.524752
107
0.59038
e294c6296019b2cb04160e87ff9b897b5979918c
1,587
#-- # Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net> # # 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 u...
33.765957
74
0.706994
e2021bc946db222626994a8083b5e49e5a6607f8
1,267
# Copyright 2015 Google 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/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
33.342105
83
0.73165
211a56baf6c5bb20cad657ba3c75713f99d0df08
2,972
require 'spec_helper' # for this spec to work, you need to have postgres and mysql installed (in # addition to the gems), and you should make sure that you have set up # appropriate users and permissions. see database.yml for more info describe "adapter" do include_context "hairtrigger utils" describe ".triggers...
30.958333
165
0.622476
d53e1dfecd2606786b7019246278dd763691771b
3,764
require "rails_helper" describe "Heading", type: :view do def component_name "heading" end it "fails to render a heading when no title is given" do assert_raises do render_component({}) end end it "renders a heading correctly" do render_component(text: "Download documents") assert...
30.852459
86
0.702179
ab54e3ce38bd8e09d5460df2f8aba82137dd0a4b
16,109
class Openstackclient < Formula include Language::Python::Virtualenv desc "Command-line client for OpenStack" homepage "https://openstack.org" url "https://files.pythonhosted.org/packages/f9/d8/474a7371757b553e61ae5d4fe14c4443e84a20cc4c84db91565e79d3d45d/python-openstackclient-5.8.0.tar.gz" sha256 "334852df8...
49.566154
151
0.822025
e2b3f4170299997e86b0a4f9719f8beac955a1a1
394
class CreateCompetes < ActiveRecord::Migration[5.0] def change create_table :competes do |t| t.references :group, null: false t.references :event, null: false t.string :award t.timestamps end add_foreign_key :competes, :groups, on_delete: :cascade, on_update: :cascade add_foreign_ke...
21.888889
80
0.705584
21b51e91537e0d0015f49e9f17cce0b7a2d85ec9
4,602
cask "firefox" do version "84.0" language "cs" do sha256 "9fe199fdb21191cbca9ecbfd11c0771e9fdaab0add164a2b899d1bfa933bd2c8" "cs" end language "de" do sha256 "297d87391b2fe18067e6bcb1ceeb94fb1e556108673447f361bad75f06b81e84" "de" end language "en-CA" do sha256 "1785253cc8425d439a91b2a056...
31.520548
152
0.752064
2144f20b284549ffd070e0345c19ff86b9674e0f
202
module BowlingSolitaire class Move def before @round.preview end def after apply.preview end def preview before puts "-->" after end end end
10.631579
23
0.554455
2883e13a2ce24953b0e8bb7b998362b8425ce52c
387
class ConditionIsHolofoil < ConditionSimple def match?(card) return false unless card.frame == "m15" return true if card.set_code == "ust" and card.rarity == "basic" return false unless %W[rare mythic special].include?(card.rarity) return false if card.back? return false if card.types.include?("co...
25.8
69
0.692506
183f2ba0881cc5f7401e35c3c337565f7f26493e
4,473
# Copyright 2017 OpenCensus Authors # # 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 wr...
37.90678
80
0.653029
08f02732400c5427745ae49b31f843428280c0d9
140,376
survey 'IQ', :full_title => 'Iraq', :default_mandatory => 'false', :status => 'alpha', :description => '<p><strong>This has been generated based on a default and needs to be localised for Iraq. Please help us! Contact <a href="mailto:certificate@theodi.org">certificate@theodi.org</a></strong></p><p>This self-as...
54.451513
724
0.690873
b9fb5ecf465adf420f9cd2faf086a170e95147c1
1,840
# frozen_string_literal: true require_relative './orms/active_record/models' RSpec.describe Surrealist do describe 'nested object surrealization' do context 'object that has self-referencing assocation to surrealize' do it 'works' do expect(Executive.first.build_schema.fetch(:assistant).fetch(:exe...
29.206349
94
0.655435
1a4885f2f38d4de3a5e5e08733d48f5eaa8124dd
1,133
# 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 Gem::Specification.new do |spec| spec.name = 'aws-sdk-opsworks' spec.version = File.read(Fil...
37.766667
109
0.659312
797184ed105255c31dd6fd703cdd197cbba681f4
247
# frozen_string_literal: true class CreatePostReceivers < ActiveRecord::Migration[5.2] def change create_table :post_receivers do |t| t.references :user, foreign_key: true t.references :post, foreign_key: true end end end
22.454545
56
0.724696
ac52ae18a49fce9179d8f55f5dd9e70c2d1e3b76
888
class Scheduler # Wait for the given file descriptor to become readable. def wait_readable(fd) end # Wait for the given file descriptor to become writable. def wait_writable(fd) end # Wait for the given file descriptor to match the specified events within the specified timeout. def wait_for_single_fd(fd, ev...
24.666667
97
0.762387
edbf56103329142e7a8fa34c3a9532cc326541bf
2,946
module Watir class IFrame < HTMLElement # # Move Driver context into the iframe # def switch_to! locate unless located? wd.switch! end # # Returns text of iframe body. # #body ensures context so this method does not have to # # @return [String] # def text...
19.006452
81
0.615411
bf0abcc53ac5faca2c7d85e835587c23c73e6f73
621
cask :v1 => 'quick-search-box' do version '2.0.0.1447' sha256 '3fec80343c50a5b492e140fef13bd1bc4cce835beb3952591e8b4638e5940470' url "https://qsb-mac.googlecode.com/files/GoogleQuickSearchBox-#{version}.Release.dmg" name 'Quick Search Box' homepage 'https://code.google.com/p/qsb-mac/' license :oss tags :...
25.875
88
0.695652
032152b49197977fb0eeabe3c150b6c71bbed28a
344
class Role < ActiveRecord::Base has_and_belongs_to_many :activists, :join_table => :activists_roles belongs_to :resource, :polymorphic => true #, #:optional => true validates :resource_type, :inclusion => { :in => Rolify.resource_types }, :allow_nil...
22.933333
69
0.590116
6263f7ef556ad364a828c3bd0a3643f53f49df7c
1,710
Pod::Spec.new do |s| # 框架的名称 s.name = "BRPickerView" # 框架的版本号 s.version = "2.7.5" # 框架的简单介绍 s.summary = "A custom picker view for iOS." # 框架的详细描述(详细介绍,要比简介长) s.description = <<-DESC A custom picker view for iOS, Include "日期选择器,时间选择器,地址选择器,自定义字符串选择器,支持自定义样式,适配深色模式",...
27.142857
139
0.630409
030430728c2ac838d13b3d5638bd1cc384841b04
1,936
class EintragsController < AuthController before_action :set_eintrag, only: [:show, :edit, :update, :destroy] # GET /eintrags # GET /eintrags.json def index @eintrags = Eintrag.all end # GET /eintrags/1 # GET /eintrags/1.json def show end # GET /eintrags/new def new @eintrag = Eintrag.n...
25.813333
95
0.661674
ed7164e14de4fdcc9b1281a0a51c5cbc12ebfbec
307
class Multiclone < Formula desc "" homepage "" url "https://github.com/osteele/multiclone/releases/download/v0.1.0/multiclone_0.1.0_macOS_64-bit.tar.gz" version "0.1.0" sha256 "108bdf0f49e5064346e98e537d9c191dfef4894cc217ba79a47ed0e462327dd6" def install bin.install "multiclone" end end
25.583333
107
0.765472
f7bbc01f66fd37ed21ee6f96bce472c7a08ce132
395
module Maria class ImagesController < ApplicationController def new @image = Image.new end def create @image = Image.new(params[:image]) if @image.save redirect_to image_path(@image) else render :new end end def show @image = Image.find(params...
14.62963
48
0.574684
62be8bd62ffe3167a11de0f9cf6c1a816390d4e9
7,218
module ChargeBee class Invoice < Model class LineItem < Model attr_accessor :id, :subscription_id, :date_from, :date_to, :unit_amount, :quantity, :amount, :pricing_model, :is_taxed, :tax_amount, :tax_rate, :discount_amount, :item_level_discount_amount, :description, :entity_description, :entity_type, :tax_...
40.550562
290
0.708368
e9b3a2001b241e09daa4332086619b3542e01a40
2,675
require 'fakefs/spec_helpers' require 'spec_helper' describe Bosh::Cli::Command::ImportCompiledPackages do subject(:command) { described_class.new } describe 'import compiled_packages' do with_director context 'when director is targeted' do with_target context 'when the user is logged in' do...
33.024691
120
0.575701
269b84eab57b8c9b71312c58bec7cb1a0d4efc50
448
require_relative '../../linux/cap/change_host_name' module VagrantPlugins module GuestPhoton module Cap class ChangeHostName extend VagrantPlugins::GuestLinux::Cap::ChangeHostName def self.change_name_command(name) return <<-EOH.gsub(/^ {14}/, "") # Set the hostname ...
22.4
62
0.580357