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 |
|---|---|---|---|---|---|
4a236452d094681582727941a116c15a462205ad | 6,299 | #!/usr/bin/ruby
require 'pg'
require 'date'
class Database
# The following block of code uses the Ruby PG (postgres) to connect to the local bookstore database that I created in postgres
# It connects to it using the authentication/credentials that I setup for my system
# The begin keyword matches with th... | 32.302564 | 239 | 0.631529 |
bf9f13a254f4fba22dd55483fbf4d0ce851cb7d6 | 4,989 | require "support/runner_support"
module RSpec::Core
RSpec.describe "Configuration :suite hooks" do
[:before, :after, :prepend_before, :append_before, :prepend_after, :append_after].each do |registration_method|
type = registration_method.to_s.split('_').last
describe "a `:suite` hook registered with... | 36.416058 | 115 | 0.60914 |
4aba3562fa379d87da9f1a590cc7f2db67ab29b2 | 462 | # @type var a: Integer
# !expects IncompatibleAssignment: lhs_type=::Integer, rhs_type=(::Integer | ::Array[::String] | nil | ::String)
a = case 1
when 2
1
when 0, 100
["String"]
when 3
nil
when 4
else
"string"
end
# !expects IncompatibleAssignment: lhs_type=::Integer, ... | 21 | 112 | 0.601732 |
d51322603441a20434215a8ca25a067329200533 | 350 | Gem::Specification.new do |s|
s.name = 'toggl_cli'
s.version = '1.3.0'
s.files = ["lib/toggl_cli.rb"]
s.summary = "A simple command line tool for toggl"
s.authors = ["Blake Erickson"]
s.license = 'MIT'
s.homepage = 'https://github.com/oblakeerickson/toggl_cli'
s.executables = ['toggl_cli']
s.add_depen... | 29.166667 | 60 | 0.66 |
d500a1080c1225eba7c9d17b2c1b516c31970d7e | 240 | require 'open-uri'
require 'pry'
require 'nokogiri'
require 'rainbow'
require_relative "./fresh_tomatoes/version"
require_relative "./fresh_tomatoes/cli"
require_relative "./fresh_tomatoes/movie"
require_relative "./fresh_tomatoes/scraper" | 26.666667 | 43 | 0.8125 |
5d9477d3c38dc1454db0bdfac6158400869bfd3b | 5,401 | # rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/MethodLength
module Fastlane
class ActionsList
def self.run(filter: nil, platform: nil)
require 'terminal-table'
if filter
show_details(filter: filter)
else
print_all(platform: platform)
end
end
def self.p... | 31.770588 | 134 | 0.583596 |
795faab6661825df259a55c72681fd11131b3372 | 1,659 | # -*- encoding: utf-8 -*-
# stub: activemodel 6.1.4.1 ruby lib
Gem::Specification.new do |s|
s.name = "activemodel".freeze
s.version = "6.1.4.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "bug_tracker_uri" => "https://github.co... | 50.272727 | 420 | 0.719711 |
6a4b1cbada40f3aa398b7bab8da28d8eaa1b2bd5 | 568 | require 'spec_helper'
RSpec.describe NewspaperWorks::PlaceOfPublicationPresenterBehavior do
let(:pop) { 'Marysville, California, United States' }
let(:request) { double(host: 'example.org') }
let(:solr_document) do
SolrDocument.new(id: 'abc123',
place_of_publication_label_tesim: [pop])
... | 31.555556 | 86 | 0.714789 |
012fdb2c97e8199192aaa05bd01eed8e140af618 | 6,410 | =begin
#Accounting API
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.1
=end
require 'time'
require 'date'
module... | 30.669856 | 213 | 0.636037 |
187d08bba336a9131059a6b7b066286670273273 | 253 | require "colorize"
require 'nokogiri'
require 'open-uri'
require_relative "./menu_count/version"
require_relative "./menu_count/cli"
require_relative "./menu_count/scraper"
require_relative "./menu_count/category"
require_relative "./menu_count/item"
| 23 | 40 | 0.802372 |
6a00da1359c3f0aef24a1e28ac0abe50d76f66b7 | 18,382 | #--
# benchmark.rb - a performance benchmarking library
#
# $Id$
#
# Created by Gotoken (gotoken@notwork.org).
#
# Documentation by Gotoken (original RD), Lyle Johnson (RDoc conversion), and
# Gavin Sinclair (editing).
#++
#
# == Overview
#
# The Benchmark module provides methods for benchmarking Ruby code, giving
# de... | 32.249123 | 106 | 0.573985 |
1a9ca23720ed1efc19d92d3594e9ce6f8414630f | 1,896 | class Xdot < Formula
desc "Interactive viewer for graphs written in Graphviz's dot language"
homepage "https://github.com/jrfonseca/xdot.py"
url "https://files.pythonhosted.org/packages/0f/1b/7ae17e0931ff011bba1c86000674666176021756d07ed29ce0b263b3fddf/xdot-1.1.tar.gz"
sha256 "e15c53d80dc8777402a7258eebe6cbf395... | 41.217391 | 136 | 0.784283 |
79cd4ff6f19c6060c4113e696c9053e27b37b59a | 1,169 | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'bundler/setup'
require 'vedeu'
TESTCASE = 'dsl_app_geometry_001'
class DSLApp
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
Vedeu.configure do
debug!
log Dir.tmpdir + '/vedeu.log'
renderers [
Vedeu::Renderers::Ter... | 17.191176 | 62 | 0.598802 |
ed63fe987c8079f7df4e2c9b14257725dffdfe89 | 208 | require 'fileutils'
CYME_TEST_PATH = File.join(Dir.pwd(), 'REMOVE_ME')
CYME_OUTPUT = StringIO.new()
END {
if !ENV['SKIP_CLEANUP']
FileUtils.remove_dir(CYME_TEST_PATH, :force => true)
end
}
| 17.333333 | 60 | 0.673077 |
389f75a988b84b575155af8a1e4fa5a0d62c037e | 384 | # dependencies of the pupu
dependencies :mootools
# javascripts for loading
javascript "form-defaults"
stylesheet "form-defaults"
# parameters of plugin
# it will be blank in most cases
#parameter :request, :optional => ["local", "ajax"] do |type|
# javascript "lib/autocompleter.#{type}"
#end
# you can put there me... | 24 | 70 | 0.75 |
33984e2bf882fe97c2e353a4a78eae919d25dcd3 | 12,128 | require 'spec_helper'
describe ActiveData::Model::Attributes do
let(:model) do
stub_model do
include ActiveData::Model::Associations
include ActiveData::Model::Localization
attribute :id, Integer
attribute :full_name, String
alias_attribute :name, :full_name
localized :t, St... | 34.552707 | 124 | 0.612302 |
d50eef89593b668cccba4c8cfe67074c502940b5 | 4,591 | # frozen_string_literal: true
require 'json'
require 'bolt/util'
module Bolt
module PuppetDB
class Config
if ENV['HOME'].nil?
DEFAULT_TOKEN = Bolt::Util.windows? ? 'nul' : '/dev/null'
DEFAULT_CONFIG = { user: '/etc/puppetlabs/puppet/puppetdb.conf',
global: '/etc/... | 29.242038 | 108 | 0.581355 |
110a0ca5ec300693bef172ef45fba3344279b76d | 4,261 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::Tcp
include Msf::Exploit::Remote::HttpClient
include ... | 30.219858 | 140 | 0.595635 |
d54b37cc820d8bffa0121f69b2805df0c09b068b | 3,463 | 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.22619 | 100 | 0.756281 |
f87639d86e760b1d216baf0b7c83a3fefd0f3ad7 | 313 | # This is an autogenerated file. See readme.md.
require 'pandarus/model_base'
module Pandarus
class SubmissionHistory < ModelBase
include Virtus.model(finalize: false)
attribute :submission_id, resolve_type("Integer")
attribute :versions, resolve_type("Integer", collection: true)
end
end
| 22.357143 | 66 | 0.747604 |
1d49d8c2584663791f76b7c5ba731d534cdeb763 | 376 | require 'rails_helper'
RSpec.describe Company, type: :model do
describe '#valid?' do
subject { Company.new(params) }
let(:params) { { name: name } }
let(:name) { 'Test company' }
context 'with valid attributes' do
it { should be_valid }
end
context 'without name' do
let(:name) {... | 19.789474 | 39 | 0.603723 |
1d9b4a9a28cda0e81ac39419ced53b4ce91ce2c5 | 1,218 | class Akamai < Formula
desc "CLI toolkit for working with Akamai's APIs"
homepage "https://github.com/akamai/cli"
url "https://github.com/akamai/cli/archive/1.1.1.tar.gz"
sha256 "fd29fb3639f0c6d0d3c0b9d19ffebb935d8d9ea693533d1255c42f55a3860a00"
bottle do
cellar :any_skip_relocation
sha256 "16764dec8d... | 33.833333 | 94 | 0.7422 |
260b16a72518c71ec3b7b6a787410a6cd44e4f18 | 9,199 | module Sequel
module Plugins
# The class_table_inheritance plugin allows you to model inheritance in the
# database using a table per model class in the hierarchy, with only columns
# unique to that model class (or subclass hierarchy) being stored in the related
# table. For example, with this hierar... | 40.170306 | 133 | 0.604414 |
ffd12fe007f0c2723cc5a10cfe52197710bc7171 | 388 | # encoding: utf-8
# author: 2017, Christoph Hartmann
title 'ec2-test-profile'
control "ami" do
title "Verifies that the correct AMI image is used"
describe ec2_instance do
its("ami_id") { should cmp "ami-1b2bb774" }
end
end
control "tags" do
title "Verifies that the X-Owner tag is set"
describe ec2_ins... | 20.421053 | 53 | 0.698454 |
ac19f324b5b95b17a97ea420df8bd8ba2c203a86 | 6,146 | =begin
#Sunshine Conversations API
The version of the OpenAPI document: 9.4.5
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.1
=end
require 'date'
module SunshineConversationsClient
class WebhookResponse
# The webhook.
attr_accessor :webhook
# Attribute mapping from ruby-... | 29.980488 | 222 | 0.625773 |
f7b4ee8306154148f1a412b272c90d0a3103b581 | 2,024 | require 'rack/contrib/jsonp'
require 'redis'
use Rack::JSONP
before do
content_type :json
end
helpers do
def link(url, text = nil)
text ||= url
%Q{<a href="#{url}">#{text}</a>}
end
end
SERVICES = []
def services(*args)
SERVICES.concat args
args.each { |arg| require "./services/#{arg}" }
end
def ... | 18.568807 | 71 | 0.605237 |
336fe69eb43dfc1a559b5f7c0407267baa0baea2 | 180 | class AdventureSerializer
include FastJsonapi::ObjectSerializer
attributes :id, :title, :memo, :image, :date, :is_wishlist?, :is_done?, :location_id
belongs_to :location
end
| 30 | 86 | 0.766667 |
289c2efb26ff44c2665fdf44aeb62614ad9b44b7 | 4,115 | # frozen_string_literal: true
# == Schema Information
#
# Table name: articles_courses
#
# id :integer not null, primary key
# created_at :datetime
# updated_at :datetime
# article_id :integer
# course_id :integer
# view_count :bigint(8) default(0)
# character_sum :inte... | 38.101852 | 82 | 0.660753 |
f787eb400305010ac32c641934e152fa275f9a9c | 13,238 | module MarketplaceService
module Transaction
TransactionModel = ::Transaction
ParticipationModel = ::Participation
module Entity
Transaction = EntityUtils.define_entity(
:id,
:community_id,
:last_transition,
:last_transition_at,
:listing,
:listing_tit... | 35.778378 | 148 | 0.654933 |
18b854867f79d8434c0a021a1e751b33bcb92690 | 5,581 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'rex/proto/tftp'
require 'rex/proto/dhcp'
require 'msf/core/module/deprecated'
class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking
inclu... | 33.220238 | 110 | 0.599176 |
e8c2c1fe0e6ff0ab76173dc41b11e536fa3ecb11 | 165 | # frozen_string_literal: true
module Wechat
class FileReplyUploadJob < ApplicationJob
def perform(file_reply)
file_reply.upload_file
end
end
end
| 15 | 43 | 0.751515 |
4a2ebb2230457e9372b7c04be4e4ea514afbaabf | 119 | # frozen_string_literal: true
module DropboxApi::Results
class CheckUserResult < DropboxApi::Results::Base
end
end
| 19.833333 | 51 | 0.798319 |
e9671e2dafb4ef8f2fcc50781aea9c6c1a8dd258 | 12,712 | require 'helper'
class RewriteTagFilterOutputTest < Test::Unit::TestCase
def setup
Fluent::Test.setup
end
def create_driver(conf)
Fluent::Test::Driver::Output.new(Fluent::Plugin::RewriteTagFilterOutput).configure(conf)
end
sub_test_case "configure" do
data("empty" => "",
"line style" =... | 33.540897 | 136 | 0.513373 |
0302e11e52313b13f38b3e383a07f9e454a396e1 | 125 | puts 'Print a number'
num = gets.chomp.to_i
sum = 0
for i in 1..num
if i%3==0 or i%5==0
sum+=i
end
end
puts sum | 13.888889 | 22 | 0.584 |
6a2f24842aabfa043c98828c0febfd0876adabab | 87 | module Shoulda
module Matchers
# @private
VERSION = '3.1.2'.freeze
end
end
| 12.428571 | 28 | 0.643678 |
1a17ed3787aae87c986dc9657a88fdd40d663e9c | 2,602 | # -*- encoding: utf-8 -*-
# stub: json 2.5.1 ruby lib
Gem::Specification.new do |s|
s.name = "json".freeze
s.version = "2.5.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "bug_tracker_uri" => "https://github.com/flori/json/issue... | 68.473684 | 773 | 0.702152 |
f7faddb325e168b716cadee6e7582037c026f85c | 57,571 | # 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
module Aws::KafkaConnect
# @api private
module ClientApi
include Seah... | 79.081044 | 205 | 0.790085 |
1de547313eaa3545d8efca5c254313d5ae920874 | 1,716 | =begin
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
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 ... | 38.133333 | 115 | 0.7162 |
aba01cdcd0e20be7226e370e8a91b669b9025c91 | 4,674 | class ReportView
def initialize(screen, tickets, block)
@screen = screen
@mode = :all
@real_tickets = tickets
@tickets = tickets
@refresh = block
@highlight = 0
display_lines
end
def refresh
@real_tickets = @refresh.... | 27.333333 | 99 | 0.453787 |
ffb1ad270984159c381dd476d4835612b5b6cc5c | 331 | Rails.application.configure do
config.exceptions_app = ->(env) do
request = ActionDispatch::Request.new(env)
action =
case request.path_info
when "/404"; :not_found
when "/422"; :unprocessable_entity
else; :internal_server_error
end
ErrorsController.action(action).call(env... | 23.642857 | 46 | 0.676737 |
4ab0d50e2f46237175d59f95534b006b003d561b | 395 | require 'test_helper'
class EventsControllerTest < ActionController::TestCase
test "should get new" do
get :new
assert_response :success
end
test "should get edit" do
get :edit
assert_response :success
end
test "should get show" do
get :show
assert_response :success
end
test "s... | 15.8 | 55 | 0.693671 |
2890b061100af854377d5cafcfc7c6e11a19d8a3 | 9,535 | # frozen_string_literal: true
require "active_support/concern"
require "view_component/slot_v2"
module ViewComponent
module SlotableV2
extend ActiveSupport::Concern
# Setup component slot state
included do
# Hash of registered Slots
class_attribute :registered_slots
self.registered_s... | 32.212838 | 120 | 0.599056 |
b95a2c72d15e4aefa198e0abb6f47178a15df8f8 | 3,087 | $:.unshift File.join(File.dirname(__FILE__))
require 'helperfunctions'
# Serialize access.
SERVICE_LOCK = Monitor.new
# AppScale uses systemd to start processes, restart them if they die, or kill and
# restart them if they take up too much CPU or memory.
module ServiceHelper
SYSTEMCTL = 'systemctl'.freeze
def se... | 34.685393 | 136 | 0.674765 |
b9782e2fc77e04315f529d6122be77f896f39591 | 903 | # frozen_string_literal: true
require 'rake_helper'
RSpec.describe 'gitlab:uploads:migrate and migrate_to_local rake tasks', :silence_stdout do
let(:model_class) { nil }
let(:uploader_class) { nil }
let(:mounted_as) { nil }
let(:batch_size) { 3 }
before do
stub_env('MIGRATION_BATCH_SIZE', batch_size.to... | 28.21875 | 91 | 0.733112 |
ab4a1d70a2e0ee8d11250f56490c266ad13cb93d | 2,870 | class Nacl < Formula
desc "Network communication, encryption, decryption, signatures library"
homepage "https://nacl.cr.yp.to/"
url "https://hyperelliptic.org/nacl/nacl-20110221.tar.bz2"
mirror "https://deb.debian.org/debian/pool/main/n/nacl/nacl_20110221.orig.tar.bz2"
sha256 "4f277f89735c8b0b8a6bbd043b3efb3f... | 53.148148 | 121 | 0.748084 |
21e5aaa80c80d7e70afe5b259b5f79970521dd16 | 354 | require 'spec_helper'
RSpec.describe MergesController, :type => :controller do
login_user
let(:workbench) { create :workbench, organisation: organisation }
describe "GET available_referentials" do
let(:request){ get :available_referentials, params: { workbench_id: workbench.id }}
it_behaves_like 'check... | 27.230769 | 87 | 0.762712 |
61476cb5ddf66413ac7e28aff9812c8f9b2b7314 | 206 | # encoding: utf-8
require 'spec_helper'
describe Github do
after { reset_authentication_for subject }
it { should respond_to :new }
it { expect(subject.new).to be_a Github::Client }
end # Github
| 15.846154 | 51 | 0.718447 |
ff7c15f5a9763c18f46b64a13d9c2c449e6b9426 | 1,980 | class Spinach::Features::ApiNavigation < Spinach::FeatureSteps
include API
step 'I should be able to navigate to posts and authors' do
api._links.posts._resource
api._links['api:authors']._resource
assert_requested :get, 'http://api.example.org/posts'
assert_requested :get, 'http://api.example.org... | 30.461538 | 83 | 0.719192 |
6a2cd042934486a26f2ba525c38fb19aca89ea3c | 86 | # desc "Explaining what the task does"
# task :lettrics do
# # Task goes here
# end
| 17.2 | 38 | 0.674419 |
ff96a7e9bb6a8d7956cc67761ac460586a9ca9a3 | 112 | class Notifier
include Acapi::Notifiers
def self.call(event, payload)
notify(event, payload)
end
end
| 14 | 31 | 0.723214 |
1dcf12b10499c2d8c29c43a2ca7fc7fcdba1e59e | 75,506 | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Gitlab::Git::Repository, :seed_helper do
include Gitlab::EncodingHelper
include RepoHelpers
using RSpec::Parameterized::TableSyntax
shared_examples 'wrapping gRPC errors' do |gitaly_client_class, gitaly_client_method|
it 'wraps gRPC not f... | 32.433849 | 215 | 0.653299 |
879894f26b3b7be0a40664897fa94756ffb11e71 | 1,823 | # This file is utilized for testing oms_diag.rb as part of oms_diag_test.rb
require_relative '../../../source/code/plugins/oms_diag_lib'
module Fluent
class DiagTest < Input
Fluent::Plugin.register_input('diagTest', self)
def initialize
require_relative '../../../source/code/plugins/om... | 33.759259 | 83 | 0.59627 |
3371acfa1f133ad03cf8e2f6e4718bd4ee6628ed | 822 | cask 'quadrosync' do
version :latest
sha256 :no_check
# amazonaws.com is the official download host per the vendor homepage.
url 'https://s3-eu-west-1.amazonaws.com/quadro-downloads/daemon/mac/QuadroSync_mac.dmg'
name 'QuadroSync'
homepage 'http://quadro.me/sync'
license :gratis
installer manual: 'Qua... | 31.615385 | 89 | 0.568127 |
ac08dd5da42a28d794ad702cdb7eb7e6f2c04d97 | 3,890 | module Fastlane
module Actions
class TestSampleCodeAction < Action
def self.run(params)
content = params[:content] || File.read(params[:path])
fill_in_env_variables
errors = []
content.scan(/```ruby\n(((.|\n)(?!```))*)\n```/).each do |current_match|
current_match =... | 34.424779 | 140 | 0.605913 |
01e01f69c5744c6949b1b48940f6ea17913db32e | 738 | Pod::Spec.new do |s|
s.name = "Mixpanel"
s.version = "2.3.2"
s.summary = "iPhone tracking library for Mixpanel Analytics"
s.homepage = "http://mixpanel.com"
s.license = 'Apache License, Version 2.0'
s.author = { "Mixpanel, Inc" => "support@mixpanel.com" }
s.platform = ... | 46.125 | 122 | 0.612466 |
d5dc82d7403e6afc5bc9c6b984318990ff110b0d | 242 | if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
if forked
Rails.cache.instance_variable_get(:@data).reset if Rails.cache.class == ActiveSupport::Cache::MemCacheStore
end
end
end
| 30.25 | 113 | 0.764463 |
7a87c2e406dc8f65117eaddc8c94fefde5b5a020 | 2,165 | require 'net/https'
require 'poms/api/response'
require 'poms/errors'
module Poms
module Api
module Drivers
# The NetHttp driver is a special module that can be used to implement the
# HTTP operations in the Client module. This is done by including a driver
# module into the client.
#
... | 29.657534 | 80 | 0.606005 |
61137c39599aea09335176a17ebd3e441a10d64a | 590 | module PartyRoutes
extend self
def included(base)
Routes.index('/v1/parties.json', base)
Routes.show('/v1/parties/:id.json', base)
end
module Routes
extend self
def index(path, base)
base.get path do
JSON.pretty_generate Party.all.map { |c| c.as_json(:index) }
end
end
... | 19.032258 | 68 | 0.60339 |
6237af28fb6d62d004805f7240df7b865220c0b1 | 20,074 | #
# Rest API Request Tests - Provision Requests specs
#
# - Create single provision request /api/provision_requests normal POST
# - Create single provision request /api/provision_requests action "create"
# - Create multiple provision requests /api/provision_requests action "create"
#
describe "Provision ... | 41.219713 | 128 | 0.632659 |
bb4c65b92e2c29bc22035ddc697ada416b427a25 | 319 | module NotificationsHelper
include SessionsHelper
def count_notification
count_notification = Notification::where(user_id: current_user.id, is_seen: false)
count_notification.count
end
def notifications
@notifications = Notification::where(user_id: current_user.id)
end
end
| 26.583333 | 90 | 0.733542 |
18d927226299c1aa6ea24c0185add70f6c37c7fd | 1,414 | class Dvm < Formula
desc "Docker Version Manager"
homepage "https://github.com/howtowhale/dvm"
url "https://github.com/howtowhale/dvm/archive/0.9.0.tar.gz"
sha256 "ee54c4aa104cd49aaec3eb65078d9d01d18b1d1eb73a32dba3f7b645df5d74c4"
bottle do
cellar :any_skip_relocation
sha256 "9ff72c71d4fc692b0b573ab35... | 33.666667 | 92 | 0.723479 |
e8e0d0e19317ead0ef99c195353efe70a07a2ab7 | 658 | require 'spec_helper'
describe Page, :type => :request do
before :each do
[{title: 'Life, the Universe, and Everything', slug: 'life-the-universe-and-everything', body: 'We apologize for the inconvenience', body_html: '<p>We appologize for the inconvenience</p>'}].
each { |attrs| Page.create(attrs) }
end
... | 32.9 | 195 | 0.706687 |
ff264300beba8a75f59cac6447a749f4a1c7c7fd | 236 | class CallCreateDirectMessageEventCount < ::Egotter::AsyncSortedSet
def initialize
super(nil)
@ttl = 1.day
@key = "#{Rails.env}:#{self.class}:#{@ttl}:any_ids"
end
def increment
add(Time.zone.now.to_f)
end
end
| 16.857143 | 67 | 0.661017 |
bfac6694196303fe3424e0734cb88bce39817a1b | 1,997 | class Api::V1::UsersController < Api::V1::BaseController
include Orderable
before_action :verify_user, except: :reset_home_location
def update
current_user.update_attributes!(update_params)
render_message "User updated successfully."
end
def show
render_object current_user
end
def user_pro... | 28.126761 | 141 | 0.687031 |
1c4e8eed0229f55961557778d8fa713753789620 | 1,047 | <% if false # the license inside this if block assertains to this file -%>
# Copyright 2017 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/LI... | 34.9 | 74 | 0.726839 |
e9eb5c5493c04bdbbb4651ceb134f635b16b134c | 707 | require "integration/factories/collection_factory"
require "integration/factories/instance_template_factory"
class InstanceGroupManagerFactory < CollectionFactory
def initialize(example)
super(Fog::Compute[:google].instance_group_managers, example)
@instance_template = InstanceTemplateFactory.new(example)
... | 22.806452 | 65 | 0.729844 |
bb67980e0cd2a742450ec499836891cb92da5533 | 1,638 | class Libquvi < Formula
desc "C library to parse flash media stream properties"
homepage "https://quvi.sourceforge.io/"
url "https://downloads.sourceforge.net/project/quvi/0.4/libquvi/libquvi-0.4.1.tar.bz2"
sha256 "f5a2fb0571634483e8a957910f44e739f5a72eb9a1900bd10b453c49b8d5f49d"
revision 2
livecheck do
... | 36.4 | 106 | 0.7442 |
abd5555d6fe63995489f2d22985eecdae13698bd | 168 | module SlackApi
module Errors
class NotFoundError < StandardError
def initialize(message)
super("SlackAPI: #{message}")
end
end
end
end
| 16.8 | 39 | 0.64881 |
f8cca5aa27ef6b0319177ed1572565778ce6db73 | 1,499 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/base/sessions/command_shell'
require 'msf/base/sessions/command_shell_options'
module MetasploitModule
CachedSize = 148
include Msf::Payload::Single
include Ms... | 28.283019 | 181 | 0.585724 |
0367d41158c557134fb896918d4b5922bb7db0f2 | 553 | # -*- coding: binary -*-
module Rex
module Proto
module Kademlia::Util
# Decodes an on-the-wire representation of a Kademlia peer to its 16-character hex equivalent
#
# @param bytes [String] the on-the-wire representation of a Kademlia peer
# @return [String] the peer ID if valid, nil otherwise
def self.deco... | 24.043478 | 95 | 0.679928 |
399610861ca4aca3cac95ce7079b14ec00006d1e | 654 | require "rails_helper"
describe ApplicationHelper do
context "#active" do
it "returns an active collection" do
struct = Struct.new(:id, :is_completed)
a = struct.new(1, false)
b = struct.new(2, true)
c = struct.new(3, true)
d = struct.new(3, false)
expect(active([a,b,c,d])).... | 21.8 | 47 | 0.587156 |
f8766d684416819554cb58b9450fd808d0b6fde2 | 55,243 | # Each Node subclass is reopened here, and bytecode-generating
# methods are added.
require 'compiler/generator'
class Compiler
##
# The precursor to a CompiledMethod
class MethodDescription
def initialize(gen_class, locals)
@generator = gen_class.new
@locals = locals
@required = 0
... | 21.715016 | 84 | 0.498018 |
e9701b2cef9b18924d1c801a3d1a84619430a43d | 28,913 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::NetApp::Mgmt::V2019_05_01
#
# Microsoft NetApp Azure Resource Provider specification
#
class Accounts
include MsRestAzure
#
... | 45.035826 | 206 | 0.69806 |
bf8db234e736238a6575309e7dd39dd701a7e16a | 545 | module UsersHelper
def unassign_or_deactivate_link(user, team)
if user.has_live_cases_for_team?(team)
link_to "Deactivate team member", confirm_destroy_team_user_path(team.id, user.id),
class: 'button-secondary button-left-spacing',
id: 'deactivate-user-button'
else
... | 34.0625 | 89 | 0.647706 |
7a5e890864bc4091cd911959c4ac0338d2907bd2 | 416 | class Page < ActiveRecord::Base
attr_accessible :title, :content
validates_presence_of :title, :content, :slug
validates_uniqueness_of :slug
scope :search, ->(text) do
term = "%#{text}%"
where('((title ILIKE ?) OR (content ILIKE ?))', term, term)
end
def self.find_by_slug!(slug)
where(slug: ... | 18.909091 | 63 | 0.65625 |
4a78e9f799eefb30946bb7d6d39b4ec47219aec5 | 9,657 | # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.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 us... | 29.990683 | 611 | 0.660971 |
18b6fd37f08fa3f6cf4a78a7b6d973e19782e8d5 | 2,683 | require 'test_helper'
require 'stringio'
module Librato
class LogReporterTest < MiniTest::Test
def setup
@buffer = StringIO.new
@reporter = LogReporter.new
@reporter.log = @buffer
end
def test_increment
@reporter.increment :foo
assert_last_logged 'count#foo=1'
@re... | 26.303922 | 76 | 0.642192 |
bf437d72c971efe4b43d24377fbf42ffc396e78f | 686 | module ConcernedInheritance::ClassMethods
def inherited_callbacks
(self.singleton_class.ancestors + self.ancestors).select do |ancestor|
ancestor.instance_variable_defined? :@inherited_callbacks
end.map do |ancestor|
ancestor.instance_variable_get :@inherited_callbacks
end.flatten
end
pr... | 24.5 | 74 | 0.74344 |
87f5b50fd36fbb1a42ee6bc81f61b0c3b51bd758 | 2,994 | # frozen_string_literal: true
require 'minitest/autorun'
require 'test_helper'
module Convert
class IBM390Test < Minitest::Test
describe 'IBM390.ascnum2num' do
include Convert::IBM390
it 'converts a number with no implied decimals' do
original = '008910'
assert_equal(8910, ascnum2nu... | 28.514286 | 95 | 0.606546 |
915b6272548e93f83bf688239c8f469afaf90d1b | 1,590 | class WordPicker
def initialize(words)
@possible_words = words
@choices = []
@last_pick = ""
end
def pick_word
return @last_pick, true if @possible_words.length == 0
@last_pick = pick = next_pick()
is_certain = (@possible_words.length == 0)
return pick, is_certain
end
def set_li... | 20.649351 | 69 | 0.644654 |
7a8fd41765cead6074859ae075aad7680eb37af5 | 742 | SLUG_TO_CONTENT_ID_MAPPING = {
"helping-government-departments-improve-their-efficiency-and-performance-to-save-the-taxpayer-money" => "5d2b59a2-7631-11e4-a3cb-005056011aef",
"making-it-easier-to-trade" => "5c7657ab-7631-11e4-a3cb-005056011aef",
"improving-the-uks-ability-to-absorb-respond-to-and-recover-from-eme... | 57.076923 | 146 | 0.784367 |
eda97f693730b6f9132825a89ab02c2f8682b59b | 2,354 | #!/usr/bin/env ruby
PARAMETERS = {
:to_if_alone_timeout_milliseconds => 300,
:to_delayed_action_delay_milliseconds => 0,
:to_if_held_down_threshold_milliseconds => 0,
:simultaneous_threshold_milliseconds => 300,
}.freeze
require 'json'
require_relative '../lib/karabiner.rb'
def main
puts JSON.pretty_genera... | 29.061728 | 110 | 0.583687 |
26acda168bcd98c33e5e779ee4766d72e176444d | 3,613 | module BTC
# Base58 is used for compact human-friendly representation of Bitcoin addresses and private keys.
# Typically Base58-encoded text also contains a checksum (so-called "Base58Check").
# Addresses look like 19FGfswVqxNubJbh1NW8A4t51T9x9RDVWQ.
# Private keys look like 5KQntKuhYWSRXNqp2yhdXzjekYAR7US3MT17... | 33.146789 | 123 | 0.662607 |
e2b58e8dde6e9c8adacd79c320f7b73385826b20 | 812 | require 'chefspec'
if defined?(Chef::Resource::DnfPackage)
describe 'dnf_package::remove' do
let(:chef_run) do
ChefSpec::SoloRunner.new(platform: 'fedora')
.converge(described_recipe)
end
it 'removes a dnf_package with an explicit action' do
expect(chef_run).to remove_dnf_package('ex... | 32.48 | 90 | 0.724138 |
187c1745493d9caa3f8e410e40aee757aea62a4a | 703 | class UserHomeChecker
attr_reader :messages
def initialize(opts)
@dir = opts[:dir]
@file = opts[:file]
@changed_code = opts[:changes]
@user = opts[:user] || ENV["USER"]
@user_home = [
Regexp.new("/home/#{@user}"), # Hard-coded path to user's HOME
Regexp.new("/Users/#{@user}")... | 22.677419 | 77 | 0.554765 |
01165c72f5f1957864ea1f820eb61d84ceca99d1 | 329 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Assignment, type: :model do
subject(:assignment) { described_class.new(assignee: person) }
let(:person) { FactoryBot.create(:person) }
before { FactoryBot.create(:task) }
it { expect { assignment.save }.to change { person.tasks.count }.by(... | 23.5 | 74 | 0.717325 |
032f2e4d50fe23f2ca3b99387d6e891316f1e130 | 588 | namespace :package do
desc "Update your clone of the packaging repo with `git pull`"
task :update do
cd 'ext/packaging' do
remote = Pkg::Config.packaging_url.split(' ')[0]
branch = Pkg::Config.packaging_url.split(' ')[1].split('=')[1]
if branch.nil? or remote.nil?
$stderr.puts "Couldn'... | 34.588235 | 119 | 0.64966 |
1a31026cab0d6efdc9edb4bf1ffb9553009051b5 | 363 | require 'test_helper'
class ArticlesControllerTest < ActionDispatch::IntegrationTest
test 'should get index' do
get articles_index_url
assert_response :success
end
test 'should get new' do
get articles_new_url
assert_response :success
end
test 'should get create' do
get articles_create_... | 19.105263 | 62 | 0.752066 |
bb5e14aa8578b9ec256c071b18ada46b49167f40 | 924 | # Copyright 2012, Dell
#
# 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, software
... | 28.875 | 74 | 0.722944 |
0892e1e1002d966107f499f9a7ebad7c30d06dff | 215 | env = ENV['RACK_ENV'] ? ENV['RACK_ENV'] : 'development'
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'] || YAML::load(IO.read('config/database.yml'))[env])
| 53.75 | 111 | 0.734884 |
5d493e958b847bbe53813c034bb1ce45f6540fa8 | 13,774 | # frozen_string_literal: true
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render inv... | 48.5 | 154 | 0.751198 |
4a6bf5b48dcb858fcccdd86f2e3e56bdb275822f | 372 | # 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::CostManagement::Mgmt::V2019_03_01_preview
module Models
#
# Defines values for OperatorType
#
module OperatorType
In =... | 21.882353 | 70 | 0.698925 |
339431d553246183b330b620fdb514831f0ff93f | 4,286 | class LoginInfoController < ApplicationController
# Variable that holds a params/object with all the attributes filled in
def list
@login_infos = LoginInfo.all
end
def show
@login_info = LoginInfo.find(params[:id])
end
# Associated with the view used for create
def new
@login_info = LoginInf... | 32.717557 | 94 | 0.695054 |
ac8853deb1ecad0ab5f2595fa6cd262636d96d85 | 841 | module Battle
module Effects
class Ability
class Download < Ability
# Function called when a Pokemon has actually switched with another one
# @param handler [Battle::Logic::SwitchHandler]
# @param who [PFM::PokemonBattler] Pokemon that is switched out
# @param with [PFM::Poke... | 36.565217 | 124 | 0.671819 |
265890021cf29a9ae849fc0a81ee57e9c36cd9d2 | 8,222 | =begin
#NSX-T Manager API
#VMware NSX-T Manager REST API
OpenAPI spec version: 2.5.1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.19
=end
require 'date'
module NSXT
# Defines the point of a graph.
class PointDefinition
# Represents the variable for the ... | 30.565056 | 254 | 0.622963 |
ac09eff009e8bde375cdb58f16f4a5504e06a609 | 13,695 | # Copyright 2019 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 applicable law or agreed to in writing, ... | 44.320388 | 131 | 0.604673 |
bbcff60b65f91e341f5bf830deb266fa46328cf5 | 2,541 | require "json"
require "sberbank/acquiring/exception"
module Sberbank::Acquiring
# Static class with helping functions for url formatting.
class UrlHelper
# Generate Sberbank API url for a call
#
# @param mode [Symbol] API mode, `:test` or `:production`
# @param version [Symbol] API version, only ... | 32.576923 | 125 | 0.608422 |
112d5aaa32bf1fef20756f884dcae0a64c9aa050 | 1,421 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/google_ads/v1/resources/keyword_plan.proto
require 'google/protobuf'
require 'google/ads/google_ads/v1/common/dates_pb'
require 'google/ads/google_ads/v1/enums/keyword_plan_forecast_interval_pb'
require 'google/protobuf/wrappers_pb'
requi... | 49 | 156 | 0.798733 |
21f4dfa5aec84210de819486e7a25077af008249 | 220 | require 'spec_helper'
describe LicenseFinderHelper do
it 'has a version number' do
expect(LicenseFinderHelper::VERSION).not_to be nil
end
it 'does something useful' do
expect(false).to eq(true)
end
end
| 18.333333 | 54 | 0.736364 |
2156c88db02dd0f9bcea0bdd7ea8dbdc4ac89534 | 79 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'oozou/cli'
| 26.333333 | 58 | 0.721519 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.