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 |
|---|---|---|---|---|---|
1c22400b0831f528d399a689f198444ff6b5afe4 | 4,920 | ENV['RACK_ENV'] = 'test'
# 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 explicitl... | 47.76699 | 92 | 0.74187 |
1c2a9ac1c8facc2008356f6ca6bc06d98ed5ffa6 | 283 | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
#
puts 'Seeding the database'
CoinGeckoApi::VsCurrencies.fetch
| 47.166667 | 115 | 0.795053 |
263b60a306c34ac157c45c4e975308be55ff36d3 | 1,098 | class OpenSp < Formula
desc "SGML parser"
homepage "http://openjade.sourceforge.net"
url "https://downloads.sourceforge.net/project/openjade/opensp/1.5.2/OpenSP-1.5.2.tar.gz"
sha256 "57f4898498a368918b0d49c826aa434bb5b703d2c3b169beb348016ab25617ce"
bottle do
revision 2
sha256 "fb795bc471277017e309d2f... | 43.92 | 92 | 0.652095 |
ed7b61eb20f1121f92e8165c5dab5e0bdfa929a5 | 1,226 | # frozen_string_literal: true
RSpec.describe Byebug::Skipper::CommentLineAbove do
subject do
described_class.(location)
File.read(tempfile.path)
end
let(:location) { "#{tempfile.path}:#{line_number}" }
let(:line_number) do
file_contents.lines.index { _1.strip == 'stop_here' } + 1
end
let(:tempf... | 19.15625 | 69 | 0.592985 |
6150a7b9baa38706403b33a7be796d2db72cad8c | 639 | $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require 'persistent_http/version'
Gem::Specification.new do |s|
s.name = "persistent_http"
s.summary = 'Persistent HTTP connections using a connection pool'
s.description = 'Persistent HTTP connections using a connection pool... | 37.588235 | 90 | 0.677621 |
acd9a4ee426305d46c79eb3fa1c1703dea665c85 | 7,862 | # frozen_string_literal: true
module Jekyll
class Renderer
attr_reader :document, :site
attr_writer :layouts, :payload
def initialize(site, document, site_payload = nil)
@site = site
@document = document
@payload = site_payload
end
# Fetches the payload used in Liquid ren... | 29.118519 | 89 | 0.646273 |
1cb464355041c81920e32a903703b19a811a3654 | 1,866 | module SpreeShopifyImporter
module DataSavers
module ShippingMethods
class ShippingMethodCreator
def initialize(shopify_rate, delivery_profile_id)
@shopify_rate = shopify_rate
@delivery_profile_id = delivery_profile_id
end
def call
find_shipping_method ... | 31.1 | 135 | 0.625938 |
7a469df4fb954cf852f1912dede83b65e4ba2ac5 | 1,769 | require 'spec_helper'
describe JobTask do
it { should validate_presence_of :type }
it { should validate_presence_of :job_id }
it { should belong_to(:job) }
describe '#assemble!' do
let(:workspace) { workspaces(:empty_workspace) }
let(:user) { users(:owner) }
let(:dataset) { datasets(:table) }
... | 26.014706 | 78 | 0.617863 |
0382074312212b3fe4d0e46cd30f21147b0480d7 | 40 | module Crackpot
VERSION = "0.0.1"
end
| 10 | 19 | 0.675 |
1a537a6b95148c5a8a603ab79ac5d382e6ccef74 | 1,306 | #
# a language data file for Ruby/CLDR
#
# Generated by: CLDR::Generator
#
# CLDR version: 1.3
#
# Original file name: common/main/mt_MT.xml
# Original file revision: 1.28 $
#
# Copyright (C) 2006 Masao Mutoh
#
# This file is distributed under the same license as the Ruby/CLDR.
#
private
def init_data
@format ... | 24.641509 | 67 | 0.624809 |
e240c68935b198ac6f264f30c579a2636945c52a | 662 | require 'formula'
class Languagetool < Formula
homepage 'http://www.languagetool.org/'
url 'https://www.languagetool.org/download/LanguageTool-2.4.1.zip'
sha1 '47ca4ee2da377450056eb386a2b88e4a077a94a5'
def server_script server_jar; <<-EOS.undent
#!/bin/bash
exec java -cp #{server_jar} org.languagetool... | 31.52381 | 86 | 0.744713 |
0846607c60259cfd95dd3d808fbd63e0ae7e6647 | 3,383 | ###
# Blog settings
###
# Time.zone = "UTC"
activate :blog do |blog|
# This will add a prefix to all links, template references and source paths
# blog.prefix = "blog"
# blog.permalink = "{year}/{month}/{day}/{title}.html"
# Matcher for blog source files
blog.sources = "articles/{year}-{month}-{day}-{title... | 22.553333 | 85 | 0.682235 |
339fe05053398b930cc2db1892db850d39741c34 | 1,375 | # frozen_string_literal: true
# It's okay to print to the console here; it's being *run* at the console.
# rubocop:disable Rails/Output
# Snippets
Dir.glob(Rails.root.join('db', 'seeds', 'snippets', '*')) do |dir|
lang = File.basename(dir)
Dir.glob(Rails.root.join('db', 'seeds', 'snippets', lang, '*.md')) do |md... | 25.943396 | 91 | 0.672727 |
ed7839cbed3613a4ddc993af58d77cbd6d7145b2 | 655 | require 'spec_helper'
require 'adventofcode/day_3/part_2'
RSpec.describe(AdventOfCode::Day3::Part2) do
describe('#run') do
let(:challenge_input) { load_fixture('day_3.txt') }
it('returns the correct answer for example one') do
expect(subject.run('^v')).to eql(3)
end
it('returns the correct an... | 26.2 | 63 | 0.665649 |
bf5497f6736c50c7d7a0be570d787fcca1b0cea2 | 83 | # encoding: UTF-8
module Mojito::Controllers
module Sinatra
end
end | 7.545455 | 26 | 0.650602 |
d50409bf3099968e1724852f344e1e171f8c677a | 468 | module Spree
module Admin
class PicturesController < ApplicationController
def create
@picture = Picture.new(picture_params)
if @picture.save
render json: {success: true, file_path: @picture.image.url}
else
render json: {success: false, msg: @picture.errors.full_m... | 22.285714 | 75 | 0.623932 |
0142b44c63bea21253b7b41235a8539a7821ab62 | 10,344 |
require 'rubygems'
require 'yajl'
@test_index = 0
def data_path(basename)
File.expand_path("../#{basename}.json", __FILE__)
end
def write_file(prefix, relname, content)
File.open(data_path("#{prefix}_#{relname}"), "w") {|f| f.print(content)}
end
def print_example(mergee, other, expected)
puts "# Example #@te... | 56.52459 | 151 | 0.602862 |
6ad18266c8f6fb8b02e707c528c19ea779baa469 | 655 | require 'fl/framework/query'
module Fl::Framework::Comment
# Query support for comments and commentables.
# This module defines a number of general support methods used by the ORM-specific query functionality.
#
# @note The module is currently empty, as all methods originally here were moved to the common quer... | 32.75 | 105 | 0.717557 |
08fe0b290d6c478597c2fb2048c185969e7a2669 | 733 | require './lib/mlb_record.rb'
class MlbRecord::Team
attr_accessor :fullname, :record, :nickname, :team_page
@@all = []
def self.new_from_index(index)
self.new(
index.css(".teamname").text.delete!("\n"),
index.css(".teamrecord").text.delete!("\n"),
"htt... | 21.558824 | 73 | 0.549795 |
1c5ff16a58a9899b25fd3f41860df4d82db3a40d | 1,205 | class Gsoap < Formula
desc "SOAP stub and skeleton compiler for C and C++"
homepage "https://www.genivia.com/products.html"
url "https://downloads.sourceforge.net/project/gsoap2/gsoap-2.8/gsoap_2.8.87.zip"
sha256 "0d117633cb973dbd46a0bdcdcba74c67485aa9bc62b065e0ca621fdef9425dda"
bottle do
sha256 "f624dbb... | 37.65625 | 93 | 0.736929 |
2168ef2d88ffe5d70e1246e359e27961d410290a | 5,732 | class UserMailer < ActionMailer::Base
prepend_view_path "app/views/branded/"
include MailerHelper
helper MailerHelper
helper FeedbacksHelper
default from: Rails.configuration.branding[:organisation][:email]
def welcome_notification(user)
@user = user
FastGettext.with_locale FastGette... | 34.739394 | 198 | 0.650558 |
ff7dcecb074f10be496f25257bbd8b2564574868 | 401 | class CreateSipityWorkflowMethods < ActiveRecord::Migration[5.2]
def change
create_table :sipity_workflow_methods do |t|
t.string "service_name", null: false
t.integer "weight", null: false
t.integer "workflow_action_id", index: true, null: false
... | 36.454545 | 64 | 0.563591 |
33ac0f2def7bab609c5edf6acd05bf1f2d1151cb | 1,426 | #!/usr/bin/env ruby
#################################################################################
# view_show.rb
#
# Generates View file: admin/views/<model>/show.html.haml
#
# 29.01.2014 ZT
# 24.02.2015 v 1.0.0
# 05.03.2015 v 1.1.0 view of references type updated
# 26.03.2015 v 1.2.0 localization
#... | 34.780488 | 148 | 0.558205 |
21bc720d65443fa3bc53bfaed1076f3412739627 | 180 | class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :name
t.integer :age
t.timestamps null: false
end
end
end
| 16.363636 | 43 | 0.65 |
6a4bcff24435cdbbf47e4d8c7d1f4b835a11c94b | 630 | shared_examples 'subscriber' do
let(:field_value) { SecureRandom.uuid }
let(:repo_entry) { described_class.repository_class.create(field => field_value) }
let(:entry_id) { repo_entry.id }
describe '.find' do
it 'should find entry' do
expect { described_class.find(entry_id) }.not_to raise_error
en... | 26.25 | 84 | 0.668254 |
9178e01bb2a666255bb109bea224a0fd52be25e7 | 1,254 | require 'faraday'
require 'json'
module Sfctl
module Harvest
module Client
API_V2_PATH = 'api/v2/'.freeze
def self.conn(account_id, token)
raise 'Please set Harvest provider before continue.' if account_id.nil? || token.nil?
headers = {
'Content-Type' => 'application/json'... | 27.866667 | 100 | 0.62201 |
ed1f2bc9af0e4c3cac1737ecd345cbef1529579c | 1,170 | require_relative '../../../search_test'
require_relative '../../../generator/group_metadata'
module USCoreTestKit
module USCoreV400
class EncounterIdSearchTest < Inferno::Test
include USCoreTestKit::SearchTest
title 'Server returns valid results for Encounter search by _id'
description %(
A se... | 27.209302 | 110 | 0.688889 |
eddd84f3044f87be79ec89e54caa8cec60404a33 | 1,875 | #!/usr/bin/env ruby
#
# newrelic-metrics
#
# DESCRIPTION:
# Pull new relic metrics
#
# OUTPUT:
# metric data
#
# PLATFORMS:
# Linux
#
# DEPENDENCIES:
# gem: sensu-plugin
# gem: <?>
#
# USAGE:
# example commands
#
# NOTES:
# this is setup to only work if you have a single account under
# your api key.
... | 22.865854 | 92 | 0.621333 |
28523604fe69a06e5095dfd6d2b9fb020f7fbac4 | 2,376 | =begin
#Cloudsmith API
#The API to the Cloudsmith Service
OpenAPI spec version: v1
Contact: support@cloudsmith.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.2.3
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for CloudsmithApi::VulnerabilitySca... | 27.952941 | 103 | 0.725589 |
21e4e82af89208c80c8b1fecf0e2368e07f94ca9 | 557 | # This file was automatically generated by Trapeze, the safety-net generator for
# Ruby. Visit http://trapeze.rubyforge.org/ for more information.
require 'test/unit'
class FooTest < Test::Unit::TestCase
def setup
@foo = Foo.new
end
def test_should_be_instance_of_class
assert_instance_of Class, Fo... | 22.28 | 80 | 0.743268 |
7a7b19cfbb1f2bd9f3b281a5fd22d7ad3bb49bc4 | 1,670 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'ZagorskiADT/version'
Gem::Specification.new do |spec|
spec.name = "ZagorskiADT"
spec.version = ZagorskiADT::VERSION
spec.authors = ["Benjamin Zagorski"]
spec.email ... | 49.117647 | 348 | 0.692814 |
4a37912bafdca39619606803d50f0cca69b228e3 | 1,183 | # coding: utf-8
# Get input from the user in raw mode. (Windows Specific Code)
module MiniTerm
# The sleep interval waiting for a key to be pressed.
WAIT_SLEEP = 0.02
TERM_MODE_MASK = 0xFFFFFFFF
ENABLE_LINE_INPUT = 0x00000002
ENABLE_PROCESSED_INPUT = 0x00000001
# Is there a character waiting... | 23.196078 | 73 | 0.688081 |
f71a1c4ee5747ee84fef77695572d68428430770 | 377 | class CreateTimeEntries < ActiveRecord::Migration[5.0]
def change
create_table :time_entries do |t|
t.date :date
t.decimal :duration
t.text :description
t.boolean :billable
t.boolean :paid
t.integer :matter_id
t.integer :lawyer_id
t.datetime :created_at
t.date... | 22.176471 | 54 | 0.644562 |
1cb99abedae0543af6912ad93409751947c7da61 | 990 | # Generated by hyrax:models:install
class FileSet < ActiveFedora::Base
property :date_copyrighted, predicate: ::RDF::Vocab::DC.dateCopyrighted do |index|
index.as :stored_searchable, type: :date
end
include ::Hyrax::FileSetBehavior
# override method in lib/hydra/works/models/concerns/file_set/mime_types.r... | 30 | 84 | 0.707071 |
e22457a414ece206b628b644e9ac9d44035dac5d | 444 | cask 'livereload' do
version '2.3.74'
sha256 '7a192cda9c15efdeea00ca53153be0c649e3d413719f8291e4f1684c0132506b'
url "http://download.livereload.com/LiveReload-#{version}.zip"
appcast 'https://s3.amazonaws.com/download.livereload.com/LiveReload-Mac-appcast.xml',
checkpoint: '755f681d6ccf6d2e69dc86ac31... | 34.153846 | 88 | 0.781532 |
336d10c7e62d151be86b07e1e6820f1af92235a1 | 392 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require File.expand_path('../../lib/discourse_api', __FILE__)
client = DiscourseApi::Client.new("http://localhost:3000")
client.api_key = "YOUR_API_KEY"
client.api_username = "YOUR_USERNAME"
# get categories
puts client.categories()
# get sub categories for ... | 30.153846 | 61 | 0.765306 |
030b1fba301555a0827e05a1f94b9a09837f6e68 | 857 | # ## Schema Information
#
# Table name: `sftp_accounts`
#
# ### Columns
#
# Name | Type | Attributes
# ---------------------- | ------------------ | ---------------------------
# **`id`** | `integer` | `not null, primary key`
# **`username`** | `string` ... | 34.28 | 75 | 0.396733 |
f7d4d003b8f1c03251eb71ead4ac7a5aa1b2e845 | 1,175 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'signed_form/version'
Gem::Specification.new do |spec|
spec.name = "signed_form"
spec.version = SignedForm::VERSION
spec.authors = ["Erich Menge", "Johnneylee Jack Rolli... | 37.903226 | 79 | 0.677447 |
abc96278e2abdd309a51a8e32aae8f92124a73ce | 7,453 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Monitor::Mgmt::V2015_05_01
#
# A service client - single point of access to the REST API.
#
class ApplicationInsightsManagementClient < MsRestAzure::Azu... | 38.61658 | 154 | 0.715685 |
03d7794a9c2c109316d10d5f6825d9d5991ca36f | 1,159 | require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "action_cable/engine"
# require "sprockets/railti... | 34.088235 | 82 | 0.775669 |
1a21154ffc42680c16247de82ceec2ee8b9527a4 | 3,909 | #!/usr/bin/env -S ruby
p 123
p 0d123
p -123
p 123.45
p 1.2e-3
p 0xffff
p 0b1011
p 0377
p 0o377
p 42r
p 3.14r
p 42i
p 3.14i
p 42ri
p 3.14ri
p "this is a string expression\n"
p 'this is a string expression\n'
p %q!I said, "You said, 'She said it.'"!
p %!I said, "You said, 'She said it.'"!
p %Q('This is it.'\n)
p "this ... | 15.389764 | 91 | 0.580967 |
5dcf575abd706d13ae972d05ad7bbd4d11d06076 | 1,202 | # frozen_string_literal: true
module Ci
class DailyBuildGroupReportResult < ApplicationRecord
extend Gitlab::Ci::Model
PARAM_TYPES = %w[coverage].freeze
belongs_to :last_pipeline, class_name: 'Ci::Pipeline', foreign_key: :last_pipeline_id
belongs_to :project
belongs_to :group
validates :da... | 35.352941 | 104 | 0.712978 |
9157eac35de393db1c350a249f1a65599f4e154d | 211 | class CreateEnrollments < ActiveRecord::Migration[5.0]
def change
create_table :enrollments do |t|
t.references :user, foreign_key: true
t.references :team, foreign_key: true
end
end
end
| 23.444444 | 54 | 0.706161 |
1de75f2edea046014c734f5b781792d2bb71e7cf | 1,721 | require 'openstudio'
# Helper to load a model in one line
def osload(path)
translator = OpenStudio::OSVersion::VersionTranslator.new
ospath = OpenStudio::Path.new(path)
model = translator.loadModel(ospath)
if model.empty?
raise "Path '#{path}' is not a valid path to an OpenStudio Model"
else
mode... | 20.011628 | 75 | 0.650203 |
edba74c5735d80f846b72c035059bf91df5b1ed9 | 3,214 | # frozen_string_literal: true
require 'bolt/executor'
require 'spec_helper'
describe 'file::read' do
around(:each) do |example|
Puppet.override({ bolt_executor: executor,
future: future }) do
example.run
end
end
shared_examples 'file loading' do
let(:future) { {} }
... | 30.609524 | 89 | 0.603298 |
acbadf50cfdd1cb015b921a25af45e0eda77eda8 | 10,318 | # frozen_string_literal: true
require "active_support/core_ext/array/extract_options"
require "action_controller/metal/mime_responds"
module ActionController #:nodoc:
module RespondWith
extend ActiveSupport::Concern
included do
class_attribute :responder, :mimes_for_respond_to
self.responder = ... | 39.837838 | 91 | 0.64276 |
875e8b2b682ec12021efc49f391e9c676521b58e | 863 | require 'spec_helper'
describe Ci::Variable do
subject { build(:ci_variable) }
describe 'validations' do
it { is_expected.to include_module(HasVariable) }
it { is_expected.to include_module(Presentable) }
it { is_expected.to validate_uniqueness_of(:key).scoped_to(:project_id, :environment_scope).with_... | 25.382353 | 144 | 0.681344 |
f7c207bafc0b0a352a75cf8d2ec66b5635a3c5a9 | 2,531 | require 'spec_helper'
describe VoluntaryScholarship::IterationParticipationsHelper do
before :each do
allow(self).to receive(:user_signed_in?).and_return true
end
describe '#can_update_scholarship_iteration_participation_roles?' do
context 'user is master' do
it 'returns true' do
allow(s... | 37.776119 | 135 | 0.669696 |
b969a612d3350a087ca4afc5ef88f72294530d72 | 1,797 | module Gridinit
module Jmeter
class DSL
def view_results_in_table(params={}, &block)
node = Gridinit::Jmeter::ViewResultsInTable.new(params)
attach_node(node, &block)
end
end
class ViewResultsInTable
attr_accessor :doc
include Helper
def initialize(params={... | 30.457627 | 115 | 0.675014 |
ab4a40b9b899cf392254318485060b11fcbb5361 | 5,482 | # frozen_string_literal: true
require 'time'
require 'net/http/post/multipart'
module Smartling
# Methods for using the Smartling files API
module Files
def files(project_id: @project_id, uri_mask: nil,
last_uploaded_after: nil, last_uploaded_before: nil,
order_by: nil, file_types:... | 40.910448 | 99 | 0.651405 |
012f0034b6cdff6f68d6e6ecb3dc305a2b017cad | 3,061 | #!/usr/bin/env ruby
ENV["MT_NO_EXPECTATIONS"] = "1"
require 'minitest/autorun'
require 'spy/integration'
$LOAD_PATH.unshift(File.join(File.expand_path(__dir__), '..', 'lib'))
require 'liquid.rb'
require 'liquid/profiler'
mode = :strict
if env_mode = ENV['LIQUID_PARSER_MODE']
puts "-- #{env_mode.upcase}... | 25.940678 | 103 | 0.680823 |
872ae821ba7611c1606c7cb619615f675a0dbe26 | 521 | require_relative 'config/environment'
require 'prometheus_exporter/server'
health_and_metrics = Rack::Builder.app do
map '/healthz' do
use Rack::Auth::Basic, 'HealthCheck' do |username, password|
Rack::Utils.secure_compare(ENV['HEALTH_PASS'], "#{username}:#{password}")
end
use Rack::Deflater
r... | 24.809524 | 79 | 0.694818 |
d58373362055d1bfb9aa83963b79a4abe6215a3f | 243 | require 'faker'
FactoryBot.define do
factory :field_options_field do
sort_order { Faker::Number.unique.between(from: -8388607, to: 8388607) }
field_id { create(:field).id }
field_option_id { create(:field_option).id }
end
end
| 24.3 | 76 | 0.716049 |
e85cf8f55fe8d377888df5dafe3d6e42256263c1 | 1,083 | module LIFX
module LAN
# @private
module Utilities
def try_until(condition_proc, timeout_exception: TimeoutError,
timeout: 3,
condition_interval: 0.1,
action_interval: 0.5,
... | 29.27027 | 74 | 0.470914 |
1864c696495501e8bc3ca6f33ff3e8ab659ae61b | 9,585 | class ProjectsController < ApplicationController
include ApplicationHelper
include OperateProjectAbilityAble
include ProjectsHelper
include Acceleratorable
before_action :require_login, except: %i[index branches branches_slice group_type_list simple show fork_users praise_users watch_users recommend banner_r... | 37.29572 | 246 | 0.702452 |
79c1213732406fd8be0fc323b3d126a9da6520f0 | 1,785 | Pod::Spec.new do |s|
s.name = "CTIVideoCall"
s.version = "1.0.1"
s.summary = "A painless way to integrate WebRTC audio/video(screen sharing) to any iOS applications via OpenTok modified by Powell at CTI Africa"
s.description = "The OpenTok Accelerator Core is required whenev... | 55.78125 | 396 | 0.694678 |
018e6297206d2c820ce3fe59e067b27bc5b4c858 | 4,296 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Page request caching' do
let!(:page) { create(:alchemy_page, :public) }
context "when caching is disabled in app" do
before do
Rails.application.config.action_controller.perform_caching = false
end
it "sets no-cache header" d... | 30.468085 | 88 | 0.615689 |
21c0fe1f2f17163ec55524cb7c18a21ed61d2a24 | 4,305 | require 'rails_helper'
feature 'Visitor search a promotion' do
scenario 'succesfully' do
user = User.create!(email: 'filipe@campuscode.com.br', password: '123456')
company = Company.create!(company_name: 'Campus Code',
street_name: 'Rua vinte e seis',
... | 45.797872 | 82 | 0.506852 |
7a463cd8e48f039de2e1fd0eb167a055f936509e | 1,371 | # frozen_string_literal: true
require 'rom/model_builder'
module ROM
class Mapper
# Model DSL allows setting a model class
#
# @private
module ModelDSL
attr_reader :attributes, :builder, :klass
DEFAULT_TYPE = :poro
# Set or generate a model
#
# @example
# clas... | 22.47541 | 60 | 0.556528 |
e206021b86ede6270dee0270d6de3e0a356a828a | 904 | # frozen_string_literal: true
namespace :osm_rubocop do
desc 'Install a pre-commit hook that ensures the code adheres to the OSM Rubocop configuration'
# rubocop:disable Rails/RakeEnvironment (installing the pre-commit hook does not require loading a rails environment)
task :install_precommit_hook do
# ruboc... | 29.16129 | 119 | 0.684735 |
abb550c00596a275b6cdd1906967d5e8d741e80a | 303 | require 'minitest/autorun'
require 'minitest/reporters'
require "minitest/skip_dsl"
require "minitest"
require_relative "../lib/array_intersection"
require_relative "../lib/palindrome_permutation"
require_relative "../lib/permutations"
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
| 23.307692 | 62 | 0.808581 |
e8bcfe5e08b198811cef10e90993dd0efc7eb5b8 | 903 | require 'optparse'
module Serf
module Handler
class Cli < Hash
def initialize
OptionParser.new do |opts|
opts.banner = "Usage: handler [options]\n\nWhen given CLI options, payload items that are normally passed to the handler via Serf can be specified manually."
opts.separator '... | 37.625 | 167 | 0.596899 |
018ef7ff3111f14fdd5ba455fc53c5db4aaa8a30 | 1,357 | class Bitcoin < Formula
desc "Decentralized, peer to peer payment network"
homepage "https://bitcoin.org/"
url "https://github.com/bitcoin/bitcoin/archive/v0.14.2.tar.gz"
sha256 "e0ac23f01a953fcc6290c96799deeffb32aa76ca8e216c564d20c18e75a25219"
revision 2
head "https://github.com/bitcoin/bitcoin.git"
bot... | 32.309524 | 93 | 0.703021 |
1ad320c5dd3ab3a633d4ced7f7f799f124c09a11 | 2,692 | # frozen_string_literal: true
require 'spec_helper'
describe 'postgresql::globals', type: :class do
context 'on a debian 8' do
let(:facts) do
{
os: {
family: 'Debian',
name: 'Debian',
release: {
full: '8.0',
major: '8',
},
d... | 24.252252 | 72 | 0.53529 |
ac18665a400794be3452483c65f7a12c2affd949 | 836 | require 'spec_helper'
module Finitio
describe Syntax, "unnamed_constraint" do
subject{
Syntax.parse(input, root: "unnamed_constraint")
}
let(:compiled){
subject.compile("a")
}
let(:ast){
subject.to_ast("a")
}
context 'a >= 10' do
let(:input){ 'a >= 10' }
... | 19 | 57 | 0.533493 |
f7d54e18e7487ae13a252968117a4af0edb86407 | 95 | module TeacherTrainingPublicAPI
class Subject < TeacherTrainingPublicAPI::Resource
end
end
| 19 | 52 | 0.842105 |
7af58a58106699f12fba39c8db1d91f7ff3de7ec | 666 | require "devise/strategies/database_authenticatable"
# This is for use in the development environment where you may have
# users in the database that were created by other strategies (e.g. LDAP)
# but you don't want to always be connecting to the LDAP server.
# This will allow you to log in as any user.
module Devise... | 20.8125 | 103 | 0.758258 |
088fab8848f418a6c794029ef3e77f9d2f3a0892 | 1,624 | #
# git_checkout.rb
# YJCocoa
#
# https://github.com/937447974
# YJ技术支持群:557445088
#
# Created by 阳君 on 2019/03/18.
# Copyright © 2017年 YJCocoa. All rights reserved.
#
module YJCocoa
class GitCheckout < Git
self.command = 'checkout'
self.summary = 'git checkout'
self.description = '... | 22.555556 | 101 | 0.485222 |
ab6ff8d9e3c6dfbd65f9e2e3ba1f04c68098ea00 | 50,502 | #
# Author:: John Keiser (<jkeiser@chef.io>)
# Copyright:: Copyright 2013-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.
# You may obtain a copy of the License at
#
# ... | 37.829213 | 188 | 0.557681 |
38a4f67bf42ec19b2d08bc7c80affb247e1f97b5 | 8,123 | #!/usr/bin/env ruby
# Finding symbol dependencies among libs in #{sLibRootPath}
# use arg 0 to specific the lib root path
t1 = Time.now
puts "Start analysing at #{t1}\n\n"
require 'find'
require 'set'
require 'json'
##################################### user configuration you should specified begin ################... | 25.070988 | 134 | 0.631048 |
01c981e3c13da78f70e51737dd7afb04b43b7ab8 | 5,053 | class ReturnAuthorization < ActiveRecord::Base
has_many :return_items
has_many :comments, :as => :commentable
belongs_to :user
belongs_to :order
belongs_to :author, :class_name => 'User', :foreign_key => :created_by
# has_many :transactions
has_many :transaction_ledgers, :as => :accountable
acc... | 34.37415 | 125 | 0.680784 |
f7c61805ee89c5288022f382bf3156308e822c13 | 1,603 | require 'spec_helper'
module ASIN
describe ASIN do
context "configuration" do
it "should fail without secret and key" do
expect { @helper.lookup 'bla' }.to raise_error(ArgumentError, "you are missing mandatory configuration options. please set [:secret, :key, :associate_tag]")
end
it "... | 32.714286 | 164 | 0.636931 |
1dd09f0665755bc5b0bd61540d81621a519b3f08 | 1,410 | class Flow < Formula
desc "Static type checker for JavaScript"
homepage "https://flowtype.org/"
url "https://github.com/facebook/flow/archive/v0.131.0.tar.gz"
sha256 "3e4e089383426bbd988c78299593019a784ba985a97cfed6efe181e330a894f5"
license "MIT"
head "https://github.com/facebook/flow.git"
bottle do
... | 32.790698 | 94 | 0.734043 |
399f49c5815e7e418d36f77c54d868cbcb5f3353 | 1,760 | Rails.application.routes.draw do
resources :saml, only: :index do
collection do
get :sso
post :acs
get :metadata
get :logout
end
end
root 'saml#index'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "r... | 25.507246 | 84 | 0.638636 |
62ab4ce777f546e25d7025afba59b9b75de9094d | 724 | # Copyright 2017 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 34.47619 | 74 | 0.774862 |
d5c0af175f455cd088cb505fd5531090863f5a54 | 1,199 | # Task to clone the packaging repo into 'ext/packaging'
build_defs_file = File.join(RAKE_ROOT, 'ext', 'build_defaults.yaml')
if File.exist?(build_defs_file)
begin
require 'yaml'
@build_defaults ||= YAML.load_file(build_defs_file)
rescue Exception => e
STDERR.puts "Unable to load yaml from #{build_defs_... | 34.257143 | 126 | 0.693078 |
4a7ccd0c965efe19a8c84538494605834c49173d | 4,379 | class ElasticsearchOss < Formula
desc "Distributed search & analytics engine"
homepage "https://www.elastic.co/products/elasticsearch"
url "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-7.2.0-darwin-x86_64.tar.gz?tap=elastic/homebrew-tap"
version "7.2.0"
sha256 "a9659c9bd5248f8071720e... | 30.838028 | 130 | 0.610413 |
034f3b183e5e8e0ce1ce8d31015bd48cb7c59a57 | 443 | class InternetDealAttribute < ActiveRecord::Base
belongs_to :deal
has_many :internet_equipments, dependent: :destroy
accepts_nested_attributes_for :internet_equipments,:reject_if => :reject_equipment, allow_destroy: true
def reject_equipment(attributes)
if attributes[:name].blank?
if attributes[... | 27.6875 | 107 | 0.697517 |
03e89c48dac41b3b350b279a5c55c17b6ffaf8da | 464 | puts('--- Trabajando con operadores de comparacion ---')
puts "comparando enteros"
puts 3 == 3
puts 3 < 3
puts 3 > 3
puts 3 != 3
puts 3 >= 3
puts 3 <= 3
puts "comparando string"
puts 'Juan' == 'juan'
puts("--- Comparando edad para saber si es mayor o no de edad")
puts("Ingrese la edad del usuario")
edad = gets.chomp
if... | 24.421053 | 63 | 0.676724 |
39debc1bbd9effa0fa2dba2ebb18bf6abc8c3648 | 1,148 | # frozen_string_literal: true
module Fog
module Compute
class Aliyun
class Real
# {Aliyun API Reference}[https://docs.aliyun.com/?spm=5176.100054.3.1.DGkmH7#/pub/ecs/open-api/region&describezones]
def list_zones
action = 'DescribeZones'
sigNonce = randonStr
tim... | 24.425532 | 124 | 0.489547 |
f71a34155a8fc8a518f3cb11aa14a6c3de906af4 | 5,775 | class StatisticsController < ApplicationController
before_filter :authenticate_user!
AGE_GROUP_LABELS = {
0..17 => " -17",
18..24 => "18-24",
25..34 => "25-34",
35..44 => "35-44",
45..54 => "45-54",
55..64 => "55-64",
65..100 => "65+",
}
def statistics_global_activity
@members ... | 33.575581 | 80 | 0.633939 |
335065d482441e8c26581a9b716a0d6030a8f9e6 | 102 | # frozen_string_literal: true
class Teachers::PasswordsController < Devise::PasswordsController
end
| 17 | 65 | 0.833333 |
bf00a120c80f472a49c0b93618f95e27b649b304 | 2,235 | class VotesController < ApplicationController
before_action :doorkeeper_authorize!, :if => lambda { authenticate_with_oauth? }
before_action :authenticate_user!, :unless => lambda { authenticated_with_oauth? }, except: [:by_login]
before_action :load_votable, except: [:by_login, :destroy]
before_action :load_us... | 29.025974 | 105 | 0.654586 |
bb4eca806865a78449b150cb9ae575532eda5bd3 | 473 | class Tram::Policy
# An exception to be risen by [Tram::Policy#validate!]
class ValidationError < RuntimeError
# Policy object whose validation has caused the exception
#
# @return [Tram::Policy]
#
attr_reader :policy
private
def initialize(policy, filter)
@policy = policy
... | 24.894737 | 72 | 0.657505 |
1cc881ae98049b8f9870cabf911f294c36319914 | 19,913 | module ConfigureDeploymentStepServices
def get_methods
[
ConfigureCommitmentMethod.new("set_maintenance_policy", ConfigureDeploymentStepMethod::FIRST_GROUP_ID, ConfigureDeploymentStepMethod::FIRST_STEP_WEIGHT),
ConfigureCommitmentMethod.new("stop_disabled_services", -1, 0),
ConfigureCommitmentMe... | 39.431683 | 430 | 0.654196 |
e99d523763094923fc5bb91866cd3f070e7137f3 | 1,300 | class Flow < Formula
desc "Static type checker for JavaScript"
homepage "http://flowtype.org/"
url "https://github.com/facebook/flow/archive/v0.15.0.tar.gz"
sha256 "4040b3dba2771904f5ce2e4f6fbe2052d452d0aca717bb571de92f4e9e91004c"
head "https://github.com/facebook/flow.git"
bottle do
cellar :any_skip_r... | 36.111111 | 95 | 0.747692 |
6a09fae754a2e158e622c75c2bcd5b53b45c3185 | 692 | require "spec_helper"
require "minitest/autorun"
def snap path
sh "bundle exec exe/consolidate gem-consolidate > #{path}"
sh "cat exe/consolidate >> #{path}"
end
describe Gem::Consolidate do
it "has a version" do
_(Gem::Consolidate::VERSION).must_match /\d.\d.\d/
end
it "matches the snapshot" do
sn... | 25.62963 | 86 | 0.65896 |
18ba89ce568b022c9be6a96716f7dc2badfa13f4 | 979 | require 'spec_helper'
require 'capybara/rspec'
describe 'Events' do
let(:user){ User.create!(email: 'something_else@email.com', password: '123456789')}
before { login }
it 'allows prepopulation of form with name' do
visit new_event_path(name: 'Blah')
expect(page).to have_selector("input#event_name[valu... | 30.59375 | 85 | 0.709908 |
91401d69f8254c00efdc106a885d194fba9e6b66 | 788 | # frozen_string_literal: true
# Copyright 2021 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... | 27.172414 | 74 | 0.733503 |
1a567b9211818f65b2d1cce5ae78dbac831be622 | 7,916 | # -*- coding: utf-8 -*-
module Plugin::Twitter
class World < Diva::Model
extend Gem::Deprecate
register :twitter, name: "Twitterアカウント"
field.string :id, required: true
field.string :slug, required: true
alias_method :name, :slug
field.string :token, required: true
field.string :secret, ... | 31.165354 | 151 | 0.623042 |
285ffee0b9a6e933c02f48737b97fabc8e641b92 | 170 | # Read about factories at http://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :account_contact do
account_id 1
contact_id 1
end
end | 21.25 | 67 | 0.741176 |
33f9d1c0cb38efb058dc7155d00686be3fb32094 | 255 | module Gramz
module LFG
class AtomicValue
attr_reader :atom
def initialize(atom)
@atom = atom
end
def ==(other)
@atom == other.atom
end
def inspect
@atom.to_s
end
end
end
end
| 13.421053 | 27 | 0.521569 |
1df93df701846456d4fcd9296d9b33926da11422 | 746 | #
# Cookbook Name:: dmg
# Attributes:: default
#
# Copyright 2011-2016, 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
... | 35.52381 | 74 | 0.742627 |
ed3bbac44506d02b0684544e6e28855a0451e039 | 81 | $: << File.expand_path(File.dirname(__FILE__))
require 'bundler'
Bundler.setup
| 13.5 | 46 | 0.740741 |
7a86e38b5e0a218afb8239a9bdc5c344b1257528 | 4,029 | class GdkPixbuf < Formula
desc "Toolkit for image loading and pixel buffer manipulation"
homepage "https://gtk.org"
url "https://download.gnome.org/sources/gdk-pixbuf/2.38/gdk-pixbuf-2.38.0.tar.xz"
sha256 "dd50973c7757bcde15de6bcd3a6d462a445efd552604ae6435a0532fbbadae47"
bottle do
sha256 "f49a95e28e72c80... | 31.97619 | 106 | 0.676843 |
bbf50a0ceccb7fb9c27f2c7db37e93b9718e81b1 | 1,573 | # Encoding: utf-8
# Cloud Foundry Java Buildpack
# Copyright 2013 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICEN... | 29.12963 | 91 | 0.73808 |
1ca7a6a09d289cd15e194f2d66ba2dd73d35c7dc | 929 | require 'spec_helper'
require 'puppet/module_tool'
describe Puppet::ModuleTool::Tar::Solaris do
let(:sourcefile) { '/the/module.tar.gz' }
let(:destdir) { '/the/dest/dir' }
let(:sourcedir) { '/the/src/dir' }
let(:destfile) { '/the/dest/file.tar.gz' }
it "unpacks a tar file" do
Puppet::Util::Executi... | 40.391304 | 106 | 0.660926 |
01da423a4d97e726d681ed29c53f51c51bd259f8 | 400 | module Fog
module Identity
class OpenStack
class V3
class Real
def token_authenticate(auth)
request(
:expects => [201],
:method => 'POST',
:path => "auth/tokens",
:body => Fog::JSON.encode(auth)
)
... | 19.047619 | 47 | 0.425 |
1114c8f1d485a060d8d57421c7b20980bf4b69d2 | 747 | cask "pgadmin4" do
version "4.27"
sha256 "be9f8f12ad0fc0e369a9d348999a10da1e4383126e7e9d723dd0e2ddab2c5d99"
# ftp.postgresql.org/ was verified as official when first introduced to the cask
url "https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v#{version}/macos/pgadmin4-#{version}.dmg"
appcast "https://ftp.pos... | 37.35 | 141 | 0.753681 |
615494cbaa8ff466d7c1d591e16d083a01427cc8 | 14,499 | =begin
vim: sw=2:
Tone Software Corporation BSD License ("License")
Ruby Application Framework
Please read this License carefully before downloading this software. By
downloading or using this software, you are agreeing to be bound by the
terms of this License. If you d... | 28.767857 | 160 | 0.583695 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.