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 |
|---|---|---|---|---|---|
38058db5890d94a23e58e07cfc762d8f86229ef8 | 1,323 | # encoding: utf-8
require 'spec_helper'
describe 'ButtonAction', 'when submitting' do
include FormtasticSpecHelper
before do
@output_buffer = ''
mock_everything
concat(semantic_form_for(@new_post) do |builder|
concat(builder.action(:submit, :as => :button))
end)
end
it 'should render ... | 20.671875 | 85 | 0.69161 |
f8bdd5920bc9143b6739fa38b0b5decc1e492d8a | 877 | cask "itsycal" do
if MacOS.version <= :el_capitan
version "0.10.16"
sha256 "dbf1b104c7a3a2ca3ead9879145cb0557955c29d53f35a92b42f48e68122957c"
elsif MacOS.version <= :high_sierra
version "0.11.17"
sha256 "fda1ba5611deaf4d5b834118b3af37ea9c5d08d1f8c813d04e7dd0552a270e11"
appcast "https://itsycal.s... | 32.481481 | 88 | 0.758267 |
7a83d7f20a33660151badb4ca01ad2774b4be9aa | 4,052 | #!/usr/bin/env rspec
require 'spec_helper'
# We use this as a reasonable way to obtain all the support infrastructure.
[:user, :group].each do |type_for_this_round|
provider_class = Puppet::Type.type(type_for_this_round).provider(:directoryservice)
describe provider_class do
before do
@resource = stub("... | 41.346939 | 103 | 0.708292 |
4af263a667669b2f1fb4924872b5f1a9af9dc835 | 728 | require 'rails_helper'
RSpec.describe 'parties/index', vcr: true do
before do
assign(:people, [])
assign(:parties, [double(:party, name: 'Conservative', graph_id: 'jF43Jxoc')])
assign(:letters, 'A')
controller.params = { letter: 'a' }
render
end
context 'header' do
it 'will render the co... | 26 | 89 | 0.684066 |
e8e0cf4344f97e81878aa20255d83ed49c8a3ebc | 1,117 | Pod::Spec.new do |s|
s.name = 'RedPacketAliAuthUI'
s.version = '2.0.1'
s.summary = 'RedPacketAliAuthUI'
s.description = <<-DESC
* RedPacketAliAuthUI.
* Redpacket
* Alipay
* 支付宝支付
... | 33.848485 | 121 | 0.521038 |
21365d91ae6723174626fac75689e678d2519c6d | 262 | require 'rails_helper'
RSpec.describe "Api::V1::Follows", type: :request do
describe "GET /api/v1/follows" do
it "works! (now write some real specs)" do
get api_v1_follows_index_path
expect(response).to have_http_status(200)
end
end
end
| 23.818182 | 52 | 0.70229 |
6a80e3061bb003b477af19bcb2010e685c57fc5d | 2,939 | class UsersController < ApplicationController
before_filter :skip_first_page, only: :new
before_filter :handle_ip, only: :create
before_filter :fetch_user, only: :show
def new
@bodyId = 'home'
@is_mobile = mobile_device?
@user = User.new
respond_to do |format|
format.html # new.html.erb... | 26.241071 | 116 | 0.664171 |
4a2bb881f0d2ce0a1231a9c8d299d22ac663fd98 | 353 | RSpec.describe 'Class 8 Exercise 2' do
let(:exercise2) do
load File.expand_path('../../../lib/class8/exercise2.rb', __FILE__)
end
it 'follows the execution and displays a short message' do
message = <<END
Executing the method
method_param is dinner
Executing the block
END
expect { exercise2 }.to out... | 22.0625 | 71 | 0.719547 |
ab9ac525f67f289bcc37c6b6409103978792c408 | 1,867 | # // 02/22/2012
# // 02/23/2012
# // Icy Engine Iliks
$simport.r 'iei/magic_learn', '1.0.0', 'IEI Magic Learn'
module IEI
module MagicLearn
module Mixins ; end
end
end
module IEI::MagicLearn::Mixins::Battler
def pre_init_iei
super
@magiclearn = {}
end
def init_iei
super
#init_magiclearn... | 19.447917 | 80 | 0.664167 |
e979ff1a9cd593f0bebad497e0a6fb328eef5d9f | 3,261 | require 'spec_helper'
describe Heartcheck::Checks::Firewall do
let(:service_opts) { { port: 443, host: 'lala.com' } }
let(:instance_default) { described_class.new.tap { |c| c.add_service service_opts } }
describe '#services' do
subject { described_class.new }
it 'returns array of FirewallService' d... | 33.96875 | 138 | 0.609322 |
7aa0e7286bb4987b4e97efb783a6dcd56d1c83fb | 3,152 | # frozen_string_literal: true
Capybara.add_selector(:disclosure) do
def aria_or_real_button
XPath.self(:button) | (XPath.attr(:role) == "button")
end
xpath do |name, **|
button = aria_or_real_button & XPath.string.n.is(name.to_s)
aria = XPath.descendant[XPath.attr(:id) == XPath.anywhere[button][XPat... | 33.178947 | 123 | 0.665609 |
28806a88d1b31bd4e1090265b1fae048172dd26e | 1,137 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
module MetasploitModule
CachedSize = 1471264
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions
include Msf::Sessions::MettleConfig
def initialize(... | 26.44186 | 96 | 0.596306 |
4a6106f583d4b6018a9750026521c2aa96120ef4 | 144 | class Test
array_testing = [1, 2, 3, 4, 5, 6]
array_testing.each {|x| puts x}
def hello_method (*_string_test)
puts 'Hello'
end
end
| 18 | 36 | 0.645833 |
28ab38bc9f104a267e4c2334a16a5f9930fd47f4 | 173 | class CreateEventUsers < ActiveRecord::Migration[5.1]
def change
create_table :event_users do |t|
t.integer :event_id
t.integer :user_id
end
end
end
| 19.222222 | 53 | 0.687861 |
18e7203dab07fd73e97d6c2bb77a3803e9c951ba | 3,134 | module NestedLayoutTags
include Radiant::Taggable
class TagError < StandardError; end
desc %{
Renders the contents of the tag inside of a "parent" layout, which is selected via the +name+
attribute. The contents of this tag are placed at a corresponding <r:content_for_layout/> tag
within the pare... | 31.979592 | 118 | 0.655073 |
612bbaa08cf110969053e8e94df7eab9206b952e | 850 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'emd/version'
require 'emd/post_message'
Gem::Specification.new do |spec|
spec.name = "emd"
spec.version = Emd::VERSION
spec.authors = ["Bryan Lim"]
spec.email ... | 36.956522 | 79 | 0.661176 |
bb4f391420a7cf7b7505eaf8f23e46850bf2d190 | 459 | module DataSources
class SniffersFactory < AbstractFactory
# TODO handle file openning in other place. Handle file not exists and so on
def records_set_builder
DataSources::SniffersRecordsSetBuilder.new(
routes_file: File.join(location, 'routes.csv'),
node_times_file: File.join(location,... | 32.785714 | 80 | 0.705882 |
d5752d520793caf2065aebdc3f62d8207ce165c1 | 1,160 | require 'dragonfly'
module Refinery
class Resource < Refinery::Core::BaseModel
::Refinery::Resources::Dragonfly.setup!
include Resources::Validators
resource_accessor :file
validates :file, :presence => true
validates_with FileSizeValidator
delegate :ext, :size, :mime_type, :url, :to => :... | 23.673469 | 80 | 0.627586 |
f8e791baefa17f0821055448fe3013886e11000e | 4,460 | class Ffmpeg < Formula
desc "Play, record, convert, and stream audio and video"
homepage "https://ffmpeg.org/"
url "https://ffmpeg.org/releases/ffmpeg-4.4.1.tar.xz"
sha256 "eadbad9e9ab30b25f5520fbfde99fae4a92a1ae3c0257a8d68569a4651e30e02"
# None of these parts are used by default, you have to explicitly pass ... | 29.536424 | 104 | 0.686099 |
91e38ed345bec5d78706a6bd4aa6c124c6479080 | 580 | # Used by Prioritizer to adjust item quantities
# see prioritizer_spec for use cases
module Spree
module Stock
class Adjuster
attr_accessor :variant, :need, :status
def initialize(variant, quantity, status)
@variant = variant
@need = quantity
@status = status
end
... | 20 | 47 | 0.574138 |
260f16c3873629c0b11b8a51491a81b34678f287 | 1,417 | class Hugo < Formula
desc "Configurable static site generator"
homepage "https://gohugo.io/"
url "https://github.com/spf13/hugo/archive/v0.19.tar.gz"
sha256 "f2d1926b226b4a5d64c4880538eb1bb47c84dd886152660d72c69269f7c5cf6f"
head "https://github.com/spf13/hugo.git"
bottle do
cellar :any_skip_relocation
... | 32.204545 | 92 | 0.697248 |
26a22792bac0fad6e4d766158833144c79a3d378 | 39 | module Badger
VERSION = "0.15.0"
end
| 9.75 | 20 | 0.666667 |
215ce161def7f82d1dd0d373c4a7e390aabe3490 | 1,531 | require 'spec_helper'
describe Atrium::BrowseLevel do
Given(:facet_name) { 'My Facet Name' }
subject { Atrium::BrowseLevel.new(solr_facet_name: facet_name) }
it_behaves_like "query_param_mixin"
it { should belong_to :exhibit }
it { should be_accessible :label }
it { should be_accessible :level_number }... | 26.859649 | 66 | 0.693011 |
087b8cb5684bad1c1861ba19c9535d53f264e6ad | 996 | class CreateServiceProviders < ActiveRecord::Migration[4.2]
def change
create_table :service_providers do |t|
t.string "issuer", null: false
t.string "friendly_name"
t.text "description"
t.text "metadata_url"
t.text "acs_url"
t.text "assertion_consumer_logou... | 33.2 | 116 | 0.631526 |
381ee2305ab97f86142acc7c20ddf24de22dba42 | 289 | class CompaniesProjects < ActiveRecord::Migration
def self.up
create_table :companies_projects, :force => true, :id => false do |t|
t.belongs_to :company
t.belongs_to :project
t.timestamps
end
end
def self.down
drop_table :companies_projects
end
end
| 20.642857 | 73 | 0.688581 |
797f5d6697d0f3331314a511e3c0ad5f968a7278 | 752 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe AppSec::Dast::Scans::ConsistencyWorker do
let(:worker) { described_class.new }
describe '#perform' do
let_it_be(:project) { create(:project) }
let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
let_it_be(:profile) { creat... | 31.333333 | 109 | 0.720745 |
28b8cd0f69a0c6f2f96b23b5632b47aeca3766c1 | 3,124 | require 'rack'
require 'base64'
# Takes an ApiGateway event and converts it to an Rack env that can be used for
# rack.call(env).
module Jets::Controller::Rack
class Env
def initialize(event, context, options={})
@event, @context, @options = event, context, options
end
def convert
options = ... | 29.196262 | 136 | 0.598912 |
6a1fa61f3c60c85b1a28c4bc01c0405fb5856abe | 163 | require 'rails_helper'
RSpec.describe "Providers", type: :request do
describe "GET /index" do
pending "add some examples (or delete) #{__FILE__}"
end
end
| 20.375 | 55 | 0.711656 |
1cf28c2b3ca5dc6bc6fc6cffb0a5748d30b3f8e3 | 6,163 | # frozen_string_literal: true
require 'lib/params'
require 'view/tiles'
require_relative '../game_class_loader'
module View
class TilesPage < Tiles
include GameClassLoader
needs :route
ROUTE_FORMAT = %r{/tiles/([^/?]*)(?:/([^?]+))?}.freeze
TILE_IDS = [
Engine::Tile::WHITE.keys,
Engine... | 29.488038 | 94 | 0.55103 |
28475a576e2e0709db4f6de0de712bbfb7a5becf | 465 | class GenerateMonthlyTsvs < GenerateTsvs
def perform
super
self.class.set(wait_until: beginning_of_next_month).perform_later
TsvRelease.where(path: release_path).first_or_create
end
private
def release_path
@dir_name ||= Date.today.beginning_of_month.strftime('%d-%b-%Y')
end
def beginning_... | 19.375 | 69 | 0.729032 |
0311ab261f74564dbc0346c500abb212395a1aed | 1,855 | module Fog
module Network
class AzureRM
# Real class for Express Route Circuit Peering Request
class Real
def get_express_route_circuit_peering(resource_group_name, peering_name, circuit_name)
msg = "Getting Express Route Circuit Peering #{peering_name} from Resource Group #{resource... | 37.857143 | 193 | 0.558491 |
ac7acbd85aec825a13a818291fff4764bff3afda | 47 | module PgMantenimiento
VERSION = '0.1.0'
end
| 11.75 | 22 | 0.723404 |
87b56653d35b31eba0b2149321018f5ad0d4354f | 1,316 | class Export::AllActivityTotals
attr_reader :totals
def initialize(activity:, report: nil)
@activity = activity
@scoped_to_report = report
@totals = nil
end
def call
apply_base_scope
apply_report_scope unless @scoped_to_report.nil?
apply_select
apply_grouping
apply_ordering
... | 20.5625 | 104 | 0.680851 |
3814c1785758b34eb8b2914f34ff740ee897f007 | 793 | # http://ow.ly/url/shorten-url -- not out yet
# http://api.bit.ly/shorten?version=2.0.1&login=shurl&apiKey=R_a08944fe85b63e4e35dd04d78d180611&longUrl=
require 'net/http'
module Shurl
class Shortener
def initialize
@@mini = []
@@shorteners = %w{http://is.gd/api.php?longurl=
http://tinyarro.ws/... | 27.344828 | 104 | 0.629256 |
33d1fea6c756605a7e7d7448034bd0e6784c8a9b | 218 | require File.expand_path('../support/helpers', __FILE__)
describe 'line::default' do
include Helpers::Line
# Example spec tests can be found at http://git.io/Fahwsw
it 'runs no tests by default' do
end
end
| 18.166667 | 59 | 0.715596 |
339f4e0fc0835ebe10c5c0486119731ca77644e9 | 457 | class CreateLivepeerEvents < ActiveRecord::Migration[5.2]
def change
create_table :livepeer_events do |t|
t.belongs_to :round
t.string :type
t.datetime :timestamp
t.string :transcoder_address
t.jsonb :data, default: {}
t.timestamps
end
add_index :livepeer_events, :type... | 26.882353 | 73 | 0.706783 |
6a7ba2d83ca925ceece92b7f5de1f315a6d97d9f | 1,644 | # coding: utf-8
require "rails_helper"
describe UsersHelper, :type => :helper do
describe "user_avatar_width_for_size" do
it "should calculate avatar width correctly" do
expect(helper.user_avatar_width_for_size(:normal)).to eq(48)
expect(helper.user_avatar_width_for_size(:small)).to eq(16)
expe... | 37.363636 | 149 | 0.680657 |
b9a860a6f40742166eed5917613822faad415e2a | 4,931 | # -*- encoding: utf-8 -*-
require_relative '../spec_helper'
require_relative '../../app'
describe Razor::Command::SetNodeIPMICredentials do
include Razor::Test::Commands
let(:app) { Razor::App }
let(:node) { Fabricate(:node).save }
let(:command_hash) { { "name" => node.name } }
before :each do
header ... | 28.836257 | 90 | 0.650578 |
b92a92a3e2179abdcee1d545d81c8a81544bebc6 | 5,838 | # 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::Redis::Mgmt::V2017_02_01
#
# A service client - single point of access to the REST API.
#
class RedisManagementClient < MsRestAzure::A... | 38.92 | 154 | 0.698013 |
ff1d28c326a6ceda86f95e2a60a7ec822292cd2b | 6,749 | #! /usr/bin/env ruby
require 'yaml'
require 'erb'
require 'attack_api'
class AtomicRedTeam
ATTACK_API = Attack.new
ATOMICS_DIRECTORY = "#{File.dirname(File.dirname(__FILE__))}/atomics"
# TODO- should these all be relative URLs?
ROOT_GITHUB_URL = "https://github.com/redcanaryco/atomic-red-team"
#
# Ret... | 51.915385 | 182 | 0.696548 |
285311e88e7bb64b7d668670bcef748143c802be | 648 | # rubocop:disable Metrics/LineLength
# == Schema Information
#
# Table name: group_permissions
#
# id :integer not null, primary key
# permission :integer not null
# created_at :datetime not null
# updated_at :datetime not null
# group_member_id :intege... | 23.142857 | 64 | 0.67284 |
5d001537aa1b04f78d4ceea975964dab5985d3a5 | 5,692 | #!/usr/bin/env ruby
# Encoding: utf-8
#
# Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
#
# License:: 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.801047 | 79 | 0.685524 |
f8a5c6cf3e766eeec1458c83d2ae1c7fabbc60fd | 1,496 | require "spec_helper"
RSpec.describe "ElasticsearchDeletionTest" do
it "removes a document from the index" do
commit_document(
"government_test",
{
"link" => "/an-example-page",
},
)
delete "/government_test/documents/%2Fan-example-page"
expect_document_missing_in_rummager... | 23.375 | 92 | 0.619652 |
616c8aae4c8dcac3d518d212dee6344f85b1a3f3 | 68 | module ApplicationHelper
include PagesCore::ApplicationHelper
end
| 17 | 38 | 0.867647 |
39df253f01c71ac7ef902cf44a765f6f336d0fee | 57 | module Annotate
def self.version
'2.7.3'
end
end
| 9.5 | 18 | 0.649123 |
39d4362e0e5bb4c80d347646e556b1322d1b4e7c | 630 | require 'test_helper'
shared_examples
describe 'Database Adapters' do
let(:attributes) do
{ name: 'Ruby' }
end
after :each do
Kind.delete_all
end
describe 'with duplicated record' do
def setup
Kind.mass_insert([attributes])
end
it 'does not raises error if is duplicated and has ... | 21 | 86 | 0.696825 |
e9d2617d3e89a65acd4dc3f4f01811b49487b0cf | 1,664 | #!/usr/bin/env ruby
class FastGame
attr_reader :final_layout
def initialize(initial)
self.circle = Hash.new
(initial.count - 1).times do |i|
self.circle[initial[i]] = initial[i + 1]
end
self.current = initial[0]
self.circle[initial[-1]] = self.current
end
def play(moves)
lowest... | 23.111111 | 98 | 0.656851 |
d5750826eaa078654d7e4a593adf50887a70427b | 3,102 | class Dspdfviewer < Formula
desc "Dual-Screen PDF Viewer for latex-beamer"
homepage "https://dspdfviewer.danny-edel.de/"
url "https://github.com/dannyedel/dspdfviewer/archive/v1.15.1.tar.gz"
sha256 "c5b6f8c93d732e65a27810286d49a4b1c6f777d725e26a207b14f6b792307b03"
revision 8
head "https://github.com/dannyed... | 34.087912 | 94 | 0.645712 |
1a3d14f04f5493129fa70d00fc9acec8d02052fe | 3,664 | # encoding: utf-8
# author: Dominik Richter
# author: Christoph Hartmann
require 'functional/helper'
require 'jsonschema'
require 'tmpdir'
describe 'inspec check' do
include FunctionalHelper
describe 'inspec check with json formatter' do
it 'can check a profile and produce valid JSON' do
out = inspec('... | 35.230769 | 114 | 0.695688 |
01ad06b8d87dc8238b330a165782dbc62fdbf3a7 | 277 | # frozen_string_literal: true
require 'rails_helper'
require 'models/step_shared_examples'
RSpec.describe RimrockStep do
subject { RimrockStep.new('rom', 'my/repo', 'repo_file.erb.sh') }
let(:pipeline) { create(:pipeline) }
it_behaves_like 'pipeline step builder'
end
| 23.083333 | 67 | 0.754513 |
ab983e2fcb79b6e9dc6933a63b65a490f424f03c | 6,378 | # frozen_string_literal: true
require "active_support/core_ext/class/attribute"
module ActiveModel
# == Active \Model \Error
#
# Represents one single error
class Error
CALLBACKS_OPTIONS = [:if, :unless, :on, :allow_nil, :allow_blank, :strict]
MESSAGE_OPTIONS = [:message]
class_attribute :i18n_cu... | 31.418719 | 115 | 0.625902 |
b9546362207c22ddfc0e0e746c731149ef4f8d94 | 1,327 | ##
# $Id$
##
##
# 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'
class Metasploit3 < Msf::Au... | 20.734375 | 72 | 0.639789 |
2874e0a7d5104c96ee5e22b9c764ce326a0c19d3 | 2,129 | require 'json'
require_relative '../lib/karabiner.rb'
TENKEY_MAPPING = {
'm'=> '1',
'comma'=> '2',
'period'=> '3',
'j'=> '4',
'k'=> '5',
'l'=> '6',
'u'=> '7',
'i'=> '8',
'o'=> '9',
'spacebar'=> '0'
}
ARITHMETIC_SYMBOLS_MAPPING = {
'semicolon' => 'keypad_plus',
'p' => 'keypad_hyphen',
'slash'... | 19.712963 | 82 | 0.602161 |
016601eda2e4c98e2cbcd09e4a5632214642bf5d | 341 | cask "font-im-fell-dw-pica" do
version :latest
sha256 :no_check
url "https://github.com/google/fonts/trunk/ofl/imfelldwpica",
verified: "github.com/google/fonts/",
using: :svn
name "IM Fell DW Pica"
homepage "https://fonts.google.com/specimen/IM+Fell+DW+Pica"
font "IMFePIit28P.ttf"
font "... | 24.357143 | 63 | 0.68915 |
39bd88a95a2db8c240dbaee879c9c4c895687334 | 461 | # frozen_string_literal: true
require 'spec_helper'
require 'vk/api/friends/responses/delete_all_requests_response'
RSpec.describe Vk::API::Friends::Responses::DeleteAllRequestsResponse do
subject(:model) { described_class }
it { is_expected.to be < Dry::Struct }
it { is_expected.to be < Vk::Schema::Response }
... | 28.8125 | 72 | 0.748373 |
87e57acbad6af77e95c5be666d71686124b83d7a | 430 | class CreateAppointment < ActiveRecord::Migration[5.1]
def change
create_table :physicians do |t|
t.string :name
t.timestamps
end
create_table :patients do |t|
t.string :name
t.timestamps
end
create_table :appointments do |t|
t.belongs_to :physician, index: true
... | 20.47619 | 54 | 0.651163 |
e24f14b83f9b93d9b1a915e1e1123aa2f46f560d | 1,691 | # frozen_string_literal: true
RSpec.describe Material::Base, type: :material do
subject { described_class }
it { is_expected.to inherit_from Spicerack::AttributeObject }
it { is_expected.to extend_module ActiveSupport::NumberHelper }
it { is_expected.to include_module Conjunction::Junction }
it { is_expe... | 28.183333 | 75 | 0.735659 |
ff6bc768446129a94c3f778113f90e59a2ea9a14 | 395 | # frozen_string_literal: true
require "bundler/setup"
require "panolint"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patc... | 23.235294 | 66 | 0.756962 |
1a7be01c6d667b7f2993375932eb4eb0e602d07a | 5,185 | #
# Be sure to run `pod spec lint QDXTFanqie.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see https://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github... | 37.846715 | 102 | 0.605786 |
61cc5145ebdafc2a5db2e193f376d967b8bea773 | 350 | require 'active_support/concern'
module CamelizeKeys
module ControllerExtension
extend ActiveSupport::Concern
included do
before_filter do
CamelizeKeys.underscore_keys params, deep: true
end
rescue_from CamelizeKeys::CollisionError do |e|
render "public/400", :status => 40... | 19.444444 | 55 | 0.691429 |
e8c2b8812cf7014ad81f3fb0538835b76d9bff38 | 1,047 | # frozen_string_literal: true
require_relative "error"
require_relative "config"
require_relative "credentials"
require_relative "auth/client"
module Firebase
module Admin
# An App holds configuration and state common to all Firebase services that are exposed from the SDK.
class App
attr_reader :proje... | 29.914286 | 105 | 0.684814 |
6154bffcb4a931da351917d382845b1035ccfcbd | 342 | module InformantRails
class Model < Struct.new(:model)
def name
model.class.name
end
def errors
model.errors.map do |field, error|
InformantRails::FieldError.new(field.to_s, model[field], error)
end
end
def as_json(*args)
{ name: name, errors: errors.map(&:as_json... | 19 | 71 | 0.622807 |
d5c8b47cdb804c496b84bc92c2ef71d29801fae8 | 1,590 | class EventsController < ApplicationController
#presents new event form
get '/events' do
redirect_if_not_logged_in #helper method
erb :'/events/new' #renders form for a new event
end
#creates a new event
post '/events/new' do
@user = current_user
event = @user.events.create(:n... | 31.176471 | 106 | 0.669182 |
385006b95c76ebf7cd30fc16611f92dc3a2bf7dd | 725 | Pod::Spec.new do |s|
s.name = 'AWSTranscribe'
s.version = '2.25.0'
s.summary = 'Amazon Web Services SDK for iOS.'
s.description = 'The AWS SDK for iOS provides a library, code samples, and documentation for developers to build connected mobile applications using AWS.'
s.homepage = 'ht... | 40.277778 | 157 | 0.617931 |
e2f1a2363bcc7aff22d5133ad701b53d2b33878f | 4,296 | require 'spec_helper'
describe 'nexus::package', :type => :class do
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts
end
let(:params) {
{
'deploy_pro' => false,
'download_site' => 'http://downl... | 35.8 | 124 | 0.474395 |
283221744384a9baac6ab515de47f11a6edea6a6 | 4,090 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 41.313131 | 102 | 0.759413 |
08bf46b418e51b20c3db3fb34378dab9363a4b84 | 328 | require 'steps/common_steps'
steps_for :search_with_drivers do
include CommonSteps
step "I am on wikipedia.com" do
visit('/')
end
step "I enter word :word" do |word|
fill_in "searchInput", :with => word
end
step "I submit request" do
find(".sprite-icons-search-icon", match: :first).click
e... | 17.263158 | 58 | 0.676829 |
012fdf1d02f606592f3435810a998f60d8e3cc3b | 2,171 | module SmartEnv
EXPLICITLY_FALSE_VALUES = [0, "0", "false", "no"]
def self.keys
@keys ||= []
end
def self.default_values
@default_values ||= {}
end
def self.required_keys
@required_keys ||= []
end
def self.boolean_keys
@boolean_keys ||= []
end
def self.reset!
@keys = nil
... | 20.875 | 85 | 0.640258 |
ab37f9176f01aa319ec646c8823b1a39414e7069 | 2,333 | # server-based syntax
# ======================
# Defines a single server with a list of roles and multiple properties.
# You can define all roles on a single server, or split them:
server "35.182.156.156", user: "ubuntu", roles: %w{app db web}
# server "example.com", user: "deploy", roles: %w{app web}, other_property:... | 33.811594 | 92 | 0.675954 |
21ce7a28e1b2589c4d609a3b2003b9909a3cde04 | 917 | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'undergrounder/version'
Gem::Specification.new do |gem|
gem.name = "undergrounder"
gem.version = Undergrounder::VERSION
gem.authors = ["Enzo Rivello"]
gem.em... | 36.68 | 88 | 0.670665 |
e24f878a50e3d53cb9f86d5eb391ce8954d2913e | 7,091 | require 'xcodeproj/project/object/helpers/groupable_helper'
module Xcodeproj
class Project
module Object
# This class represents a reference to a file in the file system.
#
class PBXFileReference < AbstractObject
# @!group Attributes
# @return [String] the name of the referen... | 29.061475 | 85 | 0.53575 |
d538b49647c3df86ad0056687c0d6c7beab32153 | 2,616 | require File.expand_path('spec_helper', File.dirname(__FILE__))
describe Sunspot::Batcher do
it "includes Enumerable" do
expect(described_class).to include Enumerable
end
describe "#each" do
let(:current) { [:foo, :bar] }
before { allow(subject).to receive(:current).and_return current }
it "ite... | 23.150442 | 91 | 0.630734 |
012a7ced7d01785da72aa9e325d08a3c853cfed1 | 1,674 | require File.expand_path('../integration_test', __FILE__)
module Propono
class SlowQueueTest < IntegrationTest
def test_slow_messages_are_received
topic = "propono-tests-slow-queue-topic"
slow_topic = "propono-tests-slow-queue-topic-slow"
text = "This is my message #{DateTime.now} #{rand()}"
... | 31.584906 | 89 | 0.650538 |
287447ccc8adabe5c8b31815fc74cd079cfb0fee | 760 | require 'rails/generators'
require "rails/generators/active_record"
class FriendlyIdMobilityGenerator < ::Rails::Generators::Base
include ::Rails::Generators::Migration
desc "Generates migration to add locale column to friendly_id_slugs table."
source_root File.expand_path('../templates', __FILE__)
def self... | 30.4 | 77 | 0.760526 |
bfb118c41601388c414190596fa75344174063ec | 37,951 | ##
# This file contains stuff stolen outright from:
#
# rtags.rb -
# ruby-lex.rb - ruby lexcal analyzer
# ruby-token.rb - ruby tokens
# by Keiju ISHITSUKA (Nippon Rational Inc.)
#
require 'rdoc/ruby_token'
require 'rdoc/ruby_lex'
require 'rdoc/code_objects'
require 'rdoc/tokenstream'
require 'rdoc/markup/... | 23.719375 | 88 | 0.601908 |
260add96cfab3b99283a4ca7669b1708d47c0168 | 1,746 | class SalesController < ApplicationController
before_action :require_login, only: [:show, :new, :create, :update]
def new
redirect_to user_path(current_user) unless !current_user.is_manager?
@sale = Sale.new
@manager_products = Product.where('manager_id = ?', current_user.manager_id)
end
def crea... | 26.861538 | 127 | 0.675258 |
1a52fe7bf685e34a7df97ce21c0ebaea1bbe18a2 | 547 | class QuestionPageList
@pages_url = 'http://toster.ru/my/feed_latest?page='
class << self
attr_accessor :pages_url
end
def self.get_questions_ids(user_agent=nil, cookie=nil)
page = Nokogiri::HTML(open("http://toster.ru/questions/latest", {'User-Agent' => user_agent||'', 'Cookie' => cookie||''}))
(1... | 39.071429 | 220 | 0.678245 |
111faf7f8edaad2b582d38c4d2fd529cc81a4b11 | 1,952 | # -*- coding: utf-8 -*-
#
#--
# Copyright (C) 2009-2016 Thomas Leitner <t_leitner@gmx.at>
#
# This file is part of kramdown which is licensed under the MIT.
#++
#
require 'kramdown/parser'
module Kramdown
module Parser
# Used for parsing a document in Markdown format.
#
# This parser is based on the k... | 34.245614 | 120 | 0.667008 |
bf7a94894b7930a5fc3398fd2d90c0c9a6490b09 | 831 | class FontNotoSansMyanmarUi < Formula
head "https://github.com/google/fonts/trunk/ofl/notosansmyanmarui", verified: "github.com/google/fonts/", using: :svn
desc "Noto Sans Myanmar UI"
homepage "https://fonts.google.com/specimen/Noto+Sans+Myanmar+UI"
def install
(share/"fonts").install "NotoSansMyanmarUI-Bla... | 43.736842 | 119 | 0.736462 |
1cb86e2ff6601c4fa146daa07aac2683c2862087 | 1,051 | # encoding: utf-8
$:.push File.expand_path("../lib", __FILE__)
Gem::Specification.new do |s|
s.name = "bootstrap_forms"
s.version = "2.0.1"
s.author = "Seth Vargo"
s.email = "sethvargo@gmail.com"
s.homepage = "https://github.com/sethvargo/bootstrap_forms"
s.summary = %q{Bootstr... | 42.04 | 154 | 0.674596 |
aca0fe2e026f39f6f14109a656f430e65bbdcebb | 3,773 | class Weeet < ApplicationRecord
belongs_to :user
validates :user, presence: true
validates :content, length: { maximum: 280 }, strict: true
has_many :votes, dependent: :destroy
before_create :add_evaluate_at
# def publish!
# self.is_published = true
# self.save!
# end
def self.seed
Activ... | 26.384615 | 87 | 0.588391 |
abf25f4c06ba68bc89e52484cadf40449a280c36 | 2,208 | class User < ApplicationRecord
attr_accessor :remember_token, :activation_token, :reset_token
before_save :downcase_email
before_create :create_activation_digest
validates :name, presence: true, length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: t... | 27.259259 | 76 | 0.703804 |
26ea11a1779c7b92810b561265eb1d7eded41a7c | 1,974 | require 'openssl'
require 'tools_string'
require 'padding'
module AESCipher
module_function
def encryptECB(plaintext,key, padding: true)
cipher = OpenSSL::Cipher::AES.new('128-ECB')
cipher.encrypt
cipher.key = key
cipher.padding = 0 if not padding
cipher.update(plaintext) + cipher.final
end... | 24.073171 | 77 | 0.684904 |
625fc1ea3f80034ad3d090513ff390eb4af0bb2e | 1,291 | # frozen_string_literal: true
# Copyright 2022 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... | 37.970588 | 79 | 0.788536 |
f876ee6dce27f5eb5f758c6e6e2660207b5024e0 | 460 | # encoding: utf-8
module WorldLite
c = Country.new
c.name = 'Venezuela'
c.key = 've'
c.alpha3 = 'VEN'
c.fifa = 'VEN'
c.net = 've'
c.continent_name = 'South America'
c.un = true
c.eu = false
c.euro = false
# Venezuela / South America
# tags: south america, andean s... | 13.939394 | 61 | 0.56087 |
bbb2ef8452c12814084591b35b4c41058d58b47c | 2,641 | ##
# $Id: php_eval.rb 5783 2008-10-23 02:43:21Z ramon $
##
##
# 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/projects/... | 29.344444 | 115 | 0.607724 |
1894b242a710233054c4fc4d4ee61c8a06d2222c | 702 | # frozen_string_literal: true
module HelpScout
class Attachment < HelpScout::Base
class << self
def create(conversation_id, thread_id, params)
HelpScout.api.post(
create_path(conversation_id, thread_id),
HelpScout::Util.camelize_keys(params)
)
true
end
... | 22.645161 | 75 | 0.622507 |
08636473402e26c5a1316d7eb937bf644fa81e30 | 2,068 |
node["nginx"]["lua"]["packages"].each do |package_name|
package package_name do
action :install
end
end
devel_kit_filename = ::File.basename(node['nginx']['lua']['url'])
lua_nginx_module_filename = ::File.basename(node['nginx']['ngx_devel_kit']['url'])
devel_kit_extract_path = "#{Chef::Config['file_cache_pa... | 32.3125 | 118 | 0.710348 |
261f726590f93ce34bc847a8200cd2dad72da70f | 5,650 | # frozen_string_literal: true
require "helper"
require "open-uri"
class TestApplyCommand < BridgetownUnitTest
unless ENV["GITHUB_ACTIONS"]
context "the apply command" do
setup do
@cmd = Bridgetown::Commands::Apply.new
File.delete("bridgetown.automation.rb") if File.exist?("bridgetown.autom... | 42.481203 | 152 | 0.655398 |
e9c5eb7543a33d54c5f86394bddc014b5e29ab23 | 159 | class CreateNotifies < ActiveRecord::Migration[5.2]
def change
create_table :notifies do |t|
t.string :email
t.timestamps
end
end
end
| 15.9 | 51 | 0.666667 |
21fbd611bb43a07c9180bcca6cda41184476aca3 | 2,128 | require 'spec_helper'
describe Member, :type => :model do
it { is_expected.to have_many( :sponsorships ) }
it { is_expected.to have_many( :bills ).through( :sponsorships ) }
describe "information formatted for display" do
before( :each ) do
@member = FactoryBot.create( :member )
end
it "shoul... | 30.4 | 80 | 0.616071 |
79dcd569e0c0b81d2a1381adac325e2b7e3c25c5 | 5,106 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your applica... | 44.4 | 114 | 0.763807 |
28ae3719ab545d4f3d5b600a38f33944bbb5a7d1 | 927 | class Redpen < Formula
desc "Proofreading tool to help writers of technical documentation"
homepage "https://redpen.cc/"
url "https://github.com/redpen-cc/redpen/releases/download/redpen-1.10.4/redpen-1.10.4.tar.gz"
sha256 "6c3dc4a6a45828f9cc833ca7253fdb036179036631248288251cb9ac4520c39d"
license "Apache-2.0"... | 33.107143 | 106 | 0.710895 |
e902ef8bc4d76d4dfd4938211a15f8ad83477bbf | 9,034 | # :nodoc:
class ServiceOptionAssignmentsController < ManageCmrController
add_breadcrumb 'Service Option Assignments', :service_option_assignments_path
def index; end
def new
authorize :service_option_assignment
set_service_entries
set_service_options
end
def create
authorize :service_optio... | 51.622857 | 288 | 0.709763 |
2816572d96e11cfb5356ac86a00923b9bbcd5685 | 70 | # frozen_string_literal: true
module Logster
VERSION = "2.7.1"
end
| 11.666667 | 29 | 0.728571 |
38d4f7a06d091906e469666ac7b01105502d2a1f | 9,252 | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... | 35.860465 | 156 | 0.684825 |
f7f02644f89eaeb1b26d183f0601220f5d20e206 | 1,237 | #!/usr/bin/env ruby
# $Id: test-tracelines.rb 51 2008-01-26 10:18:26Z rockyb $
require 'test/unit'
require 'fileutils'
require 'tempfile'
# require 'rubygems'
# require 'ruby-debug'; Debugger.init
SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__
# Test TestLineNumbers module
class TestLineNumbers1 < Test::Unit::Tes... | 29.452381 | 99 | 0.692805 |
6203738876ab0a57ce85db9a9efeafcc3128bcf1 | 3,892 | module D3Timer
class Timer
@@frame = nil #is an animation frame pending?
@@timeout = nil # is a timeout pending?
@@interval = nil # are any timers active?
@@pokeDelay = 1 #how frequently we check for clock skew , 1sec = 1000ms
@@clockLast = nil
@@clockNow = nil
@@clockSkew = 0
@@clock ... | 22.760234 | 108 | 0.527749 |
ac5a87b2d75bbe3d92ffee10425a98a5757680f4 | 1,144 | # Copyright (c) 2013 Solano Labs All Rights Reserved
require 'socket'
module NoLockFirefox
class PortPool
HOST = "127.0.0.1"
START_PORT = 24576
def initialize(path=nil)
@path_ports = path
@path_ports ||= "/tmp/webdriver-firefox.ports.json"
@random = Random.new
end
... | 20.8 | 57 | 0.570804 |
d5b31e4b94397df5cc12b9b867aeab1ab4a74886 | 846 | class QuestionsController < ApplicationController
before_filter :authenticate_user!
before_action :set_question, only: [:show, :edit, :update, :destroy]
respond_to :html
def index
@questions = Question.all
respond_with(@questions)
end
def show
respond_with(@question)
end
def new
@que... | 17.265306 | 70 | 0.692671 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.