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 |
|---|---|---|---|---|---|
bf84f0278fefc9da8f2540f39fc6c3a9edabb754 | 135 | # frozen_string_literal: true
class Api::V1::AuthorSerializer
include FastJsonapi::ObjectSerializer
attributes :name, :email
end
| 16.875 | 39 | 0.792593 |
bb87b758773f48cd11b4b9331ba7d879563f755b | 848 | class SessionsController < ApplicationController
skip_before_action :authenticate!
skip_before_action :verify_authenticity_token, only: :create
def new; end
def create
if auth_hash.blank?
fail_and_redirect
return
end
@user = User.find_or_create_from_auth_hash!(auth_hash)
if @user.... | 21.2 | 79 | 0.711085 |
2171130d6da454f61a4b879257effbf4725bdc88 | 5,981 | require 'rails_helper'
describe HolidayScheduleImporter do
let(:invalid_content) { Rails.root.join('spec/support/fixtures/invalid_holiday_schedule.csv').read }
let(:invalid_date) { Rails.root.join('spec/support/fixtures/hs_with_invalid_date.csv').read }
let(:valid_content) { Rails.root.join('spec/support/fixture... | 30.989637 | 123 | 0.665106 |
184652d12676f92bc8770efd948d1b0abc5467c2 | 217 | # Add your variables here
first_number = 3
second_number = 1
sum = first_number + second_number
difference = first_number - second_number
product = first_number * second_number
quotient = first_number / second_number
| 27.125 | 41 | 0.806452 |
7abfe0334952835241554eb1d4021f81c6555059 | 1,235 | =begin
Trulioo Ruby SDK
Gem version: 1.0.3
Trulioo OpenAPI version: v1
Generated by OpenAPI Generator version: 5.0.1
=end
module Trulioo
class ApiError < StandardError
attr_reader :code, :response_headers, :response_body
# Usage examples:
# ApiError.new
# ApiError.new("message")
# ApiErro... | 22.87037 | 81 | 0.589474 |
8733c8beb53443fcc17d372c476b3d9bd0ee1c99 | 194 | class AddAssignmentIdToContentTags < ActiveRecord::Migration[5.0]
def change
add_column :content_tags, :assignment_id, :integer
add_column :content_tags, :position, :integer
end
end
| 27.714286 | 65 | 0.773196 |
1895770fd7e9caeaaa7dc745917c24451f91ac29 | 832 | # encoding: utf-8
require 'spec_helper'
describe Function::Proposition, '#==' do
subject { object == other }
let(:object) { described_class.instance }
let(:described_class) { Class.new(Function::Proposition) }
context 'with the same object' do
let(:other) { object }
it { should be(... | 20.292683 | 61 | 0.627404 |
f8bf9050af0a1805e96a5047dd68832428b5ad38 | 172 | class AddImageableToImage < ActiveRecord::Migration
def change
add_column :images, :imageable_id, :integer
add_column :images, :imageable_type, :string
end
end
| 24.571429 | 51 | 0.761628 |
7a318eb53a710230c10a2929d378d104c9b7c23f | 718 | class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def facebook
# You need to implement the method below in your model (e.g. app/models/user.rb)
@user = User.from_omniauth(request.env["omniauth.auth"])
if @user.persisted?
sign_in_and_redirect ... | 39.888889 | 104 | 0.655989 |
e94a6a68e4d676f97ee4de325a98c87f561cc516 | 1,773 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'rex'
class MetasploitModule < Msf::Post
include Msf::Post::Windows::Priv
include Msf::Post::Windows::ShadowCopy
def initialize(info={})
supe... | 24.287671 | 86 | 0.569656 |
bf034ea4a09289929bd71699d96829fe908d854b | 3,642 | require 'rack/livereload'
require 'middleman-livereload/reactor'
module Middleman
class LiveReloadExtension < Extension
option :port, '35729', 'Port to bind the LiveReload API server to listen to'
option :apply_js_live, true, 'Apply JS changes live, without reloading'
option :apply_css_live, true, 'Apply... | 38.744681 | 145 | 0.665294 |
181ec1e69e94f77d1d70f1e893a8425a5d40e8b8 | 48 | Logger.class_eval do
def info(*args)
end
end | 12 | 20 | 0.729167 |
79085cdd00dc547691dd05434c94de5f1c6df43c | 1,421 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'linked_list/version'
Gem::Specification.new do |spec|
spec.name = "linked_list"
spec.version = LinkedList::VERSION
spec.authors = ["ob00042"]
spec.email = ["o... | 41.794118 | 104 | 0.672766 |
289df394f57eb9ffaa289215935b670dbd99e6c7 | 90 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'triple_store_drivers'
| 30 | 58 | 0.766667 |
2124fde43358ec00e6be91615a19b29a1aa06620 | 10,378 | # Paperclip allows file attachments that are stored in the filesystem. All graphical
# transformations are done using the Graphics/ImageMagick command line utilities and
# are stored in Tempfiles until the record is saved. Paperclip does not require a
# separate model for storing the attachment's information, instead a... | 42.016194 | 98 | 0.682694 |
bfc75413b8ac02ba1a2ac1851ba5be018b184670 | 6,533 | require 'spec_helper'
describe Bosh::AwsCloud::Cloud do
subject(:cloud) { described_class.new(options) }
let(:options) do
{
'aws' => {
'access_key_id' => 'keys to my heart',
'secret_access_key' => 'open sesame',
'region' => 'fake-region',
'default_key_name' => 'sesame',
... | 32.502488 | 132 | 0.58901 |
26ee321b9b66267bf865a572b580a1cb1964019b | 1,448 | # frozen_string_literal: true
require_relative '../helper/type'
require_relative '../ownable'
module Engine
module Ability
class Base
include Helper::Type
include Ownable
attr_accessor :count_this_or, :description, :desc_detail
attr_reader :type, :owner_type, :remove, :when, :count, :co... | 24.133333 | 105 | 0.582873 |
f77d95c8fc0b126b56b36de7e65b05076cafcd4b | 2,489 | # frozen_string_literal: true
# THIS FILE WAS AUTO-GENERATED -- DO NOT EDIT!
require 'ffi'
require 'crabstone/arch/extension'
require_relative 'm68k_const'
module Crabstone
module M68K
class OperandRegPair < FFI::Struct
layout(
:reg_0, :uint,
:reg_1, :uint
)
end
class Oper... | 19.146154 | 47 | 0.505022 |
33d6bfa819c176b98af6e4ad59db01b078cfc3a7 | 3,273 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 31.776699 | 135 | 0.680416 |
d5157b580fb8512fd414ae2c86278f2a2e62a512 | 1,180 | module ManageIQ
module Automate
module Transformation
module Infrastructure
module VM
module Common
class PowerOff
def initialize(handle = $evm)
@handle = handle
@task = ManageIQ::Automate::Transformation::Common::Utils.task(@handle... | 32.777778 | 97 | 0.544915 |
21f5a751e57e6d6005a3ce83e4f7b2172a5adaa9 | 2,176 | class Dzl::DSLProxies::Router < Dzl::DSLProxy
REQUEST_METHODS = [:get, :post, :put, :delete, :options]
def pblock(name, opts = {})
raise ArgumentError unless name.is_a?(Symbol) &&
opts.is_a?(Hash) &&
block_given?
pb = Dzl::DSLSubjects::P... | 26.864198 | 88 | 0.664063 |
ed2c048dc680b8daa8ac97e6d1a86ce60a76fac7 | 110 | describe package('epel-release') do
it { should be_installed }
end if os.redhat? && os.release.to_i.eql?(7)
| 27.5 | 44 | 0.709091 |
87d3e7d3e99249c4226363a3d335ed719893aafe | 46 | require 'sfrp/version'
require 'sfrp/command'
| 15.333333 | 22 | 0.782609 |
1d238b70098438e9cd85607c862a99a9283d1210 | 1,335 | class Fsh < Formula
desc "Provides remote command execution"
homepage "https://www.lysator.liu.se/fsh/"
url "https://www.lysator.liu.se/fsh/fsh-1.2.tar.gz"
sha256 "9600882648966272c264cf3f1c41c11c91e704f473af43d8d4e0ac5850298826"
bottle do
cellar :any_skip_relocation
sha256 "d99d2e8e357b91134de9b7a47... | 40.454545 | 93 | 0.729588 |
26c805c047cd12e3c926d119f1d80916f0cf5579 | 611 | require 'test_helper'
class UsersProfileTest < ActionDispatch::IntegrationTest
include ApplicationHelper
def setup
@user = users(:michael)
end
test "profile display" do
get user_path(@user)
assert_template 'users/show'
assert_select 'title', full_title(@user.name)
assert_select 'h... | 26.565217 | 59 | 0.716858 |
61d8ca5e361f92e09a557bbeed279ff90bd5da76 | 29,517 | require 'spreadsheet'
class SpidersController < ApplicationController
layout :resolve_layout
def resolve_layout
case action_name
when "project_spider_import", "do_spider_upload"
"tools_spider"
else
"spider"
end
end
# -----------------------------------------------------... | 37.035132 | 183 | 0.610868 |
4a04ca9b946996cc48681fc08017dc1eeb0449ca | 7,822 | require 'spec_helper'
describe "history_cms_logs", type: :feature, dbscope: :example, js: true do
let!(:site) { cms_site }
let!(:node) do
create_once :article_node_page, filename: "docs", name: "article",
group_ids: [cms_group.id], st_form_ids: [form.id]
end
let!(:item) { create :article_pa... | 43.94382 | 116 | 0.648683 |
03c1e8e0333dcbb4d7a8d01103cde43905f2a2f1 | 3,125 | # frozen_string_literal: true
module Faker
class Bank < Base
flexible :bank
class << self
def account_number(digits = 11)
rand.to_s[2..digits]
end
def iban(country_code = 'GB')
# Each country has it's own format for bank accounts
# Many of them use letters in certa... | 32.216495 | 161 | 0.62496 |
1a7d2a9a5d1998f4d3c61bbab568d2fcd978a233 | 1,725 | class Libpcap < Formula
desc "Portable library for network traffic capture"
homepage "https://www.tcpdump.org/"
url "https://www.tcpdump.org/release/libpcap-1.10.1.tar.gz"
sha256 "ed285f4accaf05344f90975757b3dbfe772ba41d1c401c2648b7fa45b711bdd4"
license "BSD-3-Clause"
head "https://github.com/the-tcpdump-gr... | 43.125 | 123 | 0.689275 |
acfc922740ca4561df56857d91c6d9a1d4b34e39 | 163 | FactoryBot.define do
factory :submission do
url 'MyText'
html 'MyText'
base_url 'MyText'
save_html false
render_html_in_page false
end
end
| 16.3 | 29 | 0.699387 |
918ab6a460ffd679c90ba858483564a7c9f96822 | 756 | module Promethee::StructureUpgrader::Components
class Base
def initialize(data)
@data = data
# puts "<#{self.class}> Initialized."
upgrade
end
def upgraded_data
@upgraded_data
end
def upgrade
@upgraded_data = @data.deep_dup
@upgraded_data['attributes'] ||= {}... | 20.432432 | 76 | 0.653439 |
08d677b960714cd5066a97f2ff9f2b31fb181344 | 1,541 | require 'bosh/director/api/deployment_lookup'
module Bosh::Director
module Api
class InstanceLookup
def by_id(instance_id)
instance = Models::Instance[instance_id]
if instance.nil?
raise InstanceNotFound, "Instance #{instance_id} doesn't exist"
end
instance
e... | 29.075472 | 97 | 0.626866 |
187d878472eb6992d0dcd73e2ed11b4db57690dc | 1,551 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'The group page' do
include ExternalAuthorizationServiceHelpers
let(:user) { create(:user) }
let(:group) { create(:group) }
before do
sign_in user
group.add_owner(user)
end
def expect_all_sidebar_links
within('.nav-sidebar')... | 26.288136 | 90 | 0.690522 |
d5d3490bbcc7e1e495deaccd4d494382619a4c78 | 1,352 | # frozen_string_literal: true
class Fisk
module Instructions
# Instruction SETNS: Set byte if not sign (SF == 0)
SETNS = Instruction.new("SETNS", [
# setns: r8
Form.new([
OPERAND_TYPES[47],
].freeze, [
Class.new(Fisk::Encoding) {
def encode buffer, operands
... | 25.037037 | 55 | 0.454142 |
1aa7ac84eeae681eefd6efe13d295aaee2533c86 | 30,785 | #
# Author:: Adam Jacob (<adam@opscode.com>)
# Author:: Christopher Brown (<cb@opscode.com>)
# Author:: Daniel DeLeo (<dan@opscode.com>)
# Copyright:: Copyright (c) 2008 Opscode, Inc.
# Copyright:: Copyright (c) 2010 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.... | 41.101469 | 226 | 0.664447 |
6196fd5d867d7e3544fe4757d474971ed9b1c3bb | 93,647 | require_relative '../../lib/data/state_pension_date_query'
require_relative '../test_helper'
class StatePensionDateQueryTest < ActiveSupport::TestCase
context 'when female, born between 1 January 1890 and 5 April 1950' do
should 'return state pension date 60 years from date of birth' do
assert_equal StateP... | 53.208523 | 155 | 0.756212 |
18a0f01d14e599093f026eab5290bfbddf5ee988 | 1,199 | # frozen_string_literal: true
class SetAbsence < BaseService
attr_reader :user, :text
def initialize(user, text)
@user = user
@text = text
super()
end
def call
match_data = text.match Message::Conditions::SET_ABSENCE_REGEXP
reason = match_data[1].downcase
start_date = end_date = p... | 33.305556 | 107 | 0.653878 |
1852c5236e72f6c45107c98e1a01154fe4ca9557 | 71 | { :'it_IT' => { :i18n => { :plural => { :keys => nil, :rule => } } } } | 71 | 71 | 0.366197 |
91599b6459077dfc6a3be2eea8bb95390c53f3bc | 388 | class Pry
class Command
class Reset < Pry::ClassCommand
match 'reset'
group 'Context'
description 'Reset the REPL to a clean state.'
banner <<-'BANNER'
Reset the REPL to a clean state.
BANNER
def process
output.puts 'Pry reset.'
exec 'pry'
end
... | 18.47619 | 52 | 0.592784 |
8776acac6a56e56966845d059c330da2a95f25d5 | 148 | Readit::Engine.routes.draw do
post '/announcements/:id/store_reviewed', to: 'announcements#store_reviewed', as: 'store_reviewed_announcement'
end
| 37 | 113 | 0.797297 |
032b9c09e8f89c286b2242f83eb8ef4d3ce7671c | 320 | class DocAuthLog < ApplicationRecord
belongs_to :user
# rubocop:disable Rails/InverseOf
belongs_to :service_provider,
foreign_key: 'issuer',
primary_key: 'issuer'
# rubocop:enable Rails/InverseOf
def self.verified_users_count
Profile.where.not(verified_at: nil).count
end
end
| 22.857143 | 45 | 0.7125 |
912f8f7a9a555f9374076c36fde13c16a1f1c56b | 11,721 | # Copyright 2019, Google LLC
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the fo... | 33.778098 | 107 | 0.676307 |
ab844a961b29f78a75b31d2c2522ff1310e2b329 | 820 | Pod::Spec.new do |s|
s.name = "FXAppContextSwift"
s.version = "1.0.1"
s.summary = "FX启动配置框架"
s.homepage = "https://github.com/zqw87699/FXAppContextSwift"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = {"zhangdazong" => "929013100@qq.com"}
s.source ... | 24.117647 | 105 | 0.610976 |
21505a8ddde55912e2c9841572e7e353d39b7de4 | 607 | Pod::Spec.new do |s|
s.name = "AURefreshControl"
s.version = "0.0.1"
s.summary = "Base class for scroll view refresh control."
s.homepage = "http://www.appunite.com"
s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
s.license = 'MIT'
s.author ... | 35.705882 | 105 | 0.617792 |
62a1b2f29ff8daec8b8983dc47fdce8ce8f37c4e | 314 | # frozen_string_literal: true
require 'bundler/setup'
require 'kramdown_rpf'
require 'byebug'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.rspec_status'
config.expect_with :rspec do |c|
c.syntax = :expect
end
end
| 20.933333 | 63 | 0.754777 |
878c1385d3521d47e23bc5db5da61e59c155982d | 621 | input = File.read('input').strip
#input = File.read('example1').strip
#input = File.read('example2').strip
lines = input.split("\n")
valid1 = 0
valid2 = 0
lines.each do |line|
words = line.split(/\s+/)
if words.uniq.length == words.length
valid1 += 1
anagrams = []
words.each do |word|
chars = wor... | 20.032258 | 52 | 0.62963 |
e847d1046c3cfcf9a647155959722e75f756bcc5 | 59 | # encoding: utf-8
{ :en => { :fuh => { :bah => "bas" } } } | 19.666667 | 40 | 0.389831 |
ab14e115a348610714e084385fd90462ae1a8cae | 294 | require 'sinatra'
require './picturesUrl.rb'
get '/' do
@route = request.path_info
puts("request: "+@route)
erb:index
end
get '/*' do
puts "get"
@route = request.path_info
erb :antioquia
end
post '/test' do
puts "hola"
request.body.rewind
puts "body: "+request.body.read
end
| 10.888889 | 33 | 0.666667 |
ab23ef87c116f8a422610115863aa5ae757246c4 | 416 | method def merge_temporary
person = {height: '6ft', weight: '160 lbs', hair: 'brown'}
other_characteristics = {personality: 'ISFJ'}
person.merge(other_characteristics)
p person
end
method def merge_permanent
person = {height: '6ft', weight: '160 lbs', hair: 'brown'}
other_characteristics = {personality: 'I... | 26 | 60 | 0.735577 |
87813a4fc10eb32967876d1b2a76d0a911c2ef16 | 1,162 | class Odt2txt < Formula
desc "Convert OpenDocument files to plain text"
homepage "https://github.com/dstosberg/odt2txt/"
url "https://github.com/dstosberg/odt2txt/archive/v0.5.tar.gz"
sha256 "23a889109ca9087a719c638758f14cc3b867a5dcf30a6c90bf6a0985073556dd"
bottle do
cellar :any_skip_relocation
rebui... | 35.212121 | 93 | 0.781411 |
910526832597fe4cd3333e4df0b78bdbdefaf61b | 1,137 | require 'test_helper'
module BlockStorage
class VolumesControllerTest < ActionController::TestCase
setup do
@volume = block_storage_volumes(:one)
@routes = Engine.routes
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:volumes)
... | 21.45283 | 58 | 0.643799 |
e99cb8b741dfdbcc9444f518d33d1da3386ed277 | 760 | #
# Grupo 13 - Resúmenes Diarios
#
# Sample declaration for homologation of Daily Receipt Summary.
#
# Set environment variables, then run:
#
# ruby daily_receipt_summary.rb
#
lib = File.expand_path('../../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'sunat'
require './config'
d... | 19.487179 | 63 | 0.703947 |
f808121c9b0687e0d60bf993ebd5a648946e39ef | 388 | RSpec.describe YandexTranslate do
# use this code for manual testing during developing and debugging
xit 'does right thing' do
client = YandexTranslate::Client.new(key: '')
binding.pry
langs = client.get_langs ui: 'ru'
lang = langs['langs'].keys[0]
binding.pry
client.detect text: 'россия', h... | 29.846154 | 68 | 0.68299 |
ffaef0601b220725b6af12a035332d514a99dfcf | 618 | module LocalhostMailManager
def localhost_email(from_mailbox: nil, to:, text_body:, subject: nil, name: nil)
# Need to parametrize the domain
_from = from_mailbox.present? ? "#{name || 'CPTii user'}<#{from_mailbox}@#{Rails.application.config.action_mailer.default_url_options[:host]}>" : "#{Rails.applicat... | 47.538462 | 351 | 0.7411 |
bb18ff6c5d6d1b55564bc4e6e3d4dff57b1edde1 | 290 | name 'base_packages'
maintainer 'YOUR_COMPANY_NAME'
maintainer_email 'YOUR_EMAIL'
license 'All rights reserved'
description 'Installs/Configures base_packages'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
| 36.25 | 72 | 0.7 |
3888c316905cfefa7a01bf1c029a9a8f4c773bdd | 4,146 | require File.dirname(__FILE__) + '/spec_helper.rb'
describe "binary executable with no command line arguments" do
it "should provide the current execution dir as basedir" do
runner = mock("runner", :null_object => true)
current_dir = Dir.pwd
JettyRails::Runner.should_receive(:new) do |config|
co... | 31.648855 | 77 | 0.654124 |
d5039803e1189adc773a926b601e059de71ba437 | 176 | class User < ApplicationRecord
has_secure_password
validates :name, presence: true
validates :email, presence: true, uniqueness: true
has_many :tasks
#1対多の関係
end
| 17.6 | 52 | 0.75 |
1a694990271dfeaa8b1676d1d04916a73e5c9e52 | 2,274 | # frozen_string_literal: true
#
# Cookbook Name:: verdaccio
# Recipe:: verdaccio
#
require 'digest'
npm_package 'verdaccio' do
version node['verdaccio']['version']
end
directory node['verdaccio']['confdir'] do
recursive true
end
[
node['verdaccio']['logdir'],
node['verdaccio']['datadir']
].each do |create_... | 23.6875 | 93 | 0.673703 |
edbad7fc58f62238b22dbf53746baa887ed74965 | 4,660 | # frozen_string_literal: true
require "rails_helper"
require "importer"
require "active_fedora/cleaner"
describe Importer::Factory::AudioRecordingFactory do
let(:data) { [File.join(fixture_path, "cylinders")] }
let(:metadata) { "#{fixture_path}/cylinders/cylinders-objects.xml" }
let(:attributes) do
{
... | 29.125 | 79 | 0.635837 |
ace7d57e4355c08bf111aaf0224c2ab74ae349f3 | 9,052 | class PAX
class Printer
RET_OK = 0
ERR_PRN_BUSY = -3701 # Printer busy
ERR_PRN_PAPEROUT = -3702 # Out of paper
ERR_PRN_WRONG_PACKAGE = -3703 # The format of print data packet error
ERR_PRN_OVERHEAT = -3704 # Printer over heating
ERR_PRN_OUTOFMEMORY = -3705 #... | 30.581081 | 112 | 0.622072 |
8725ad7eb4eedd4c4d703034b14e60013c65b45b | 219 | class UserDecorator < Draper::Decorator
delegate_all
include DecorateSerializer
attr :id, :uid, :name, :avatar_url, :is_admin, :url
def id
object._id.to_s
end
def url
h.user_path(object)
end
end
| 15.642857 | 53 | 0.69863 |
6abc2ad80a4c715b6a8b6f237271327a288018d3 | 695 | require 'json'
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
Pod::Spec.new do |s|
s.name = 'EXReactNativeAdapter'
s.version = package['version']
s.summary = package['description']
s.description = package['description']
s.license = package['licens... | 27.8 | 73 | 0.6 |
e88c721ec4e445919b0f1195f5d1a520dc02e719 | 1,554 | module CmdStan
class MCMC
include Utils
attr_reader :column_names, :draws
# private
# TODO use runset for args
def initialize(output_files)
@output_files = output_files
validate_csv_files
end
def sample
sample = []
@output_files.each_with_index do |output_file, c... | 25.064516 | 117 | 0.582368 |
088b58b62f5216563a7ce018261475a82f1224f1 | 517 | class Goto < Formula
desc "Bash tool for navigation to aliased directories with auto-completion"
homepage "https://github.com/iridakos/goto"
url "https://github.com/iridakos/goto/archive/v2.0.0.tar.gz"
sha256 "460fe3994455501b50b2f771f999ace77ade295122e90e959084047dbfb1f0dc"
bottle :unneeded
def install
... | 28.722222 | 82 | 0.756286 |
1814258e377692430ca64b5d9a129ae92b3a7fc6 | 407 | # frozen_string_literal: true
RSpec.describe Pragma::Filter::Ilike do
subject { described_class.new(param: :by_title, column: :title) }
let(:relation) do
Class.new do
def where(*); end
end.new
end
it 'can be applied properly' do
expect(relation).to receive(:where)
.with('title ILIKE ?... | 20.35 | 67 | 0.648649 |
62a094efd6c938bc646368121237a8cf3d57b9c6 | 2,748 | # Run Coverage report
require 'simplecov'
SimpleCov.start do
add_filter 'spec/dummy'
add_group 'Controllers', 'app/controllers'
add_group 'Helpers', 'app/helpers'
add_group 'Mailers', 'app/mailers'
add_group 'Models', 'app/models'
add_group 'Views', 'app/views'
add_group 'Libraries', 'lib'
end
# Configur... | 32.329412 | 124 | 0.760917 |
9132e3b64d5197f20e013c75e67244f144ec24c6 | 872 | require 'auto_html/task'
# Rake task for rebuilding cached in DB auto_html columns values
# Usage: rake auto_html:rebuild CLASS=[your model]
# Where [your model] is the name of model which contains auto_html_for columns
namespace :auto_html do
desc "Rebuild auto_html columns"
task :rebuild => :environment do
... | 32.296296 | 105 | 0.691514 |
8780dce3bc5c21a40badd3ceaa288ab2b8a7418b | 613 | Pod::Spec.new do |spec|
spec.name = 'BaasBoxSDK'
spec.version = '0.9.0'
spec.summary = 'iOS SDK for the open source back end BaasBox. See http://www.baasbox.com'
spec.homepage = 'https://github.com/baasbox/iOS-SDK'
spec.author = { 'Cesare Rocchi' => 'c.rocchi@baasbox.com' }
spec.... | 47.153846 | 96 | 0.60522 |
38d6b82ecd9187c18930e7b9718dadee3bbb3c29 | 1,156 | namespace :multisite do
def run_task ( name )
RailsMultisite::ConnectionManagement.manager.each_connection do | db |
puts "Executing rake #{ name } #{ db }"
puts "---------------------------------\n"
RailsMultisite::Tasks.execute_task name
end
end
desc 'migrate all sites in tier'
... | 19.266667 | 74 | 0.676471 |
08adb0aa51e597a0ee2dbf870233212b6fd46b78 | 138 | # frozen_string_literal: true
require_relative '../base'
module R2OAS
module Routing
class BaseComponent < Base
end
end
end
| 12.545455 | 30 | 0.724638 |
6224bb41f6fc94d62e41ae36751470f065a68a97 | 66 | require 'rspec'
require "#{File.dirname(__FILE__)}/../lib/jwt.rb"
| 22 | 49 | 0.69697 |
e9f0b44f33ea34500d22ce1ed375f8b18029e1d0 | 456 | # encoding: utf-8
require "spec_helper"
describe Toby::Request::Taobao::ItemcatsGet do
include_context "initialize client"
it 'should returns a taobao item cats list, when it is executed.' do
request = Toby::Request.create("taobao.itemcats.get")
request.parent_cid = 0
@client.stub(:request).and_retu... | 25.333333 | 74 | 0.717105 |
6168ca2bf4e450222a21307b97ce7b1ffe1088ec | 1,157 | class Nnn < Formula
desc "Tiny, lightning fast, feature-packed file manager"
homepage "https://github.com/jarun/nnn"
url "https://github.com/jarun/nnn/archive/v3.4.tar.gz"
sha256 "7803ae6e974aeb4008507d9d1afbcca8d084a435f36ff636b459ca50414930a1"
license "BSD-2-Clause"
head "https://github.com/jarun/nnn.git"... | 30.447368 | 93 | 0.746759 |
e22e61e3ec777c69c2b897213fe3d5d83be76042 | 3,719 | cask "karabiner-elements" do
if MacOS.version <= :el_capitan
version "11.6.0"
sha256 "c1b06252ecc42cdd8051eb3d606050ee47b04532629293245ffdfa01bbc2430d"
url "https://pqrs.org/osx/karabiner/files/Karabiner-Elements-#{version}.dmg"
pkg "Karabiner-Elements.sparkle_guided.pkg"
elsif MacOS.version <= :m... | 39.56383 | 129 | 0.639419 |
8756b44e02e35769972ccbb5a9f3b211acea7f5a | 48 | class IdenticalCourseError < StandardError; end
| 24 | 47 | 0.854167 |
4a820e5a3f37fb0609860c7af037fb2375f7dc40 | 3,101 | # frozen_string_literal: true
require_relative "../path"
$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,mustermann,rack,tilt,sinatra,ruby2_keywords}-*/lib")].map(&:to_s))
require "artifice"
require "sinatra/base"
ALL_REQUESTS = [] # rubocop:disable Style/MutableConstant
ALL_REQUESTS_MUTEX ... | 26.732759 | 139 | 0.633989 |
619eea1c07bf6703e374a3c0af92721ac3ec9b17 | 3,506 | class Gitup < Formula
desc "Update multiple git repositories at once"
homepage "https://github.com/earwig/git-repo-updater"
url "https://github.com/earwig/git-repo-updater.git",
:revision => "bf66406c10d3e7654ca3f56f4ec6b57bcc068fea",
:tag => "v0.4.1"
bottle do
cellar :any_skip_relocation
sha25... | 36.14433 | 93 | 0.726184 |
ffbe10ceb33f1b107d09036d56dea14a3f8c3199 | 1,544 | # 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.registro.br/property_nameservers_with_ip.expected
#
# and regenerate the tests with the following rake task
#
# $ rake spec:generate
#
require 'spec_helpe... | 35.906977 | 91 | 0.704016 |
e9cb10efe2fd9d6762888c1e5526471cfe8173be | 251 | # frozen_string_literal: true
module Canary
module Types
module Enums
class OrganizationOrderField < Canary::Types::Enums::Base
value "CREATED_AT", "作成日時"
value "FAVORITE_USERS_COUNT", "お気に入り数"
end
end
end
end
| 19.307692 | 63 | 0.669323 |
1add8677a065e3c7855e00cdcd08d3dc79dcc87c | 1,610 | require_relative '../lib/scraper'
require_relative '../lib/user'
describe User do
describe '#validate' do
it 'it returns false if user inputs a blank name' do
user = User.new
expect(user.validate('')).to eql(false)
end
it 'checks and returns true if name given is not blank' do
user = U... | 25.555556 | 85 | 0.637888 |
9107b78c88da0189ccd2a3e69d1b0bdbefcce98e | 5,070 | require 'grape/middleware/base'
module Grape
module Middleware
module Versioner
# This middleware sets various version related rack environment variables
# based on the HTTP Accept header with the pattern:
# application/vnd.:vendor-:version+:format
#
# Example: For request header
... | 38.120301 | 132 | 0.58501 |
03313d10057b00771f634a8c8636011f0380513c | 2,066 | # frozen_string_literal: true
require 'faraday'
require 'web_test/util'
require 'rspec/webservice_matchers/redirect_helpers'
module RSpec
module WebserviceMatchers
module EnforceHttpsEverywhere
# This is a high level matcher which checks three things:
# 1. Permanent redirect
# 2. to an https u... | 33.868852 | 106 | 0.638432 |
2833845605e30bdb2487d9ace349c8a2f53d61bc | 24,072 | ##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##
require 'msf/core'
require 'zlib'
class Metasploit3 ... | 36.920245 | 261 | 0.632228 |
f7cc7f67c87c10c8c78d850e3f66c20b80aaedb4 | 7,492 | # coding: utf-8
require 'highline'
require 'libis/tools/logger'
require 'libis/services/soap_client'
module Libis
module Services
module Sharepoint
class Search
include ::Libis::Services::SoapClient
include ::Libis::Tools::Logger
include ::Libis::Services::GenericSearch
... | 31.745763 | 147 | 0.465563 |
1d22a05c687b1e747221688c44022332c354d2e5 | 299 | class ForcePasswordResetDuringSetup < ActiveRecord::Migration[4.2]
def up
User.where(login: "admin", last_login_on: nil).update_all(must_change_passwd: true)
end
def down
User.where(login: "admin", last_login_on: nil, must_change_passwd: true).update_all(must_change_passwd: false)
end
end
| 29.9 | 112 | 0.785953 |
5d0c0cfdc9d04d16b674b41e386827fa8892fe35 | 412 | # frozen_string_literal: true
module Super
module Flux
module Producer
module DSL
def self.included(base)
base.class_eval do
%i[max_buffer_size topic].each do |method|
define_singleton_method(method) do |value|
configuration.send("#{method}=", val... | 20.6 | 56 | 0.546117 |
bf5e64648be6915a7193743c210b862914456105 | 1,117 | Monologue.config do |c|
c.site_name = "@jipiboily / Jean-Philippe Boily"
c.site_subtitle = "my own place online"
c.site_url = "http://jipiboily.com"
c.meta_description = "This is my personal blog about Rails, Monologue, programming, etc..."
c.meta_keyword = "rails, programming, monologue, ruby"
c.admin_fo... | 29.394737 | 93 | 0.70009 |
7a716dd899a1c980ceda01d2c979359513da02dc | 217 | # frozen_string_literal: true
FactoryBot.define do
factory :location, class: PriceHubble::Location do
address { build(:address) }
trait :full do
coordinates { build(:coordinates) }
end
end
end
| 18.083333 | 52 | 0.691244 |
e866d9c30677b8ae9680960f1c3b7c6522479ddb | 429 | module SwellSocial
class ObjectSubscription < ApplicationRecord
self.table_name = 'object_subscriptions'
enum status: { 'active' => 1, 'deleted' => 2 }
enum availability: { 'just_me' => 1, 'anyone' => 2 }
belongs_to :user
belongs_to :parent_obj, polymorphic: true
def self.muted
where.not( mute: fal... | 18.652174 | 54 | 0.668998 |
335f8f97f0930da21573c512fb33d20d53f6a45a | 1,226 | require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
Bundler.require(*Rails.groups)
require "cs_rai... | 37.151515 | 99 | 0.747145 |
f7ce31b4f61b139aa7807999b537cd4eb2588155 | 2,882 | # frozen_string_literal: true
require 'active_support/core_ext/integer/time'
Rails.application.configure do
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your appl... | 36.025 | 87 | 0.771339 |
28cb8368a87653c7f8692ae7cadeda54c906230b | 759 | require 'spec_helper'
module ASIN
describe ASIN do
context "similarity" do
before do
options = {:secret => @secret, :key => @key, :associate_tag => @tag}
@helper.configure options
end
it "should find similar items", :vcr do
items = @helper.similar(ANY_ASIN)
item... | 30.36 | 117 | 0.645586 |
87b2dca725622cdeeee7d6eb6499cf43e5518969 | 286 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
require File.expand_path('../shared/concat', __FILE__)
describe "String#<<" do
it_behaves_like :string_concat, :<<
it_behaves_like :string_concat_encoding, :<<
end
| 31.777778 | 58 | 0.741259 |
1dd5ba4e8b2b755f4eb403b81daf021f58cd9996 | 12,659 | # frozen_string_literal: true
require 'ros/be/application/cli_base'
require 'ros/be/application/cli/generate'
require 'ros/be/application/cli/rails'
require 'ros/be/infra/generator'
require 'ros/be/application/generator'
module Ros
module Be
module Application
class Cli < Thor
include CliBase
... | 40.967638 | 157 | 0.597678 |
1c865b274b98714b7b4a956cbbbcc8214d08ab27 | 7,444 | # encoding: utf-8
require "logstash/devutils/rspec/spec_helper"
require "logstash/inputs/gelf"
require_relative "../support/helpers"
require "gelf"
require "flores/random"
describe LogStash::Inputs::Gelf do
context "when interrupting the plugin" do
let(:port) { Flores::Random.integer(1024..65535) }
let(:host... | 39.807487 | 133 | 0.67316 |
7a77db0b4d8712dd62a0b650855636d39c684a0e | 2,563 | require "spec_helper"
describe "Bundler.with_env helpers" do
shared_examples_for "Bundler.with_*_env" do
it "should reset and restore the environment" do
gem_path = ENV['GEM_PATH']
Bundler.with_clean_env do
expect(`echo $GEM_PATH`.strip).not_to eq(gem_path)
end
expect(ENV['GEM_... | 27.55914 | 105 | 0.645337 |
7aad7f90376b51e345e2df60e3d6ca6e9432aa52 | 4,857 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require ... | 47.15534 | 92 | 0.744698 |
d5f7da9033f36b2824fe2a91e9d95fb797362519 | 980 | cask "adoptopenjdk8" do
version "8,292:b10"
sha256 "4e200bc752337abc9dbfddf125db6a600f2ec53566f6f119a83036c8242a7672"
url "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk#{version.before_comma}u#{version.after_comma.before_colon}-#{version.after_colon}/OpenJDK#{version.before_comma}U-jdk_... | 39.2 | 312 | 0.780612 |
6278dfe7bfd092aabfb85b81f8f8ed34283eb368 | 1,452 | require 'spec_helper'
require 'apartment/elevators/generic'
describe Apartment::Elevators::Generic do
class MyElevator < described_class
def parse_tenant_name(*)
'tenant2'
end
end
subject(:elevator){ described_class.new(Proc.new{}) }
describe "#call" do
it "calls the processor if given" do... | 26.4 | 77 | 0.655647 |
03fe966983f1fcb963e75a0862eee48f59a13b62 | 30,283 | # 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::NetApp::Mgmt::V2019_10_01
#
# Microsoft NetApp Azure Resource Provider specification
#
class Accounts
include MsRestAzure
#
... | 46.446319 | 206 | 0.700459 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.