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 |
|---|---|---|---|---|---|
b9efcd84bd6feb01a159986b69b13e48b91ddc3d | 1,466 | class PeopleController < ApplicationController
def new
@person = Person.new
end
def create
@person = Person.find(@person.id) # Guest -> Person
if @person.update_attributes(person_params)
sign_in(@person)
redirect_to :passages
else
flash.now[:error] = "Couldn't create account"
... | 21.880597 | 82 | 0.685539 |
113e0bce163365b974ebe7575f409b3d4a9d4cd7 | 2,274 | if Concurrent.on_jruby?
require 'concurrent/errors'
require 'concurrent/utility/engine'
require 'concurrent/executor/abstract_executor_service'
module Concurrent
# @!macro abstract_executor_service_public_api
# @!visibility private
class JavaExecutorService < AbstractExecutorService
java_im... | 24.717391 | 97 | 0.62533 |
871353ba771f57d795cad1291d12617e64ed224f | 8,061 | require File.dirname(__FILE__) + '/../integration_helper'
describe 'Authentication' do
include Rack::Test::Methods
def app
run_server
end
describe 'sign up action' do
it 'renders the form' do
get '/account/sign-up'
expect(last_response.body).to include '/account/sign-up'
end
de... | 29.855556 | 116 | 0.596328 |
18154b87c7eb1047392bfc0222f46d16fc5b5125 | 14,049 | #!/usr/bin/env ruby
# encoding: UTF-8
# Util functions for the SuccessWhale API.
# Connect to database and all services. Required for every API call.
def connect()
# Connect to the DB, we will need this for all our API functions
@db = Mysql2::Client.new(:host => ENV['DB_HOST'], :username => ENV['DB_USER'], :pass... | 35.65736 | 139 | 0.657983 |
289f402878bef43ea6865a68091de3b617ffb1f8 | 849 | Pod::Spec.new do |s|
s.name = "StreamingKit"
s.version = "0.1.29"
s.summary = "A fast and extensible audio streamer for iOS and OSX with support for gapless playback and custom (non-HTTP) sources."
s.homepage = "https://github.com/tumtumtum/StreamingKit/"
s.license = 'MIT'
s.autho... | 49.941176 | 138 | 0.660777 |
3939981b4276537f0d6c603ddfad63884274655f | 200,257 | SEQUEL_ADAPTER_TEST = :postgres
require_relative 'spec_helper'
uses_pg = Sequel::Postgres::USES_PG if DB.adapter_scheme == :postgres
uses_pg_or_jdbc = uses_pg || DB.adapter_scheme == :jdbc
DB.extension :pg_array, :pg_range, :pg_row, :pg_inet, :pg_json, :pg_enum
begin
DB.extension :pg_interval
rescue LoadError
end
... | 41.912306 | 251 | 0.633136 |
794f906a8053a3f21d4862d46b31234f31f31193 | 1,336 | #
# Cookbook Name:: memcached
# Attrbutes:: default
#
default['memcached'].tap do |memcached|
# Default: DO NOT install memcached
# Override this to true to install memcached
memcached['perform_install'] = true
# Set to true if you want to install from source
# Installing from the Gentoo package in the por... | 33.4 | 89 | 0.731287 |
ac5a3ae318b3cee8641584ac70a9aacc84b7cb74 | 6,096 | require 'sawyer'
require 'octokit/authentication'
module Octokit
# Network layer for API clients.
module Connection
include Octokit::Authentication
# Header keys that can be passed in options hash to {#get},{#head}
CONVENIENCE_HEADERS = Set.new([:accept, :content_type])
# Make a HTTP... | 30.48 | 103 | 0.612369 |
e2cc6baaeb0597d405b058289d3f4fcfeb689f85 | 3,396 | require 'hanami/routing/route'
require 'hanami/commands/generate/action'
module Hanami
class CliSubCommands
class Destroy < Thor
include Thor::Actions
namespace :destroy
desc 'action APPLICATION_NAME CONTROLLER_NAME#ACTION_NAME', 'destroy a hanami action'
long_desc <<-EOS
`hanami... | 32.970874 | 224 | 0.650766 |
acac859847fbcfb1c0dccf7bfdf1b02b0e47f9b1 | 5,448 | require('cartesius/segment')
require('cartesius/determinator')
require('cartesius/numerificator')
require('cartesius/cramer')
module Cartesius
class Ellipse
include Determinator, Numerificator
# Conic
# Conic equation type: ax^2 + by^2 + dx + ey + f = 0
def initialize(x2:, y2:, x:, y:, k:)
@x... | 26.837438 | 133 | 0.588289 |
1d2622d2d48e96e11736ab38a7a1749ec3e283d7 | 108 | module MobileIntegration
class Engine < ::Rails::Engine
isolate_namespace MobileIntegration
end
end
| 18 | 39 | 0.787037 |
b92d9ec2a28474d8d9a4d44d2d4991fedff10dd5 | 2,141 | require 'spec_helper'
RSpec.describe 'Raisex integration specs' do
let(:client) { Cryptoexchange::Client.new }
let(:eth_btc_pair) { Cryptoexchange::Models::MarketPair.new(base: 'ETH', target: 'BTC', market: 'raisex') }
it 'fetch pairs' do
pairs = client.pairs('raisex')
expect(pairs).not_to be_empty
... | 32.938462 | 109 | 0.686128 |
03a9de068bf227b1c457c59de4180e9a9813de11 | 872 | module Users
class Notification < ActiveRecord::Base
belongs_to :user, inverse_of: :notifications
belongs_to :actor, class_name: ::Users::User
belongs_to :target, polymorphic: true
validates :user, presence: true
validates :link_policy, inclusion: { in: ['users', 'admin'] }
scope :find_unre... | 27.25 | 105 | 0.676606 |
6a9b12d31a1a32a1391d98d50cc21c7df00b7d83 | 1,177 | #--
# Author:: Adam Jacob (<adam@chef.io>)
# Author:: Christopher Walters (<cw@chef.io>)
# Copyright:: Copyright 2008-2016, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... | 32.694444 | 82 | 0.747664 |
e295630244e38d88542a010318d454180bc2da6e | 23,689 | # frozen_string_literal: true
require "graphql"
require "graphql/client"
require "json"
require "minitest/autorun"
class TestClient < MiniTest::Test
GraphQL::DeprecatedDSL.activate if GraphQL::VERSION > "1.8"
module NodeType
include GraphQL::Schema::Interface
field :id, ID, null: false
end
module Adm... | 27.935142 | 118 | 0.637258 |
5d2c4e81163e55b61701b73a142f504dd956add5 | 2,852 | # frozen_string_literal: true
RSpec.describe Api::Internal::V2::HearingSerializer do
subject { described_class.new(hearing).serializable_hash }
let(:hearing) do
instance_double("Hearing",
id: "UUID",
court_name: "Bexley Court",
hearing_type: "Committ... | 50.928571 | 153 | 0.66094 |
1ad8d1837b63cae9b9e060519ca85aa8920edd42 | 17,916 | # frozen_string_literal: true
require "socket"
require "cgi"
require "redis/errors"
class Redis
class Client
# Defaults are also used for converting string keys to symbols.
DEFAULTS = {
url: -> { ENV["REDIS_URL"] },
scheme: "redis",
host: "127.0.0.1",
port: 6379,
path: nil,
... | 26.820359 | 111 | 0.555928 |
33df9706ecaf885bf39afaa4bbe0228634b82459 | 636 | # Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... | 48.923077 | 180 | 0.822327 |
381c3565e476400b2772cb1e9a628bd6c154838a | 1,147 | OfficeSpace::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the we... | 32.771429 | 84 | 0.771578 |
ac6862be6c83558c7bbbee5ac0343534b490b2aa | 1,305 | class Lcdproc < Formula
desc "Display real-time system information on a LCD"
homepage "http://www.lcdproc.org/"
url "https://github.com/lcdproc/lcdproc/releases/download/v0.5.9/lcdproc-0.5.9.tar.gz"
sha256 "d48a915496c96ff775b377d2222de3150ae5172bfb84a6ec9f9ceab962f97b83"
bottle do
sha256 "1a875cd265136e... | 38.382353 | 93 | 0.691188 |
4a0546347ae0db238a583de111b48970c0dd16be | 1,769 | # A copy of the original Resque:Plugin class from the "resque" gem
# No need to redefine this class if the resque gem was already loaded
unless defined?(Resque::Plugin)
module Resque
module Plugin
extend self
LintError = Class.new(RuntimeError)
# Ensure that your plugin conforms to good hook ... | 27.215385 | 81 | 0.630865 |
21e90eba01aa3a89c4d874b972a2bbbb5e90b6b8 | 270 | require 'rails_helper'
RSpec.describe "companies/new", type: :view do
before(:each) do
assign(:company, Company.new())
end
it "renders new company form" do
render
assert_select "form[action=?][method=?]", companies_path, "post" do
end
end
end
| 18 | 71 | 0.67037 |
8706ef30481b85d60d774ef447fed9f7a2e0538a | 374 | include_recipe "ca-certificates::default"
execute "update-ca-certificates" do
action :nothing
end
remote_file "/usr/local/share/ca-certificates/sub.class1.server.ca.crt" do
source "https://www.startssl.com/certs/sub.class1.server.ca.pem"
owner "root"
group "root"
mode "644"
action :create_if_missing
... | 24.933333 | 74 | 0.745989 |
11699466d603a4dc72470cb19f3ce14b277fde75 | 259 | class AddUuidIndexToAccount < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
def change
add_index(:accounts, :uuid, unique: true, algorithm: :concurrently)
add_index(:accounts, :idme_uuid, unique: true, algorithm: :concurrently)
end
end
| 28.777778 | 76 | 0.756757 |
336385bf234535cf58246a6728f0547598e6e738 | 339 | class CreateCachedPageReferences < ActiveRecord::Migration
def self.up
create_table :cached_page_references, :force => true do |t|
t.references :cached_page
t.integer :object_id
t.string :object_type
t.string :method
end
end
def self.down
drop_table :cached_page_r... | 24.214286 | 63 | 0.684366 |
1113e5456fa5831a9ffabf166ae7ad0f0ef21815 | 20,964 | # frozen_string_literal: true
describe "OracleEnhancedAdapter establish connection" do
it "should connect to database" do
ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
expect(ActiveRecord::Base.connection).not_to be_nil
expect(ActiveRecord::Base.connection.class).to eq(ActiveRecord::Connecti... | 39.779886 | 179 | 0.698579 |
1d9c9134b5f6c777358c9498a945ed4465363948 | 2,269 | module LinkDemo
class TopLevelController
include Origen::Controller
# JTAG_CONFIG = {
# tclk_format: :rh,
# tclk_multiple: 2
# }
# This is called automatically at the start of generating a pattern
def startup(options = {})
tester.set_timeset(:func_25mhz, 40) # Wher... | 35.453125 | 114 | 0.65227 |
113f3100737b5d41efe6912ef9dac99d9d40f234 | 538 | class JsonWebToken
class << self
def encode(payload, exp = 2.days.from_now)
payload[:exp] = exp.to_i
JWT.encode(payload, ENV['JWT_SECRET'])
end
def decode(token)
body = JWT.decode(token, ENV['JWT_SECRET'])[0]
HashWithIndifferentAccess.new body
rescue JWT::ExpiredSignature, JW... | 31.647059 | 63 | 0.680297 |
1ac572b20aa654b01c50712fd4264648b8c1abb6 | 386 | require 'fastlane_core/ui/ui'
module Fastlane
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
module Helper
class DebiHelper
# class methods that you define here become available in your action
# as `Helper::DebiHelper.your_method`
#
def self.show_message
UI.message(... | 22.705882 | 74 | 0.681347 |
abf0c7eaadf6a2c79c0b4b99ff0341e3a258a3f2 | 813 | # Encoding: UTF-8
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'refinerycms-extensions'
s.version = '1.0'
s.description = 'Ruby on Rails Extensions extension for Refinery CMS'
s.date = '2016-04-13'
s.summary = 'Extensio... | 36.954545 | 77 | 0.597786 |
5d53ca9102bea42d9e347790fabc6b04304a341c | 545 | # frozen_string_literal: true
class CreateListings < ActiveRecord::Migration[6.1]
def change
create_table :listings do |t|
t.string :name
t.string :tag_name
t.string :status
t.date :first_listed
t.string :bedrooms
t.string :bathrooms
t.string :summary
t.string :sqf... | 20.961538 | 51 | 0.629358 |
79fec896b845ffa42d96098662c93a632ebb9c71 | 262 | require 'spec_helper'
describe PageTemplate do
describe "バリデーション" do
subject { create(:page_template) }
it { should validate_presence_of :name }
it { should validate_uniqueness_of :name }
it { should validate_presence_of :content }
end
end
| 21.833333 | 47 | 0.725191 |
01c90b387b51d0d7436a97af8f05da3e2b2294f4 | 557 | require 'formula'
class Gforth < Formula
homepage 'http://bernd-paysan.de/gforth.html'
url 'http://www.complang.tuwien.ac.at/forth/gforth/gforth-0.7.2.tar.gz'
sha256 '77db9071c2442da3215da361b71190bccb153f81f4d01e5e8bc2c2cf8ee81b48'
depends_on 'libtool' => :run
depends_on 'libffi'
depends_on 'pcre'
def... | 27.85 | 80 | 0.718133 |
18815905ba2e9e5442253d369ec46f6a9a2ae56e | 2,320 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'rubycritic/version'
Gem::Specification.new do |spec|
spec.name = 'rubycritic'
spec.version = RubyCritic::VERSION
spec.authors = ['Guilherme Simoes']
spec.e... | 40.701754 | 94 | 0.657328 |
03106a6584f434f9b28a067ccca7cb397fbdb2eb | 4,795 | require 'spec_helper'
describe 'nginx::package' do
shared_examples 'redhat' do |operatingsystem|
let(:facts) {{ :operatingsystem => operatingsystem, :osfamily => 'RedHat', :operatingsystemmajrelease => '6' }}
context "using defaults" do
it { is_expected.to contain_package('nginx') }
it { is_expe... | 40.982906 | 123 | 0.631283 |
87257b8f9203560ad4909ad2efaf1b7eb6a37a62 | 13,392 | # Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 38.930233 | 245 | 0.67376 |
01164810e8fbc5fc8f3b33af89a76808b73d4bd1 | 382 | cask "font-sulphur-point" do
version :latest
sha256 :no_check
url "https://github.com/google/fonts/trunk/ofl/sulphurpoint",
verified: "github.com/google/fonts/",
using: :svn
name "Sulphur Point"
homepage "https://fonts.google.com/specimen/Sulphur+Point"
font "SulphurPoint-Bold.ttf"
font "... | 25.466667 | 63 | 0.712042 |
abe165bab65c1d5eca73ca9dc64278c088fb4790 | 1,551 | module Dawn
module Kb
module OwaspRorCheatSheet
class CommandInjection
include PatternMatchCheck
def initialize
message = "Ruby offers a function called \"eval\" which will dynamically build new Ruby code based on Strings. It also has a number of ways to call system commands. Whil... | 53.482759 | 603 | 0.662798 |
9118fb5831b8832332335f6234887b8e8280f84e | 2,101 | ##
# WARNING: Metasploit no longer maintains or accepts meterpreter scripts.
# If you'd like to imporve this script, please try to port it as a post
# module instead. Thank you.
##
#Meterpreter script for running multiple scripts on a Meterpreter Session
#Provided by Carlos Perez at carlos_perez[at]darkoperator[dot]... | 26.594937 | 139 | 0.63684 |
79c76285830fa3d0f8fec19fbcfae2f46ec70027 | 4,499 | # frozen_string_literal: true
require 'devise/warden/hooks/expirable'
module Devise
module Models
# Deactivate the account after a configurable amount of time. To be able to
# tell, it tracks activity about your account with the following columns:
#
# * last_activity_at - A timestamp updated when t... | 35.992 | 138 | 0.63792 |
e905d5701c1b0da926089e72116959c3fcd880aa | 118 | FactoryGirl.define do
factory :game do |f|
name "Name"
producer "Producer"
release_year "2016"
end
end | 16.857143 | 23 | 0.669492 |
b9570b41d3b03e5f232af6c9d10b38c152444b5c | 304 | class StatusSweeper < ActionController::Caching::Sweeper
observe Status
def after_create(status)
expire_fragment('status_index')
end
def after_update(status)
expire_action(:controller => 'statuses', :action => 'show', :id => status.id)
expire_fragment('status_index')
end
end
| 21.714286 | 81 | 0.713816 |
bb3f4c3a1328412f9f433e88ab74104d2cb8b8fd | 423 | class Api::V1::FarmerSerializer < ActiveModel::Serializer
attributes :phone_number,
:association_name,
:country,
:county,
:registration_time,
:name,
:gender,
:year_of_birth,
:received_loans
def reports
instance_options[:farmer_reports]
end
has_many :reports, include_data: ... | 21.15 | 78 | 0.713948 |
18860b980d78e7441f0ab459deb43cf32d2138e7 | 26 | set :rails_env, "staging"
| 13 | 25 | 0.730769 |
18d3b2d99b72cb8635a0cb3039673f386e15f5be | 5,033 | # frozen_string_literal: true
FactoryBot.define do
factory :service do
project
type { 'Service' }
end
factory :custom_issue_tracker_service, class: 'CustomIssueTrackerService' do
project
active { true }
issue_tracker
end
factory :emails_on_push_service do
project
type { 'EmailsO... | 24.432039 | 124 | 0.661435 |
393e76f2433bd175f3aa4cbe537e83c612bad652 | 2,496 | # Copyright (C) 2009-2014 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 32.415584 | 74 | 0.657051 |
1a2821bd6a1f6765f71b0e37cc8cdd68514f1210 | 2,346 | #
# tkextlib/iwidgets/radiobox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
#
require 'tk'
require 'tkextlib/iwidgets.rb'
module Tk
module Iwidgets
class Radiobox < Tk::Iwidgets::Labeledframe
end
end
end
class Tk::Iwidgets::Radiobox
TkCommandNames = ['::iwidgets::radi... | 20.051282 | 75 | 0.626598 |
263415bce28262169d12fc4874edb0ee0e2bbd3f | 1,608 | # Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 34.212766 | 90 | 0.726368 |
617cc601a953a543878088d4592562f3cb966b84 | 532 | module Issues::Validation
extend ActiveSupport::Concern
included do
validates :customer, :entry, :operation, :currency,
length: { maximum: 255 }, allow_nil: true, allow_blank: true
validates :close_date, timeliness: { type: :date }, allow_blank: true
validates :customer, :entry, :operation, :curr... | 35.466667 | 85 | 0.718045 |
1c6fab008f8af1e64b012541ef515a24e3bf0595 | 305 | class Location < ApplicationRecord
has_many :notes, dependent: :nullify
has_many :notebooks, through: :notes
validates_presence_of :name
# validates :name, presence: true
def reassign_default_location_of_notes
self.notes.map do |note|
note.location_id = Location.first.id
end
end
end
| 20.333333 | 42 | 0.760656 |
395d739a721cea12486c4bc4a639acf9fb41952b | 1,172 | require 'rimageanalysistools'
require 'rimageanalysistools/get_image'
require 'rimageanalysistools/create_parameters'
require 'rimageanalysistools/simple_output'
require 'pericentromere/find_centromeres'
require 'pericentromere/resegment_within_regions'
require 'pericentromere/quantification'
module Pericentromere
d... | 24.416667 | 123 | 0.823379 |
f8dded1ca8ae1f4e788181fab5033ddd6448d3b9 | 1,600 | # (c) Copyright 2020 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 25 | 84 | 0.774375 |
e9efadfb4d7cd40d71ab2627ee8ff288fea475b5 | 341 | class AddCoverImageToPortfolioProjects < ActiveRecord::Migration
def change
add_column :portfolio_projects, :cover_image_id, :string
add_column :portfolio_projects, :cover_image_filename, :string
add_column :portfolio_projects, :cover_image_size, :integer
add_column :portfolio_projects, :cover_image_content_ty... | 37.888889 | 68 | 0.832845 |
ac670597f61608191e9a0e71403c480306f12f09 | 576 | class Spree::ContactsController < Spree::StoreController
helper "spree/products"
def new
@contact = Spree::Contact.new
render 'spree/contacts/contact'
end
def create
@contact = Spree::Contact.new(permit_attributes)
if @contact.save
#todo mailer here
redirect_to(spree.root_path,... | 18 | 82 | 0.689236 |
4ae7a0c16dcee1834cc0686b008d6191d30fa367 | 736 | class Tag::Public::Node::TagsController < Tag::Public::NodeController
def pre_dispatch
@node = Page.current_node
@content = Tag::Content::Tag.find(Page.current_node.content_id)
end
def index
@items = @content.tags
.paginate(page: params[:page], per_page: 50)
@items = Cms::Con... | 28.307692 | 79 | 0.682065 |
91e2f580bdd6c1f49a37434fdd6e1262c7cbc09b | 669 | module ActiveAdmin
# A simple object that gets used to present different aspects of views
#
# Initialize with a set of options and a block. The options become
# available using hash style syntax.
#
# Usage:
#
# presenter = PagePresenter.new as: :table do
# # some awesome stuff
# end
... | 20.272727 | 72 | 0.61435 |
79f9ecb39cf19fa6683de64326b7173938ec178c | 793 | # frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Graphql::Loaders::BatchModelLoader do
describe '#find' do
let(:issue) { create(:issue) }
let(:user) { create(:user) }
it 'finds a model by id' do
issue_result = described_class.new(Issue, issue.id).find
user_result = descr... | 25.580645 | 63 | 0.65826 |
014e793d8ff79c9c8d3f5757617d1516e85703d2 | 811 | cask "hackolade" do
version "5.4.5"
sha256 :no_check
url "https://s3-eu-west-1.amazonaws.com/hackolade/current/Hackolade-mac-setup-signed.pkg",
verified: "s3-eu-west-1.amazonaws.com/hackolade/current/"
name "Hackolade"
desc "Data Modeling for NoSQL databases, storage formats, REST APIs, and JSON in RDB... | 28.964286 | 92 | 0.704069 |
7abeaba14fa0868b6adfc0b09c25636206e4d054 | 5,555 | # frozen_string_literal: true
# Copyright 2021 Teak.io, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | 36.30719 | 124 | 0.668767 |
384db2b8e6604a48e1c65a18bb852135c3aa5295 | 1,723 | require_relative './test_helper'
require_relative '../../lib/cdo/rack/request'
require 'cdo/geocoder'
require 'geocoder'
require 'webmock/minitest'
class RequestTest < Minitest::Test
def test_shared_cookie_domain
[
['code.org', 'code.org'],
['studio.code.org', 'code.org'],
['test.code.org', 'co... | 38.288889 | 127 | 0.668601 |
7970f747ca52afad318918da070e3e725ffa3583 | 5,231 | module GeoKitchen
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
# Dynamically define instance methods on including model
def acts_as_geo_ingredient(opts={})
model = opts[:model] || self.name
attributes = opts[:attributes] || [:name]
# Returns a GeoIngr... | 27.244792 | 102 | 0.649589 |
f8fcfd380012a60ec58a6f2d3e218746e170d014 | 357 | cask 'ynab' do
version '4.3.817'
sha256 '66ff8fd735b69fa16fe884f91913fd4ef867fb03980631bb7d32b18cf68e400a'
url "https://www.youneedabudget.com/CDNOrigin/download/ynab4/liveCaptive/Mac/YNAB4_LiveCaptive_#{version}.dmg"
name 'You Need A Budget'
name 'YNAB'
homepage 'https://www.youneedabudget.com/'
license... | 27.461538 | 112 | 0.767507 |
8733ceb1407c162e2d8e7e6710ae9896bca32499 | 3,896 | class AdvocacySite
def self.get_blocks(request)
[
{
type: "block",
title_actual: "TAKE ACTION",
text: "",
color1: "118, 101, 160",
color2: "166, 155, 193",
image: "/images/advocacy3.jpg",
links:
[
{
text_actual: "Let... | 30.4375 | 149 | 0.480493 |
26e65711e9fadb74c67746fedbd1086ac33a6d37 | 7,728 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe HelpController do
include StubVersion
include DocUrlHelper
let(:user) { create(:user) }
shared_examples 'documentation pages local render' do
it 'renders HTML' do
aggregate_failures do
is_expected.to render_template('help/s... | 28.20438 | 113 | 0.6272 |
264214180f9f7a2887f5eb0abdd286fbf003862b | 1,351 | require_relative '../../bundler_setup'
require 'log4r'
require 'VMwareWebService/MiqVim'
require 'VMwareWebService/MiqVimBroker'
#
# Formatter to output log messages to the console.
#
class ConsoleFormatter < Log4r::Formatter
def format(event)
(event.data.kind_of?(String) ? event.data : event.data.inspect) + "\n... | 24.125 | 92 | 0.697261 |
1c294b9b1631177116f34e0461d6bd05a28bf81b | 519 | module StackMaster
module ParameterResolvers
class LatestAmiByTags < Resolver
array_resolver class_name: 'LatestAmisByTags'
def initialize(config, stack_definition)
@config = config
@stack_definition = stack_definition
@ami_finder = AmiFinder.new(@stack_definition.region)
... | 27.315789 | 78 | 0.695568 |
f80775bbd409d72659b169a27c271da6f6f14695 | 1,483 | # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | 29.66 | 78 | 0.678355 |
0814c08db6b6c342e198ffcf09b3104472c0b836 | 208 | require 'minitest_helper'
class TestLastMile < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::LastMile::VERSION
end
def test_it_does_something_useful
assert false
end
end
| 17.333333 | 39 | 0.788462 |
e284c3fbfb2db1b5f479ceef2ae9e8601684975e | 7,145 | # test-loop
# loops a green light from left to right, and then a blue one from right to left
# put in our requirements.
require '../../libcombustd/libcombustd';
puts "\nRunning test-loop\n"
# Some dummy code to test the Ambx interface
# try to connect and open the device and then loop trough some colors.
if Ambx.co... | 68.047619 | 98 | 0.719944 |
8718e9413503d2ab6ff373e514f12476e89148a2 | 2,393 | # encoding: utf-8
module Mongoid
module Attributes
# This module defines behaviour for readonly attributes.
module Readonly
extend ActiveSupport::Concern
included do
class_attribute :readonly_attributes
self.readonly_attributes = ::Set.new
end
# Are we able to write ... | 30.291139 | 103 | 0.605934 |
1a8fc46dfe0a02f2f714f58c100e53abaa6cc375 | 3,275 | 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.455696 | 102 | 0.763969 |
ab66dd3350921c1411021ae24e63dc6bf5c5fcc2 | 275 | # Devise's user notification mailer
#
# We override this class in order to use our custom mail layout.
class DeviseMailer < Devise::Mailer
include Roadie::Rails::Automatic
include Devise::Controllers::UrlHelpers
default from: 'PupilFirst <noreply@pupilfirst.com>'
end
| 27.5 | 64 | 0.774545 |
1c2b45b7ea405dd47923b9f5ce5a62fbb5eb8435 | 256 | require "flex_commerce_api/api_base"
module FlexCommerce
#
# A flex commerce PaymentProcess model
#
# This model provides access to the flex commerce "process order" resource
#
#
#
class PaymentProcess < FlexCommerceApi::ApiBase
end
end
| 18.285714 | 76 | 0.738281 |
ff25d1e36446369944805766f47db29307851bc5 | 1,240 | # -*- encoding: utf-8 -*-
$:.push File.expand_path('../lib', __FILE__)
require 'redis/actionpack/version'
Gem::Specification.new do |s|
s.name = 'redis-actionpack'
s.version = Redis::ActionPack::VERSION
s.authors = ['Luca Guidi']
s.email = ['me@lucaguidi.com']
s.homepage = 'http://red... | 38.75 | 83 | 0.657258 |
38729a2254740f604d4f7fbf5676324d41b45e13 | 4,210 | require "lita/adapters/hipchat/callback"
require "xmpp4r"
require "xmpp4r/roster/helper/roster"
require "xmpp4r/muc/helper/simplemucclient"
require "xmpp4r/muc/helper/mucbrowser"
module Lita
module Adapters
class HipChat < Adapter
class Connector
attr_reader :robot, :client, :roster
def i... | 27.880795 | 78 | 0.569834 |
08c6438eb2759ac630bce4fa397b3055c627e58b | 4,697 | # frozen_string_literal: true
load './lib/common.rb'
@startAt = 1
@maxResults = -1
unless ARGV[0].nil?
goodbye("Invalid ARGV1='#{ARGV[0]}', must be 'startAt=number' where number > 0") unless /^startAt=([1-9]\d*)$/.match?(ARGV[0])
m = /^startAt=([1-9]\d*)$/.match(ARGV[0])
@startAt = m[1].to_i
unless ARGV[1].n... | 35.583333 | 136 | 0.713221 |
38b81c5c86be76bbd1d35e0b0c5f190095d6cbd7 | 50 | require 'rspec/autorun'
$: << 'lib'
require 'lani' | 16.666667 | 23 | 0.66 |
f78a9aa4c71b9e7cce68ef748da10be27015a0f4 | 13,664 | =begin
#BrowserUp Proxy
#___ This is the REST API for controlling the BrowserUp Proxy. The BrowserUp Proxy is a swiss army knife for automated testing that captures HTTP traffic in HAR files. It is also useful for Selenium/Cypress tests. ___
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-... | 35.035897 | 219 | 0.633563 |
e223deb46e8afdea358c9bdee7deccae11dd739c | 350 | module Sidekiq
module Overlord::ClientMiddleware
class PrepareWorker
def call(worker_class, msg, queue, redis_pool)
msg['retry'] = false
if msg['args'].first.try(:has_key?, 'job_namespace')
job_namespace = msg['args'].first['job_namespace']
msg['queue'] = job_namespace
end
yield... | 21.875 | 57 | 0.648571 |
08d4bee7aff33e03ec1f3f39d4a8c6859320cfea | 747 | #
# Cookbook Name:: nfs
# Recipe:: client4
#
# Copyright 2011, Eric G. Wolfe
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | 31.125 | 74 | 0.746988 |
87865e9580477a388181ffc04be661ff659c7467 | 8,810 | =begin
#Hydrogen Integration API
#The Hydrogen Integration API
OpenAPI spec version: 1.3.1
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.21
=end
require 'date'
module IntegrationApi
# Kms Config details
class KmsConfig
attr_... | 28.603896 | 151 | 0.610443 |
6afb62d092cdb3815f2dce47b3b56258c7c5f517 | 722 | module Activity
class Show < Operations::Base
# TODO: Consider moving this to configuration
HISTORY_DEPTH = 1.year.ago
def call
{
json: { activity: posts_per_day }.merge(meta)
}
end
private
def posts_per_day
posts.group('DATE(created_at)').count.sort.to_h
end
... | 17.190476 | 57 | 0.598338 |
33a7584c33d30899c112d2d5fb7ab5c65992de3d | 2,315 | # frozen_string_literal: true
module Authentication
class SubjectReceiver
include RapidRack::DefaultReceiver
include RapidRack::RedisRegistry
def map_attributes(_env, attrs)
{
targeted_id: attrs['edupersontargetedid'],
shared_token: attrs['auedupersonsharedtoken'],
name: at... | 28.231707 | 79 | 0.650972 |
ff74164af0f65ada189fc44090eca399cf564cac | 1,307 | class GitNumber < Formula
desc "Use numbers for dealing with files in git"
homepage "https://github.com/holygeek/git-number"
url "https://github.com/holygeek/git-number/archive/1.0.1.tar.gz"
sha256 "1b9e691bd2c16321a8b83b65f2393af1707ece77e05dab73b14b04f51e9f9a56"
bottle do
sha256 cellar: :any_skip_reloc... | 50.269231 | 122 | 0.79648 |
7af55a0bd7fb08437284cce87b314a6987cd40a7 | 6,733 | Pod::Spec.new do |s|
s.name = 'DeltaDNAAds'
s.version = '1.7.0-beta.2'
s.license = { :type => 'APACHE', :file => 'LICENSE' }
s.summary = 'Smart advertising mediation from deltaDNA.'
s.homepage = 'https://www.deltadna.com'
s.authors = { 'David White' => 'david.white@deltadna.com' }
s.source =... | 43.720779 | 107 | 0.685578 |
bf152e99186084a7fc7dbcff7714d912902fd542 | 1,028 | class Gputils < Formula
desc "GNU PIC Utilities"
homepage "http://gputils.sourceforge.net/"
url "https://downloads.sourceforge.net/project/gputils/gputils/1.5.0/gputils-1.5.0.tar.gz"
sha256 "f6a517c186b991f504be5e4585316871d5950568257885d37487bb368dc76227"
bottle do
sha256 "e92667f348195c4500354273997257... | 35.448276 | 92 | 0.731518 |
d56cfffb8a995f011856da42ed74417fda68ff6e | 34 | require '<%= file_name %>_filter'
| 17 | 33 | 0.676471 |
610a1697f85c2bfcb07f379f979d29b7e2e79817 | 2,396 | module Puppet
Type.newtype(:sshkey) do
@doc = "Installs and manages ssh host keys. By default, this type will
install keys into `/etc/ssh/ssh_known_hosts`. To manage ssh keys in a
different `known_hosts` file, such as a user's personal `known_hosts`,
pass its path to the `target` parameter. See... | 31.526316 | 151 | 0.638147 |
87954d1fc90aa1bd47b9a48dc290c41aa60fab1e | 216,641 | # 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
require 'seahorse/client/plugins/content_length.rb'
require 'aws-sdk-core/plug... | 52.531765 | 923 | 0.680601 |
bf83b7f6426219c789f6c16a65f97ee22d5ba7be | 569 | Pod::Spec.new do |s|
s.name = 'CSV.swift'
s.version = '2.2.1'
s.license = 'MIT'
s.summary = 'CSV reading and writing library written in Swift.'
s.homepage = 'https://github.com/yaslab/CSV.swift'
s.authors = { 'Yasuhiro Hatta' => 'hatta.yasuhiro@gmail.com' }
s.source = { :git => 'https://github.com/yaslab/... | 31.611111 | 85 | 0.653779 |
086860d0c40af4d0cdf661b0f6bdc86c1a14e732 | 192 | class AddAmountSpentSinceStartDateToAdArchiveReportPage < ActiveRecord::Migration[6.0]
def change
add_column :ad_archive_report_pages, :amount_spent_since_start_date, :integer
end
end
| 32 | 86 | 0.838542 |
bb5186c32038a4000d7338598fc0ee4c8543511d | 1,888 | class Cms::Admin::LayoutsController < Cms::Controller::Admin::Base
include Sys::Controller::Scaffold::Base
include Sys::Controller::Scaffold::Publication
def pre_dispatch
return error_auth unless Core.user.has_auth?(:designer)
end
def index
@items = Cms::Layout.readable.order(:name, :id).paginate(pa... | 25.513514 | 107 | 0.634004 |
8701956ee8e4ad656fe95b7df3c75ca73d1d8bba | 91 | Rails.application.routes.draw do
resource :painters, only: [:show, :create, :update]
end
| 22.75 | 53 | 0.736264 |
1823ee3a139578346dbd96272649932da91d9b92 | 505 | class ChangeRiskLevelToEnum < ActiveRecord::Migration[5.2]
def up
safety_assured do
execute <<-SQL
CREATE TYPE risk_levels AS ENUM ('serious', 'high', 'medium', 'low', 'other');
SQL
remove_column :investigations, :risk_level, :integer
add_column :investigations, :risk_level, :risk_... | 22.954545 | 86 | 0.655446 |
7a2eeda74c4177d9f6f69fe6a8512bb57b6635cf | 907 | # frozen_string_literal: true
RSpec.shared_context "with example flow having state" do |extra_flow_modules = nil|
subject(:example_flow) { example_flow_class.new }
let(:root_flow_modules) { [ ShortCircuIt, Technologic, Flow::Callbacks, Flow::Core ] }
let(:flow_modules) { root_flow_modules + Array.wrap(extra_flo... | 34.884615 | 88 | 0.753032 |
21b14e7b7090a4581f0178dd9ef94f89de5f8a36 | 260 | class UserMailer < ApplicationMailer
def account_activation(user)
@user = user
mail to: user.email, subject: "Account activation"
end
def password_reset(user)
@user = user
mail to: user.email, subject: "Password reset"
end
end
| 17.333333 | 54 | 0.680769 |
ed105811ee7bc52165da521360d47bb4245b2291 | 2,980 | require 'spec_helper'
describe OmniAuth::Strategies::WSFed::AuthCallback do
describe 'Initialization' do
context 'with Invalid Context' do
it 'should raise an exception when raw callback is nil' do
expect { described_class.new(nil, {}) }.to raise_error ArgumentError
end
it 'should r... | 32.043011 | 136 | 0.656376 |
1d08a5e3bcb18a5fce0e6e60f6f7085eab706dfd | 197 | class UserMailer < ActionMailer::Base
default from: "railscasts@example.com"
def signup_confirmation(user)
@user = user
mail to: user.email, subject: "Sign Up Confirmation"
end
end
| 19.7 | 56 | 0.720812 |
280b13b4c3b804f12757e98b21cb51ad6d60a1ad | 503 | module Fog
module Linode
class DNS
# This class provides the actual implementation for service calls
class Real
def update_domain(id, options = {})
response = request(
expects: [200],
method: 'PUT',
path: "domains/#{id}",
body: Fog::JSO... | 22.863636 | 71 | 0.49503 |
01c8e35822e09b3113c99ba444f35de15d019afc | 845 | class UspsConfirmationCode < ApplicationRecord
belongs_to :profile
def self.first_with_otp(otp)
find do |usps_confirmation_code|
Pii::Fingerprinter.verify(
Base32::Crockford.normalize(otp),
usps_confirmation_code.otp_fingerprint
)
end
end
def expired?
code_sent_at < Fig... | 23.472222 | 70 | 0.752663 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.