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
1a2e9de56615d5237ea342f1aa30511217028166
2,453
class Pcl < Formula desc "Library for 2D/3D image and point cloud processing" homepage "http://www.pointclouds.org/" url "https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.1.tar.gz" sha256 "5a102a2fbe2ba77c775bf92c4a5d2e3d8170be53a68c3a76cfc72434ff7b9783" head "https://github.com/PointCloudLibrary/pcl....
31.857143
93
0.714635
6274657f881a147618edee1600eb424c6b7cf273
226
Rails.application.routes.draw do resources :tasks, except: [:show, :index] resources :projects do member do get 'tasks_feed' end end devise_for :users get 'welcome/index' root 'welcome#index' end
14.125
43
0.672566
f84b24cd60ff166ede1107b64280cbc5ef6684d4
955
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: xsuportal/services/admin/dashboard.proto require 'google/protobuf' require 'xsuportal/resources/leaderboard_pb' Google::Protobuf::DescriptorPool.generated_pool.build do add_file("xsuportal/services/admin/dashboard.proto", :syntax => :proto3) do ...
35.37037
145
0.769634
334e960a9f7f6efe641ed5b6133dd8b81e778366
3,154
require "redis" require "redis-namespace" require_relative "./rails_performance/version.rb" require_relative "rails_performance/rails/query_builder.rb" require_relative "rails_performance/rails/middleware.rb" require_relative "rails_performance/models/base_record.rb" require_relative "rails_performance/models/request_r...
32.854167
88
0.811985
6a858cd99cf57700d4fc77e9904acb395e6de7da
313
cask :v1 => 'spideroak' do version :latest sha256 :no_check url 'https://spideroak.com/getbuild?platform=mac' name 'SpiderOak' homepage 'http://spideroak.com' license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder app 'SpiderOak.app' end
26.083333
115
0.722045
1ab031a4288f645d8c56690442a1509c5c819a1b
137
#!/usr/bin/env ruby $:.unshift(File.dirname(__FILE__) + '/../lib') require 'test/unit' require 'active_shipping' require 'mocha/setup'
17.125
46
0.70073
ab60dc6a5f00563b329116281880baa3228022f9
646
# frozen_string_literal: true # helper methods for Location-related views: # ListCountries, ListLocations, ShowLocation module LocationHelper def country_link(country, count = nil) str = country + (count ? ": #{count}" : "") link_to(str, action: :list_by_country, country: country) end # title of a link ...
30.761905
73
0.744582
268e50a1f2c994c75a0aabdafd504f5c01f559ed
1,055
require 'spec_helper' describe Runreg::Event do describe '#initialize' do subject { Runreg::Event.new hash } context 'when has contains fields with keys containing \'Date\'' do let(:hash) do { "StartDate" => 'start date', "StartTime" => 'start time', "EndDate" => ...
30.142857
105
0.63128
38af1bfe4b21d90bb504b5920df12f2dd5ba34bd
829
class ExtendedProfile < ActiveRecord::Migration def self.up add_column :users, :city, :string add_column :users, :state, :integer add_column :users, :zip, :string add_column :users, :country, :integer add_column :users, :phone, :string add_column :users, :phone2, :string add_column :users,...
30.703704
47
0.681544
5df9757764d36f4f9291d48a3a07f5cfd0359218
1,142
require 'test_helper' class CategoriesControllerTest < ActionDispatch::IntegrationTest setup do @category = categories(:one) end test "should get index" do get categories_url assert_response :success end test "should get new" do get new_category_url assert_response :success end tes...
23.306122
107
0.721541
ede9c2c7e8db393db4b3f737081695f5c8eb937b
1,599
require File.dirname(__FILE__) + '/helper' describe 'Registering extensions' do module FooExtensions def foo end private def im_hiding_in_ur_foos end end module BarExtensions def bar end end module BazExtensions def baz end end module QuuxExtensions def quu...
25.790323
106
0.730457
5df6bd341852eee9abfef703513318086876ebc3
2,750
class Import::FogbugzController < Import::BaseController before_action :verify_fogbugz_import_enabled before_action :user_map, only: [:new_user_map, :create_user_map] rescue_from Fogbugz::AuthenticationException, with: :fogbugz_unauthorized def new end def callback begin res = Gitlab::FogbugzIm...
26.699029
113
0.728
d54d4eaa705199bf79e25461a8d23ccf0c14d5ba
1,249
# == Schema Information # # Table name: partners # # id :integer not null, primary key # name :string # email :string # created_at :datetime # updated_at :datetime # organization_id :integer # status :string # class Partner < ApplicationRecord requ...
22.303571
96
0.653323
4a2c0ebfdb3fc03b555b5077ce791481323ec7be
948
module GroupMethods protected def get_group @group = Group.find_by_url_key(params[:group_id]) || Group.find_by_url_key(params[:id]) || Group.find(params[:group_id]) || Group.find(params[:id]) if !@group flash[:notice] = "取得群組訊息時出現問題,請重新嘗試一次" permission_denied end end def membership_r...
22.046512
151
0.668776
abd0b32e6e0e4b8785b933a94d74b8137a351ed8
2,045
# Copyright (c) 2020-2021 Andy Maleh # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # d...
30.073529
95
0.692421
e8388825718710e5b53fbff0952ba7bfef9a43fb
132
class User < Sequel::Model # def validate # super # errors.add(:name, 'cannot be empty') if !name || name.empty? # end end
16.5
65
0.628788
3924775cb9e39d9b7b0067d10de04147c8581526
751
cask "font-iosevka-ss06" do version "5.0.5" sha256 "c7c24d6cd732cf3b4614abe328673f8760f0f2b7e2855c2f3e875dd912a1132c" url "https://github.com/be5invis/Iosevka/releases/download/v#{version}/ttc-iosevka-ss06-#{version}.zip" appcast "https://github.com/be5invis/Iosevka/releases.atom" name "Iosevka SS06" desc ...
35.761905
105
0.757656
ff7248edc0616dd72a34d9d8f50e9cff7da22d6e
6,261
# frozen_string_literal: false require 'test/unit' class TestDefined < Test::Unit::TestCase class Foo def foo p :foo end protected :foo def bar(f) yield(defined?(self.foo)) yield(defined?(f.foo)) end def baz(f) end attr_accessor :attr def attrasgn_test yiel...
24.944223
84
0.63089
1cf5f4b33eda0ac6848ce1f2c247ab19d03553b4
8,961
require "test_helper" class Api::V1::DeletionsControllerTest < ActionController::TestCase context "with yank rubygem api key scope" do setup do @api_key = create(:api_key, key: "12345", yank_rubygem: true) @user = @api_key.user @request.env["HTTP_AUTHORIZATION"] = "12345" end context "...
37.651261
112
0.572369
1dfa60819e92b4a6c76f26b104f2612d7f2ba1cc
238
class ApplicationController < ActionController::Base protect_from_forgery with: :null_session include DeviseTokenAuth::Concerns::SetUserByToken include ActionController::ImplicitRender include ActionController::Serialization end
29.75
52
0.848739
03fbe4a71edf554638ea0f7137300acf78d8603b
10,882
# frozen_string_literal: true require "rails_helper" require File.expand_path("config_shared_examples", __dir__) module ActiveAdmin RSpec.describe Resource do it_should_behave_like "ActiveAdmin::Resource" around do |example| with_resources_during(example) { namespace.register Category } end l...
31.450867
103
0.631869
9132759931be6096e09d1241d834f5df8dfc3106
120
module MyApp class ApplicationController < ActionController::Base protect_from_forgery with: :exception end end
20
54
0.8
1ac3fd7c64d5473853013963969f7dd2152156c2
2,128
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe "include_text" do describe "where target is a String" do it 'should match submitted text using a string' do string = 'foo' string.should include_text('foo') end it 'should match if the text is contained' do ...
29.971831
127
0.642387
6a8fc7ee17b51c257f7a96f0ef45eb03243ff294
2,206
begin require 'stomp' rescue LoadError puts "Can't load stomp gem - all queue loops will be disabled!" end require 'timeout' module Loops class Queue < Base def self.check_dependencies raise "No stomp gem installed!" unless defined?(Stomp::Client) end def run create_client config...
27.924051
108
0.62602
e99e4056e70bcfd57021108141feddd91ac13953
1,915
ExceptionHunter.setup do |config| # == Enabling # # This flag allows disabling error tracking, it's set to track in # any environment but development or test by default # # config.enabled = !(Rails.env.development? || Rails.env.test?) # == Dashboard User # Exception Hunter allows you to restrict users ...
30.887097
91
0.690862
1a13b828db62cb35f7b3c644c9d525d666851a3e
3,166
require 'support/aruba_support' RSpec.describe 'Fail if no examples' do include_context "aruba support" before { clean_current_dir } context 'when 1 passing example' do def passing_example(fail_if_no_examples) " RSpec.configure { |c| c.fail_if_no_examples = #{fail_if_no_examples} } RS...
29.045872
85
0.656033
b9afc037423a056549e62170df4e225eca7558ae
3,734
describe Spaceship::Client do describe "UI" do describe "#select_team" do subject { Spaceship.client } let(:username) { 'spaceship@krausefx.com' } let(:password) { 'so_secret' } before do Spaceship.login client = Spaceship.client end it "uses the first team if...
38.895833
99
0.636047
624c3f9ba1280daa1053380246de39fd2955756f
170
class EnablePostgresDblink < ActiveRecord::Migration[5.1] def change if Rails.env.development? || Rails.env.test? enable_extension 'dblink' end end end
21.25
57
0.711765
4afea5d9f4b1e60546a14c6c52faf4f4276318da
1,675
# # Author:: Adam Jacob (<adam@chef.io>) # Author:: Christopher Walters (<cw@chef.io>) # Copyright:: Copyright 2008-2016, 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. # Yo...
32.843137
96
0.674627
bbd4a540c9cfbddd422a2f8661a6f5eeaca96bec
982
#@author : John Paul.H #Update a user with the company details require "rubygems" require "rest_client" require "json" contact_id = 3213088 #you can also use apikey instead of user/passwd site = RestClient::Resource.new("http://domain.freshdesk.com/contacts/#{contact_id}.json","sample@freshdesk.com","test") #you can...
49.1
143
0.763747
1a92d2ea5385a1b9c24658ad2bf850a878e58928
4,037
if defined?(AssetSync) AssetSync.configure do |config| <%- if aws? -%> config.fog_provider = 'AWS' config.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID'] config.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY'] config.aws_session_token = ENV['AWS_SESSION_TOKEN'] if ENV.key?('AWS_SESSION_TOKEN') ...
41.618557
105
0.689621
33a7ac63388881a75ee817eef8d5a89e4c16aa22
432
module IMS::LTI::Serializers::MembershipService class LISPersonSerializer < IMS::LTI::Serializers::Base set_attribute :id, key: :@id set_attributes :name, :img, :email set_attribute :family_name, key: :familyName set_attribute :given_name, key: :givenName set_attribute :result_sourced_id, key: :re...
36
59
0.743056
5d97f1e3039564c28812e71d7ca95b623eda7211
5,334
=begin Titan API The ultimate, language agnostic, container based job processing framework. OpenAPI spec version: 0.4.9 Generated by: https://github.com/swagger-api/swagger-codegen.git Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. Yo...
28.524064
120
0.660105
089d1286830cb842712d621d4f9b61a7ad9aadee
1,174
# encoding: UTF-8 # 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 sou...
37.870968
86
0.74276
03bdea4756b09ee554ce9fe2f7d5bcab5668ae08
2,828
require 'spec_helper' module CMIS describe Document do context 'when creating a document with content' do it 'has properties and content' do document = repository.new_document document.name = 'apple_document' document.object_type_id = 'cmis:document' document.content = { str...
35.797468
75
0.631188
ff28de8654a3badfc8c17cb74eed807fcc58f0ca
960
require "bundler/setup" require 'pry' require 'active_record' require 'database_cleaner' require "frp-eventsourcing" ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:" load File.dirname(__FILE__) + '/support/schema.rb' require File.dirname(__FILE__) + '/support/models.rb' require File.di...
24
80
0.75
ac41372ae4fb976fa1d2b5b25cd97686b61cb6d4
2,248
### # # framework-util-svn # -------------- # # The class provides methods for parsing the SVN information in the framework directory # ### require 'date' module Msf module Util class SVN def self.load_root info = {} path = ::File.join(::File.dirname(__FILE__), "..", "..", "..", ".svn", "entries") if !::File....
18.733333
87
0.59742
e884303a44e51128d76046ea5d48ede48113793a
1,968
class WorkampJobs::Cli @@muted="\e[1;31m" @@grn="\e[1;32m" @@blu="\e[1;34m" @@mag="\e[1;35m" @@cyn="\e[1;36m" @@white="\e[0m" def call puts "\nWelcome to Workamp jobs!\n" @input = "" until @input == "exit" get_jobs job_list more_info next_step end goodbye end ...
29.373134
94
0.573679
61b741c30ebc4b181be77d1d8b4bdb6c05de2fbe
1,549
class BalanceReport extend ActiveModel::Naming attr_accessor :user def initialize(user, year) @user = user @years = @user.transactions.group_by{|t| t.year}.keys @year = year end def exec balance_report yearly_total my_current_balance end def get_instance_variable hash = {} hash[:year] = @y...
28.163636
129
0.671401
7a1a0da14a35bd52a7b95486d7ecfa7d1e8365bf
1,282
module VagrantPlugins module Docker class DockerInstaller def initialize(machine, version) @machine = machine @version = version end # This handles verifying the Docker installation, installing it if it was # requested, and so on. This method will raise exceptions if thing...
32.05
87
0.659906
33f779f11b914dece1a1ef381a8c86ca156f2f56
814
# frozen_string_literal: true require "dry/effects/providers/reader" require "dry/effects/instructions/raise" module Dry module Effects module Providers class State < Reader[:state] def write(value:) case value when state_type @state = value else ...
22
75
0.558968
6a20b1650cebfdc10de892bb718a683814010cee
1,091
module Build def self.root_path Pathname.new(__FILE__).dirname.parent end def self.data_path if ENV.key?('LOLSCHEDULE_DATA_DIR') Pathname.new(ENV['LOLSCHEDULE_DATA_DIR']) else root_path + 'data' end end def self.source_path data_path + 'source.json' end def self.archived...
18.810345
89
0.659945
0890587fe14d009c91baf564613e4eedec4d8f37
1,687
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::ContainerRegistry::Mgmt::V2017_10_01 module Models # # The registry node that generated the event. Put differently, while the # actor initiates th...
27.655738
78
0.543568
0390b06eef424d350fe3dd5738558dd71796b12a
788
{ matrix_id: '1344', name: 'rajat17', group: 'Rajat', description: 'Rajat/rajat17 circuit simulation matrix', author: 'Rajat', editor: 'T. Davis', date: '2006', kind: 'circuit simulation problem', problem_2D_or_3D: '0', num_rows: '94294', num_cols: '94294', nonzeros: '479...
29.185185
111
0.664975
26d94e1f8730811e5812c3f59d8ec03109deb3b9
287
FactoryBot.define do # Define your Spree extensions Factories within this file to enable applications, and other extensions to use and override them. # # Example adding this to your spec_helper will load these Factories for use: # require 'spree_gem_configuration/factories' end
41
130
0.794425
ed894aad27ab4fa80fff6552508871065b60b86b
10,500
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic...
47.727273
285
0.698286
e8d6d8b0687cb97af3a0b0836c00e4fe9981b215
1,074
module AutotestNotification class Mac @last_test_failed = false class << self def notify(title, msg, img, total = 1, failures = 0, priority = 0) system "growlnotify -n autotest --image #{img} #{'-s ' if ((failures > 0) and STICKY)}-p #{priority} -m '#{msg}' -t #{title}" play(SUCC...
34.645161
133
0.608939
18b2d1706b7f2757848a8215368c49c56663b21a
8,265
module SmsTools # UTF-8 to GSM-7 (GSM 03.38) mapping. Based on code from: # https://github.com/threez/smspromote/blob/master/lib/smspromote/encoding.rb module GsmEncoding extend self GSM_EXTENSION_TABLE_ESCAPE_CODE = "\x1B".freeze UTF8_TO_GSM_BASE_TABLE = { 0x0040 => "\x00", # COMMERCIAL AT ...
40.514706
100
0.581972
f71407eb41e57cd3807112ac72e64247c7d78262
450
# frozen_string_literal: true class RenameTopicCustomFieldTopicPostEventStartsAtIndex < ActiveRecord::Migration[6.0] def up remove_index :topic_custom_fields, name: "idx_topic_custom_fields_post_event_starts_at" add_index :topic_custom_fields, %i[name topic_id], name: :idx_topic_custom_fields_to...
32.142857
91
0.777778
4a0d4116d4bd9f7b2d5978b078b968943c5ebc1a
764
Types::BerryType = GraphQL::ObjectType.define do name 'Berry' description '' field :id, types.ID, '', property: :id field :item, Types::ItemType, '', property: :item field :firmness, Types::BerryFirmnessType, '', property: :berry_firmness field :naturalGiftPower, types.Int, '', property: :natural_gift_powe...
40.210526
74
0.704188
d594b608fa01bf186ffff9477daf06b3d6dcec93
757
# frozen_string_literal: true module Admin class RoomsController < Admin::BaseController before_action :find_room, except: %i[index new create] def index @rooms = Room.all end def new @room = Room.new end def create @room = Room.new(room_params) return redirect_to a...
16.456522
70
0.638045
0134c887928cbffc92f785d477ba3814081d54c7
183
Rails.application.routes.draw do resources :microposts resources :users get 'static_pages/home' get 'static_pages/help' get 'static_pages/prueba' root 'users#index' end
16.636364
32
0.748634
e2f3eff96f36d6c5f37037675b656c328a017b37
318
module Instructions class IncrementMilitaryOps < Instruction fancy_accessor :player, :amount needs :military_ops def initialize(player:, amount:) super self.player = player self.amount = amount end def action military_ops.increment(player, amount) end end end
15.142857
44
0.669811
18fea411283224602d93a6c2bb1dddbc63c7d7a3
3,165
# 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::Compute::Mgmt::V2019_07_01 module Models # # The source user image virtual hard disk. Only tags may be updated. # class Imag...
30.728155
77
0.504897
e9ed6510c182e9172b94118992b9891764bcb2d6
6,118
require 'support/helper' describe 'MyJohnDeereApi::Client' do include JD::ResponseHelpers it 'includes the CaseConversion helper' do client = JD::Client.new(api_key, api_secret) assert_equal 'thisIsATest', client.send(:camelize, :this_is_a_test) end describe '#initialize(api_key, api_secret, options=...
32.031414
142
0.681105
03490a554deb43f50f1eda4a6e7299a2ca43058f
1,751
raise "JRuby Required" unless defined?(JRUBY_VERSION) #c = Solr::HTTP::Adapter::ApacheCommons.new('http://localhost:8983/solr') #puts c.get('/select', :q=>'*:*') #puts c.post('/update', '<commit/>', {}, {"Content-Type" => 'text/xml; charset=utf-8'}) require 'java' proc {|files| files.each do |f| require File.j...
26.134328
87
0.677327
332c761da02584367dbfda5cddbc3922babbf995
507
# 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::Network::Mgmt::V2020_05_01 module Models # # Defines values for SecurityPartnerProviderConnectionStatus # module SecurityPar...
26.684211
70
0.731755
acc5419167dcd9ba2b5c54f273f0c2174cae60f3
5,275
require 'pty' module Fastlane module Actions module SharedValues LANE_NAME = :LANE_NAME PLATFORM_NAME = :PLATFORM_NAME ENVIRONMENT = :ENVIRONMENT end # Helper Methods def self.git_author s = `git log --name-status HEAD^..HEAD` s = s.match(/Author:.*<(.*)>/)[1] ret...
31.029412
125
0.620664
4a54558674fc4525abba085d3318c52f50035f5b
1,501
class BeersController < ApplicationController before_action :find_user before_action :authorized def index @beers = @user.beers.find_by(id: params[:id]) render json: @beers end def show @beer = @user.beers.find_by(id: params[:id]) render json: @beer end ...
24.209677
157
0.581612
61bc3edec2e7586bf1cfcdbc9920324fca6958c2
3,119
class Sip < Formula desc "Tool to create Python bindings for C and C++ libraries" homepage "http://www.riverbankcomputing.co.uk/software/sip" url "https://downloads.sf.net/project/pyqt/sip/sip-4.16.5/sip-4.16.5.tar.gz" sha1 "d5d7b6765de8634eccf48a250dbd915f01b2a771" bottle do revision 1 sha1 "ac110e1...
29.704762
78
0.599231
33375b8cee6a7fce01b065c595840b2905da64bb
15,877
require 'spec_helper' describe Account do it_should_behave_like "it has a logged-in user" describe "creating an Account" do before do @account = Account.make end it "should allow currency to be set to a Currency object" do currency = Currency.new("USD") @account.currency = currency ...
30.650579
163
0.662216
e845d3394c7b64f242674a1102334af6ab81d055
5,312
# powering tv for a period # driving a car for a distance # number of showers lasting 8 minutes # # Usage: # equivalence = EnergyEquivalences.new(10000000000.0, :kwh) # pounds = equlivalece.value(:£) # car_distance = equlivalece.value(:ice_car_distance_km) # car_distance, units, description = equlivalece....
42.496
159
0.748494
2853852233685e6ae63427a25983a9eba6e2d304
949
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'ops_build/version' Gem::Specification.new do |spec| spec.name = 'ops_build' spec.version = OpsBuild::VERSION spec.authors = ['HAMSIK Adam'] spec.email = ['adh...
35.148148
81
0.643836
08c3031cde706dbcea225b4636293be6a61a39a2
941
=begin #Datadog API V2 Collection #Collection of all Datadog Public endpoints. The version of the OpenAPI document: 1.0 Contact: support@datadoghq.com Generated by: https://openapi-generator.tech Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. This product...
29.40625
107
0.77577
33d691519dbc8a6829caf8f1ee4b6917f5b7c732
1,454
require 'chronic' module hbEshopReports class Orders def initialize(start__time, end__time) @start_time = start__time @end_time = end__time @legders = Order.where("created_at >= ? AND created_at <= ?", start_time, end_time) end def finished_order_ids @order_ids ||= Order.finish...
32.311111
204
0.650619
61a377c947642ca7fa9ce1845a0c46f57e67ebfe
2,061
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
32.714286
153
0.73605
1d8d217c7dcfa49f7df78f9084bf91accd6d0821
571
class UsersController < ApplicationController before_action :require_login, except: [:home, :new, :create] def new @user = User.new end def create @user = User.create(user_params) if @user.save session[:user_id] = @user.id redirect_to user_path(@user...
18.419355
74
0.567426
2617b25252f2e8ec7d36950de474f3c42c391f8e
9,209
=begin #Influx OSS API Service #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: 2.0.0 Generated by: https://openapi-generator.tech =end require 'date' require 'time' module InfluxDB2::API class ResourceOwner attr...
28.868339
202
0.605386
039a66df4b1e484aeddc5ab6c04fccfd7bc9f306
640
module Steps::Lateness class InTimeForm < BaseForm attribute :in_time, String def self.choices InTime.values.map(&:to_s) end validates_inclusion_of :in_time, in: choices private def in_time_value InTime.new(in_time) end def changed? tribunal_case.in_time != in_tim...
20
70
0.654688
ffb6ccb0e890f5c98715e21fe01655c3e5cc9a2f
3,121
require 'spec_helper' describe Specjour::CLI do subject { Specjour::CLI.new } let(:fake_pid) { 100_000_000 } before do stub(Specjour::CPU).cores.returns(27) stub(Specjour::Dispatcher).new.returns(stub!) stub(Specjour::Manager).new.returns(stub!) stub(Specjour::Worker).new.returns(stub!) end ...
29.443396
120
0.674784
114a256a6091633273fb3c1dbb7de5a44b278440
38,610
require 'redis' require_relative '../../spec/spec_helper.rb' rack_env = ENV['RACK_ENV'] describe DynamicDynamoDBManager do before do puts 'Creating all dynamoDB tables from an API list. Use December to test a new year' Timecop.freeze Date.new(2014, 12, 24) do @manager = DynamicDynamo...
53.328729
272
0.581896
38fa3e31b356974241922c70e2cd9824d1135f2c
698
SS::Application.routes.draw do Category::Initializer concern :deletion do get :delete, on: :member end content "category" do get "/" => redirect { |p, req| "#{req.path}/nodes" }, as: :main resources :nodes, concerns: :deletion resources :pages, concerns: :deletion end node "category" do ...
25.851852
73
0.621777
38bdac52d08cc75f06705584c1610bf9986af0e4
388
# Challenge 5 def number_length(number) Math.log10(number).to_i + 1 end def is_curious_number? (number) number ** 2 % (10 ** number_length(number) ) == number end puts is_curious_number?(25) puts is_curious_number?(76) puts is_curious_number?(212890625) puts "" puts is_curious_number?(1) puts is_curious_num...
20.421053
58
0.755155
33312ec5d6cd9db7c732920b2f61c9cfbe070806
5,621
# This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, without a need to explicitly require it in any # file...
44.259843
94
0.731365
ff95ea62c613189a55dff56330d1222ad7965ed6
35
require './app' run FixerData::App
11.666667
18
0.714286
d537f268449cd4192a5fbd496459c0560ee136b9
232
class AddAuthenticationTokenToUsers < ActiveRecord::Migration def change add_column :users, :auth_token, :string, default: "", unique: true add_column :users, :password, :string add_index :users, :auth_token end end
29
70
0.737069
610df82446faf13591d6d483cdada8e371bde832
740
require 'fantasy_faker/utils/array_utils' module FantasyFaker module BaseModule def const_missing(const_name) file_content = File.readlines(data_path(const_name)).map(&:strip) data = FantasyFaker::ArrayUtils.const_array(file_content) const_set(const_name, data) data end ...
21.764706
114
0.614865
62b02cd6d8a0a240819a50ee107e52ad976e6b8e
4,224
# frozen_string_literal: true require 'exception_notification/sidekiq' Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of R...
39.849057
100
0.758049
3905f2306792fde96667bcfcba38bca6d566058b
1,048
require_relative "../canvas_base_resolver" require_relative "../../types/canvas/grade_change_event" module LMSGraphQL module Resolvers module Canvas class GradeChangeLogQueryByCourse < CanvasBaseResolver type [LMSGraphQL::Types::Canvas::CanvasGradeChangeEvent], null: false argument :get_all,...
38.814815
87
0.64313
33594bc45da15652d78ccc34837db310630be7f6
4,024
# frozen_string_literal: true require 'rails_helper' RSpec.describe Course::Forum, type: :model do it { is_expected.to have_many(:topics).inverse_of(:forum).dependent(:destroy) } it { is_expected.to have_many(:subscriptions).inverse_of(:forum).dependent(:destroy) } it { is_expected.to belong_to(:course).inverse_...
38.692308
100
0.666252
4aa28d6f5755b09d3d07c012c65de3f106ab0329
5,746
# MIT License # # Copyright (c) 2018 Sebastian Katzer # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, me...
28.029268
80
0.621128
bb8208dc27f30da0278bf1451a22b282e78b23f5
17,303
# # Author:: Daniel DeLeo (<dan@kallistec.com>) # Copyright:: Copyright (c) 2008 Opscode, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
49.016997
188
0.71843
f8ffde18541d7f4dc4497c692062a0df8649edce
1,561
module Featurable extend ActiveSupport::Concern QUERY_MODE = { flag_query_mode: :bit_operator }.freeze FEATURE_LIST = YAML.safe_load(File.read(Rails.root.join('config/features.yml'))).freeze FEATURES = FEATURE_LIST.each_with_object({}) do |feature, result| result[result.keys.size + 1] = "feature_#{...
21.985915
89
0.699552
03691ef039796e6532a6e1a8040f67609c1bcc78
1,897
module Lita module Handlers class Mysql < Handler namespace 'Mysql' include ::MysqlHelper::Regex include ::MysqlHelper::Utility route( /^mysql\salias\sadd\s#{ALIAS_PATTERN}\s#{FQDN_PATTERN}\s#{USERNAME_PATTERN}\s#{PASSWORD_PATTERN}$/, :alias_add, command: true, ...
27.897059
107
0.571429
fff63a518efcd31c00981b293c1bf4d00e0aca27
100
class CampaignFeatureJoin < ActiveRecord::Base belongs_to :campaign belongs_to :feature end
14.285714
46
0.78
1156fecca75d1ad6a4c955c5e696f78c4d152f03
5,211
# 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...
36.697183
95
0.720975
628c9814bba2e35dd88b0ff1afd5202a057d2d54
241
FactoryGirl.define do factory :oauth_user, :class => 'User' do before(:create) do |user, evaluator| user.oauth_callback = true end if User.devise_modules.include? :confirmable confirmed_at Time.now end end end
24.1
48
0.684647
1d863993a0b0f16e3b686e5c97a8e8dae1052174
1,878
# frozen_string_literal: true module ActiveRecord # :nodoc: module ConnectionAdapters # :nodoc: module PostGIS # :nodoc: class TableDefinition < PostgreSQL::TableDefinition # :nodoc: include ColumnMethods # super: https://github.com/rails/rails/blob/master/activerecord/lib/active_recor...
34.145455
141
0.592652
1aee803e219906dfd590b2dc252df790bc197106
2,418
require_relative './config/boot' require "json" require "date" require "active_support/all" require "base64" class Time def floor(seconds = 60) Time.at((self.to_f / seconds).floor * seconds).utc end end set :root, File.dirname(__FILE__) configure do $diskcache = Diskcached.new(File.join(settings.root, 'cac...
26
103
0.670389
6afc998218c9a8ebbf6889c55eb5b20122dcfbf3
1,014
class ApartmentTherapy::CLI def call list_articles menu goodbye end def list_articles #this will grab from the articles class puts "Articles available:" @articles = ApartmentTherapy::Articles.articles @articles.each.with_index(1) do |a, i| puts "#{i}. #{a.title}" end end ...
24.142857
89
0.627219
e9379a10193b01cb5ff94edfbf90027d412858dc
8,793
require "cases/helper" require 'support/schema_dumping_helper' module PostgresqlUUIDHelper def connection @connection ||= ActiveRecord::Base.connection end def drop_table(name) connection.drop_table name, if_exists: true end end class PostgresqlUUIDTest < ActiveRecord::TestCase include PostgresqlUU...
29.115894
107
0.7034
01774f95113803247d5e24c5eb0a557da96beb50
249
require "lita" Lita.load_locales Dir[File.expand_path( File.join("..", "..", "locales", "*.yml"), __FILE__ )] require "lita/handlers/sensu" Lita::Handlers::Sensu.template_root File.expand_path( File.join("..", "..", "templates"), __FILE__ )
19.153846
53
0.662651
91de12a9dccf189d8163cd65a48773998a325057
12,153
require 'spec_helper' describe UsersController, :type => :controller do render_views describe "GET 'show'" do before(:each) do @user = FactoryBot.create(:user) end # Exercise 11.5.4: it "should paginate microposts" do 35.times { FactoryBot.create(:micropost, :user => @user, :c...
28.866983
80
0.573274
d561a73dc0d9ae0c53660efd3a7748a42809ff64
936
class Pokemon < ApplicationRecord has_many :team_pokemons has_many :teams, through: :team_pokemons scope :search, -> (query) { self.where("name LIKE ?", "%#{query}%") } def self.pokemon_data(id) information = { "name" => [], "abilities" => [], "types" => [], ...
30.193548
73
0.491453
7ab87a1af091a70a2bf2c2fdd5eca5b4c2e3cb09
832
# frozen_string_literal: true # This is the original root class for service related classes, # and due to historical reason takes a project as scope. # Later separate base classes for different scopes will be created, # and existing service will use these one by one. # After all are migrated, we can remove this class....
29.714286
76
0.754808
e2be93cfb35b80305c082bf86cc81a77fd5320a9
3,537
# encoding: utf-8 module Backup module Packager class Error < Backup::Error; end class << self include Utilities::Helpers ## # Build the final package for the backup model. def package!(model) @package = model.package @encryptor = model.encryptor @splitter ...
32.75
78
0.584676
916ed828ff199f4afbe86d3514b517098c919a5f
3,178
require 'test_helper' require 'crud_test_model' require 'custom_assertions' class ListHelperTest < ActionView::TestCase REGEXP_ROWS = /<tr.+?<\/tr>/m REGEXP_HEADERS = /<th.+?<\/th>/m REGEXP_SORT_HEADERS = /<th><a .*?sort_dir=asc.*?>.*?<\/a><\/th>/m include StandardHelper include CrudTestHelper include Cu...
24.828125
79
0.654185
5dc1c0bae41c4637c06a4bf0f406c53338ded193
1,193
module Mautic module Connections class Oauth2 < Mautic::Connection def client @client ||= OAuth2::Client.new(client_id, secret, { site: url, authorize_url: 'oauth/v2/authorize', token_url: 'oauth/v2/token', raise_errors: false }) end def ...
24.346939
96
0.616094
2115ce4eaafb94b006bbdf8f7c689bdd1b5fa064
2,640
class Openmama < Formula desc "Open source high performance messaging API for various Market Data sources" homepage "https://openmama.finos.org" url "https://github.com/finos/OpenMAMA/archive/OpenMAMA-6.3.1-release.tar.gz" sha256 "43e55db00290bc6296358c72e97250561ed4a4bb3961c1474f0876b81ecb6cf9" license "LGPL...
38.823529
123
0.640152
1c10d4783dfc7f76c39ad22352949d95fb48b071
395
# frozen_string_literal: true module Gruff # @private class Renderer::Bezier def initialize(color:, width: 1.0) @color = color @width = width end def render(points) draw = Renderer.instance.draw draw.push draw.stroke(@color) draw.stroke_width(@width) draw.fil...
17.173913
38
0.61519