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 |
|---|---|---|---|---|---|
7aaf419d7ba1c1ec0443d2bdab09099c0cf873fc | 822 | class TextField < FormGroup
def initialize(form, attribute, options)
@input_data = options.fetch :input_data, nil
@input_class = options.fetch :input_class, nil
super
end
private
def content_body(inner_body)
labelled_text_field + inner_body
end
def input_options
@input_options ||= {}... | 20.04878 | 94 | 0.687348 |
5dbb818455a49e980d48b2a1f6672f4f9f9fb6a9 | 2,057 | require 'date'
require_relative "../lib/blogish"
describe Blogish do
before :each do
Blogish.stub!(:entries).and_return(['2013-02-03_hello-world.mkd', '2013-02-05_an-example-post.mkd', '2013-02-04_another-example-post.mkd'])
File.stub!(:read).with('views/blog/2013-02-03_hello-world.mkd').and_return("Hello W... | 30.701493 | 154 | 0.657754 |
e23360ad3702b008915a0111b2fc108c814a24b3 | 6,882 | # frozen_string_literal: true
module RailsBestPractices
module Reviews
# Review a route file to make sure all auto-generated routes have corresponding actions in controller.
#
# See the best practice details here https://rails-bestpractices.com/posts/2011/08/19/restrict-auto-generated-routes/
#
#... | 35.658031 | 121 | 0.611305 |
03f15766a35ee0a250e0d6cd9d68a439adb1d9b0 | 450 | # frozen_string_literal: true
class Category < ActiveRecord::Base
mount_uploader :category_logo, CategoryLogoUploader
enum language: { English: 0, Español: 1 , Italiano: 2, Tagalog: 3 }
has_and_belongs_to_many :recommended_feeds
def self.current_language
language = Hash.new
language = { en: "English... | 21.428571 | 74 | 0.735556 |
91468e0157a23176dedf78d88dd8b9834075ab00 | 7,283 | # frozen_string_literal: true
# EffectiveMembershipsCategory
#
# Mark your category model with effective_memberships_category to get all the includes
module EffectiveMembershipsCategory
extend ActiveSupport::Concern
module Base
def effective_memberships_category
include ::EffectiveMembershipsCategory
... | 29.971193 | 136 | 0.705753 |
4a95d283f83a68f5439f7ee4b34e27c8f6774d74 | 220 | Sequel.migration do
up do
alter_table :data_imports do
add_column :original_url, :text, default: ''
end
end
down do
alter_table :data_imports do
drop_column :original_url
end
end
end
| 15.714286 | 50 | 0.672727 |
080fdeb945005a81c7ac95d1b218230b7a5b1e24 | 290 | class School::BeforeCanOrderController < School::ChromebooksController
def edit
@chromebook_information_form = ChromebookInformationForm.new(
school: impersonated_or_current_user.school,
)
end
private
def after_updated_redirect_location
home_school_path
end
end
| 20.714286 | 70 | 0.793103 |
bbe053c39cf31ad1d838f2d52f16a35d16855a8f | 2,344 | #--
# Copyright (c) 2009 Ryan Grove <ryan@wonko.com>
# 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 ... | 39.066667 | 80 | 0.71971 |
01fea1e13efb6dd520b35a7e3e863f44f070058c | 882 | require 'rails_helper'
RSpec.describe AvatarHelper do
describe '#gravatar_url' do
it "returns an https URL to the gravatar image" do
expect(helper.gravatar_url('erik@pm.me', 128))
.to eq 'https://gravatar.com/avatar/2caa5cfcd25eb9cf3371e5dc6adc8ec9.png?s=128'
end
end
describe '#avatar_for'... | 28.451613 | 87 | 0.62585 |
61d4558c4fa053f31f32fbaaa2d02d2935afac73 | 6,734 | # frozen_string_literal: true
require 'test_helper'
class Micro::Authorization::ModelTest < Minitest::Test
require 'ostruct'
def setup
@user = OpenStruct.new(id: 1)
@role_permissions = {
'visit' => {'any' => true},
'export' => {'except' => ['sales', 'foo']}
}
end
def test_permissions... | 27.263158 | 108 | 0.66038 |
1c919f0b57763e728d3c315f3a81f9542b93c209 | 3,802 | require "cases/helper"
require 'models/author'
require 'models/post'
require 'models/comment'
require 'models/developer'
require 'models/computer'
require 'models/project'
require 'models/reader'
require 'models/person'
class ReadOnlyTest < ActiveRecord::TestCase
fixtures :authors, :posts, :comments, :developers, :p... | 31.94958 | 103 | 0.723041 |
ff8a711fd0f83f910baaa1d9435733635e421dad | 1,641 | module Proteus
module Templates
class TemplateBinding
include Proteus::Helpers::PathHelpers
include Proteus::Helpers::StringHelpers
def initialize(context:, environment:, module_name:, data: {}, defaults: [])
@context = context
@environment = environment
@module_name =... | 26.047619 | 121 | 0.581353 |
9167a653e8e8fce1c2505858b8bd98fccf6dfcea | 5,578 | module Fastlane
# This class is responsible for checking the ARGV
# to see if the user wants to launch another fastlane
# tool or fastlane itself
class CLIToolsDistributor
class << self
def running_version_command?
ARGV.include?('-v') || ARGV.include?('--version')
end
def running_... | 41.93985 | 165 | 0.635174 |
87b568a48e7509e23f6f9e3af85c29970bf88d9b | 3,176 | require 'spec_helper'
describe Forem::FormattingHelper do
describe "as_formatted_html(text)" do
let(:raw_html) {"<p>html</p>"}
let(:text) {'three blind mice'}
before { Forem.formatter = nil }
describe "unsafe html" do
subject { helper.as_formatted_html("<script>alert('HELLO')</script> LOL") }
... | 32.080808 | 103 | 0.621222 |
7967c58dcee2cc4d2f6e4dd00be00aff4f942e53 | 446 | require 'webmock'
require 'gds_api/test_helpers/content_api'
require 'gds_api/test_helpers/imminence'
RSpec.configure do |config|
config.include GdsApi::TestHelpers::ContentApi, :type => :controller
config.include GdsApi::TestHelpers::ContentApi, :type => :feature
config.before(:each, :type => :feature) do
... | 31.857143 | 70 | 0.775785 |
3305bc867524d444f60a28d2c42b770ba74bf55a | 315 | module Glimmer
module DataBinding
module ObservableElement
def method_missing(method, *args, &block)
method_name = method.to_s
if method_name.start_with?('on_')
handle_observation_request(method_name, block)
else
super
end
end
end
end
end
| 21 | 56 | 0.628571 |
5d456765b423369f14b6f610023728e129866db7 | 1,207 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-wafv2'
spe... | 37.71875 | 111 | 0.659486 |
b96b85c79ca73c9a314b8f244c10112099111332 | 247 | # frozen_string_literal: true
require 'spec_helper'
describe 'fc_mariadb::galera::start' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
it { is_expected.to compile }
end
end
end
| 17.642857 | 40 | 0.668016 |
1d1f37566574247b6c45507ab41760b48bd684b0 | 3,394 | require File.join(File.dirname(__FILE__), "spec_helper")
class FakeController < Merb::Controller
def check_recaptcha
return recaptcha_valid?.to_s
end
end
describe "FakeController#check_recaptcha" do
def do_request(ssl = false)
@response = dispatch_to(FakeController, :check_recaptcha, { :recaptcha_challe... | 29.77193 | 179 | 0.681202 |
26bec3c1621d22240be3ebfb6e73d0045307162c | 541 | module TransactionService::Gateway
class FreeSettingsAdapter < SettingsAdapter
CommunityModel = ::Community
def configured?(community_id:, author_id:)
true
end
def tx_process_settings(opts_tx)
minimum_commission = Maybe(opts_tx[:unit_price]).map { |price| Money.new(0, price.currency) }.... | 27.05 | 121 | 0.719039 |
bb5651d4813ea406b386e3293482ba12934ac731 | 702 | # frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = "jekyll-new-theme"
spec.version = "0.1.0"
spec.authors = ["chzos"]
spec.email = ["me@ryanchoi.ca"]
spec.summary = "TODO: Write a short summary, because Rubygems requires one."
spec.homepage =... | 35.1 | 132 | 0.635328 |
1d19b85c2c971d361ef23bfc93f12f68d9c755b8 | 5,403 | # random users
User.create!(
username: "admin",
address_line_1: "633 Folsom",
address_line_2: "6th Floor",
city: "San Francisco",
state: "CA",
zip: "94107",
email: "admin@admin.com",
password: "adminadmin",
avatar: "https://pbs.twimg.com/profile_i... | 24.898618 | 92 | 0.648529 |
875994cd508788c66e983a4cc3a648bea5469d38 | 718 | require "spec_helper"
describe Mongoid::Extensions::Array::DeepCopy do
describe "#_deep_copy" do
context "when the array hash clonable objects" do
let(:one) do
"one"
end
let(:two) do
"two"
end
let(:array) do
[ one, two ]
end
let(:copy) do
... | 16.697674 | 53 | 0.564067 |
7a8b1940c2663d3ead76a33193b2b4bb80351484 | 380 | require 'rails_helper'
RSpec.shared_examples 'Authable' do
describe '#logged_in' do
describe 'When logged in' do
it {
session[:user_id] = 1
expect(subject.logged_in?).to eq(true)
}
end
describe "When logged out" do
it {
session[:user_id] = nil
expect... | 19 | 47 | 0.584211 |
e2a6753a7919dc412ad4145eaa667d2aeb0f7dcc | 211 | class CreateArtists < ActiveRecord::Migration
def change
create_table :artists do |t|
t.string :name
t.string :genre
t.integer :age
t.string :hometown
end
end
end | 19.181818 | 46 | 0.606635 |
1aa2e38e09bb50a7417d34fb3abba0c7d2fdd3b1 | 320 | class AddSuspendedToUsers < ActiveRecord::Migration[4.2]
def self.up
add_column :users, :suspended_at, :datetime
rename_column :accounts, :tall_free_phone, :toll_free_phone
end
def self.down
rename_column :accounts, :toll_free_phone, :tall_free_phone
remove_column :users, :suspended_at
end
end
| 26.666667 | 63 | 0.759375 |
28bbca9af0d95d27f81a6610503ade91006cacb7 | 2,879 | require_relative 'boot'
require 'rails'
# Pick the frameworks you want:
require 'active_model/railtie'
require 'active_job/railtie'
require 'active_record/railtie'
require 'active_storage/engine'
require 'action_controller/railtie'
require 'action_mailer/railtie'
require 'action_mailbox/engine'
# require "action_text/... | 39.438356 | 86 | 0.680792 |
6a49b25430b34769104969b3d8c2cf5d0dd7d9f6 | 1,980 | require 'active_record'
require 'models/status'
require 'models/harvest_job'
module Stash
module Harvester
module Models
class HarvestedRecord < ActiveRecord::Base
belongs_to :harvest_job
has_many :indexed_records
# 1. find the most recent harvest/index operation for each identifie... | 32.459016 | 79 | 0.582828 |
e9c220dd8365be7e1f590ffcb00ec97cfb99c478 | 7,598 | require 'chef/provisioning/aws_driver/aws_provider'
require 'retryable'
class Chef::Provider::AwsRouteTable < Chef::Provisioning::AWSDriver::AWSProvider
include Chef::Provisioning::AWSDriver::TaggingStrategy::EC2ConvergeTags
provides :aws_route_table
def action_create
route_table = super
if !new_resou... | 41.977901 | 205 | 0.712688 |
87e875ac56e4d071e5b6e3d9cc6be6b1660e0a98 | 934 | Pod::Spec.new do |s|
s.name = "Sentry"
s.version = "6.0.10"
s.summary = "Sentry client for cocoa"
s.homepage = "https://github.com/getsentry/sentry-cocoa"
s.license = "mit"
s.authors = "Sentry"
s.source = { :git => "https://github.com/getsentry/sentry-cocoa.git",
... | 27.470588 | 77 | 0.574946 |
873d26df5e1208dc2f0b846350b7507c60f3210b | 763 | # coding: utf-8
# 外出旅行, 可以有很多方式, 自行车, 自驾, 火车, 飞机 等等,
# 如果通过条件判断去计算需要花费的时间或者金钱, 那么代码会类似下面的样子:
class Travel
def initialize(vehicle, mile)
@vehicle = vehicle
@mile = mile
end
def calculate
case @vehicle
when '自行车'
1
when '自驾'
2
when '火车'
3
when '飞机'
4
end
en... | 12.508197 | 40 | 0.636959 |
e2783f6770fc6c3c97f5deb6095eb7459a89410e | 6,543 | require 'rails_helper'
require 'skirmish/factories'
require 'json'
require 'pp'
RSpec.describe GameStateController, :type => :controller do
describe 'show' do
let(:user) {
User.create(
email: 'foo@bar.org',
password: 'swordfish',
password_confirmation: 'swordfish'
)
... | 30.291667 | 97 | 0.548067 |
113e0d96039195f952d0773c18af8a6092f20dcb | 2,146 | # encoding: utf-8
class Nanoc::DataSources::StaticTest < MiniTest::Unit::TestCase
include Nanoc::TestHelpers
def new_data_source(params=nil)
# Mock site
site = Nanoc::Site.new({})
# Create data source
data_source = Nanoc::DataSources::Static.new(site, nil, nil, params)
# Done
data_sourc... | 32.029851 | 100 | 0.590867 |
01e5a40e1b627ee27fefdba119fe8bd4bae281c7 | 2,655 | class User < ApplicationRecord
has_many :microposts, dependent: :destroy
has_many :active_relationships, class_name: "Relationship", foreign_key: 'follower_id', dependent: :destroy
has_many :passive_relationships, class_name: "Relationship", foreign_key: 'followed_id', dependent: :destroy
has_many :following, t... | 29.5 | 115 | 0.73371 |
18a5834c80c15364edc0f4696b20893c8d1dd8cf | 153 | require File.expand_path('../../../../spec_helper', __FILE__)
describe "Process::Sys.setregid" do
it "needs to be reviewed for spec completeness"
end
| 25.5 | 61 | 0.718954 |
7a597ef9c28087ddfe57b6ead0b3c234d388a5e5 | 1,745 | Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rails routes".
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
# You can have the root of your site rou... | 28.606557 | 101 | 0.655587 |
914a1fe49f15bfbbf9bcfee0d193eb03215ebb0c | 366 | #!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__)+'/../config/environment')
course_id = ARGV[0]
@course = Course.find(course_id)
exit if !@course
#require(File.expand_path("app/models/gradebook_cache.rb"))
#begin
# CacheUpdater.update_cache(@course.id)
#rescue StandardError => error
# puts 'AHHHH... | 21.529412 | 73 | 0.756831 |
bb31bb218cd27c96b45599c08d8ea93856c3ac33 | 8,599 | require 'spec_helper'
describe 'cis_hardening::auth::ssh' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
# Check for default class
it {
is_expected.to contain_class('cis_hardening::auth::ssh')
}
# Ensure that Ensure permissions on ... | 35.533058 | 267 | 0.555065 |
ab9bcda5ee8fc0cb762b105f1993f91868c059ad | 1,784 | # 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::Logic::Mgmt::V2018_07_01_preview
module Models
#
# The artifact properties definition.
#
class ArtifactProperties
inc... | 25.855072 | 70 | 0.511771 |
ac5a096b40072eead8a7bef15247cd1e8f40a7fb | 2,558 | # frozen_string_literal: true
#
# Author:: Pavel Yudin (<pyudin@parallels.com>)
# Author:: Tim Smith (<tsmith@chef.io>)
# Copyright:: Copyright (c) 2015 Pavel Yudin
# Copyright:: Copyright (c) Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
... | 27.212766 | 74 | 0.673182 |
f89951171a7e8513a683e66b41df3d0d10c92c12 | 1,308 | # -*- encoding: utf-8 -*-
# REXML is an XML toolkit for Ruby[http://www.ruby-lang.org], in Ruby.
#
# REXML is a _pure_ Ruby, XML 1.0 conforming,
# non-validating[http://www.w3.org/TR/2004/REC-xml-20040204/#sec-conformance]
# toolkit with an intuitive API. REXML passes 100% of the non-validating Oasis
# tests[http://ww... | 40.875 | 83 | 0.733945 |
b93ee8439f0b5a6eb840b9b18d2b4b5513e18e7b | 1,799 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/functional-light-service/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Boscolo Michele"]
gem.email = ["miboscol@gmail.com"]
gem.description = %q{A service skeleton with an emphasis on simplicity with a pinch a functi... | 48.621622 | 113 | 0.669261 |
6188e0e7951fc8ebac73f1776e9dda6c0b07fe95 | 720 | # 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::KeyVault::Mgmt::V2015_06_01
module Models
#
# Defines values for KeyPermissions
#
module KeyPermissions
All = "all"
... | 22.5 | 70 | 0.594444 |
1a598628763005ebfbba5e5ba767092c1d9573d1 | 607 | cask "sapmachine-jdk" do
version "14.0.2"
sha256 "9c11682ba91c4285f8ca56682114a46c2e0bf723b65b81060b6f8403d681ff1f"
# github.com/SAP/SapMachine/ was verified as official when first introduced to the cask
url "https://github.com/SAP/SapMachine/releases/download/sapmachine-#{version}/sapmachine-jdk-#{version}_os... | 46.692308 | 123 | 0.777595 |
ab293174d4037f5e4da83cadc8d7872f1ec2dc64 | 2,697 | #
# Author:: John Keiser (<jkeiser@chef.io>)
# Copyright:: Copyright 2013-2019, 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
#
# ... | 29 | 74 | 0.6396 |
629d91535649ad98bc47d253a71454353bfa0ffe | 913 | module DeviseGoogleAuthenticator
module Controllers # :nodoc:
module Helpers # :nodoc:
def google_authenticator_qrcode(user, qualifier=nil, issuer=nil)
username = username_from_email(user.email)
app = user.class.ga_appname || Rails.application.class.try(:module_parent_name) || Rails.applicat... | 36.52 | 126 | 0.652793 |
5dd94996a8ba06dc5f8c5fe746587a62429c4854 | 9,520 | # frozen_string_literal: true
# Redmine - project management software
# Copyright (C) 2006-2019 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the L... | 30.809061 | 108 | 0.714391 |
9120075fd30cd961cc05ee75da49d84db59179ab | 1,110 | # Ta-Lib function mapping class
# Function: 'LINEARREG_SLOPE'
# Description: 'Linear Regression Slope'
# This file has been autogenerated - Do Not Edit.
class Indicator::AutoGen::LinearRegSlope < Indicator::Base
# Time Period <Integer>
attr_accessor :time_period
def initialize(*args)
if args.first.... | 20.555556 | 59 | 0.624324 |
33674d90c4100bd8da1c657f599281e0c0800816 | 20 | action :run do
end
| 5 | 14 | 0.7 |
f77c89bac32454a744df0c5348e01395be9a03ca | 803 | class TeachersController < ApplicationController
before_action :redirect_if_not_logged_in, only: :show
def new
render :layout => "login"
@teacher = Teacher.new
end
def create
@teacher = Teacher.new(teacher_params)
if @teacher.save
session[:teacher_id]= @t... | 25.903226 | 117 | 0.62142 |
b980f97c7bdf41928babfa50314f0d16ace68439 | 12,733 | require_relative '../spec_helper'
require_relative '../../app/controllers/visualizations_controller_helper'
describe VisualizationsControllerHelper do
include VisualizationsControllerHelper
include CartoDB::Factories
include Carto::Factories::Visualizations
before(:all) do
@organization = create_organizat... | 39.666667 | 130 | 0.735412 |
ab4ebf0d524fb1def0ccb3428a3263afdb77ed04 | 443 | describe :hash_value_p, shared: true do
it "returns true if the value exists in the hash" do
new_hash(a: :b).send(@method, :a).should == false
new_hash(1 => 2).send(@method, 2).should == true
h = new_hash 5
h.send(@method, 5).should == false
h = new_hash { 5 }
h.send(@method, 5).should == fals... | 29.533333 | 54 | 0.625282 |
39794a42c0b011ba0b738811f450a84354c6fc23 | 646 | require 'spec_helper'
describe JsonServiceRowPresenter do
describe '#name' do
it 'returns the handlebar template tag for name' do
expect(subject.name).to eq '{{name}}'
end
end
describe '#service_url' do
it 'exposes the handlebar template tag for service_url' do
expect(subject.service_url... | 23.071429 | 62 | 0.671827 |
b9c780549fcad71707e022f4c2defea0997fb9cb | 89 | service "apache2" do
action :restart
end
service "shibd" do
action :restart
end
| 11.125 | 20 | 0.696629 |
ffc941e72b210eb589c76f4e2e9b844f509239dc | 7,710 | #
# Cookbook Name:: nova
# Recipe:: database
#
# Copyright 2010-2011, Opscode, Inc.
# Copyright 2011, Dell, Inc.
# Copyright 2012, SUSE Linux Products GmbH.
#
# 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 t... | 34.115044 | 97 | 0.716602 |
387ee3ba598fd0969bc84d7dc7cba88367d0b3b1 | 1,584 | require "spec_helper"
RSpec.describe Amazon::XML::Envelope::Prices do
include_context :product
include_context :child_product
let(:instance) { described_class.new products, options }
let(:products) do
[
product,
child_product,
]
end
let(:options) do
{
credentials: {
... | 24 | 90 | 0.606061 |
382b06285c9fd420bc463094f9234419d9fa7722 | 83 | module AEAD
autoload :Cipher, 'aead/cipher'
autoload :Nonce, 'aead/nonce'
end
| 16.6 | 33 | 0.710843 |
ff1c2a0d82307cad7211b684ac25de38fd46bb7a | 4,728 | require 'cases/helper'
require 'models/author'
require 'models/comment'
require 'models/developer'
require 'models/post'
require 'models/project'
class RelationMergingTest < ActiveRecord::TestCase
fixtures :developers, :comments, :authors, :posts
def test_relation_merging
devs = Developer.where("salary >= 800... | 33.295775 | 127 | 0.705161 |
8788af57a678cd99faeceff2481222333b34ee66 | 5,159 | ##
# This class is compatible with IO class (https://ruby-doc.org/core-2.3.1/IO.html)
# source: https://gitlab.com/snippets/1685610
module Gitlab
module Ci
class Trace
class HttpIO
BUFFER_SIZE = 128.kilobytes
InvalidURLError = Class.new(StandardError)
FailedToGetChunkError = Class.n... | 26.055556 | 151 | 0.539252 |
1c3f0daa39770c0bc2086fe4c77c0235e225a48e | 149 | module RbDbg
APP_NAME = "rbdbg"
VERSION = "0.0.1"
end
require 'optparse'
require 'ffi'
require 'rbdbg/debugger/base'
require 'rbdbg/debugger/osx' | 14.9 | 29 | 0.731544 |
e81c04ba84766a2f2381ca423abcabf2393171a6 | 670 | require 'eventide/postgres'
require 'user_email_address/client'
require 'registration_component/load'
require 'registration_component/registration'
require 'registration_component/projection'
require 'registration_component/store'
require 'registration_component/encode_email_address'
require 'registration_componen... | 30.454545 | 68 | 0.873134 |
335bf55cc899f161f8718ead226731419043281f | 64 | module Omniauth
module Fedena
VERSION = "0.1.1"
end
end
| 10.666667 | 21 | 0.65625 |
1c3186d8005a15a4b7fc6d7990781d7ff665c05c | 1,313 | require 'base32-alphabets'
Base32.format = :electrologica # use the Electrologica Alphabet / Variant
# hexadecimal (base 16)
genome = 0x00004a52931ce4085c14bdce014a0318846a0c808c60294a6314a34a1295b9ce # kitty 1001
p Base32.encode( genome )
#=> "09-09-09-09-06-07-07-04-01-01-14-01-09-15-14-14-00-05-05-00... | 37.514286 | 150 | 0.744097 |
bb36d8d3916f44ec3c4d0febcee95a6d606683f9 | 465 | module Capachrome
module DriverExtensions
module HasInputDevices
#
# @return [ActionBuilder]
# @api public
#
def action
ActionBuilder.new mouse, keyboard
end
#
# @api private
#
def mouse
Mouse.new @bridge
end
#
# @a... | 14.090909 | 41 | 0.541935 |
01b5d18822086b638048bb8f380addf410b7f817 | 1,848 | require 'spec_helper'
describe 'Shipments', type: :feature do
stub_authorization!
let!(:order) { create(:order_ready_to_ship, number: 'R100', state: 'complete', line_items_count: 5) }
# Regression test for #4025
context 'a shipment without a shipping method' do
before do
order.shipments.each do |s|... | 26.782609 | 103 | 0.66829 |
398aa5f749b0a46537d3d899f63434ee31224a92 | 1,133 | class SetMysqlCollationToUtf8mb4Unicode < ActiveRecord::Migration[5.0]
def change
unless ActiveRecord::Base.connection.adapter_name.downcase =~ /^mysql/
return
end
reversible do |dir|
dir.up do
update_collation!('utf8mb4_unicode_ci')
# Updating to mb4 switches TEXT columns to... | 26.97619 | 80 | 0.656664 |
d5692a2a321714a81c8416367b1da302fc92e1ea | 1,039 | # Encoding: UTF-8
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = "refinerycms-<%= plural_name %>"
s.version = "1.0.0"
s.description = "Ruby on Rails <%= plural_name.titleize %> forms-extension for Refinery CMS"
s.date = "<%= Time.now... | 45.173913 | 121 | 0.600577 |
e8ba543d4b3e3a75a78d3ab98336864219cb975b | 28,371 | # frozen_string_literal: true
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------... | 40.242553 | 176 | 0.603997 |
28fdc40b5eb11fe14ae81339c8b5838f3f6287e7 | 182 | class CreateEnquiries < ActiveRecord::Migration[5.2]
def change
create_table :enquiries do |t|
t.string :name
t.text :message
t.timestamps
end
end
end
| 16.545455 | 52 | 0.653846 |
612711011b893b56c273f6e124b698386895443a | 48 | module SortNames
VERSION = '0.1.0'.freeze
end
| 12 | 26 | 0.708333 |
bbffbbacade452768ff915c2d99aa0fef343b797 | 685 | Spree::Core::Engine.routes.draw do
namespace :admin do
resources :reports, only: [:index] do
collection do
get :total_sales_of_each_variant
post :total_sales_of_each_variant
get :ten_days_order_count
get :thirty_days_order_count
get :stock_report
post :stock_r... | 27.4 | 41 | 0.665693 |
bfe958d1deae7eee7d123bf99273c4143dcfe12a | 359 | require 'forwardable'
require 'apitizer'
require_relative 'typekit/core'
require_relative 'typekit/error'
require_relative 'typekit/helper'
require_relative 'typekit/converter'
require_relative 'typekit/client'
require_relative 'typekit/element'
require_relative 'typekit/collection'
require_relative 'typekit/recor... | 19.944444 | 37 | 0.835655 |
87914848ccc796318a2d79e6c5e0e3a53cf35eff | 3,532 | # 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::ServiceFabric::V6_4_0_36
module Models
#
# Application Created event.
#
class ApplicationCreatedEvent < ApplicationEvent
... | 28.483871 | 70 | 0.471687 |
e2c01ea135049f861049d3db4a9c9fcf15939bdc | 575 | require 'spec_helper'
describe Facter::Util::Fact.to_s do
before(:each) do
Facter.clear
end
describe 'mysqld_version' do
context 'with value' do
before :each do
Facter::Util::Resolution.stubs(:exec).with('mysqld -V 2>/dev/null').returns('mysqld Ver 5.5.49-37.9 for Linux on x86_64 (Percona... | 30.263158 | 185 | 0.66087 |
28c41902002b403b49a02dee000c0952ecc04c1b | 3,273 | # encoding: UTF-8
require 'test_helper'
class Wankel::OneOffParseTest < Minitest::Test
test "should parse 23456789012E666 as Infinity" do
infinity = (1.0/0)
assert_equal({'key' => infinity}, Wankel.parse('{"key": 23456789012E999}'))
end
test "should not parse JSON with a comment, with :allow_commen... | 41.961538 | 136 | 0.68897 |
3895ebcfd8c89f570e42ff041ca78b2621fe1510 | 1,020 | # frozen_string_literal: true
require 'aws_backend'
class AWSCloudFrontOriginRequestPolicy < AwsResourceBase
name 'aws_cloudfront_origin_request_policy'
desc 'Describes an origin request policy.'
example "
describe aws_cloudfront_origin_request_policy(id: 'ID') do
it { should exist }
end
"
d... | 26.153846 | 107 | 0.714706 |
26e173c4e96e316bc6bb2a32be509d77cf6b87e1 | 6,583 | require 'rails_helper'
RSpec.describe TasksController, type: :controller do
let!(:user) { create(:user, username: 'the_user') }
#I have used let! instead of let because let is lazily evaluated
describe 'index' do
it 'should creates the user received if it is not already' do
expect(User.count).t... | 33.080402 | 151 | 0.664591 |
79a9a9486dee2b3f39b8de11c2b35b5820f8c7fe | 556 | # encoding: utf-8
require 'spec_helper'
describe Function::Predicate::GreaterThanOrEqualTo, '.call' do
subject { object.call(left, right) }
let(:object) { described_class }
context 'when left is equal to right' do
let(:left) { 1 }
let(:right) { 1 }
it { should be(true) }
end
context 'when l... | 17.935484 | 62 | 0.602518 |
1dc8abf74658803c7ecb0c06490e92e86150e47e | 1,350 | # frozen_string_literal: true
version = File.read(File.expand_path("../RAILS_VERSION", __dir__)).strip
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = "actionpack"
s.version = version
s.summary = "Web-flow and rendering framework putting the VC in MVC (part of Rails).... | 34.615385 | 158 | 0.675556 |
ed26565b59906f96d50782d8c6e331fe06f7ebaf | 255 | #! /usr/bin/ruby
# encoding: utf-8
require 'xcodeproj'
projectPath = ARGV[0]
targetId = ARGV[1]
project = Xcodeproj::Project.open(projectPath)
project.root_object.attributes["TargetAttributes"][targetId]["ProvisioningStyle"]="Manual"
project.save
| 15.9375 | 90 | 0.74902 |
bf8caa1e0d5953839e84b4681c4c41ebc153dc72 | 13,254 | require_relative "../../aws_refresher_spec_common"
require_relative "../../aws_refresher_spec_counts"
describe ManageIQ::Providers::Amazon::CloudManager::Refresher do
include AwsRefresherSpecCommon
include AwsRefresherSpecCounts
###################################################################################... | 39.213018 | 131 | 0.606458 |
ac90841a695a50df9842d8e369ef471700475264 | 1,212 | $:.unshift(File.join(File.expand_path("."), "src"))
require 'pathname'
require 'unlight'
$arg = ARGV.shift
module Unlight
# デバッグ用アイテム追加
puts "アイテムを追加しますか?(y/n)"
answer = gets.chomp
if answer == "y" || answer == "Y" || answer == "yes" || answer == "Yes"
puts "追加するアバターのIDを指定してください"
avatar_id = gets.chom... | 22.867925 | 73 | 0.589109 |
e909d659d822f5314131180e94aec4c186fe13e1 | 125 | require 'test_helper'
class StaticValueTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.625 | 47 | 0.712 |
1cbcf3065d5ab6d82794070f8c8b43930c558352 | 669 | cask 'sqlpro-studio' do
version '1.0.423'
sha256 '921bdd2e2a185a4c45f61c5d5f24503dfb944abf15a1ab243c621558d082891e'
# d3fwkemdw8spx3.cloudfront.net/studio was verified as official when first introduced to the cask
url "https://d3fwkemdw8spx3.cloudfront.net/studio/SQLProStudio.#{version}.app.zip"
name 'SQLPro... | 39.352941 | 163 | 0.7429 |
bbf1028d2a0240bb6fe306d3ec0374223e316d55 | 213 | class CreateFoodLogs < ActiveRecord::Migration[5.1]
def change
create_table :food_logs do |t|
t.integer :user_id
t.integer :recipe_id
t.datetime :date
t.timestamps
end
end
end
| 17.75 | 51 | 0.657277 |
016343e8c46cb1a41ceb862c251df89180f18dea | 2,470 | # encoding: UTF-8
# frozen_string_literal: true
describe Blockchain do
context 'validations' do
subject { build(:blockchain, 'eth-mainet') }
it 'checks valid record' do
expect(subject).to be_valid
end
it 'validates presence of key' do
subject.key = nil
expect(subject).to_not be_v... | 29.759036 | 105 | 0.665587 |
28c8ac05e6b1885316b5dd146add3342d1a8ba09 | 5,176 | module RailsAdmin
module Config
# Provides accessors and autoregistering of model's fields.
module HasFields
# Defines a configuration for a field.
def field(name, type = nil, add_to_section = true, &block)
field = _fields.detect { |f| name == f.name }
# some fields are hidden by ... | 37.781022 | 124 | 0.619011 |
7a7fb7f09cc1984d824a5de6c30727905e748c30 | 3,301 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(name: "Example User", email: "user@example.com",
password: "foobar", password_confirmation: "foobar")
end
test "should be valid" do
assert @user.valid?
end
test "name should be pres... | 28.704348 | 123 | 0.684035 |
62431fb05a1dd943265838191fe0c3562e0140a4 | 253 | require 'lib/templatemailer'
class Alert < TemplateMailer
def initialize(options)
super(ALERT_SMTP_SERVER, ALERT_TEMPLATE, options)
end
def mail
to = ALERT_TO if defined?(ALERT_TO)
cc = ALERT_CC if defined?(ALERT_CC)
super(to, cc)
end
end
| 18.071429 | 51 | 0.750988 |
3900a7fed34ecc46143f35a0a2cf5bf0898e59ae | 87 | $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "stewart_view_tool"
| 29 | 58 | 0.758621 |
1857fa853a234ebd77ea096aeab2d60040f141d9 | 2,178 | #--
# Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy,... | 29.432432 | 78 | 0.783287 |
bfb500ac33c48f24a0a286e24439ba00d4b441c5 | 3,812 | # frozen_string_literal: true
# See LICENSE.txt at root of repository
# GENERATED FILE - DO NOT EDIT!!
require 'ansible/ruby/modules/base'
module Ansible
module Ruby
module Modules
# Create, update and delete blob containers and blob objects. Use to upload a file and store it as a blob object, or download ... | 52.219178 | 785 | 0.690976 |
4ad27f711706e075e561797a9f73426edabc3e83 | 1,640 | class Admin::PagesController < Admin::ResourceController
before_filter :initialize_meta_rows_and_buttons, :only => [:new, :edit, :create, :update]
before_filter :count_deleted_pages, :only => [:destroy]
responses do |r|
r.plural.js do
@level = params[:level].to_i
@template_name = 'index'
re... | 29.285714 | 116 | 0.609146 |
919d4146109f0a07c78b40f24c06d67882c0ca18 | 233 | # frozen_string_literal: true
require Hyrax::Engine.root.join('app/services/hyrax/user_stat_importer.rb')
module Hyrax
class UserStatImporter
require 'legato'
require 'hyrax/pageview'
require 'hyrax/download'
end
end
| 23.3 | 75 | 0.763948 |
e91d05e29e5c2d2959b0ecf2ecea94b16e69f2ad | 1,376 | require "spec_helper"
describe Sunspot::Queue::DelayedJob::Backend do
# Mock DelayedJobJob
class CustomDelayedJobJob < Struct.new(:klass, :id)
def perform
end
end
subject(:backend) { described_class.new(configuration) }
let(:configuration) { ::Sunspot::Queue::Configuration.new }
describe "#ind... | 25.018182 | 64 | 0.678052 |
f8403bfe1aa9616aef9dffe8c118abd0a92c24d0 | 9,131 | require "cases/helper"
require 'support/connection_helper'
module ActiveRecord
class PostgresqlConnectionTest < ActiveRecord::PostgreSQLTestCase
include ConnectionHelper
class NonExistentTable < ActiveRecord::Base
end
fixtures :comments
def setup
super
@subscriber = SQLSubscriber.n... | 35.391473 | 124 | 0.701566 |
d5115b36923753cd121d51b0c7b71be4c6adc0ee | 2,361 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.requi... | 41.421053 | 99 | 0.726387 |
28703bd4e5bb0715baf329bef3aa0d46e87600b1 | 2,090 | module Blueprints
# Contains configuration of blueprints. Instance of this is yielded in Blueprints.enable block.
# @example Configuring through Blueprints.enable block
# Blueprints.enable do |config|
# config.prebuild = :user, :profile
# end
# @example Configuring directly
# Blueprints.config.t... | 41.8 | 144 | 0.704306 |
1a5de31c1aeabaf3e44c782e37743eba85f79bff | 723 | # == Schema Information
#
# Table name: repositories
#
# id :integer not null, primary key
# name :string(255) default(""), not null
# namespace_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# marked :boolean default(... | 24.1 | 74 | 0.622407 |
6a91a16c9c37082014760137c2747db3fdc62fb9 | 25 | module MenteesHelper
end
| 8.333333 | 20 | 0.88 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.