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 |
|---|---|---|---|---|---|
e983a33d4d84f57d249db81364edc3cc4dcab42b | 2,090 | require "language/node"
require "json"
class Webpack < Formula
desc "Bundler for JavaScript and friends"
homepage "https://webpack.js.org/"
url "https://registry.npmjs.org/webpack/-/webpack-5.11.0.tgz"
sha256 "cf8fc82308a8196eab9d2e905a645b9eb65d72b704868880110db34112b54ffc"
license "MIT"
head "https://git... | 32.153846 | 107 | 0.71866 |
1cc5fb2fcf8db5dba3374ddea7a2cdc4299fe073 | 2,612 | # frozen_string_literal: true
module JekyllImport
module Importers
class RSS < Importer
def self.specify_options(c)
c.option "source", "--source NAME", "The RSS file or URL to import"
c.option "tag", "--tag NAME", "Add a tag to posts"
c.option "render_audio", "--render_audio", "Rend... | 26.653061 | 103 | 0.542496 |
f8136a2e5cbfccce627eecf2becffa5185d66248 | 142 | require 'test_helper'
class KirpichTest < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::Kirpich::VERSION
end
end
| 17.75 | 39 | 0.788732 |
d5e77fd2e7ad7907ad1884f96a2104438b10c9fa | 63 | Dummy::Application.routes.draw do
root "dashboard#index"
end
| 15.75 | 33 | 0.777778 |
e98f247cead0ae6ccf05a3170385c9a002017ef2 | 1,196 | class API
module Parsers
# Parse objects for API.
class ObjectParser < ObjectBase
attr_accessor :limit
# Always has to have limit argument: the set of allowed object types.
def initialize(*args)
super
self.limit = self.args[:limit]
raise("missing limit!") unless limi... | 29.170732 | 75 | 0.606187 |
08ad9fe1bd4112c5bbb5912a6a66a6b82e01198b | 5,003 | # encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
module TwitterCldr
module Shared
class Calendar
DEFAULT_FORMAT = :'stand-alone'
DEFAULT_PERIOD_FORMAT = :format
NAMES_FORMS = [:wide, :narrow, :abbreviated]
ERAS_NAMES_FORMS = [:abbr, :name]
... | 29.958084 | 106 | 0.628823 |
bb53216c10ef42a0cbf81c9094a94fb83a8c8209 | 397 | module Rubicure
module Concerns
# utility methods
module Util
# @param arg
# @return [Date] arg is String or Date
# @return [Time] arg is Time
# @return [nil] arg is other
def to_date(arg)
case arg
when Date, Time
arg
when String
Date.p... | 18.045455 | 44 | 0.513854 |
f89f740cd196a28e3469c1f7f809502871a58f82 | 2,532 | # Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
... | 46.888889 | 101 | 0.720379 |
5d4fb54c53dca0f5ddc333b39f637e66c250a956 | 1,176 | require_relative('../config/environment')
class Api
API_KEY = "7ab46aa5f86d43f2addd9e5da1e6a23d"
#get request to the api for a list of recipes including the ingredients that user inputs, creates Recipe instances with the returned recipes
def self.get_recipes_from_ing(ing_array, num_of_recipes = 2)
ingredie... | 45.230769 | 186 | 0.765306 |
d507d33f5da9d636e02afb38dc3ade80f5d2c3e3 | 269 | class AddAbbreviationToOrganizationQuarterStatusTypes < ActiveRecord::Migration
def self.up
add_column :organization_quarter_status_types, :abbreviation, :string
end
def self.down
remove_column :organization_quarter_status_types, :abbreviation
end
end
| 26.9 | 79 | 0.821561 |
6ad495d7f26a4bf4f798bfd999249d2d25b1ec8f | 4,943 | # Source: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
module ThatLanguage
module Iso639
def self.[](language_code)
LOOKUP_HASH[language_code.to_sym]
end
private
LOOKUP_HASH = {
aa: :"Afar",
ab: :"Abkhaz",
ac: :"Australian",
ae: :"Avestan",
af: :"Afrikaan... | 23.538095 | 65 | 0.447906 |
f8e53e3411b573609efdfa23c8258e44384bd135 | 6,847 | # frozen_string_literal: true
require 'test_helper'
module Dashboard::InternshipOffers
class CreateTest < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers
test 'POST #create (duplicate) as visitor redirects to internship_offers' do
post dashboard_internship_offers_path(params... | 49.258993 | 111 | 0.670951 |
6245ad22356d79aba3a516d62f4801e98fdd1bf8 | 2,996 | # A Journey is the path (or intended path) between two locations.
#
# A Move is composed of one or more Journeys; each individual journey record indicates the path and whether it is billable.
# Moves can be redirected for various reasons (e.g. supplier is late and the prison is closed; or the PMU call to say the prison... | 31.87234 | 174 | 0.694259 |
4a7b1951ac8767c07004d07c38f19d06be9c0930 | 828 | require 'spec_helper'
describe Nydp do
def run txt
Nydp.setup ns
Nydp::Runner.new(ns, Nydp::StringReader.new("test", txt)).run
end
describe "unhandled_error" do
it "raises a helpful error" do
error = nil
begin
run "(/ 10 0)"
rescue StandardError => e
error = e
... | 21.789474 | 77 | 0.624396 |
1a293cbd6a98aa3b7bf3dbe89751dace54724fda | 551 | class <%= class_name.underscore.camelize %> < ActiveRecord::Migration[5.2]
def self.up<% attributes.each do |attribute| %>
<%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><% end -%>
<%- end %>
end
def self.down<% attributes.... | 45.916667 | 176 | 0.597096 |
ab690695d9303d86dec4d56cd124aa6abde5ba37 | 2,706 | require_relative '../lib/game.rb'
RSpec.describe Game do
let(:game) { Game.new }
let(:player_one) { double('player one object', name: 'Recardo') }
let(:player_two) { double('player two object', name: 'Ted') }
describe '#player_two_is_the_same_as_player_one?' do
context 'player two\'s name is the same as p... | 29.096774 | 81 | 0.641537 |
ff306c4a743b9d6b539e8653d40d231a061b42ec | 4,516 | # -------------------------------------------------------------------------- #
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# no... | 39.269565 | 80 | 0.46147 |
387840e0e245ee2517c8f6b781472f0f423c98e3 | 5,267 | # frozen_string_literal: true
# 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.
#
# This file is the source Rails uses to define yo... | 42.475806 | 114 | 0.715588 |
e2d02fd4757cc8053d694eba88d9c1b98b824742 | 571 | # # frozen_string_literal: true
module OmniAuth
module Strategies
autoload :OIDC, Rails.root.join('lib', 'omniauth', 'strategies', 'openid_connect')
end
end
Rails.application.config.middleware.use OmniAuth::Builder do
provider(
:OIDC,
scope: ENV["SCOPES"],
issuer: ENV["ISSUER"],
extr... | 25.954545 | 86 | 0.639229 |
b91ccee371ef3aebc97012e8884e839e368a34ad | 339 | # frozen_string_literal: true
module Primer
module ViewComponents
module VERSION
MAJOR = 0
MINOR = 0
PATCH = 60
STRING = [MAJOR, MINOR, PATCH].join(".")
end
end
end
# rubocop:disable Rails/Output
puts Primer::ViewComponents::VERSION::STRING if __FILE__ == $PROGRAM_NAME
# rubocop:e... | 18.833333 | 73 | 0.681416 |
116322ff28ccdda81f4ea3514e44585915fc5fba | 1,859 | class Sollya < Formula
desc "Library for safe floating-point code development"
homepage "https://sollya.gforge.inria.fr/"
url "https://gforge.inria.fr/frs/download.php/file/37749/sollya-7.0.tar.gz"
sha256 "30487b8242fb40ba0f4bc2ef23a8ef216477e57b1db277712fde1f53ceebb92a"
bottle do
cellar :any
sha256 ... | 30.983333 | 100 | 0.651963 |
f8c68da6f59a6302cbbe30020d5c3ab8f8799f3a | 1,156 | #
# Cookbook: consul
# License: Apache 2.0
#
# Copyright 2014-2016, Bloomberg Finance L.P.
#
require 'poise'
module ConsulCookbook
module Resource
# Resource for providing `consul exec` functionality.
# @since 1.0.0
class ConsulExecute < Chef::Resource
include Poise(fused: true)
provides(:con... | 25.130435 | 99 | 0.57872 |
1d2272d30ff46fbd7b897dc6161c0b65b5ea9565 | 3,937 | #!/usr/bin/env ruby
require_relative '../config/active_record_config'
require_relative '../models/database/inv_type'
require_relative '../models/build/job'
require_relative '../models/build/waste_calculator'
require_relative '../models/build/materials_calculator'
require_relative '../models/build/pricing_calculator'
r... | 30.053435 | 106 | 0.758954 |
1ab193e4e5b80311d752c28a1dde25f038a129a3 | 9,250 | describe 'Ridgepole::Client#diff -> migrate' do
context 'when change index' do
let(:dsl) {
erbh(<<-EOS)
create_table "clubs", force: :cascade do |t|
t.string "name", default: "", null: false
t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
... | 40.570175 | 102 | 0.544432 |
bbbdc7f2e1a7bf5d80e928571652e1b5bdb4b507 | 1,152 | require 'test_helper'
class ArticlesControllerTest < ActionDispatch::IntegrationTest
setup do
@article = articles(:one)
end
test "should get index" do
get articles_url
assert_response :success
end
test "should get new" do
get new_article_url
assert_response :success
end
test "shoul... | 23.510204 | 125 | 0.713542 |
bbff5bf4f8a857ff7f5ef8eafe29c394a9fbe08c | 353 | require 'bibmarkdown'
require 'bibtex'
require 'csl/styles'
Nanoc::Filter.define(:bibmarkdown) do |content, params|
entries = BibTeX.parse(params[:bibfile].raw_content).entries
entries.each_value { |e| e.convert!(:latex) { |key| key != :url } }
params = params.merge(entries: entries)
BibMarkdown::Document.new(... | 32.090909 | 69 | 0.733711 |
b9206b167cd78504b53475d8109816100fb57ab9 | 4,487 | module RailsSemanticLogger
# Options for controlling Rails Semantic Logger behavior
#
# * Convert Action Controller and Active Record text messages to semantic data
#
# Rails -- Started -- { :ip => "127.0.0.1", :method => "GET", :path => "/dashboards/inquiry_recent_activity" }
# UserController -- Co... | 38.025424 | 235 | 0.633385 |
ff27b2208312cc2d7c164e6775e0fb861687f941 | 2,379 | # frozen_string_literal: true
module GraphQL
module StaticValidation
module ArgumentLiteralsAreCompatible
def on_argument(node, parent)
# Check the child arguments first;
# don't add a new error if one of them reports an error
super
# Don't validate variables here
if... | 35.507463 | 179 | 0.559058 |
616e07434706ad8e2c7946e0373b687fdac5eb3b | 1,792 | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in
# config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database i... | 38.956522 | 79 | 0.773438 |
18cc0d313a84c166e63db4c43f077ead7f76359f | 9,949 | require File.dirname(__FILE__) + '/../../spec_helper'
require 'controller_spec_controller'
['integration', 'isolation'].each do |mode|
describe "A controller example running in #{mode} mode", :type => :controller do
controller_name :controller_spec
integrate_views if mode == 'integration'
specify "t... | 35.659498 | 126 | 0.681978 |
0124c39c3be9c89428571d273828c0d60eaa379c | 260 | бот устанавливает локальный доступ для указанного пользователя
{command} [!/доступ] [jid/nick]
*/{command} 6 Оби-Ван Кеноби
бот установит локальный доступ 6 для Оби-Ван Кеноби
*/{command} ! obi-wan_kenobi@jab.net
бот снимет доступ с obi-wan_kenobi@jab.net | 43.333333 | 63 | 0.769231 |
bb5cd2aae430c1588f269d5b604d8b5a2ee83103 | 731 | #
# Cookbook Name:: patch-management
# Recipe:: default
#
# Copyright 2014, 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... | 33.227273 | 74 | 0.760602 |
6a9c78a87bd46433d14d4aa14fb78b9c63c1c5c7 | 135 | #encoding: utf-8
class MobilyApiUnicodeConverter
def self.convert(str)
str.chars.map{ |x| '%04x' % x.ord }.join.upcase
end
end | 19.285714 | 51 | 0.696296 |
4a51f1e3c740a7529ac9adf9a65ae281228401c6 | 28,907 | ##
# This code was generated by
# \ / _ _ _| _ _
# | (_)\/(_)(_|\/| |(/_ v1.0.0
# / /
#
# frozen_string_literal: true
module Twilio
module REST
class Api < Domain
class V2010 < Version
class AccountContext < InstanceContext
class ApplicationList < ListResource
... | 47.544408 | 409 | 0.571903 |
28d8eef8232b299d46141022f77f7bfcdc33b0f0 | 337 | ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require "minitest/reporters"
Minitest::Reporters.use!
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
include Applicati... | 24.071429 | 82 | 0.756677 |
18828ec6d7f7c6b306e9d44f085703d523cfd810 | 5,584 | require 'spec_helper'
include RR
describe ProxiedTableScan do
before(:each) do
Initializer.configuration = deep_copy(proxied_config)
# Small block size necessary to exercize all code paths in ProxiedTableScan
# even when only using tables with very small number of records.
Initializer.configuration... | 36.736842 | 89 | 0.676755 |
ab6eb0d8d202c2b08d2952114bbc0c577940e597 | 59 | module GoogleScholarScraper
VERSION = "0.1.1".freeze
end
| 14.75 | 27 | 0.762712 |
bf622f2ac78bc8631cd584df8b5ff154a772471d | 108 | module Bootstrap
VERSION = '3.3.7'
BOOTSTRAP_SHA = '0b9c4a4007c44201dce9a6cc1a38407005c26c86'
end
| 21.6 | 60 | 0.75 |
1a33ab40aa327af1ba0833921974f85aa58d00a2 | 1,682 | # -*- encoding: utf-8 -*-
# stub: rack-protection 2.0.5 ruby lib
Gem::Specification.new do |s|
s.name = "rack-protection"
s.version = "2.0.5"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.metadata = { "documentation_uri" => "https://www.rubydoc.info/... | 42.05 | 258 | 0.662901 |
bf08bc908d942983a6a8460c89a1278ed2652b6f | 2,454 | class ApplicationFormBuilder < Formtastic::FormBuilder
def cancel_link(options = {})
location = options[:url] || template.request.params[:_cancel_url] || template.request.referer || '/'
template.hidden_field_tag(:_cancel_url, location)
if location =~ /\?/
location = location + '&_cancel=1'
... | 36.088235 | 130 | 0.599837 |
4a935cf1c2dc7a4ec55f62068c7b0dd7e17628af | 1,008 | class GitDelta < Formula
desc "Syntax-highlighting pager for git and diff output"
homepage "https://github.com/dandavison/delta"
url "https://github.com/dandavison/delta/archive/0.13.0.tar.gz"
sha256 "5a0ba70a094a7884beb6f1efd4d155861e4b3e3584c452cabbce1607f8eb0f30"
license "MIT"
head "https://github.com/da... | 34.758621 | 115 | 0.750992 |
4a60830a98e6d676713c0997d64133a22109d1b0 | 423 | require 'rubygems'
require 'jruby-prof'
require 'jrjackson_r'
js = %({"one":1,"two":"deux","three":[333.333,66.666]})
result = JRubyProf.profile do
JrJackson::Json.parse js
end
JRubyProf.print_flat_text result, "flat.txt"
JRubyProf.print_graph_text result, "graph.txt"
JRubyProf.print_graph_html result, "graph.html... | 26.4375 | 55 | 0.770686 |
183f8b744897d68f6bd59a5eae985ead8ba7cd7e | 1,788 | # require_relative "./pedia"
# api = SNaPi::Pedia.new
# # Change limit to :max later
# response = api.query.list.title("Category:Is a genotype").prop(:ids).limit(500).response
# genos_ids = response.to_h["categorymembers"].map(&:first).map(&:last)
# i = 0
# puts "Genotypes:"
# puts genos_ids.size
# while response.co... | 32.509091 | 90 | 0.66443 |
1d90dfae7cd11be1032de024874c6d1398ff3e61 | 512 | cask 'praat' do
version '6.1.12'
sha256 'c3da9f39833f923f40f91e3842cf5730f72b17fb06eb365df807a06a7a108c06'
# github.com/praat/praat/ was verified as official when first introduced to the cask
url "https://github.com/praat/praat/releases/download/v#{version}/praat#{version.no_dots}_mac64.dmg"
appcast 'https:/... | 36.571429 | 102 | 0.751953 |
03d68c0f89e4d3bda468aa1d6f718b356b6eb79b | 43,139 | # frozen_string_literal: true
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 48.2 | 167 | 0.605299 |
79154e422b6ae6d14f1fa7b8ca64b12156e48a36 | 4,524 | #!/usr/bin/env ruby
# Define a task library for running unit tests.
require 'rake'
require 'rake/tasklib'
module Rake
# Create a task that runs a set of tests.
#
# Example:
#
# Rake::TestTask.new do |t|
# t.libs << "test"
# t.test_files = FileList['test/test*.rb']
# t.verbose = true
... | 27.925926 | 76 | 0.587091 |
5dddda21a856dcee5749380b750aa135ed65d231 | 1,843 | Portfolio::Application.routes.draw do
devise_for :admin
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
root 'home#index'
resources :contact, :about, only: [:index]
constraints(id: /\d+/) do
resources :blog, :portfolio, only: [:index, :show]
end
# The priority is based upon order of creat... | 26.710145 | 84 | 0.646229 |
265f0992115b293a968c8d62dc12e93f4909a48a | 175 | RSpec.describe Kovid do
it "has a version number" do
expect(Kovid::VERSION).not_to be nil
end
it "does something useful" do
expect(false).to eq(true)
end
end
| 17.5 | 40 | 0.691429 |
032fdad0263e8cc7cd9e38b98fc6a07fc43c3d54 | 1,724 | # encoding: utf-8
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# /spec/fixtures/responses/whois.eenet.ee/status_registered.expected
#
# and regenerate the tests with the following rake task
#
# $ rake genspec:parsers
#
require 'spec_helper'
require '... | 25.731343 | 83 | 0.675174 |
26dd991a582b39a46bb81387e18a16b87abd9605 | 937 | Pod::Spec.new do |s|
s.name = 'MHVideoPhotoGallery'
s.version = '2.2.1'
s.license = 'MIT'
s.homepage = 'https://github.com/falipate/MHVideoPhotoGallery.git'
s.author = {
'Mario Hahn' => 'mario_hahn@me.com'
}
s.summary = 'Gallery for iOS 9 Devices.'
s.platform = :ios
... | 33.464286 | 118 | 0.658485 |
382133175b4454874978f39dc871ace8c196862f | 1,516 | module Locomotive
module Concerns
module ContentType
module EntryTemplate
extend ActiveSupport::Concern
included do
## fields ##
field :entry_template
## validation ##
validate :entry_template_must_be_valid
end
def render_entry_temp... | 25.694915 | 103 | 0.613456 |
18bba70466d89876677a58a7fd498dca3ea4b47a | 33,670 | # frozen_string_literal: true
require "helper"
class TestTags < JekyllUnitTest
def setup
FileUtils.mkdir_p("tmp")
end
# rubocop:disable Metrics/AbcSize
def create_post(content, override = {}, converter_class = Jekyll::Converters::Markdown)
site = fixture_site({ "highlighter" => "rouge" }.merge(overri... | 29.252824 | 165 | 0.533234 |
ff0bfb81370a57dc82b8b7d2955372846ea132d7 | 827 | module Smartweb::V1
autoload :API, 'smartweb/v1/api'
autoload :Order, 'smartweb/v1/order'
module Workers
autoload :BaseWorker, 'smartweb/v1/workers/base_worker'
module Products
autoload :CollectionWorker, 'smartweb/v1/workers/products/collection_worker'
end
module Categories
autoloa... | 29.535714 | 84 | 0.754534 |
b944ba8478b4464cf2c4ecfc708f9f5f97dc0a37 | 177 | class CreateOrders < ActiveRecord::Migration[6.1]
def change
create_table :orders do |t|
t.string :name
t.integer :state
t.timestamps
end
end
end
| 16.090909 | 49 | 0.644068 |
28e95aad071abc753f9fbeff9c4145d99a7a5b89 | 6,144 | require 'test_helper'
class RemoteRedsysSHA256Test < Test::Unit::TestCase
def setup
@gateway = RedsysGateway.new(fixtures(:redsys_sha256))
@credit_card = credit_card('4548812049400004')
@declined_card = credit_card
@options = {
order_id: generate_order_id,
}
end
def test_successful_pur... | 33.032258 | 88 | 0.760742 |
d5adb8c0e381df20399e45fa4e1c102d58ddb5b3 | 62 | module Itamae
module Client
VERSION = "0.1.0"
end
end
| 10.333333 | 21 | 0.645161 |
b9a999c012e086aff626aeeda9c95e9cd783033a | 2,109 | # libraries/default.rb
module Zk
PERM_NONE = 0x00
PERM_READ = 0x01
PERM_WRITE = 0x02
PERM_CREATE = 0x04
PERM_DELETE = 0x08
PERM_ADMIN = 0x10
PERM_ALL = PERM_READ | PERM_WRITE | PERM_CREATE | PERM_DELETE | PERM_ADMIN
def self.error_message(error_code)
case error_code
when -1 then 'Syst... | 31.477612 | 99 | 0.652916 |
397bcdc5f580d36aab43d17e6b6ee1548e8d3ab1 | 408 | Rails.application.routes.draw do
get 'sessions/new'
get '/signup', to: 'users#new'
root 'static_pages#home'
get '/help', to: 'static_pages#help', as: 'helf'
get '/about', to: 'static_pages#about'
get '/contact', to: 'static_pages#contact'
get '/login', to: 'sessions#new'
post '/login', ... | 34 | 54 | 0.642157 |
4a6bde62d3bc927a682a159b2936072934fcb43e | 2,886 | Teacher.delete_all
Teacher.create(:name => "Matt Hardy", :email => "matthardy@flat.edu", :password => "hardip")
Teacher.create(:name => "Chelsea Matthews", :email => "chelmatt@flat.edu", :password => "mattchel")
Teacher.create(:name => "Robert Fredericks", :email => "rfreddy@flat.edu", :password => "robfred")
Teach... | 52.472727 | 135 | 0.670132 |
877922dd67b7e4986a51a22fe2031c8366ca87fe | 2,320 | # -*- ruby -*-
#
# Copyright 2017-2018 Kouhei Sutou <kou@clear-code.com>
#
# 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... | 36.825397 | 81 | 0.717241 |
6277edd249f94e4bdbf2b3ffd28d03d0ea80ac10 | 947 | #encoding: utf-8
module Aequitas
class Rule
class Nullary
class Attribute
# Rule that tests inputs against formats
class Format < self
TYPE = :invalid
# Builder for format rule
class Builder < Builder::Nullary
REQUIRED_OPTIONS = [:format].freeze
... | 20.148936 | 68 | 0.467793 |
796805ed011a8d0b6898a2be5a95e8cd776c3eb6 | 550 | require 'puppet/provider/aos'
Puppet::Type.type(:aos_a_vlan).provide :aos, :parent => Puppet::Provider::Aos do
desc "Aos switch/router provider for vlans."
mk_resource_methods
def self.lookup(device, id)
vlans = {}
device.command do |dev|
vlans = dev.parse_aos_vlans || {}
end
vlans[id]
... | 18.965517 | 80 | 0.669091 |
792e7ad28bc65c193551d99bc75fbc6702251909 | 1,581 | # frozen_string_literal: true
# Copyright 2015 Australian National Botanic Gardens
#
# This file is part of the NSL Editor.
#
# 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
#
# ht... | 35.133333 | 76 | 0.658444 |
269c873308ed4ae97faf02ea04fc04e53a588c51 | 1,533 | require_relative "lib/multi_render/version"
Gem::Specification.new do |spec|
spec.name = "multi_render"
spec.version = MultiRender::VERSION
spec.authors = ["Karl Heitmann"]
spec.email = ["khf1988@gmail.com"]
spec.summary = "MultiRenderer is a class that renders multiple partials o... | 54.75 | 434 | 0.72668 |
bb21870ae0d35cdba45c9220f6d0e8813e3d3bed | 1,311 | module Api
module V1
class SearchController < ApplicationController
include PaginationHeaders
include CustomErrors
include Cacheable
after_action :set_cache_control, only: :index
def index
locations = Location.search(params).page(params[:page]).
per(para... | 27.3125 | 99 | 0.644546 |
5ddb3f10c47a15d8bd57fc3d3571ba79862637d3 | 81,255 | ######################################################################
#
# Parser routine tests. One test for each grammar rule.
#
######################################################################
require 'test_helper'
class ParserTest < Test::Unit::TestCase
def check(s)
check_ast(s){|inp| @parser.parse(i... | 26.968138 | 101 | 0.342539 |
f89a76fd14fbb6c579985ce81a161e3cf0e7e8ba | 6,011 | require 'spec_helper_integration'
describe 'Revoke Token Flow' do
before do
Doorkeeper.configure { orm DOORKEEPER_ORM }
end
context 'with default parameters' do
let(:client_application) { FactoryGirl.create :application }
let(:resource_owner) { User.create!(name: 'John', password: 'sekret') }
le... | 41.743056 | 127 | 0.688072 |
91dcb0c189dcfa2bf5c7f9a81e3618ea24fd3946 | 301 | class CreateBloodSpotRequests < ActiveRecord::Migration
def change
create_table :blood_spot_requests do |t|
t.integer :study_subject_id
t.date :sent_on
t.date :returned_on
t.boolean :is_found
t.string :status
t.text :notes
t.string :request_type
t.timestamps
end
end
end
| 20.066667 | 55 | 0.737542 |
ffaddae6ae62abedc22642aaf1e2d606bf256fcd | 1,952 | require 'jar_installer'
module JBundler
class Vendor
def initialize( dir )
@dir = File.expand_path( dir )
@jars_lock = File.join( @dir, 'Jars.lock' )
end
def vendored?
File.exists?( @dir ) && Dir[ File.join( @dir, '*' ) ].size > 0
end
def require_jars
if File.exists?(@ja... | 25.684211 | 115 | 0.535348 |
f8a673e4387f8610710519ab9a6f4690a4c9bbfc | 336 | require_relative 'base_icann_compliant'
module Whois
class Parsers
class WhoisNicCapital < BaseIcannCompliant
self.scanner = Scanners::BaseIcannCompliant, {
pattern_available: /^Domain not found/
# pattern_disclaimer: /^Access to/,
# pattern_throttled: /^WHOIS LIMIT EXCEEDED/,
}
... | 25.846154 | 52 | 0.699405 |
f77c0553b29786be07f157a32b15ef50385dc8ee | 268 | require 'test_helper'
class FeedControllerTest < ActionDispatch::IntegrationTest
test "should get common" do
get feed_common_url
assert_response :success
end
test "should get private" do
get feed_private_url
assert_response :success
end
end
| 17.866667 | 58 | 0.757463 |
e84498d457675004e59d1441d7a49ee51b71e066 | 1,107 | class PurchaseItem < ActiveRecord::Base
# t.integer :organization_id
# t.integer :purchase_id
# t.integer :item_id
# t.integer :batch_id
# t.integer :quantity
# t.integer :price
# t.integer :amount
# t.integer :vat
belongs_to :organization
belongs_to :purchase
belongs_to :item
belongs_to :batc... | 19.767857 | 71 | 0.706414 |
28c56afb942b71194b403797b0fdcc3f523fd44b | 8,509 | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# This cop checks for the placement of the closing parenthesis
# in a method call that passes a HEREDOC string as an argument.
# It should be placed at the end of the line containing the
# opening HEREDOC tag.
#
... | 29.751748 | 93 | 0.573275 |
bf2753ac317dd43fc90f70e1c1dd96e35345db34 | 67 | s = gets.to_s
if s == "ABC"
puts "ACR"
else
puts "ABC"
end | 9.571429 | 14 | 0.537313 |
bb0471fc355eaa2e57831ad0dd69b62de070a396 | 87 | class Idea < ApplicationRecord
validates :description, :author, presence: true
end
| 21.75 | 51 | 0.770115 |
e86ad079097814c44b770c8489cb0d172d2a46e2 | 4,081 | # encoding: utf-8
require 'spec_helper'
describe BlabbrApi::Api, type: :requests do
let!(:current_user) {
BlabbrCore::Persistence::User.create(nickname: 'nickname', email: 'email@email.com')
}
let(:admin) {
BlabbrCore::Persistence::User.create(nickname: 'nickname', email: 'email@email.com', roles: [:admi... | 30.684211 | 109 | 0.634648 |
e8ee337064a659dc974ea7c29a3e1d75f75beb11 | 959 | # frozen_string_literal: true
module Banzai
module ReferenceParser
class ExternalIssueParser < BaseParser
self.reference_type = :external_issue
def referenced_by(nodes, options = {})
issue_ids = issue_ids_per_project(nodes)
projects = find_projects_for_hash_keys(issue_ids)
is... | 25.236842 | 107 | 0.653806 |
ab7804592f5890244fe841f1cf62f4466d3a4f98 | 8,850 | ########################
# Cookbook Configuration
########################
default["transloader"]["repository"] = "https://github.com/GeoSensorWebLab/data-transloader"
default["transloader"]["revision"] = "v0.7.0"
default["transloader"]["install_home"] = "/opt/data-transloader"
default["transloader"]["user_home"]... | 52.366864 | 155 | 0.654463 |
38a9a1ae1bd75c9379c14cef584ec89e14a43860 | 2,471 | class Paginate < Liquid::Block
Syntax = /(#{Liquid::QuotedFragment})\s*(by\s*(\d+))?/
def initialize(tag_name, markup, options)
super
if markup =~ Syntax
@collection_name = $1
@page_size = if $2
$3.to_i
else
20
end
@attributes = { 'window_size' => 3 }
... | 27.153846 | 118 | 0.572643 |
ab0205aa39d2b7779e43488b76a312c74e61c1f3 | 497 | Gem::Specification.new do |s|
s.name = "sinatra-redis"
s.description = "Redis module for Sinatra"
s.summary = s.description
s.authors = ["Alyssa Herzog"]
s.email = "alyssadaemon@gmail.com"
s.version = "0.0.1"
s.date = "2016-07-09"
s.license = "MIT"
s.files = %... | 35.5 | 77 | 0.589537 |
e288d803beaa6208190fa89985be7b18defde510 | 3,490 | ##########################################################################
# Copyright 2016 ThoughtWorks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/li... | 38.351648 | 168 | 0.678797 |
f810e1991720bad1aa7d375d1dad353e2b8f9049 | 5,454 | # frozen_string_literal: true
module Solargraph
module Parser
module Rubyvm
# A factory for generating chains from nodes.
#
class NodeChainer
include Rubyvm::NodeMethods
Chain = Source::Chain
# @param node [Parser::AST::Node]
# @param filename [String]
... | 40.4 | 131 | 0.563623 |
62086dd334ee98e5b92eb3e1789e53d35cd4495f | 40 | class PastEvent < ApplicationRecord
end
| 13.333333 | 35 | 0.85 |
b9e646cf6d8699229ec0283ba8df1f1d85e0d889 | 1,891 | describe "Acceptance: Fetching details of a client" do
context "as an authorised client" do
let(:token) { create_token scopes: %w[client:fetch] }
describe "fetching an existing client" do
let(:client) { create_client scopes: %w[one two], supplemental: { test: true } }
let(:response) do
ma... | 27.014286 | 86 | 0.629825 |
183a6aa9d3566fe02b424640f8c8a7e2b8d12d25 | 378 | # frozen_string_literal: true
module NfgUi
module Bootstrap
module Utilities
# Delivers the dismissibility of the component to the HAML partial
module Headable
def heading
options.fetch(:heading, nil)
end
private
def non_html_attribute_options
sup... | 18 | 72 | 0.626984 |
e982eead549aa4524a3703b09020e8ba5b41cf4e | 1,532 | class NotesController < ApplicationController
def new
@note = Note.new(user_id: session[:user_id], destination_id: params[:destination_id])
@destination = @note.destination
end
def create
@note = Note.create(note_params)
if @note.save
destination = D... | 28.37037 | 93 | 0.576371 |
b9cb55595bb2cf128ca185472cd2f3b995949798 | 1,101 | module Wikia
module Response
module RelatedPage
class RelatedPages
class RelatedPage
class ImgOriginalDimension
attr_reader :width, :height
def initialize(img_original_dimensions)
if img_original_dimensions
@width = img_original_dimensi... | 33.363636 | 104 | 0.580381 |
1164d1615e2509d4de0e820ad2a3ce68d5bd65ea | 589 | # 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::DataBoxEdge::Mgmt::V2019_08_01
module Models
#
# Defines values for DataBoxEdgeDeviceStatus
#
module DataBoxEdgeDeviceStatus... | 26.772727 | 70 | 0.70798 |
4a8f8837d9a90c647564976d1fd9802ec9864b65 | 734 | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
# Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_module... | 43.176471 | 84 | 0.757493 |
1c3e9d37faebe77c0ea030bdf874543a735b3000 | 276 | class CreateTranslationLog < EOL::LoggingMigration
def self.up
connection.create_table :translation_logs do |t|
t.string :key, :limit => 128
t.integer :count, :default => 1
end
end
def self.down
connection.drop_table :translation_logs
end
end
| 21.230769 | 52 | 0.695652 |
bfb6cdd1483de514c41c3b1a3676f189d8229c06 | 5,681 | require 'spec_helper'
describe 'New Order', type: :feature do
let!(:product) { create(:product_in_stock) }
let!(:state) { create(:state) }
let!(:user) { create(:user, ship_address: create(:address), bill_address: create(:address)) }
stub_authorization!
before do
create(:check_payment_method)
create... | 28.984694 | 108 | 0.647421 |
ff5f3d6d093e956b4afa153163f754e91cb85833 | 2,956 | module Travis
module Addons
module Hipchat
# Publishes a build notification to hipchat rooms as defined in the
# configuration (`.travis.yml`).
#
# Hipchat credentials can be encrypted using the repository's ssl key.
class Task < Travis::Task
require 'travis/addons/hipchat/h... | 31.446809 | 133 | 0.52977 |
1df4a5b09b0f4b8081bef89372c26af6f1344432 | 529 | require 'minitest/autorun'
require_relative 'src'
# Tests for part1
class TestPart1 < MiniTest::Test
def test_no_block
assert_raises(LocalJumpError) { integrate(0, 5) }
end
def test_wrong_order
assert_raises(ArgumentError) { integrate(10, 0) { |x| x } }
end
def test_eps
exact_value = Math.log(2... | 24.045455 | 75 | 0.667297 |
f892486c5df225e53a3b41a410d2eedd34e0fbca | 6,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... | 32.338308 | 245 | 0.633077 |
ff0d183b7f4bc00781e1e64f2240b48ef2710057 | 146 | # Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Bi::Application.initialize!
| 24.333333 | 52 | 0.794521 |
b90a023b34d998e0bd91c59683a054af558db4c8 | 915 | class Sxiv < Formula
desc "Simple X Image Viewer"
homepage "https://github.com/muennich/sxiv"
url "https://github.com/muennich/sxiv/archive/v1.3.2.tar.gz"
mirror "https://mirrors.kernel.org/debian/pool/main/s/sxiv/sxiv_1.3.2.orig.tar.gz"
sha256 "9f5368de8f0f57e78ebe02cb531a31107a993f2769cec51bcc8d70f5c668b653... | 29.516129 | 92 | 0.747541 |
6a5f7aa241402c30425238bc17129461fe77ef07 | 386 | require 'data_mapper/adapters/data_object_adapter'
class MockAdapter < DataMapper::Adapters::DataObjectAdapter
COLUMN_QUOTING_CHARACTER = "`"
TABLE_QUOTING_CHARACTER = "`"
def delete(instance_or_klass, options = nil)
end
def save(database_context, instance)
end
def load(database_context, klass, ... | 18.380952 | 59 | 0.733161 |
617b862b814864cbba76f80991bd687f382a3aa1 | 4,143 | require "rails_helper"
describe Entities::Company do
it_behaves_like "Entities::BaseEntity#initialize"
input_args = {
address: "Address",
company_executives: ["Company Executive"],
exchange: "Exchange",
id: 123,
issuer_type: "Issuer Type"
}
it_behaves_like("Entities::HasDbEntity.from_db_ent... | 33.682927 | 117 | 0.66015 |
4abd678c8b4f52bb2f144cfc66f7f9b690bcdbbf | 1,415 | Pod::Spec.new do |s|
s.name = 'IBMWatsonPersonalityInsightsV3'
s.version = '3.3.0'
s.summary = 'Client framework for the IBM Watson Personality Insights service'
s.description = <<-DESC
IBM Watson™ Personality Insights uses linguistic analytics to infer in... | 50.535714 | 122 | 0.577385 |
d5ba178600effd4ca8329a122f417f5bd2b907d8 | 871 | #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint analytics_support.podspec` to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'analytics_support'
s.version = '0.0.1'
s.summary = 'Support package for Google Analyti... | 37.869565 | 105 | 0.614237 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.