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 |
|---|---|---|---|---|---|
bb79b5c8579059eb783f79f75917d67174725eee | 2,075 | # encoding: utf-8
require_relative 'input_type_resolver'
require_relative 'cities_text_points'
require_relative 'cities_column_points'
require_relative 'admin0_text_polygons'
require_relative 'admin1_text_polygons'
require_relative 'admin1_column_polygons'
require_relative 'postalcode_text_points'
require_relative 'p... | 34.016393 | 115 | 0.69012 |
8717d699c1f268c34eaaf8deddd93abb34e1208b | 118 | class Faculty < ActiveRecord::Base
has_many :elections
has_many :departments
validates_uniqueness_of :code
end
| 16.857143 | 34 | 0.79661 |
21b2b7e8d3fc1eb2115cb5ec386fb92a58d0e8d3 | 9,134 | class Work
class PlaceLists
US_STATES = [
["Armed Forces Americas", "AA"],
["Armed Forces Europe", "AE"],
["Alaska", "AK"],
["Alabama", "AL"],
["Armed Forces Pacific", "AP"],
["Arkansas", "AR"],
["American Samoa", "AS"],
["Arizona", "AZ"],
["California", "CA"... | 27.512048 | 49 | 0.417232 |
edce8fb911416efa735c644ffade7a3cc527054e | 121 | class AddQuantityToPatches < ActiveRecord::Migration
def change
add_column :patches, :quantity, :integer
end
end
| 20.166667 | 52 | 0.768595 |
e857a611c7c03baa6060f66f8f9f4f79721a80a7 | 362 | # frozen_string_literal: true
module FacilitiesQuery
class StateQuery < Base
def run
state = params[:state]
conditions = "address -> 'physical' ->> 'state' ilike '#{state}'"
BaseFacility::TYPES.flat_map do |facility_type|
get_facility_data(conditions, params[:type], facility_type, param... | 25.857143 | 86 | 0.671271 |
1c97701d58ce22fab2bbc0a7c1544983cce22663 | 5,665 | require File.dirname(__FILE__) + '/../spec_helper'
describe SiteController do
dataset :pages
it "should find and render home page" do
get :show_page, :url => ''
response.should be_success
response.body.should == 'Hello world!'
end
it "should find a page one level deep" do
get :show_page, :url... | 32.745665 | 95 | 0.652251 |
261268260fe425d391983ed3b241463d49ef5b50 | 2,973 | # frozen_string_literal: true
require "test_helper"
module SmartTodo
module Events
class IssueCloseTest < Minitest::Test
def test_when_pull_request_is_close
stub_request(:get, /api.github.com/)
.to_return(body: JSON.dump(state: "closed"))
expected = <<~EOM
The Pull Req... | 34.172414 | 95 | 0.640767 |
3932c28e9086c037c47d229f4f0e9bfa0d824e5a | 1,620 | #
# Cookbook Name:: rsyslog
# Attributes:: rsyslog
#
# Copyright 2009, Opscode, 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
#
# Unl... | 33.061224 | 74 | 0.711728 |
acf54b746e32f48dfb7a9e80e0b217e1796ddd3e | 1,128 | # frozen_string_literal: true
module Rails # :nodoc:
module GraphQL # :nodoc:
class Request # :nodoc:
# = GraphQl Multi Query Strategy
#
# This is a resolution strategy to solve requests that only contain
# queries, allowing the strategy to collect all the information for all
# the ... | 30.486486 | 77 | 0.612589 |
e9e757cd89726b311ba630a5f9dd2ee6e818e968 | 45 | module NoStarchPress
VERSION = "0.1.0"
end
| 11.25 | 20 | 0.711111 |
d5c19191b16ab0bc9539f952b51e6bf6d0954bba | 552 | # frozen_string_literal: true
module Spree
class ReturnItem < Spree::Base
module EligibilityValidator
class OrderCompleted < Spree::ReturnItem::EligibilityValidator::BaseValidator
def eligible_for_return?
if @return_item.inventory_unit.order.completed?
true
else
... | 24 | 92 | 0.643116 |
2894b4365cdf7a915d9e12ab7d851a700e216c84 | 9,039 | class HomeassistantCli < Formula
include Language::Python::Virtualenv
desc "Command-line utility for Home Assistant"
homepage "https://github.com/home-assistant-ecosystem/home-assistant-cli"
url "https://files.pythonhosted.org/packages/f0/f5/a90000b810751a6094761ed5fed3a6cb746c3c8be3bd1c5ed525e77be69a/homeassi... | 49.664835 | 149 | 0.823542 |
116839b37b98afd89cc1509f416fc48d32a668ab | 903 | module Bosh::Bootstrap::NetworkProviders
class AWS
attr_reader :cyoi_provider_client
def initialize(cyoi_provider_client)
@cyoi_provider_client = cyoi_provider_client
end
def perform(settings)
attributes = {}
sg_suffix = ""
if vpc_id = settings.exists?("address.vpc_id")
... | 27.363636 | 98 | 0.633444 |
ed7b282c7da8eddbd8bed587570f27f1a46c1bf3 | 938 | Pod::Spec.new do |s|
s.name = "Dropbox-Sync-API-SDK"
s.version = "2.0.0"
s.summary = "The Dropbox Sync API SDK for iOS."
s.homepage = "https://www.dropbox.com/developers/sync"
s.license = { :type => 'Copyright', :file => 'dropbox-ios-sync-sdk-2.0.0/LICENSE.txt' }
s.author = ... | 46.9 | 116 | 0.644989 |
6ad2599c2dba321e12f914f488e30070bf99e11e | 1,254 | # frozen_string_literal: true
require 'rspec'
require_relative '../app/helpers/file_reader'
RSpec.describe FileReader do
it 'Opens the file into an array' do
file = 'w1-slave-test-file'
expect(FileReader.new(file: file).read_file.is_a?(Array)).to be true
end
it 'Reads the last line as a string' do
... | 30.585366 | 85 | 0.692982 |
ff467d905a72d14dc1307868ecce27241a99f919 | 1,130 | require 'aws/sns'
require 'aws/sqs'
class Service::AmazonSNS < Service
string :aws_key, :aws_secret, :sns_topic, :sqs_queue
white_list :aws_key, :sns_topic, :sqs_queue
password :aws_secret
def receive_event
raise_config_error "Missing 'aws_key'" if data['aws_key'].to_s == ''
raise_config_error "Mis... | 24.565217 | 78 | 0.684956 |
f891555c044a6990b19dd618c5954bc5552dc4a6 | 2,966 | require 'em-websocket'
require 'json'
require 'digest'
require_relative 'outputStream'
require_relative 'interfaces/debugger'
require_relative 'interfaces/runtime'
require_relative 'interfaces/profiler'
class InterfaceServer
def initialize(opts)
host = opts[:host]
port = opts[:port]
if host.nil? || hos... | 20.887324 | 137 | 0.523264 |
ffaba54fff0b2cee843874b90c51339f61b99cad | 1,008 | maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.1.1"
recipe "yum", "Runs 'yum update' during compile phase"
recipe "yum::yum", "manages yum conf... | 45.818182 | 235 | 0.701389 |
91223ca0147af1570e8992e7fb26e9a4b1a3aae9 | 12,998 | # frozen_string_literal: true
class DecisionReview < CaseflowRecord
include CachedAttributes
include Asyncable
self.abstract_class = true
attr_reader :saving_review
has_many :request_issues, as: :decision_review, dependent: :destroy
has_many :claimants, as: :decision_review, dependent: :destroy
has_ma... | 27.832976 | 110 | 0.7485 |
6252f93860cf66f3797641fd0ecb9731361234b6 | 1,685 | class Ffms2 < Formula
desc "Libav/ffmpeg based source library and Avisynth plugin"
homepage "https://github.com/FFMS/ffms2"
url "https://github.com/FFMS/ffms2/archive/2.23.tar.gz"
mirror "https://deb.debian.org/debian/pool/main/f/ffms2/ffms2_2.23.orig.tar.gz"
sha256 "b09b2aa2b1c6f87f94a0a0dd8284b3c791cbe77f0f... | 28.083333 | 94 | 0.719881 |
e862c50f8eb75299af31af83e56af0c82c88e9ad | 2,951 | # Preprocessor helpers
#
# This file has a collection of methods that are meant to be used in the
# preprocess-block in the Nanoc Rules file.
#
# @author Arjan van der Gaag
# Generate a sitemap.xml file using Nanoc's own xml_sitemap helper method by
# dynamically adding a new item.
#
# Make items that should not appe... | 31.731183 | 94 | 0.691291 |
790e7d380b661050bbef58c1a0279b6139f7f1ed | 209 | FactoryGirl.define do
factory :skrill_transaction, class: Spree::SkrillTransaction do
email ''
amount 0.0
currency 'USD'
transaction_id nil
customer_id nil
payment_type nil
end
end
| 19 | 65 | 0.712919 |
ede80bc43007ef9b20f4485dc795d3f721aae972 | 1,164 | require 'log4r'
module VagrantPlugins
module Kernel_V2
# Represents a single configured provisioner for a VM.
class VagrantConfigProvisioner
# The name of the provisioner that should be registered
# as a plugin.
#
# @return [Symbol]
attr_reader :name
# The configuration a... | 28.390244 | 87 | 0.629725 |
1d0b531e13c8598c86c2463504734e4fb21803d1 | 1,316 | require "language/go"
class Gdm < Formula
desc "Go Dependency Manager (gdm)"
homepage "https://github.com/sparrc/gdm"
url "https://github.com/sparrc/gdm/archive/v1.0.tar.gz"
sha256 "e0dbec8deed27af3ff4cb16782bc38a4fd8eeb0db8e024b3083a00d36f877cab"
bottle do
cellar :any_skip_relocation
sha256 "70883b... | 30.604651 | 92 | 0.721125 |
383a1d1617da3404688bf0d0090c83079d2bf1b8 | 598 | #!/usr/bin/env ruby
# encoding: UTF-8
require_relative 'helper'
class TestExprLte < TestImpl
def test_lte_native
x = WAB::Impl::Lte.new('num', 3)
assert_equal(['LTE', 'num', 3], x.native, 'LTE native mismatch')
end
def test_lte_int
d = make_sample_data
x = WAB::Impl::Lte.new('num', 7)
asse... | 23.92 | 90 | 0.658863 |
21a6e96369a801dcf3537587657519c73a9c0c9c | 3,450 | class PasswordsController < ApplicationController
before_filter :login_required, :except => [:new, :create, :edit, :update]
before_filter :not_logged_in_required, :only => [:new, :create]
# Enter email address to recover password
def new
render
end
# Forgot password action
... | 38.333333 | 168 | 0.613623 |
267ac64f4f4d0df116cf6858f4649887ac59dac7 | 233 | require 'rails_bootstrap_alerts/view_helpers'
module RailsBootstrapAlerts
class Railtie < Rails::Railtie
initializer "rails_bootstrap_alerts.view_helpers" do
ActionView::Base.send :include, ViewHelpers
end
end
end
| 23.3 | 56 | 0.785408 |
1d119a200ee1cf63a941e8c9e00f3eb240dcd934 | 490 | class Marty::ComponentsController < Marty::ApplicationController
# This is useful for individual component testing. Note that the
# appropriate route needs to be defined.
# <base_url>/components/<ComponentCamelCaseName>
def index
component = params[:component]
return redirect_to root_path unless comp... | 30.625 | 78 | 0.712245 |
1a41fbf7cbbaa7c7e5fa797dae2bf259daa2e2bf | 669 | ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require "minitest/reporters"
Minitest::Reporters.use!
class ActiveSupport::TestCase
fixtures :all
include ApplicationHelper
def is_logged_in?
!session[:user_id].nil?
end
def log_in_as(us... | 24.777778 | 68 | 0.641256 |
87aebf635eb1f904adbb71a2ce9f8127516dee66 | 23,812 | # encoding: utf-8
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
require 'azure_mgmt_storage'
module Azure::Profiles::Latest
module Storage
module Mgmt
Operations = Azure::Storage::Mgmt::V2019_04_01... | 49.8159 | 204 | 0.672056 |
793f70f0c2c91ed35d820639efeb8a774462b5d0 | 1,108 | # This migration comes from alchemy (originally 20160108174834)
class AddTimebasedPublishingColumnsToPages < ActiveRecord::Migration[4.2]
def up
add_column :alchemy_pages, :public_on, :datetime
add_column :alchemy_pages, :public_until, :datetime
add_index :alchemy_pages, [:public_on, :public_until]
u... | 32.588235 | 92 | 0.726534 |
382d25070c85242e9d023bac02e968a63c82b72a | 2,005 | class Libxmlxx3 < Formula
desc "C++ wrapper for libxml"
homepage "https://libxmlplusplus.sourceforge.io/"
url "https://download.gnome.org/sources/libxml++/3.2/libxml++-3.2.0.tar.xz"
sha256 "b786fae7fd7820d356698069a787d107995c3efcbef50d8f4efd3766ab768e4f"
bottle do
cellar :any
sha256 "583c5345ed243a5... | 29.925373 | 93 | 0.634913 |
4a0de252059ff6b1690a7610a2644a0d7d75882a | 125 | class AddGoogleIdToLocations < ActiveRecord::Migration
def change
add_column :locations, :google_id, :string
end
end
| 20.833333 | 54 | 0.776 |
e8acac7d3ed9b56a1ed7b78da6bc1b6dd66be2ff | 42 | module Powerpoint
VERSION = "1.8.1"
end
| 10.5 | 19 | 0.690476 |
91df9784f77bf23a79a59693215a0baf21dd2dd9 | 994 | require "helper"
module Nokogiri
module XML
class TestSyntaxError < Nokogiri::TestCase
def test_new
error = Nokogiri::XML::SyntaxError.new 'hello'
assert_equal 'hello', error.message
end
def test_line_column_level_libxml
skip unless Nokogiri.uses_libxml?
bad_do... | 26.864865 | 119 | 0.645875 |
0323bd1118cd48753dc0ecc8ab0fd57d2892acb6 | 1,556 | # frozen_string_literal: true
require 'karmap'
class TestService < Karma::Service
port 33000
min_running 1
max_running 1
num_threads 2
def self.command
travis_build_dir = ENV['TRAVIS_BUILD_DIR'] || '.'
File.open('./test_service.run', 'w') do |file|
file.write("cd #{travis_build_dir... | 31.755102 | 157 | 0.626607 |
e269f70585db16ba767953f846b91d7d19d56e13 | 1,571 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Help do
describe '.ri_cmd' do
context 'when ri command found' do
it 'returns the path to RI' do
allow(described_class).to receive(:`).with(/which ri/).and_return('/usr/bin/ri')
expect(described_class.ri_cmd).to eq('... | 30.211538 | 88 | 0.664545 |
3372e2be803321c499ec9f28868948177b92004a | 1,189 | # frozen_string_literal: true
module ActiveModelSerializers
module Adapter
class Attributes < Base
def initialize(*)
super
instance_options[:fieldset] ||= ActiveModel::Serializer::Fieldset.new(fields_to_fieldset(instance_options.delete(:fields)))
end
def serializable_hash(optio... | 32.135135 | 131 | 0.674516 |
26def57e49f2362f1be2d1837381e49c909c02e6 | 144 | require 'test_helper'
class PlayersTeamsControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end
| 18 | 66 | 0.75 |
e2e654c5bcffa111749bf71363e2751f5b45283b | 548 | # encoding: utf-8
require 'spec_helper'
describe Github::API, 'endpoint' do
let(:endpoint) { "https://my-company/api/v3/" }
let(:options) { {:endpoint => endpoint } }
let(:path) { "/repos/GitHub/issues-dev/issues" }
subject(:api) { described_class.new(options) }
before {
stub_get(path, 'https://my-co... | 23.826087 | 61 | 0.629562 |
e9b6dc70786cf5031f939fc09bebc3672cd08453 | 6,617 | =begin
--------------------------------------------------------------------------------------------------------------------
Copyright (c) 2021 Aspose.Cells Cloud
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 ... | 31.8125 | 116 | 0.623848 |
084a2985339f4da70a86e81d318501f04292873d | 2,370 | require "log4r"
module VagrantPlugins
module Triggers
module Action
class Trigger
def initialize(app, env, condition)
@app = app
@condition = condition
@env = env
@exit = false
@logger = Log4r::Logger.new("vagrant::plugins::trigg... | 31.6 | 118 | 0.550633 |
614d9bb3258050df3cf5098415217baae03c6942 | 1,280 | require File.dirname(__FILE__) + '/helper'
class TestConfig < Test::Unit::TestCase
def setup
@r = Repo.new(GRIT_REPO)
end
# data
def test_bracketed_fetch
Git.any_instance.expects(:config).returns(fixture('simple_config'))
config = @r.config
assert_equal "git://github.com/mojombo/grit.git", ... | 21.694915 | 81 | 0.700781 |
21ddcc7e85a2f2e49baaa1af09d37924101960e8 | 1,872 | #!/usr/bin/env ruby
require 'csv'
require 'spreadsheet'
def safe_title(title)
string = title.dup
string.gsub!(/[^\w\s\d-]/, '')
string.squeeze!(" ")
string
end
unless File.exists?(ARGV[0].to_s)
abort "Usage: convert_xls.rb input_data.xls"
end
jobs = Hash.new
puts "Opening #{ARGV[0]}..."
data = Spreadshee... | 22.554217 | 86 | 0.589209 |
282bfcd866f1fd58c8206ac330ce3a03256160d0 | 27,803 | class Story < ApplicationRecord
belongs_to :user
belongs_to :merged_into_story,
:class_name => "Story",
:foreign_key => "merged_story_id",
:inverse_of => :merged_stories,
:required => false
has_many :merged_stories,
:class_name => "Story",
... | 28.283825 | 100 | 0.620293 |
bbd537f39a82cb3fb75fb8be0b16498208303fcf | 1,228 | # == Schema Information
#
# Table name: comments
#
# id :integer not null, primary key
# title :string(50) default("")
# comment :text
# commentable_id :integer
# commentable_type :string(255)
# user_id :integer
# role :string(255) defa... | 24.56 | 66 | 0.661238 |
33937537bcd6ac0af7e828009d5eb7234e257dab | 1,139 | class Pianod < Formula
desc "Pandora client with multiple control interfaces"
homepage "https://deviousfish.com/pianod/"
url "https://deviousfish.com/Downloads/pianod/pianod-176.tar.gz"
sha256 "4f3be12daef1adb3bcbbcf8ec529abf0ac018e03140be9c5b0f1203d6e1b9bf0"
revision 1
bottle do
sha256 "01b47d23674efa... | 32.542857 | 93 | 0.709394 |
ed78b2edee4198f37a84718f409fb9ccdd528a1d | 822 | require 'dbi'
require 'dbd/mysql'
require 'dbd/pg'
begin
mysql = DBI.connect("DBI:Mysql:source:localhost", "root", "password")
postgres = DBI.connect("DBI:Pg:destination:localhost", "deh", "IFSP2011")
mysql.select_all("SHOW TABLES") do |table|
next if ['schema_migrations', 'sessions'].include?(table.to_s)
... | 34.25 | 90 | 0.658151 |
f8e2d317303d428a8443ee09ebb55ef7812b88c1 | 156 | require "rails_helper"
RSpec.describe SupportTicket, type: :model do
it "has valid factory" do
expect(create(:support_ticket)).to be_valid
end
end
| 19.5 | 47 | 0.75 |
3960949b4681a2e2246035a34e397a007d3f0de2 | 292 | class AddDefaultToDeviceNames < ActiveRecord::Migration[5.0]
def up
say_with_time 'Fixing null device names'
Device.where(name: nil) { |device| device.update(name: []) }
end
def change
change_column :devices, :name, :string, array: true, default: [], null: false
end
end
| 26.545455 | 81 | 0.695205 |
380bbd8e2b49c832cdb8d8afd739fcfcbf7b1d96 | 4,984 | # 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... | 34.611111 | 126 | 0.701846 |
ff53b2d626118bb8f00e29b7161e0366ad2ddc96 | 1,025 | require File.dirname(__FILE__) + '/base_object'
class Redis
#
# Class representing a simple value. You can use standard Ruby operations on it.
#
class Value < BaseObject
require 'redis/helpers/core_commands'
include Redis::Helpers::CoreCommands
attr_reader :key, :options
def initialize(key, *... | 21.808511 | 83 | 0.621463 |
e8ea85645e90e468714811676ed8e2074cb2259b | 980 | # frozen_string_literal: true
RSpec.describe CfdiSat::V33::DigitalTaxStampXml do
def digitalt_tax_stamp
sat_xml = File.read('spec/fixtures/documents/invoices/invoice_v33.xml')
CfdiSat::V33::DigitalTaxStampXml.new(
Nokogiri::XML(sat_xml).at_xpath(
"//*[local-name()='Complemento']"
).at_xp... | 35 | 86 | 0.677551 |
e88698a9c2452cabff9bf7f843167f7d7d42ecdc | 253 | class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
end
end
| 25.3 | 72 | 0.818182 |
91649ca8a2654bb475efee73c6be8a23b24f80ad | 395 | # frozen_string_literal: true
# Module that allows a Model to be versioned
module VersionableModel
extend ActiveSupport::Concern
included do
extend UniqueRandom
attr_readonly :versionable_id
attribute :versionable_id,
:string,
default: lambda {
un... | 20.789474 | 66 | 0.622785 |
61927a7b97275c9eaf2d72b79d783db1134b3463 | 15,099 | require 'rubygems'
require 'find'
require 'hbc/cask_dependencies'
require 'hbc/staged'
require 'hbc/verify'
require 'hbc/locations'
class Hbc::Installer
# todo: it is unwise for Hbc::Staged to be a module, when we are
# dealing with both staged and unstaged Casks here. This should
# either be a class which is... | 30.814286 | 175 | 0.63587 |
ac2f617dc2486a15941e79a5c6f434ec333a2ad9 | 1,065 | # encoding: utf-8
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
# Changes may cause incorrect behavior and will be lost if the code is
# rege... | 29.583333 | 73 | 0.692019 |
61836ec2334c9dfa776d1394abaaea70e7231855 | 2,105 | # frozen_string_literal: true
require "rexml/document"
module Jekyll
module Favicon
module Utils
# Favicon rexml for include
module Tag
def self.included(klass)
klass.extend(ClassMethods)
end
def self.mutate_find_or_create_element(parent, key)
parent.get_... | 29.647887 | 81 | 0.593824 |
91e7f4da90b06ca8a0c71d359e441333b57c7dda | 2,944 | class Hm
# @private
module Algo
module_function
def delete(collection, key)
collection.is_a?(Array) ? collection.delete_at(key) : collection.delete(key)
end
# JRuby, I am looking at you
NONDUPABLE = [Symbol, Numeric, NilClass, TrueClass, FalseClass].freeze
def deep_copy(value)
... | 30.666667 | 105 | 0.613791 |
6210d8c5b823b21c690f633156b1227670bb3153 | 96 | module Sekrat
module Warehouse
class FileSystem
VERSION = "1.0.0"
end
end
end
| 12 | 23 | 0.635417 |
269b0d4836d79081a507bc196ba788f023fa7b5d | 929 | #!/usr/bin/ruby
require 'yaml'
CONFIG_FILE = File.join((ENV["XDG_USER_HOME"] && !ENV["XDG_USER_HOME"].empty? ? ENV["XDG_USER_HOME"] : File.join(ENV["HOME"], ".config")), "reasonset", "diary.yaml")
CONFIG_BASE = {
"diary_dir" => File.join(`xdg-user-dir DOCUMENTS`.chomp, "diary"),
}
if File.exist? CONFIG_FILE
CONF... | 22.658537 | 165 | 0.649085 |
4a92299fa0a3f68b345f6641e3f6bcea07c26469 | 1,483 | #
# Cookbook:: test
# Recipe:: pool
#
# copyright: 2017, Chef Software, 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 requ... | 23.539683 | 74 | 0.735671 |
ed32cea2e7e030ef0a5f1c1b2d7ebb8246845bc2 | 17,326 | # encoding: utf-8
require "logstash/outputs/base"
require "logstash/namespace"
require "logstash/plugin_mixins/aws_config"
require "stud/temporary"
require "stud/task"
require "concurrent"
require "socket"
require "thread"
require "tmpdir"
require "fileutils"
require "set"
require "pathname"
require "aws-sdk"
require "... | 43.206983 | 286 | 0.696872 |
28b2047142b39998b5547ceb4f981962c8509cba | 6,827 | class Dataset < ActiveRecord::Base
has_many :occurrences, primary_key: :datasetKey, foreign_key: :datasetKey
validates :datasetKey, presence: true
before_update :set_update_time
after_create :add_search
after_update :update_search
after_destroy :remove_search
def has_claim?
UserOccurrence.from("use... | 31.606481 | 80 | 0.569796 |
79ec01fb37a1881a60cd8d5559c04e6d9f18e871 | 730 | # frozen_string_literal: true
module Vedeu
# Provides a mechanism to coerce values within Vedeu in to expected
# objects.
#
# @api private
#
module Coercers
end # Coercers
end # Vedeu
require 'vedeu/coercers/coercer'
require 'vedeu/coercers/alignment'
require 'vedeu/coercers/horizontal_alignment'
req... | 23.548387 | 69 | 0.791781 |
33a5780cd68380be4e0a581c8023008e7ac8b3b1 | 637 | # frozen_string_literal: true
module Types
# rubocop: disable Graphql/AuthorizeTypes
# Types that use DiffRefsType should have their own authorization
class DiffRefsType < BaseObject
graphql_name 'DiffRefs'
field :head_sha, GraphQL::STRING_TYPE, null: false, description: 'The sha of the head at the time... | 42.466667 | 123 | 0.764521 |
3895e9dc863691aa3373b157f8351e320b76e9a2 | 3,618 | 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 Rails and
# your application in memory, allowing both threaded web serve... | 42.069767 | 100 | 0.758154 |
ed4f29c415ea0fe265cc8c77f31a03faeeee7b0b | 1,873 | require "bugsnag/middleware/rack_request"
require "bugsnag/middleware/warden_user"
require "bugsnag/middleware/callbacks"
require "bugsnag/middleware/rails3_request"
module Bugsnag
class Rack
def initialize(app)
@app = app
# Configure bugsnag rack defaults
Bugsnag.configure do |config|
... | 32.859649 | 162 | 0.674853 |
38d5b6bca86651aadcc9151cef82606b2c807e7b | 325 | module Library
class AuthorRecord < ActiveRecord::Base
self.table_name = 'library_authors'
has_many :item_authors, class_name: 'Library::ItemAuthorsRecord', foreign_key: :author_id
has_many :items, class_name: 'Library::ItemRecord', through: :item_authors, foreign_key: :item_id, dependent: :destroy
end... | 36.111111 | 122 | 0.763077 |
797087e405599e8e530b40146f2f2d606631295e | 132 | class AddDeletedAtColumnToUsers < ActiveRecord::Migration[6.0]
def change
add_column :users, :deleted_at, :datetime
end
end
| 22 | 62 | 0.765152 |
873910a1f1a31767f9abc52485afd468eee6c69d | 1,354 | require_relative '../../app/models/user'
module Todoable
RSpec.describe User do
describe 'validates' do
it 'email presence' do
user = User.new(email: '', password: 'asdfasdf')
expect(user.valid?).to eq(false)
user.email = 'asdf@asdf.com'
expect(user.valid?).to eq(true)
... | 29.434783 | 72 | 0.587149 |
1aed01a5b6a4e20cce709c6fdd86d30559092f31 | 1,214 | shared_examples :immutable_set_from_ranges do |variant|
it 'fills the receiver with the numbers from all passed ranges' do
expect(variant.from_ranges(2..3, 5..7)).to eq variant[2, 3, 5, 6, 7]
end
it 'inserts the elements in order, irrespective of the order of args' do
hash = variant.from_ranges(5..7, 2..... | 31.947368 | 76 | 0.670511 |
0300b750755ed89cc05de639d527391d9e24a039 | 18,198 | # Copyright (C) The Arvados Authors. All rights reserved.
#
# SPDX-License-Identifier: AGPL-3.0
class Arvados::V1::SchemaController < ApplicationController
skip_before_action :catch_redirect_hint
skip_before_action :find_objects_for_index
skip_before_action :find_object_by_uuid
skip_before_action :load_filters... | 36.838057 | 175 | 0.497033 |
117f500402e62ec4c9574837fb36398d7e1a67bc | 4,817 | # Alternative Augeas-based providers for Puppet
#
# Copyright (c) 2012 Greg Swift
# Licensed under the Apache License, Version 2.0
Puppet::Type.type(:pam).provide(:augeas, :parent => Puppet::Type.type(:augeasprovider).provider(:default)) do
desc "Uses Augeas API to update an pam parameter"
# Boolean is the key be... | 32.328859 | 109 | 0.595807 |
6a816aae1ebe867eb2a7b22f733c0f8273bf4b3b | 5,973 | require "spec_helper"
describe Unsplash::Collection do
let (:collection_id) { 201 }
let (:fake_id) { 987654321 }
describe "#find" do
it "returns a Collection object" do
VCR.use_cassette("collections") do
collection = Unsplash::Collection.find(collection_id)
expect(collection).to be_a... | 30.015075 | 94 | 0.660137 |
5d853614d80afb113859605a894a647592d3b937 | 276 | RSpec.describe PullingUpPushingDownFiltering::FilterSumRunner do
subject { described_class.filter_and_sum([{amount: 10, filter_for_this: true, filter_for_this_too: true}]) }
it "filters input on filter_for_this and sums amount" do
expect(subject).to eq(10)
end
end
| 34.5 | 110 | 0.782609 |
edc4676a69fb81fa8a0ed9e332894f45cb67a6be | 325 | class CreateLinks < ActiveRecord::Migration[6.0]
def change
create_table :links do |t|
t.string :name
t.string :url
t.string :category
t.string :section
t.string :language
t.string :blurb
t.belongs_to :topic, foreign_key: true, index: true
t.timestamps
end
en... | 21.666667 | 57 | 0.630769 |
e8e4dc0742dfa039eb67ad3414a15fff784cf195 | 637 | # frozen_string_literal: true
# Updates the last_activity_at fields from the record. Only when the user is active
# for authentication and authenticated.
# An expiry of the account is only checked on sign in OR on manually setting the
# expired_at to the past (see Devise::Models::Expirable for this)
Warden::Manager.af... | 49 | 141 | 0.786499 |
4a930494b87bc9fa579f5d87ca454f8182946d24 | 406 | require 'rails_com'
module RailsAudit
class Engine < ::Rails::Engine
config.generators do |g|
g.rails = {
assets: false,
stylesheets: false,
helper: false
}
g.test_unit = {
fixture: true,
fixture_replacement: :factory_girl
}
g.templates.un... | 20.3 | 82 | 0.591133 |
7a2e5f79a7a423ef6338bff92b953e9d306025cb | 654 | # -*- encoding: UTF-8 -*-
# This code is automatically transpiled by Saklient Translator
require_relative '../../errors/http_conflict_exception'
module Saklient
module Cloud
module Errors
# 要求された操作を行えません. ISOイメージが無効化されています. 排出後に再度お試しください.
class CdromDisabledException < Saklient::Errors::HttpConfli... | 25.153846 | 123 | 0.66055 |
01326087dbc9bab84365c18871856da4dd81d936 | 2,333 | #--
# Copyright (c) 2005-2007 Tobias Luetke
#
# 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, publi... | 34.820896 | 72 | 0.785255 |
18116ef1e5d1a0c9bf9b026f12b77d496509d803 | 3,787 | 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 Rails and
# your application in memory, allowing both threaded web serve... | 41.163043 | 102 | 0.757064 |
18a5e23705fb4cad95fc700a7eb8bdf60d6e747e | 1,272 | module Bot
module DiscordEvents
module Konus
extend Discordrb::EventContainer
message(content:"Merhaba") do |event|
event.send "Merhaba İnsan"
end
message(content:"Naber") do |event|
event.send "İyidir senden?"
end
message(content:"nbr") do |event|
... | 31.02439 | 71 | 0.427673 |
91ee0dfb57757f355fbbaa70dd476b2745ad3d9c | 1,215 | class RemoveCancelProjectsFromApiEndpoints < ActiveRecord::Migration
def up
execute %Q{
drop function if exists "1".cancel_project(integer);
}
end
def down
execute %Q{
CREATE OR REPLACE FUNCTION "1".cancel_project(_project_id integer)
RETURNS void
LANGUAGE plpgsql
AS $function$
declare
... | 36.818182 | 160 | 0.647737 |
f79e3f2b93baeef9f2c62a70bbb540a8b720fe30 | 4,035 | module AviGlitch
# Base is the object that provides interfaces mainly used.
# To glitch, and save file. The instance is returned through AviGlitch#open.
#
class Base
# AviGlitch::Frames object generated from the +file+.
attr_reader :frames
# The input file
attr_reader :avi
##
# Create... | 26.372549 | 94 | 0.581908 |
1a756cfeb225e012cc9cb55c57cd2b19084d023a | 62 | module Faker
module Precure
VERSION = "0.0.6"
end
end
| 10.333333 | 21 | 0.645161 |
380ed41586198c152e9127c6a2ae16f882612bca | 1,006 | # frozen_string_literal: true
class RemovePaperclipColumns < ActiveRecord::Migration[5.2]
def change
reversible do |dir|
change_table :users, bulk: true do |t|
dir.up do
t.remove :face_file_name
t.remove :face_content_type
t.remove :face_file_size
t.remove :f... | 23.952381 | 59 | 0.595427 |
5d7a07ed2f35b843f1f4aabcd8e0dc1e55db92f1 | 321 | # == Schema Information
#
# Table name: rooms
#
# id :integer not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# room_id :string
#
class Room < ApplicationRecord
has_many :messages
validates :room_id, presence: true, uniqueness: true
end... | 20.0625 | 54 | 0.64486 |
035571d8797bfadec742507f98e19aeb5a46efba | 79 | require_relative 'jruby/oj'
require_relative 'jruby/oj_serialization_provider'
| 26.333333 | 50 | 0.873418 |
6a747655ec448a25fadcac9627ddefca1887771b | 4,584 | # frozen_string_literal: true
require 'dry/configurable'
require 'dry/initializer'
require 'dry/schema/type_registry'
require 'dry/schema/type_container'
require 'dry/schema/rule_applier'
require 'dry/schema/key_coercer'
require 'dry/schema/value_coercer'
module Dry
module Schema
# Processes input data using o... | 22.581281 | 106 | 0.549084 |
1cba3734c13f7b7742f052d5a91ece48a70e6623 | 216 | RSpec.describe Superbot::CLI::Local::VersionCommand do
before { @k = superbot_local "version" }
describe "stdout" do
it do
expect(@k.out).to include "#{Superbot::Local::VERSION}\r\n"
end
end
end
| 21.6 | 65 | 0.662037 |
011880e3e00614a1983c57059a8216a5e5dc73ac | 1,361 | # Test scene for pinhole camera specifications.
class BlinnTestScene
include Scene
def initialize(width, height, spp)
@width = width
@height = height
@spp = spp
eye = Vector3f.new(0.0, 0.0, 3.0)
look_at = Vector3f.new(0.0, 0.0, 0.0)
up = Vector3f.new(0.0, 1.0, 0.0)
fov ... | 23.067797 | 71 | 0.606172 |
acfbc6f6c87c1969b546f25cc3f7b97a5218ed1d | 1,527 | # encoding: utf-8
module Dynamoid #:nodoc:
module Associations
module SingleAssociation
include Association
delegate :class, :to => :target
def setter(object)
delete
source.update_attribute(source_attribute, Set[object.id])
self.send(:associate_target, object) if targe... | 21.814286 | 79 | 0.588736 |
015612bb968cbb115b3464247ed767eaf517848d | 743 | require "helper"
class Patch::IO::WebsocketTest < Minitest::Test
context "Websocket" do
context "#new_from_config" do
setup do
@config = {
:id => 6,
:type => "websocket",
:host => "localhost",
:port => 9006
}
@websocket = Patch::IO::Websock... | 19.552632 | 66 | 0.574697 |
38c60624c237ef8bf35673c8dc961e00538e647e | 701 | w, h, alpha = gets.split.map &:to_f
h, w = [w, h].sort
if alpha > 90
alpha = 180 - alpha
end
if alpha == 0
puts w * h
elsif alpha == 90
puts h * h
else
alpha = (alpha / 180) * Math::PI
if (alpha / 2) >= Math.atan2(h, w)
# area of diamond
puts h * (h / Math.sin(alpha))
else
x = Math.tan(alpha... | 20.028571 | 89 | 0.554922 |
4a5d2ae19a4491cfada82ccfb58eaf81c0f74681 | 1,397 |
class Manager::TasksController < Manager::ManagerController
before_action :set_lists
def new
@task = Task.new
@task.badge_id = params[:badge_id] if params[:badge_id]
end
def create
@task = Task.new params[:task].permit!
authorize! :create, @task
params[:task].delete( :video_id ) if para... | 22.174603 | 72 | 0.617752 |
d5aa1879f8d086fea81386e90aa582141cc75ed0 | 1,937 | require 'yaml'
require 'json'
module Gitlab
# This class represents auto-deploy-app chart managed by GitLab.
class Chart
attr_reader :major, :minor, :patch
GITLAB_MANAGED_CHART_NAME = 'auto-deploy-app'.freeze
class << self
# Load a chart from `helm list` output
#
# @param [String] d... | 28.072464 | 93 | 0.611771 |
7aa07c75645154ce3f73a6b2e49e05573b4bae4e | 5,208 | #
# Be sure to run `pod spec lint BPaspect.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.co... | 36.93617 | 93 | 0.593702 |
f740026ec03c783926fd1239e5b6949d7ee158ea | 321 | module ActsHelper
def detect_doc_operation(id)
status = @vchasno_client.doc(@doc_id)['status']
if status == 7008
return 'view_session'
elsif (status == 7004) && (current_user.manager_role? || current_user.admin_role?)
return 'view_session'
else
return 'sign_session'
end
end
end... | 24.692308 | 86 | 0.672897 |
abeee6d5d05c34fd5cbed28d1adf5d4a8db19eee | 7,641 | require_relative 'validate_runnable_reference'
module Inferno
module Repositories
class Results < Repository
include Import[
messages_repo: 'repositories.messages',
requests_repo: 'repositories.requests',
tests_repo: 'repositories.tests',
grou... | 33.96 | 114 | 0.583562 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.