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 |
|---|---|---|---|---|---|
ab4a7082c5efc22cf334b6af9c2bf7cd6785add0 | 33,140 | # frozen_string_literal: true
describe Csl::Citation do
# Fixture data from spec/fixtures/pub_hash/*.rb
include PubHash::Article
include PubHash::Book
include PubHash::CaseStudy
include PubHash::Conference
include PubHash::TechnicalReport
include PubHash::WorkingPaper
let(:pub_hash) do
{ provenanc... | 43.547963 | 330 | 0.649336 |
bb5f7157b8b052cf3bf9f9732dff981526c76bb3 | 145 | require './config/environment'
use Rack::MethodOverride
use UserController
use CharacterController
use GameController
run ApplicationController
| 18.125 | 30 | 0.862069 |
1a1ed5dff07b0d09e11efa19edfcc539a0fc3836 | 1,315 | class OrdersController < ApplicationController
before_action :set_order, only: [:show, :edit, :update, :destroy]
def index
@orders = Order.all
end
def show
end
def new
@order = Order.new
end
def edit
end
def create
@order = Order.new(order_params)
respond_to do |format|
i... | 21.557377 | 89 | 0.64943 |
189b38bd7f1c9fa68a39bd4c546b6c998990981f | 6,849 | describe "Airbrake expection errors" do
before(:each) do
create(:assignment, name: "TestAssignment", directory_path: 'test_assignment')
create_list(:participant, 3)
create(:assignment_node)
create(:deadline_type, name: "submission")
create(:deadline_type, name: "review")
create(:deadline_type,... | 41.011976 | 143 | 0.725507 |
ffd376bb576ad307a8f5abba26289bb5afb2ba33 | 409 | # frozen_string_literal: true
module Trainees
class Update
include ServicePattern
def initialize(trainee:, params: {})
@trainee = trainee
@params = params
end
def call
trainee.update!(params)
Dqt::UpdateTraineeJob.perform_later(trainee)
Trainees::SetCohortJob.perform_l... | 17.041667 | 51 | 0.672372 |
bb852f8c4f3ba15426a47a0030e7a7222c39465d | 314 | maintainer "Heavy Water Software Inc."
maintainer_email "darrin@heavywater.ca"
license "Apache 2.0"
description "Installs/Configures locale"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.0.2"
supports "ubuntu"
supports "debian"
supports "centos"
| 28.545455 | 72 | 0.713376 |
e83fbfcc0b938d6b0a2c2e0dabc77afb2f6b7f56 | 108 | module MosaicoRails
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
end
| 18 | 46 | 0.777778 |
e8831a2e6e59596d963cf9b224f618f1eb019878 | 5,430 | namespace :mysql do
desc "Enable mysql on boot and start"
task :enable, :roles => :db do
sudo "/sbin/chkconfig mysqld on"
sudo "/etc/rc.d/init.d/mysqld start"
end
desc "Create database"
task :create, :roles => :db, :only => { :primary => true } do
db_root_user = fetch(:db_root_user, 'root')
... | 39.064748 | 216 | 0.630939 |
017e95ead03d3ff544b32941c1284d92d45fefd6 | 155 | subscription = Mollie::Customer::Subscription.update(
'sub_rVKGtNd6s3',
customer_id: 'cst_5a2pPrwaWy',
amount: { value: '20.00', currency: 'EUR' }
)
| 25.833333 | 53 | 0.703226 |
ffea465049039d6431aa327661ead2b76d3ca590 | 170 | class StepsProcessorType < ActiveModel::Type::Value
def cast(value)
if value.is_a?(StepsProcessor)
value
else
raise ArgumentError
end
end
end
| 17 | 51 | 0.682353 |
2656c1d381a45aaa6ceab557742ddaf791b30bc0 | 144 | json.extract! event_category, :id, :event_id, :category_id, :created_at, :updated_at
json.url event_category_url(event_category, format: :json)
| 48 | 84 | 0.798611 |
ed168aed369653fb0cb68d53218bdf0e538422b9 | 1,518 | module Trailblazer::V2_1::Macro
module Policy
# Step: This generically `call`s a policy and then pushes its result to `options`.
# You can use any callable object as a policy with this step.
class Eval
def initialize(name: nil, path: nil)
@name = name
@path = path
end
# ... | 35.302326 | 231 | 0.639657 |
18686fa4191ed159abb3d4bd7e8e83f6cff5ae30 | 672 | class Ey::Core::Client
class Real
def get_load_balancers(params={})
query = Ey::Core.paging_parameters(params)
url = params.delete("url")
request(
:params => params,
:query => query,
:path => "/load-balancers",
:url => url,
)
end
end # Real
... | 22.4 | 100 | 0.572917 |
3970e3948927dc86681a93d0191fc05b34055134 | 400 | namespace :pibi do
namespace :journals do
desc "removes all stale journals"
task :cleanup => :environment do
five_minutes = 3600 * 5
stale = Journal.all.select { |j|
j.created_at && Time.now.to_i - j.created_at.to_time.to_i >= five_minutes
}
puts "Cleaning up #{stale.length} ... | 21.052632 | 81 | 0.6125 |
f8402e2acee3470a4c99380e039c753257999dc0 | 1,756 | # MYSQL_CONNECTION_PARAMS = {
# :adapter => "mysql2",
# :host => "localhost",
#
# :username => "the-teacher",
# :database => "open_cook_dev",
# :password => "qwerty",
# :encoding => "utf8"
# }
#
# PSQL_CONNECTION_PARAMS = {
# :adapter => "postgresql",
# :encoding => "unicode",
# :host => "lo... | 27.4375 | 106 | 0.61959 |
bbb164651e115ef2bb18fef7c9f73d4f5d58b85f | 1,560 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::TimeSeriesInsights::Mgmt::V2017_11_15
module Models
#
# Parameters supplied to the Update Reference Data Set operation.
#
class ReferenceDataS... | 28.363636 | 71 | 0.532692 |
f7af561f085b80ac95fa1e04e67dd4bd58cdc908 | 1,749 | module TD::Types
# Represents short information about a sticker set.
#
# @attr id [Integer] Identifier of the sticker set.
# @attr title [String] Title of the sticker set.
# @attr name [String] Name of the sticker set.
# @attr thumbnail [TD::Types::PhotoSize, nil] Sticker set thumbnail in WEBP format with w... | 49.971429 | 118 | 0.715266 |
87adf181602322a3f97fe4dc3dffb8a4256eae9e | 119 | require 'test_helper'
class TesteTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 14.875 | 41 | 0.697479 |
620f04b234682e56f3c22bd954491539734fdbdc | 425 | test_name 'puppet module search should print a reasonable message for no results'
tag 'audit:low',
'audit:unit'
module_name = "module_not_appearing_in_this_forge"
step 'Setup'
stub_forge_on(master)
step "Search for a module that doesn't exist"
on master, puppet("module search #{module_name}") do |res|
asser... | 26.5625 | 81 | 0.752941 |
1cce6807371f5445cebbd95fb7650274ddd9f002 | 643 | MultiSession.setup do |config|
# Uncomment to force multi_session cookies to expire after a period of time
# config.expires = 30.minutes
# Uncomment to change the domain of the multi_session cookies
# config.domain = nil
# Salt used to derive key for GCM encryption. Default value is 'multi session authentic... | 45.928571 | 111 | 0.777605 |
b9f57c60c4d0d77c426cf99732b63a9b6b3023d2 | 497 | RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.run_all_when_everything_filtered = true
config.filter_run :focus
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providi... | 31.0625 | 77 | 0.756539 |
33ec4b4e67743ffc264f3196c894d333f9659b69 | 921 | # Простая игра "Камень, Ножницы, Бумага"
# Copyright (c) 2019 Алексей Рознован
# Большинство прав защищено... :)
loop do
print "Камень (R), Ножницы (S) или Бумага (P)? Выбирай! "
answer = gets.strip.capitalize
if answer == "R"
user_choice = :rock
elsif answer == "S"
user_choice = :scissors
elsi... | 24.891892 | 93 | 0.654723 |
26c2b7a5287e68586b60a60715a1423ec2c25fb5 | 1,191 | require 'helpers/spec'
require 'aws-sdk'
require 'vgh/ec2/volume'
describe VGH::EC2::Volume do
include_context 'AWS Dummy'
let(:volume) {VGH::EC2::Volume.new}
before(:each) do
volume.stub(:message).and_return(Dummy.new)
volume.stub(:ec2).and_return(@ec2)
end
it "Should return an instance" do
... | 24.8125 | 64 | 0.721243 |
01a58a2bcb2114d1bbbdfb1a5ac93658d525f698 | 426 | #load everything in /engine_config/initializers
Dir["#{RAILS_ROOT}/vendor/plugins/community_engine/engine_config/initializers/**/*.rb"].each do |initializer|
load(initializer)
end
CommunityEngine.check_for_pending_migrations
if AppConfig.theme
theme_view_path = "#{RAILS_ROOT}/themes/#{AppConfig.theme}/views"
... | 38.727273 | 110 | 0.802817 |
ac0aea2d838f03d4f44513033e0f4b3863ca855c | 1,817 | require 'spec_helper'
RSpec.describe Gws::Board::Post, type: :model, dbscope: :example do
describe "descendants_updated field" do
describe "set before save" do
context "when creating" do
let(:post) { build :gws_board_post }
it do
expect { post.save }
.to change { pos... | 27.953846 | 76 | 0.593286 |
ff7eb995f0480407c9753f66cc6a95f589c6600f | 799 | class CreateMilestones < ActiveRecord::Migration[5.2]
def self.up
create_table :milestones, :force => true do |t|
t.column :name, :string, :null => false
t.column :description, :string, :default => ""
t.column :effective_date, :date
... | 38.047619 | 85 | 0.534418 |
b90bf51724790afd322f328ce6b75d12431ede50 | 324 | require File.dirname(__FILE__) + '/../spec_helper.rb'
describe ProjectList do
describe "creation" do
it "should set defaults" do
p = Project.make!
pl = p.project_list
expect( pl ).to be_valid
expect( pl.title ).to_not be_blank
expect( pl.description ).to_not be_blank
end
end
e... | 21.6 | 53 | 0.657407 |
bf9cf3f87f6a76d4577bc2ba83ac9aa8799e3b0d | 1,071 | require File.expand_path('spec/spec_helper')
require 'fog/arubacloud/models/compute/network_adapter'
describe Fog::Compute::ArubaCloud::NetworkAdapter do
include ModelSetup
let (:network_adapter_class) do
class Fog::Compute::ArubaCloud::NetworkAdapter
def self.read_identity
instance_variable_get... | 32.454545 | 74 | 0.528478 |
d563b8fa6e7071e1aca0bb8989309ecec9ea1d93 | 940 | require 'sinatra/base'
require 'yaml'
require 'ostruct'
class OpenStruct
def new_ostruct_member(name)
name = name.to_sym
@table[name] = case name
when :title then @table[name][0, 100]
when :description then @table[name][0, 260]
when :keywords then @table[name].split(" ")[0, 15].join(" ... | 22.926829 | 100 | 0.603191 |
38b4fb074387a98454d938c65c78acd2eaf41d49 | 753 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Backend - Asset (HTML)', type: :feature do
describe '#destroy' do
before do
sign_in(profile)
create(:asset, name: 'delete_me.jpg')
create(:asset, name: 'keep_me.jpg')
end
let(:profile) { create(:user) }
it 'dis... | 21.514286 | 71 | 0.625498 |
11514b16006d0b9ced8ca1197feb331455cbe48b | 111 | module SendleAPI
class Tracking < Base
self.prefix = "/api/tracking"
self.element_name = ""
end
end | 18.5 | 33 | 0.675676 |
d57710e8a9ca653afcd2dd334c51779068411410 | 289 | require_relative "spec_helper"
def app
ApplicationController
end
describe ApplicationController do
it "responds with a welcome message" do
get '/'
expect(last_response.status).to eq(200)
expect(last_response.body).to include("Welcome to the Sinatra Template!")
end
end
| 20.642857 | 77 | 0.757785 |
7ae4c12cf366c5037fdf998de5553b3e987fa0d2 | 872 | # frozen_string_literal: true
describe Facts::Debian::Dmi::Manufacturer do
describe '#call_the_resolver' do
subject(:fact) { Facts::Debian::Dmi::Manufacturer.new }
let(:sys_vendor) { 'VMware, Inc.' }
before do
allow(Facter::Resolvers::Linux::DmiBios).to \
receive(:resolve).with(:sys_vendo... | 33.538462 | 108 | 0.694954 |
1a02cff6cabf34c4551dde924844f164013f2ad1 | 207 | require 'rack-proxy'
module Dao
class Forwarder < Rack::Proxy
def rewrite_env(env)
req = Rack::Request.new(env)
env['HTTP_HOST'] = PortMapper.get_addr_for(req)
env
end
end
end
| 17.25 | 53 | 0.647343 |
abbd5893e4d5a1bbe262105383587a955f610750 | 7,394 | require 'uri'
module RHC::Commands
class ForwardingSpec
include RHC::Helpers
include Enumerable
# class to represent how SSH port forwarding should be performed
attr_accessor :port_from
attr_reader :remote_host, :port_to, :host_from, :service
attr_writer :bound
def initialize(service, re... | 37.343434 | 185 | 0.558155 |
6ac9f2c255d1978c56d7e2c81b487660777218bd | 1,796 | require 'formula'
class Mediatomb < Formula
homepage 'http://mediatomb.cc'
url 'https://downloads.sourceforge.net/mediatomb/mediatomb-0.12.1.tar.gz'
sha1 '86e880584cc9c8aaf3926d56048510d1d06e76b4'
depends_on 'libexif' => :recommended
depends_on 'libmagic' => :recommended
depends_on 'lzlib' => :recommended... | 32.654545 | 120 | 0.739978 |
082a25ed2fe7ec08c254cfbc6e2a3f36c7007ec7 | 829 | require_relative '../../lib/conductor/kernel/process_manager'
include Conductor::Kernel
describe ProcessManager do
describe 'finding a process' do
describe 'when the manager contains a process with the matching id' do
subject { ProcessManager.new }
before :each do
@subprocess = stub('sub... | 23.685714 | 74 | 0.635706 |
e9574abcc05479cc49042d586eb393aced393fd2 | 4,257 | require_relative "../scripts"
require_relative "../github"
require_relative "../github/issue"
require_relative "../github/issue_creator"
require_relative "../pivotal/story_commenter"
require_relative "../jira/story_commenter"
require_relative "../question"
module Octopolo
module Scripts
class Issue
include... | 25.189349 | 88 | 0.622974 |
87d9e7c3e83619b0624cc4db7454e9c8188aa37b | 817 | # The SMPP Receiver maintains a unidirectional connection to an SMSC.
# Provide a config hash with connection options to get started.
# See the sample_gateway.rb for examples of config values.
# The receiver accepts a delegate object that may implement
# the following (all optional) methods:
#
# mo_received(receive... | 29.178571 | 69 | 0.698898 |
e9f1f7c649f56824af65df16872dcc123dc74566 | 4,514 | require "language/node"
class Lanraragi < Formula
desc "Web application for archival and reading of manga/doujinshi"
homepage "https://github.com/Difegue/LANraragi"
url "https://github.com/Difegue/LANraragi/archive/v.0.8.0.tar.gz"
sha256 "44709430b4bd7edf772f04ba59c2eea86cfc442264878f1cd1919293dfe15f57"
lice... | 36.699187 | 121 | 0.70514 |
7987d6fe7987625f98f88f8a7742c551a08223dc | 837 | xml.instruct!
xml.list do
xml.id @list.id
xml.name @list.name
xml.details @list.details
xml.url list_url(:id => @list.id)
@errors.each do |error|
xml.error error
end
@talks.each do |talk|
xml.talk do
xml.id talk.id
xml.title talk.title
xml.abstract talk.abstract
xml.... | 25.363636 | 62 | 0.663082 |
2194b003e7fd711fd4f4f2d9d99509ecf6a14ce0 | 27,145 | module Rubinius
class Sprinter
total = Rubinius::Config['printf.cache']
case total
when Fixnum
if total == 0
@cache = nil
else
@cache = Rubinius::LRUCache.new(total)
end
when false
@cache = nil
else
@cache = Rubinius::LRUCache.new(50)
end
de... | 23.043294 | 88 | 0.476478 |
7a2832d0cb85fe8eda447d65ca6cc0e8d822531a | 4,116 | module TaskLifecycle
extend ActiveSupport::Concern
include StateMachine
included do
validate :newed_task_is_valid, if: :newed?
validate :started_task_is_valid, if: :started?
validate :planned_task_is_valid, if: :planned?
validate :finished_task_is_valid, if: :finished?
validate :abandoned_ta... | 36.105263 | 119 | 0.69655 |
4a408eeec347f55f3cc19d3bb4b91a7a6c5e416e | 1,578 | #-- encoding: UTF-8
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2021 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProj... | 37.571429 | 91 | 0.738276 |
ed83ef01d6f5b7eb97e945a3b01a564fb0fbdfa1 | 186 | class AddFormattedQuestionParts < ActiveRecord::Migration[5.0]
def change
add_column :tossups, :formatted_answer, :text
add_column :bonuses, :formatted_leadin, :text
end
end
| 26.571429 | 62 | 0.763441 |
26e10c652c7ff6dfb3494fce655299387d0eeef6 | 6,485 | module Fog
module Compute
class HP
class Real
# Create a new server
#
# ==== Parameters
# * name<~String> - Name of server
# * flavor_id<~Integer> - Id of flavor for server
# * image_id<~Integer> - Id of image for server. If block_device_mapping is passed, th... | 44.115646 | 172 | 0.49653 |
03db7cc2be530473f0b657084ec1861141d79685 | 933 | # frozen_string_literal: true
class SessionsController < ApplicationController
def new; end
def create
@user = User.find_by(email: params[:session][:email].downcase)
# same as @user && @user.authenticate
if @user&.authenticate(params[:session][:password])
if @user.activated?
log_in @use... | 27.441176 | 79 | 0.648446 |
7a61d16c8851ccd01caa15413023db34df222acd | 151 | require 'spec_helper'
describe ActiveModelWarnings do
it 'has a version number' do
expect(ActiveModelWarnings::VERSION).not_to be nil
end
end
| 18.875 | 54 | 0.774834 |
21924cc154c3ab807fcf858bb6d79acecd6da435 | 8,624 | module CampusOracle
class UserCourses < BaseProxy
include Cache::UserCacheExpiry
extend Proxies::EnableForActAs
APP_ID = "Campus"
def initialize(options = {})
super(Settings.sakai_proxy, options)
@uid = @settings.fake_user_id if @fake
@academic_terms = Berkeley::Terms.fetch.campus.... | 36.542373 | 125 | 0.610853 |
e80807f48ddcc245f5df069c27b51810340c5354 | 159 | #!/usr/bin/env ruby
require File.expand_path 'boot'
# Sinatra::Base.set(:run, false)
# Sinatra::Base.set(:environment, :production)
run Sinatra::Application | 19.875 | 46 | 0.735849 |
3915b803cf7217ee45cb434a16d1e29dbf39c723 | 1,145 | require 'selenium-webdriver'
require 'test/unit'
module DisableJavaScript
class DisableJavaScriptTests < Test::Unit::TestCase
DEMO_PAGE = <<-eos
data:text/html,
<noscript><p class="js-disabled">JavaScript disabled</p></noscript>
<div>This is a demo page.</div>
eos
def teardown
@driver.quit unless... | 27.926829 | 125 | 0.751965 |
4abdf4907058f46991fb3fa1b8fa36ab59bd6b46 | 49 | module RailsServerStatus
VERSION = "1.0.0"
end
| 12.25 | 24 | 0.734694 |
4a7e13d06d14a14cb6b9b3a89cff7db959646c53 | 295 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe Arclight::Parent do
describe "#global_id" do
it "returns just the ID" do
parent = described_class.new(id: "test", label: "Test", eadid: "2", level: 2)
expect(parent.global_id).to eq "test"
end
end
end
| 22.692308 | 83 | 0.681356 |
627c562e1db1887b81299e01afd00a7b6a9a81cd | 216 | require 'spec_helper'
describe UserRole do
describe "valid UserRole model" do
it "should be valid" do
@user_role = FactoryGirl.build(:user_role)
expect(@user_role).to be_valid
end
end
end
| 15.428571 | 48 | 0.689815 |
e27379e4caa677d0521886703859174c9c1eb739 | 3,383 | require 'spec_helper'
describe Xively::Base::InstanceMethods do
before(:each) do
@feed = Feed.new
@feed.updated = Time.parse("20110202")
@feed.title = "Feed Title"
@feed.private = true
@feed.icon = "http://xively.com/logo.png"
@feed.website = "http://xively.com"
@feed.tags = "kittens, sof... | 30.754545 | 113 | 0.635531 |
01b60af7147d6bd6a920ae6af17d763a087f8f1e | 6,685 | =begin
#Accounting API
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
Contact: api@xero.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.1
=end
require 'time'
require 'date'
module XeroRuby::Accounting
require 'bigdecimal... | 30.525114 | 213 | 0.630366 |
628897e8b1fa0e2ba8be1f2244445c858ae1f5a2 | 1,816 | class AliyunCli < Formula
desc "Universal Command-Line Interface for Alibaba Cloud"
homepage "https://github.com/aliyun/aliyun-cli"
url "https://github.com/aliyun/aliyun-cli.git",
tag: "v3.0.91",
revision: "8183fee83c0e11fdfe8de827bf7e0e6c9dae2815"
license "Apache-2.0"
bottle do
sha256 c... | 44.292683 | 122 | 0.730727 |
5d2a8806200a9d1cb2ab9b1ddb24aacd6ed39278 | 775 | require 'rubygems'
version = File.open(File.dirname(__FILE__) + '/../VERSION', 'r').read.strip
Gem::Specification.new do |gem|
gem.name = "oa-basic"
gem.version = version
gem.summary = %Q{HTTP Basic strategies for OmniAuth.}
gem.description = %Q{HTTP Basic strategies for OmniAuth.}
gem.email = "michael@intr... | 33.695652 | 85 | 0.668387 |
e82bc7d0889a99abc21bec9367c83caedd6b109b | 333 | # frozen_string_literal: true
RSpec.describe DrawioDsl::Schema::Face do
include_context :node_dependencies
subject { instance }
let(:instance) { described_class.new(diagram, **args) }
let(:args) { { id: 1 } }
let(:default) { KConfig.configuration.drawio.element(:face) }
it_behaves_like :basic_element_at... | 23.785714 | 63 | 0.735736 |
5dfdd3449bc2388d8c06324ecf95980d8e69c70e | 1,853 | # Saviors rescue ally groups in atari
require_relative "heuristic"
require_relative "hunter"
class Savior < Heuristic
def initialize(player)
super
@enemy_hunter = Hunter.new(player,true)
end
def init_color
super
@enemy_hunter.init_color
end
def eval_move(i,j)
stone = @goban.stone_at... | 29.412698 | 117 | 0.634107 |
2183489e6532bcdc38ba3728b1ba1cb9d5c71cb8 | 2,791 | class ApplicationController < ActionController::Base
include Pundit
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :set_locale
def about; end
def change_locale
l = params[:locale].to_s.strip.to_sym
l = I18n.default_locale... | 27.362745 | 93 | 0.661053 |
acf09bc10fcb844b063a1add82825539a2a78da9 | 470 | class MakeupSearch::API
def self.get_data
url = 'https://makeup-api.herokuapp.com/api/v1/products.json'
response = HTTParty.get(url)[21..30]
response.each do |makeup|
name = makeup["name"]
brand = makeup["brand"]
product_type = makeup["product_type"]
des... | 24.736842 | 72 | 0.589362 |
18ce7054da192255b1116a69074bfd9dfb24c97e | 2,415 | # frozen_string_literal: true
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0... | 36.044776 | 95 | 0.681573 |
e2e75b7dcd6fb754486790124514eaf844961e6a | 4,936 | # frozen_string_literal: true
class Course::LessonPlan::Todo < ApplicationRecord
include Workflow
workflow do
state :not_started
state :in_progress
state :completed
end
after_initialize :set_default_values, if: :new_record?
validates :workflow_state, length: { maximum: 255 }, presence: true
v... | 43.298246 | 99 | 0.711912 |
87b41da7a9ba0c7421a22db415d133fa97678208 | 526 | class HomeController < ApplicationController
def index
end
def execute
# Print the available params that get passed from the button
# p params
# https://github.com/rest-client/rest-client
# Post a response using RestClient, to the server address, and passing in the correct id
# respons... | 27.684211 | 92 | 0.661597 |
113bb99b733f0aa9140827f0ea714533aa7ce610 | 1,457 | # -*- encoding: utf-8 -*-
# stub: benchmark-ips 2.1.0 ruby lib
d = File.read(File.expand_path("../lib/benchmark/ips.rb", __FILE__))
if d =~ /VERSION = "(\d+\.\d+\.\d+)"/
version = $1
else
version = "0.0.1"
end
Gem::Specification.new do |s|
s.name = "benchmark-ips"
s.version = version
s.required_rubygems_ve... | 32.377778 | 105 | 0.630062 |
e9669384b8b1cd61abad7abaf19e4121118d8811 | 1,686 | class ApiApplicationController < ActionController::API
include CanCan::ControllerAdditions
include ActionController::Serialization
respond_to :json
before_action :check
private
def check
token = request.headers["HTTP_API_TOKEN"] || nil
@current_user = User.new
@current_user = ... | 29.068966 | 122 | 0.668446 |
39b98bfb162ba715bd285f6421fa23d98bf1877c | 121 | def Integer.all
Enumerator.new do |yielder, n: 0|
loop { yielder.yield(n += 1)}
end.lazy
end
p Integer.all.first(10) | 17.285714 | 34 | 0.68595 |
089a82e8d686cc8e4d895a4a9216cc59ce04c306 | 9,073 | module Imports
module ProductHelpers
$current_user = Figaro.env.api_admin_user_id.to_i
def self.identify_product_uniqueness(product_params)
identity_params_hash = {product_name:product_params["Product Name"].strip, category_id: self.get_category_id_from_name(product_params["Category Name"].strip),organization... | 49.579235 | 425 | 0.703957 |
b970c0846c02d7276ba631bb55eb0bff0c80a1cf | 5,608 | # Copyright 2018 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, ... | 36.653595 | 183 | 0.672611 |
267006ac6758b6fd0ae127d91fa03f4cf8311077 | 1,220 | module Qernel
# Error class which serves as a base for all errors which occur in the Qernel.
class Error < RuntimeError
def initialize(*args) ; super(make_message(*args)) end
def make_message(msg) ; msg end
end
# Internal: Creates a new error class which inherits from Qernel::Error,
# whose message i... | 30.5 | 80 | 0.622131 |
9136f38cb01725c05185271b9b1f17eb9e54ecac | 694 |
Pod::Spec.new do |s|
s.name = "FTZoomTransition"
s.version = "0.2.2"
s.summary = "Customize the present animation"
s.description = <<-DESC
FTZoomTransition. Customize the present animation with simple api.
DESC
s.homepage = "https://github.com/liufengting/FTZoo... | 34.7 | 108 | 0.597983 |
f761fcebca56e1a459b4da4e0d79ebdb79f2a1ab | 8,185 | require 'editmode/helper'
module Editmode
module ActionViewExtensions
module EditmodeHelper
require 'httparty'
include Editmode::Helper
def api_version
# Todo Add Header Version
end
def api_root_url
ENV["EDITMODE_OVERRIDE_API_URL"] || "https://api.editmode.com"
... | 38.97619 | 216 | 0.608552 |
f8a38e9a19320fa02b38e79d5bc6c82de7368736 | 1,014 | require 'spec_helper'
describe "RailsAdmin Namespaced Model New" do
subject { page }
describe "AbstractModel#to_param" do
it "turns namespaces into prefixes with ~" do
expect(RailsAdmin::AbstractModel.new("Cms::BasicPage").to_param).to eq('cms~basic_page')
end
end
describe "ApplicationControll... | 31.6875 | 107 | 0.728797 |
383d53aae35a397df3022535ead2fad9727d1861 | 318 | require 'help_test'
class TestQueriesWithDynamicFinders< ActiveSupport::TestCase
def test_queries_with_dynamic_finder_on_attributes
user = Plant(:user, :name => 'toto', :age => 30)
assert_equal user, User.find_by_name('toto')
assert_equal user, User.find_by_name_and_age('toto', 30)
end
end | 26.5 | 60 | 0.735849 |
b908fc99cd1aee48474960be0076a327900c83e3 | 384 | require 'wisper/sidekiq'
RSpec.describe 'configuration' do
let(:configuration) { Wisper.configuration }
it 'configures sidekiq as a broadcaster' do
expect(configuration.broadcasters).to include :sidekiq
end
it 'configures sidekiq as default async broadcaster' do
expect(configuration.broadcasters[:asy... | 27.428571 | 95 | 0.778646 |
877406885cccaf6b43a736801c9500fdfd1414a4 | 4,386 | # frozen_string_literal: true
require 'optparse'
require 'patchelf/patcher'
require 'patchelf/version'
module PatchELF
# For command line interface to parsing arguments.
module CLI
# Name of binary.
SCRIPT_NAME = 'patchelf.rb'.freeze
# CLI usage string.
USAGE = format('Usage: %s <commands> FILENA... | 29.436242 | 102 | 0.580255 |
21c77567a0a537081d210e00493422a0b10fb9dc | 2,213 | xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
xml.instruct! "xml-stylesheet", :type=>"text/xsl", :href=>"/schemas/wadl/1.0/stylesheets/wadl_en.xsl"
xml.tag!("wadl:application",
"xmlns:wadl".to_sym => "http://wadl.dev.java.net/2009/02",
"xmlns:xsi".to_sym => "http://www.w3.org/2001/XMLSchema-instance",
"xsi... | 44.26 | 135 | 0.635337 |
382a7324d810faaed2260082c4cb1c2dcaeeacf8 | 120 | require 'test_helper'
class P6UserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15 | 42 | 0.7 |
1c5a3e3b4ba8af1523fb76d8da214e52a3e52374 | 111 | class Registration < ApplicationRecord
validates :first_name, :last_name, :email, :course, presence: true
end | 37 | 68 | 0.792793 |
4a28c827145077e20ad8068297fc228bb7587dec | 393 | module AmazonPaApi
module Extensions
class ::String
def camel_case
self.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
end
def snake_case
self.to_s.gsub(/::/, '/').
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
gsub(/([a-z\d])([A-Z])/,'\1_\2')... | 23.117647 | 84 | 0.417303 |
619e4a55e00cf578303d2ed2f4792b80ab167ecb | 154 | # Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
WakeupLamp::Application.initialize!
| 25.666667 | 52 | 0.805195 |
798cb1038238c74c74effdb7b57e185ad6bc7a43 | 150 | class Loom < Cask
url 'https://loom.com/download/loom-mac.dmg'
homepage 'http://loom.com/'
version 'latest'
no_checksum
link 'Loom.app'
end
| 18.75 | 46 | 0.686667 |
5d203db91bf609d66df939f5f75da6a5a940d208 | 1,112 | # encoding: utf-8
module FileWatch module TailMode module Handlers
class Delete < Base
DATA_LOSS_WARNING = "watched file path was deleted or rotated before all content was read, if the file is found again it will be read from the last position"
def handle_specifically(watched_file)
# TODO consider tryi... | 50.545455 | 161 | 0.72482 |
1ddb4fb217fab65f9c527d5298da6d053d4a7d00 | 550 | class AddVotesToProblemsAndSolutions < ActiveRecord::Migration
def change
add_column :users, :up_votes, :integer, :null => false, :default => 0
add_column :users, :down_votes, :integer, :null => false, :default => 0
add_column :problems, :up_votes, :integer, :null => false, :default => 0
add_column :p... | 50 | 79 | 0.678182 |
03f3220769a91282190aa71d876f78a72d629fb9 | 2,255 | class Scipy < Formula
desc "Software for mathematics, science, and engineering"
homepage "https://www.scipy.org"
url "https://files.pythonhosted.org/packages/53/10/776750d57ade26522478a92a2e14035868624a6a62f4157b0cc5abd4a980/scipy-1.5.2.tar.gz"
sha256 "066c513d90eb3fd7567a9e150828d39111ebd88d3e924cdfc9f8ce19ab6... | 35.793651 | 133 | 0.727273 |
ed49432b2995f99456d8fc1e4a29be34f0fa639e | 2,109 | require 'nokogiri'
require 'open-uri'
###
### Base class for all the social-related services. These classes
### may have a WebClient and an ApiClient for querying information
### about persons or accounts on the specific platform.
###
### All "social" classes will inherit methods from this base class.
###
module Clie... | 26.037037 | 100 | 0.646752 |
21a599fea1e44031b143ddcdf96f9a30feb76711 | 616 | # frozen_string_literal: true
module ShopifyAPI
class ResourceFeedback < Base
class ExistingFeedbackSaved < StandardError; end
include DisablePrefixCheck
self.collection_name = 'resource_feedback'
conditional_prefix :product, false
EXISTING_FEEDBACK_SAVED_ERROR_MESSAGE = 'WARNING: Attempted cal... | 30.8 | 108 | 0.779221 |
ff842827b446a6f12918b9324ec066e3cb8b00ae | 6,807 | require "spec_helper"
RSpec.describe ParameterService, type: :service do
describe "SCIM_CORE_USER_SCHEMA.contains?" do
let(:schema) { ParameterService::SCIM_CORE_USER_SCHEMA }
# Singular Simple Value Attributes
%w(
id
externalId
userName
displayName
nickName
pro... | 26.486381 | 109 | 0.53445 |
0874cf19f03a667a7e742128f71b6c58149ee0e3 | 2,798 | # 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.
#
# This file is the source Rails uses to define your schema when running `bin/rai... | 34.975 | 86 | 0.709793 |
61814159298846abde0e9d548c0668eb94dbae4b | 13,629 | # 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 invalid all existing
# confirmat... | 49.02518 | 154 | 0.751926 |
08599bfac39c7c996e27d5ab3577182e993e4e6d | 362 | # frozen_string_literal: true
require_relative 'wrapper'
module Rainbow
def self.global
@global ||= Wrapper.new
end
def self.enabled
global.enabled
end
def self.enabled=(value)
global.enabled = value
end
def self.uncolor(string)
StringUtils.uncolor(string)
end
end
def Rainbow(strin... | 13.923077 | 34 | 0.71547 |
5d1cc48d6b505e2e2dcbfe4dd46da546472369b3 | 11,171 | cask "xscreensaver" do
version "6.00"
sha256 "ca2b96f1635ed0b208601b5824ea0c8d71bfdc2a0794a9fd32fdc00520d337ff"
url "https://www.jwz.org/xscreensaver/xscreensaver-#{version}.dmg"
name "XScreenSaver"
desc "Screen savers"
homepage "https://www.jwz.org/xscreensaver/"
livecheck do
url "https://www.jwz.o... | 44.684 | 75 | 0.800555 |
e97ff8b10f825a73e8d1e99fecd679af063e667b | 142 | class AddCounterCacheToTechnologies < ActiveRecord::Migration
def change
add_column :technologies, :locations_count, :integer
end
end
| 23.666667 | 61 | 0.802817 |
e9c7aecc7251929ad2fad853c6e44acc27da94a1 | 486 | # encoding: utf-8
module PlutoUpdate
MAJOR = 1
MINOR = 6
PATCH = 1
VERSION = [MAJOR,MINOR,PATCH].join('.')
def self.version
VERSION
end
def self.banner
### todo: add RUBY_PATCHLEVEL or RUBY_PATCH_LEVEL e.g. -p124
"pluto-update/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{... | 19.44 | 95 | 0.670782 |
017be557c27f79be21b4ed9abb4cdb65d6cdabdd | 10,462 | =begin
#DocuSign Admin API
#An API for an organization administrator to manage organizations, accounts and users
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end
require 'date'
module DocuSign_Admin
class UserDrilldownResponse
at... | 30.680352 | 281 | 0.625502 |
11464ed9a7f36450bf5aa7132b4a8b8d626a920e | 7,467 | # ********** Copyright Viacom, Inc. Apache 2.0 **********
module RokuBuilder
MISSING_DEVICES = 1
MISSING_DEVICES_DEFAULT = 2
DEVICE_DEFAULT_BAD = 3
# = 4
MISSING_PROJECTS_DEFAULT = 5
PROJECTS_DEFAULT_BAD = 6
DEVICE_MISSING_IP = 7
DEVICE_MISSING_... | 39.094241 | 130 | 0.621401 |
bb675bad767d88b542490d38e2718203a95fc779 | 5,629 | # 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.941489 | 88 | 0.58927 |
eda136b16a01c2423a77bf519e5d4e80a81bf770 | 821 | class RequestListDetailSection < SitePrism::Section
element :public_id_link, "td.public_id a"
element :status, "td.status"
end
class RequestTableSection < SitePrism::Section
element :section_title, "h3"
element :empty_list_label, "p.empty-list-label"
element :desc_column_header, "th.desc"
sections :request... | 35.695652 | 75 | 0.779537 |
4a6a014acc5d6ea2850007dca6a5d3ec9bad8ec3 | 2,617 | # frozen_string_literal: true
require 'logger'
desc "GitLab | Packages | Events | Generate hll counter events file for packages"
namespace :gitlab do
namespace :packages do
namespace :events do
task generate: :environment do
Rake::Task["gitlab:packages:events:generate_counts"].invoke
Rake:... | 33.987013 | 129 | 0.639664 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.