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 |
|---|---|---|---|---|---|
e8e31be1f36e87f8db80d0ed974d18420db7ee65 | 3,024 | class SipOctaveApp < Formula
desc "Tool to create Python bindings for C and C++ libraries"
homepage "https://www.riverbankcomputing.com/software/sip/intro"
url "https://dl.bintray.com/homebrew/mirror/sip-4.19.8.tar.gz"
mirror "https://downloads.sourceforge.net/project/pyqt/sip/sip-4.19.8/sip-4.19.8.tar.gz"
sh... | 29.940594 | 90 | 0.593254 |
d568a98a6fb830fcddf7611f2d084a72001a1e01 | 1,020 | class BoardsController < ApplicationController
before_action :set_board, only: [:show, :update, :destroy]
# GET /boards
def index
@boards = Board.all
render json: @boards
end
# GET /boards/1
def show
render json: @board
end
# POST /boards
def create
@board = Board.new(board_params)... | 19.615385 | 73 | 0.659804 |
e2fa8bcea6d06c6c3bca77811eb462ee21726f79 | 7,068 | # encoding: UTF-8
# frozen_string_literal: true
describe API::V2::Account::Deposits, type: :request do
let(:member) { create(:member, :level_3) }
let(:other_member) { create(:member, :level_3) }
let(:token) { jwt_for(member) }
let(:level_0_member) { create(:member, :level_0) }
let(:level_0_member_token) { jw... | 36.246154 | 127 | 0.659451 |
abb81922d6bbd0c0abf4fbe4dd75a19ece109b16 | 552 | Pod::Spec.new do |s|
s.name = "VAProgressCircle"
s.version = "0.0.9"
s.summary = "A custom loading bar for iOS"
s.homepage = "https://github.com/MitchellMalleo/VAProgressCircle"
s.license = 'MIT'
s.author = { "Mitch Malleo" => "mitchellmalleo@gmail.co... | 39.428571 | 115 | 0.570652 |
01a0005917ef18b7c283552f3fa263478be5bfa5 | 320 | cask 'checkra1n' do
version '0.9.3'
sha256 'f7a16ee122a6d7c8c9a0429db1a0b8fb4ecc3543684713eda951f19b30c02c11'
url "https://checkra.in/assets/downloads/macos/#{sha256}/checkra1n%20beta%20#{version}.dmg"
appcast 'https://checkra.in/'
name 'checkra1n'
homepage 'https://checkra.in/'
app 'checkra1n.app'
end
| 26.666667 | 93 | 0.746875 |
62908f3e22263c3e77b5a4c0477ed10234898806 | 1,361 | module Chronicle
module ETL
module Registry
# Records details about a connector such as its provider and a description
class ConnectorRegistration
attr_accessor :identifier, :provider, :klass, :description
def initialize(klass)
@klass = klass
end
def phase
... | 23.465517 | 109 | 0.542248 |
ed12e215cf92702aa22f54d18acc2f7db419ac83 | 898 | class Admin::PostCategoriesController < AdminController
include CrudConcern
before_action :find_post_category, only: [:edit, :update, :destroy]
before_action :get_locales, only: [:edit, :create, :new]
def index
# @post_categories = PostCategory.all
@post_categories = index_helper("PostCategory")
end
def n... | 20.409091 | 86 | 0.776169 |
017b98e4976e9ab544aa676f0138aac2017697e9 | 1,572 | require 'active_record_date_formatted/date_format_validator'
# Creates additional instance getter and setter methods for each date attribute with postfix _formatted
# These methods use date string formatted with the current locale.
module ActiveRecordDateFormatted
module Model
def inherited(subclass)
supe... | 39.3 | 202 | 0.693384 |
d52bf999f3337ce343d339e0695a5b29d5e895a0 | 975 | namespace :static_resources do
desc 'Sync public/{packs,assets} to s3'
task sync_s3: :environment do
require 'static_resources_rails/storage'
['assets', *StaticResourcesRails.additional_sync_dirs].each do |dir|
StaticResourcesRails::Storage.sync(dir)
end
end
desc 'Download manifest.json'
t... | 36.111111 | 132 | 0.757949 |
01174a4b72a21425e5caca5e144cf69736a0df58 | 201 | Group.seed(:id, [
{ id: 99, name: "GitLab", path: 'gitlab', owner_id: 1 },
{ id: 100, name: "Brightbox", path: 'brightbox', owner_id: 1 },
{ id: 101, name: "KDE", path: 'kde', owner_id: 1 },
])
| 33.5 | 65 | 0.557214 |
f7240969588ddf196768fd9fbd0c7baa664166fc | 49,805 | require 'spec_helper'
describe NotificationService, services: true do
include EmailHelpers
let(:notification) { NotificationService.new }
around(:each) do |example|
perform_enqueued_jobs do
example.run
end
end
shared_examples 'notifications for new mentions' do
def send_notifications(*ne... | 36.810791 | 220 | 0.682462 |
1cb0fbe09a2eb177f6b35a1eb921f0dea4a05c3e | 188 | # encoding=UTF-8
require_relative '../writeFile.rb'
ObjSample = CWriteFile.new
ObjSample.start({"action" => "WriteFile","path" => "./document/text.txt","isCover"=>true,"text"=>"123"}) | 37.6 | 104 | 0.675532 |
91f64875f78d769cbb20dd19af17ad77e97d9534 | 1,893 | require 'test_helper'
class BlockUnitTest < Minitest::Test
include Liquid
def test_blankspace
template = Liquid::Template.parse(" ")
assert_equal [" "], template.root.nodelist
end
def test_variable_beginning
template = Liquid::Template.parse("{{funk}} ")
assert_equal 2, templat... | 32.084746 | 81 | 0.698362 |
21157591cfd4fb660c5cc8a15f7e217247337741 | 350 | class RolePlayMigrationGenerator < Rails::Generators::Base
include Rails::Generators::Migration
source_root File.expand_path("../templates", __FILE__)
def self.next_migration_number(path)
Time.now.utc.strftime("%Y%m%d%H%M%S")
end
def create_model_file
migration_template "migration.rb", "db/migra... | 26.923077 | 67 | 0.745714 |
ed676b52b42a829b09ca7cc8381819f961e71d0b | 1,332 | # -*- encoding: utf-8 -*-
# stub: em-websocket 0.5.1 ruby lib
Gem::Specification.new do |s|
s.name = "em-websocket".freeze
s.version = "0.5.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Ilya Gr... | 38.057143 | 112 | 0.676426 |
0117d58683eb4deb1a5c25e876735f8e97756fc1 | 179 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/equal', __FILE__)
describe "Bignum#==" do
it_behaves_like :bignum_equal, :==
end
| 25.571429 | 58 | 0.715084 |
ed4a3e72ee7c99a153323a703cfd2b2c75cd230c | 110 | module Pulsar
class Install
include Interactor::Organizer
organize CopyInitialRepository
end
end
| 13.75 | 34 | 0.772727 |
38040bbcb9323f1182bf7459972301181abfc39e | 1,767 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe TraineeStatusCard::View do
include Rails.application.routes.url_helpers
alias_method :component, :page
let(:current_user) { create(:user, system_admin: true) }
let(:trainee) { create(:trainee) }
let(:trainees) { Trainee.all }
let(:targe... | 29.949153 | 89 | 0.659875 |
3859c875f9d347fd9debc0f4ca0b142761da81aa | 113 | class Admin < ApplicationRecord
validates :name, presence: true
has_many :logins, foreign_key: :user_id
end
| 18.833333 | 41 | 0.769912 |
e973d3df37d77f4a5a5d6e20b53d0da3c4c515cd | 368 | require_relative '../options_helper'
describe OctocatalogDiff::CatalogDiff::Cli::Options do
describe '#opt_bootstrap_script' do
it 'should set options[:bootstrap_script]' do
result = run_optparse(['--bootstrap-script', 'my-bootstrap-script'])
expect(result.fetch(:bootstrap_script, 'key-not-defined'))... | 33.454545 | 93 | 0.728261 |
61cefd24b3f466796c92e53b1f72ea57df02ac01 | 7,705 | # 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::CDN::Mgmt::V2016_10_02
#
# Use these APIs to manage Azure CDN resources through the Azure Resource
# Manager. You must make sure that re... | 35.506912 | 129 | 0.673459 |
033f029d27bcbd0180b874ce1307a4c9a7fd0f15 | 1,655 | #
# Be sure to run `pod lib lint OMTFoundation.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'OMTFo... | 35.978261 | 107 | 0.648943 |
e2bab9c1999d2dd743280b753ad7dc99961b6f3f | 12,366 | # frozen_string_literal: true
RSpec.describe "real source plugins" do
context "with a minimal source plugin" do
before do
build_repo2 do
build_plugin "bundler-source-mpath" do |s|
s.write "plugins.rb", <<-RUBY
require "bundler-source-mpath"
class MPath < Bundler::... | 26.941176 | 106 | 0.505337 |
e8d7a4266ec001a50737aaf96c04a61d06e6d518 | 1,657 | #
# Be sure to run `pod lib lint DBDatePickerView.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'DB... | 36.822222 | 104 | 0.655401 |
6a8f13c08b93139039e613c7d9a6fda92cac64f6 | 8,018 | class Locust < Formula
include Language::Python::Virtualenv
desc "Scalable user load testing tool written in Python"
homepage "https://locust.io/"
url "https://files.pythonhosted.org/packages/6e/ee/8c91551fc6f216f3106786191c8205e6bc05186dd690ffdf15bae06e6f66/locust-2.7.0.tar.gz"
sha256 "0dc4a801afab0197e8dcf... | 47.443787 | 149 | 0.815665 |
186cda333dc5a335451e9fd0138134f2f3290570 | 247 | class AddTestGroupNumberToCachedRessiEvents < ActiveRecord::Migration[5.2]
def self.up
add_column :cached_ressi_events, :test_group_number, :integer
end
def self.down
remove_column :cached_ressi_events, :test_group_number
end
end
| 24.7 | 74 | 0.793522 |
38194124eac677b2e44b21e68b3dd11ca088c300 | 624 | module Imdb
# Represents a TV series on IMDB.com
class Serie < Base
def season(number)
seasons[number - 1]
end
def seasons
season_urls.map { |url| Imdb::Season.new(url) }
end
def creators
document.search("div[text()*='Creator']//a").map { |a| a.content.strip }
end
pr... | 21.517241 | 106 | 0.607372 |
7ac2ec3fb2ae8ea8b438b9ae130d39f5a2bf953d | 1,348 | # frozen_string_literal: true
module Fields
class DateRangeField < Field
# serialize :validations, Validations::DateRangeField
# serialize :options, Options::DateRangeField
def interpret_to(model, overrides: {})
check_model_validity!(model)
accessibility = overrides.fetch(:accessibility, se... | 26.431373 | 76 | 0.622404 |
ab5fe0a812e4dd3b51f00912747954a30bb150c4 | 954 | Pod::Spec.new do |s|
s.name = "ADProgressView"
s.version = "1.2.0"
s.summary = "A UIProgressView subclass allowing start/pause/continue/reset."
s.description = "I created this subclass after discovering that UIProgressView does not allow you to pause/continue its progression. Thanks to ADPr... | 43.363636 | 370 | 0.685535 |
336515cd3638f9d11958426792a7630ba0d4327d | 189 | class DropColumnnsFromBillingInvoices < ActiveRecord::Migration
def change
remove_column :bill_invoices, :invoiceable_id
remove_column :bill_invoices, :invoiceable_type
end
end
| 27 | 63 | 0.814815 |
91609de6f1bff033146a91033c6a78284d907894 | 613 |
module RailsSqlViews
module Loader
SUPPORTED_ADAPTERS = %w( Mysql PostgreSQL SQLServer SQLite )
def self.load_extensions
SUPPORTED_ADAPTERS.each do |db|
if ActiveRecord::ConnectionAdapters.const_defined?("#{db}Adapter")
require "rails_sql_views/connection_adapters/#{db.downcase}_adap... | 32.263158 | 82 | 0.698206 |
1ad400605d70f7cbfaa2107dad0bfd97f368e072 | 2,547 | class Consul < Formula
desc "Tool for service discovery, monitoring and configuration"
homepage "https://www.consul.io"
url "https://github.com/hashicorp/consul.git",
:tag => "v0.9.3",
:revision => "112c0603d3d6fb23ab5f15e8fdb1a761da8eaf9a"
head "https://github.com/hashicorp/consul.git",
:sh... | 31.060976 | 125 | 0.639183 |
e92b28fc2e81aeccf9aea977eee0108d111aab9d | 2,004 | # Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
... | 44.533333 | 97 | 0.735529 |
11044155e6a990579a57c705c35a75d3bbceca47 | 918 | =begin
#RadioManager
#RadioManager
OpenAPI spec version: 2.0
Contact: support@pluxbox.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.3.0
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for RadioManagerClient::Tag
# Automatically generated by sw... | 21.348837 | 103 | 0.729847 |
28610ce41ff3d3e46485e648467cd1efde1c68a3 | 2,427 | # 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, ... | 35.173913 | 121 | 0.699629 |
39b277fb252fe49ba43a413411b1e4e4827220d5 | 1,409 | class RegistrationsController < Devise::RegistrationsController
before_action :configure_permitted_parameters, if: :devise_controller?
# updated from original to look for changes to user crosswalk setting
def update_resource(resource, params)
original_crosswalk_setting = resource.crosswalk_enabled
saved =... | 29.978723 | 102 | 0.740951 |
6295cf0287433bf51243f9ae6376d6b0dce75be2 | 1,275 | require 'pathname'
class Repository
NAME = '.hangover'
class << self
def find(dir)
path = Pathname.new(dir).expand_path.realpath
begin
try_path = path + NAME
return new(path.to_s) if try_path.directory?
end while (path = path.parent).to_s != '/'
nil
... | 17.22973 | 75 | 0.574118 |
267c54b2c935479d730ff60fdd05858256107aa1 | 1,074 |
module Cocoadex
class DataType < SequentialNodeElement
TEMPLATE_NAME=:data_type
class Field < Parameter;end
attr_reader :abstract, :declaration, :declared_in,
:discussion, :availability, :considerations
attr_accessor :next_termdef
def fields
@fields ||= []
end
def constan... | 22.851064 | 69 | 0.627561 |
1a4ea76572bee97a37aad33400a3f0daf113dab8 | 524 | require 'minitest/autorun'
class Array
undef uniq
end
module Enumerable
undef uniq
end
require_relative 'uniq'
class UniqTest < MiniTest::Test
def test_without_block
assert_equal ["a", "b", "c"], ["a", "a", "b", "b", "c"].uniq
end
def test_with_block
assert_equal [["student", "sam"], ["teacher", "... | 20.96 | 141 | 0.624046 |
61c12abe67669562cd49e0ea50710535a65f8b35 | 2,408 | # frozen_string_literal: true
class Admin::RolesController < Admin::ApplicationController
before_action :set_role, only: %i[show user update]
before_action :set_breadcrumbs, only: %i[new edit create update], if: -> { request.format.html? }
def index
prepare_meta_tags title: t('.title')
@roles = Role.all... | 38.83871 | 194 | 0.679402 |
39b43bae18f63485c374c58e0cd3a295586c199e | 683 | cask "scrutiny" do
version "9.13.0"
sha256 "27df87b74681e938cc4e1f6013907d1bae08c32e988d4e65a1fcf13b2bd2a7a1"
url "https://peacockmedia.software/mac/scrutiny/scrutiny.dmg"
appcast "https://peacockmedia.software/mac/scrutiny/version_history.html"
name "Scrutiny"
homepage "https://peacockmedia.software/mac/s... | 35.947368 | 81 | 0.751098 |
62532ebdeffa04e2e7a410f56aa0c04e8771f8f2 | 13,346 | require 'webmock/rspec'
require 'avro_turf/messaging'
require 'avro_turf/test/fake_confluent_schema_registry_server'
describe AvroTurf::Messaging do
let(:registry_url) { "http://registry.example.com" }
let(:client_cert) { "test client cert" }
let(:client_key) { "test client key" }
let(:client_key_pass) { "test... | 33.116625 | 130 | 0.667915 |
618360822f358fd8d6919951b549c8411202fab9 | 1,222 | require 'bunny'
require 'amqp'
require 'eventmachine'
module BunnyHop
class Reader
def initialize(config)
@config = config
end
def run(name, controller, settings = {})
count = settings.fetch(:count, -1)
closed = false
EventMachine.run do
conn = AMQP.connect(@config)
... | 29.095238 | 87 | 0.556465 |
d5929ad6d7f101b59aa4d919d07817648c48fad0 | 142 | # coding: UTF-8
class FeatureFlagsUser < Sequel::Model
include CartoDB::MiniSequel
many_to_one :feature_flag
many_to_one :user
end
| 12.909091 | 38 | 0.753521 |
18d20ef653ee0e14d6dadaa039dd28835b14df7b | 626 | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules ... | 41.733333 | 76 | 0.77476 |
62142ea10c710e7dda07540048c28ec76a46b332 | 313 | require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
## Armenia
class AMTest < Phonie::TestCase
def test_local
parse_test('+37422212345', '374', '222', '12345', 'Armenia', false)
end
def test_mobile
parse_test('+37451234567', '374', '5', '1234567', 'Armenia', true)
end
end
| 24.076923 | 73 | 0.661342 |
5df4a7d4c84cfa57ad07a19df24128bc16796fb9 | 223 | class AddAttachmentCarouselToImages < ActiveRecord::Migration[4.2]
def self.up
change_table :carousels do |t|
t.attachment :image
end
end
def self.down
remove_attachment :carousel, :image
end
end
| 18.583333 | 66 | 0.713004 |
6a06fc0c3ec7708c53eb014bf49a28b25b394374 | 5,703 | module Rockstar
class RockstarParser < Parslet::Parser
root(:blocks)
# general
rule(:blocks) {(function | conditional_block | block).repeat(1).as(:blocks)}
rule(:eol) {match['\n']}
rule(:eof) {any.absent?}
rule(:space) {match('[ \t]').repeat(1)}
rule(:block) {(block_part >> (eol >> block... | 63.366667 | 170 | 0.644047 |
6aa4d62309dfd3e5bd7219c2235a449d2329bf16 | 162 | if ENV["LOGSTASH_HOST"].present?
Rails.application.configure do
SemanticLogger.add_appender(file_name: "log/#{Rails.env}.json", formatter: :json)
end
end
| 27 | 85 | 0.746914 |
28449ae3667efdeb11d951260f18a89c442b6527 | 3,603 | 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... | 42.388235 | 102 | 0.737441 |
288e36338ca795e993b281a62dd8f7164a9b0c1e | 176 | module Rpush
def self.reflect
yield reflection_stack[0] if block_given?
end
def self.reflection_stack
@reflection_stack ||= [ReflectionCollection.new]
end
end
| 17.6 | 52 | 0.744318 |
abedbdda8e1f70e3cde4dd066fca68098bb5856a | 397 | class CreateNotifications < ActiveRecord::Migration[6.0]
def change
create_table :notifications do |t|
t.integer :contestant_id, null: false
t.boolean :read, null: false, default: false
t.text :encoded_message, null: false
t.timestamps
end
add_index :notifications, [:contestant_i... | 26.466667 | 58 | 0.690176 |
f8965a91d2bb48fd51ea625c3d7e404e256e14b6 | 254 | def first_n_fibs(n)
return [0, 1].take(n) if n <= 2
prev_fibs = first_n_fibs(n-1)
first_to_last = prev_fibs[-1]
second_to_last = prev_fibs[-2]
prev_fibs << first_to_last + second_to_last
end
p first_n_fibs(8)
# => [0, 1, 1, 2, 3, 5, 8, 13]
| 19.538462 | 45 | 0.649606 |
bfd7ba0aee60ce0759e07573c8c96c18a7ea1984 | 7,250 | # Copyright (c) 2016, 2021, 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... | 60.92437 | 245 | 0.883172 |
ac7bcd83a68e520cd7a48638804f6ee9c6f31986 | 2,794 | #!/bin/ruby
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, msyksphinz
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# ... | 27.392157 | 86 | 0.73121 |
79a6fa4dde6dd3be99671c288792264709436e55 | 849 | class Logtalk < Formula
desc "Declarative object-oriented logic programming language"
homepage "https://logtalk.org/"
url "https://github.com/LogtalkDotOrg/logtalk3/archive/lgt3400stable.tar.gz"
version "3.40.0"
sha256 "61e591388fff3aa81fbd383360d24f85a270422eacf7660aec83df689342cb35"
license "Apache-2.0"
... | 36.913043 | 94 | 0.792697 |
b9d0af5478ba8e1de48ec2fa32b787b64a7a13c4 | 1,529 | #snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.]
#snippet-sourceauthor:[Doug-AWS]
#snippet-sourcedescription:[Adds items from a JSON file to a DynamoDB table.]
#snippet-keyword:[Amazon DynamoDB]
#snippet-keyword:[put_item method]
#snippet-keyword:[Ruby]
#snippet-service:[dyn... | 33.23913 | 88 | 0.701112 |
d5768e290f234f632adabae7e6006268b6622c25 | 322 | class FollowerPolicy < ApplicationPolicy
def destroy?
raise Pundit::NotAuthorizedError unless record.followed_id == user.id
return Regular.new(record.follower)
end
class Scope < Scope
def resolve
return Regular.new(scope, User)
end
end
class Regular < FlexiblePermissions::Base
end
en... | 20.125 | 73 | 0.726708 |
18a7787efd1d8141924d62ed061be187a3a3732a | 1,279 | require 'rails_helper'
RSpec.describe 'PowerConverter' do
context 'access_url' do
[
{
to_convert: Sipity::Models::Attachment.create!(file: File.new(__FILE__), work_id: 1, pid: 2, predicate_name: 'attachment'),
expected: %r{#{File.join(Figaro.env.url_host, "attachments")}/\w+}
}, {
... | 41.258065 | 132 | 0.650508 |
91a248bc2370358ba715e82258bb70d43ff8eb12 | 494 | # frozen_string_literal: true
module Shmup
module Entities
module Bullet
class Graphics < Core::Component
def initialize(game_object, sprite)
super(game_object)
@sprite = sprite
end
def draw
@sprite.draw_rot(x, y, ZOrder::BULLET, object.physics.angle)
... | 18.296296 | 70 | 0.552632 |
8782305ecbf6a6845b25130c10d6f5e62716d974 | 94 | require "asana/cli/version"
module Asana
module Cli
# Your code goes here...
end
end
| 11.75 | 28 | 0.680851 |
bbe514c8cc4f83bb2586b8709d7bfe0976149fa2 | 247 | require "json"
Dir.chdir(__dir__)
contents = ""
lines = JSON.parse(File.read("roberta-base-vocab.json"))
lines.each do |k, v|
token = k.sub("Ġ", "▁")
contents << "#{token}\t-#{v}\n"
end
File.write("spiece.model.exportvocab.txt", contents)
| 17.642857 | 56 | 0.647773 |
91f5eaec72f9a57a63a54d837f6530682f46c07a | 690 | # Section 03 - Lesson 02 - Inversions made easy
# Isn't She Lovely - Stevie Wonder
require "#{Dir.home}/ruby/pianoforall/section03/lesson02/bossa_nova_bounce"
use_synth :piano
in_thread(name: :right_hand) do
bossa_nova_bounce_treble(:E4, :minor7, shift: -1, bounce: 1.5)
bossa_nova_bounce_treble(:A3, shift: -2, bou... | 32.857143 | 75 | 0.73913 |
4aefd671f4a80186486d366aa353ea9ea7de1f33 | 6,702 | require 'rails_helper'
RSpec.describe ArchiveSignaturesJob, type: :job do
let(:petition) { FactoryBot.create(:validated_petition, sponsors_signed: true) }
let(:archived_petition) { FactoryBot.create(:archived_petition, id: petition.id) }
let(:archived_signature) { archived_petition.signatures.last }
it "copie... | 34.193878 | 127 | 0.751567 |
e99e33e4f0ad81906610f020f1ad516679f96ab9 | 7,627 | =begin
#Datadog API V2 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://openapi-generator.tech
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
This product... | 29.447876 | 220 | 0.621214 |
11696c4867a86d3ed400fca81dbba0e21abfcd12 | 358 | # frozen_string_literal: true
require 'spec_helper'
# Before running this spec again, you need to set environment variable BOLETOSIMPLES_API_TOKEN
RSpec.describe BoletoSimples::SmsDelivery do
describe 'all', vcr: { cassette_name: 'resources/sns_delivery/all' } do
subject { described_class.all }
it { expect... | 27.538462 | 94 | 0.765363 |
8750b57fc37e471582b16013585360255ea7f3e8 | 820 | # authentication tutorial: http://railscasts.com/episodes/250-authentication-from-scratch
class User < ApplicationRecord
attr_accessor(:password)
before_save(:encrypt_password)
validates_confirmation_of(:password)
validates_presence_of(:password, :on => :create)
validates_presence_of(:username)
validates_u... | 30.37037 | 104 | 0.741463 |
6263923c5f88a3c8bd49992a86ca61ca92a48ac7 | 1,243 | # 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.527778 | 80 | 0.746581 |
1818947d79c8e1ab63e087a416c54dc961acccfa | 382 | class CreateEventSubscriptions < ActiveRecord::Migration
def change
create_table :event_subscriptions do |t|
t.references :event, index: true
t.references :user, index: true
t.timestamps null: false
end
add_foreign_key :event_subscriptions, :events, on_delete: :cascade
add_foreign_ke... | 31.833333 | 70 | 0.73822 |
f7817cfa1fd9fc8b107db75b4743e0a77ea6541c | 2,235 | # Copyright 2011-2015, The Trustees of Indiana University and Northwestern
# University. 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
# ... | 33.863636 | 133 | 0.685906 |
ac940da658cbc28d431f4c9fc3b650643792afcd | 1,790 | # encoding: utf-8
# frozen_string_literal: true
module RuboCop
module Cop
module Performance
# This cop is used to identify usages of `count` on an
# `Array` and `Hash` and change them to `size`.
#
# @example
# # bad
# [1, 2, 3].count
#
# # bad
# {a: ... | 22.948718 | 72 | 0.510615 |
5d8a7dfe42b9b4ef8f6ad93cc8a061e7d31b539b | 2,179 | # Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
require 'spec_helper'
describe 'client.cluster#stats' do
let(:expected_args) do
[
'GET',
url,... | 19.283186 | 107 | 0.616338 |
bb30b37adc01d63502b36a82e0af53b2c08b77ac | 1,133 | # frozen_string_literal: true
Rails.application.configure do
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't ... | 32.371429 | 75 | 0.776699 |
ff56ef51cf2702abefaa495a534d5112466ba04c | 634 | module Cucumber
module Mate
module Files
class StepDetector
def initialize(path_to_a_feature_file)
@step_files = (
Dir[File.dirname(path_to_a_feature_file) + "/step_definitions/**/*.rb"] +
Dir[File.dirname(path_to_a_feature_file) + "/**/*_steps.rb"]
).un... | 24.384615 | 97 | 0.57571 |
39cfbbf23c16fb0611962f8d9eaa537b18ee5e11 | 295 | module ApplicationHelper
# a customized out link function, can add prefix to the weblink
def link_to_external_lookup(options={})
#url_prefix = 'https://www.google.com/search?q='
options[:value].map do |url|
link_to "#{url}", "#{url}"
end
end
end
| 26.818182 | 67 | 0.616949 |
bb544de5af5bba66d65eceddb2a9df99f7cff9d8 | 504 | module Cofidin33
class SellaComprobante
def self.call(comprobante:, certificado:, llave_privada:, fecha_hora:)
comprobante.fecha = fecha_hora
serie, cert = ProcesaCertificado.call certificado
comprobante.no_certificado = serie
comprobante.certificado = cert
cadena_original = GeneraCa... | 33.6 | 74 | 0.736111 |
bbdb4cac2dc4cb17f2a167a35aeba534dcc4394b | 260 | class Xtrafinder < Cask
url 'http://www.trankynam.com/xtrafinder/downloads/XtraFinder.dmg'
homepage 'http://www.trankynam.com/xtrafinder/'
version 'latest'
no_checksum
install 'XtraFinder.pkg'
uninstall :pkgutil => 'com.trankynam.xtrafinder.*'
end
| 28.888889 | 68 | 0.75 |
62a5e4f5daae91ff4d0c04135349001a36318470 | 2,170 | unless Hash.instance_methods.include? '-'
Hash.class_eval do
# removes one or more keys from a hash
# {:red => 1, :blue => 2, :green => 3} - [:red, :blue] => {:green => 3}
def -(v)
hsh = self.dup
(v.is_a?(Array) ? v : [v]).each{|k| hsh.delete(k) }
hsh
end
end
end
unless Hash.ins... | 31.911765 | 101 | 0.588479 |
e81a177ef5fb0035619b5cc57cee40c07740d4a6 | 1,972 | require 'active_support/core_ext/object/to_query'
require 'action_view'
require 'action_view/helpers'
require 'rack/utils'
require 'query_report/errors'
module QueryReportEngineHelper
def query_report_render_filter(filter, comparator)
hint = comparator.name
search_tag_name = comparator.search_tag_name
va... | 34.596491 | 153 | 0.707404 |
0193d64f7b9f2e5dc4dd83669e060ab1c41951a1 | 122 | module UserProfile
class Profile < ApplicationRecord
belongs_to :user, class_name: UserProfile.user_class
end
end
| 20.333333 | 56 | 0.795082 |
6ad1ce5f4deb4caf7d75b55bf493bda8968e0c34 | 7,864 | require 'spec_helper_acceptance'
#fact based two stage confine
#confine array
confine_array = [
(fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') == '10.04'),
(fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') == '5'),
(fact('operatingsystem') == 'Debian' && fac... | 36.239631 | 156 | 0.56854 |
87be11eecccdf89a5609451133e3903a99319df0 | 943 | module SearchParserMatchers
class QueryFor
def initialize(term)
@term = term
end
def matches?(parser)
@parser = parser
@parser.query == @term
end
def failure_message
%{expected parser to have query for "#{@term}" but got query "#{@parser.query}"}
end
end
def que... | 20.06383 | 103 | 0.616119 |
28feddbd86ae6bc820473f2ec993b9c274dae256 | 1,106 | require "active_support/core_ext/module/delegation"
require "active_support/concern"
module MiqToolsServices
module SidekiqWorkerMixin
extend ActiveSupport::Concern
included do
delegate :sidekiq_queue, :workers, :running?, :to => self
end
module ClassMethods
def sidekiq_queue
si... | 26.97561 | 100 | 0.654611 |
1dcdc124c854648847a4a238c33325fd46f567e8 | 979 |
Praxis::Application.configure do |application|
# This is a commented out copy of the default Praxis layout
# This example app follows the standard practices, so there is no reason to override it
# If we wanted to organize the structure and ordering of files, we can uncomment the layout
# and define it at our o... | 37.653846 | 93 | 0.579162 |
87045238c82d4821a4d6652f012c11b0a3a1bbef | 12,632 | # 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... | 48.584615 | 150 | 0.747863 |
bfba13ae50c3fb7e0b48e6558d2321e75e5107d7 | 1,028 | class DebateOutcome < ActiveRecord::Base
include Translatable
translate :overview, :transcript_url, :video_url, :debate_pack_url
belongs_to :petition, touch: true
validates :petition, presence: true
validates :debated_on, presence: true, if: :debated?
with_options url: true, length: { maximum: 500 } do
... | 22.347826 | 73 | 0.715953 |
18b52bc011ba25ab0c33135e14acb1a3be409b8c | 1,027 | # frozen_string_literal: true
require 'rails_helper'
module Validators
RSpec.describe PhoneContract, dbclean: :after_each do
subject do
described_class.new.call(params)
end
describe 'missing kind and full_phone_number field' do
let(:params) do
{ }
end
let(:error_messa... | 20.137255 | 131 | 0.623174 |
79e7e9fae0bef6869a2d9b27942c3e35ba70757c | 126 | test_cask 'appcast-invalid-sha256' do
appcast 'http://localhost/appcast.xml',
:sha256 => 'not a valid shasum'
end
| 25.2 | 41 | 0.674603 |
1a5692885af869cd1b89e523d69f49a2086e8a2b | 1,387 | require_relative '../../../kitchen/data/spec_helper'
suffix = node['tomcat']['base_version'].to_i < 7 ? node['tomcat']['base_version'] : ''
describe 'should be running tomcat6 on port 8080' do
describe service("tomcat#{suffix}") do
it { should be_enabled }
it { should be_running }
end
describe port(808... | 30.822222 | 100 | 0.69863 |
acfe150589459fd5bc2e915533ccb9b0d8cf2c6a | 422 | require "spec_helper"
module YieldStarClient
module GetLeaseTermRent
describe Request do
it "is configured to get lease term rents" do
expect(described_class.lease_term_request_opts[:request_element])
.to eq :lease_term_rent_unit_request
end
it "has the correct SOAP_ACTION" d... | 24.823529 | 73 | 0.71564 |
1105ec23145cf941a0929d705484d50d7fcba518 | 2,769 | require 'bundler'
require 'thor'
require_relative 'templates/resource'
puts 'Loaded Resource Generator'
module Voom
module Generators
class Resource < Thor::Group
include Thor::Actions
argument :resource, types: :string
def self.source_root
__dir__
end
# These methods nee... | 37.931507 | 123 | 0.609967 |
4af0fcc86f5f12e73ba28e2cfacb3868cc71aec9 | 899 | require 'test_helper'
class UserMailerTest < ActionMailer::TestCase
test "account_activation" do
user = users(:michael)
user.activation_token = User.new_token
mail = UserMailer.account_activation(user)
assert_equal "Account Activation", mail.subject
assert_equal [user.email], mail.to
assert_equal ["n... | 31 | 56 | 0.766407 |
1d5e3e423a3d89b41fe8d4909d52339f54764591 | 2,047 | class Juju < Formula
desc "DevOps management tool"
homepage "https://juju.is/"
url "https://github.com/juju/juju.git",
tag: "juju-2.9.16",
revision: "b84c5592b1036265aa1ce28b1e40b79c3886a21a"
license "AGPL-3.0-only"
version_scheme 1
head "https://github.com/juju/juju.git"
livecheck do
... | 40.94 | 123 | 0.700049 |
01c1fec6ec471d8d572e702e2892f7b2b9107898 | 4,357 | # Copyright 2007 Chang Sau Sheong
#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, so... | 28.292208 | 99 | 0.630939 |
611610bf3f31a5252d428fc2c206bbc77acce4d1 | 1,126 | # frozen_string_literal: true
require 'cucumber/platform'
module Cucumber
module Constantize #:nodoc:
def constantize(camel_cased_word)
try = 0
begin
try += 1
names = camel_cased_word.split('::')
names.shift if names.empty? || names.first.empty?
constant = ::Object
... | 23.458333 | 60 | 0.531972 |
e9b025c9cc06f6ffa713694543962de5a4d9ea07 | 19,616 | require 'spec_helper'
require 'shared_examples/protect_product_actions'
module Spree
describe Api::V1::ProductsController, type: :controller do
render_views
let!(:product) { create(:product) }
let!(:inactive_product) { create(:product, available_on: Time.current.tomorrow, name: 'inactive') }
let(:ba... | 39.468813 | 159 | 0.589876 |
ace1bfa3e6301e270e03c66d20e45bb4dc911f3b | 11,644 | require 'spec_helper'
describe 'dhcp' do
on_os_under_test.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts
end
let(:params) do
{
:interfaces => ['eth0'],
}.merge(overridden_params)
end
conf_path = case os
when /^Fre... | 35.178248 | 95 | 0.499141 |
5d04d96ba8e1c1afac05a2d93dbdd0655cb5c99c | 294 | class AddSubtotalToShoppeTransactions < ActiveRecord::Migration
def change
rename_column :shoppe_subscriber_transactions, :amount, :total
add_column :shoppe_subscriber_transactions, :subtotal, :decimal
add_column :shoppe_subscriber_transactions, :discount_code, :string
end
end
| 36.75 | 71 | 0.816327 |
01f54c2a24ff8227f7a2e2cc659ecf9fc6920a40 | 427 | # From ruby_parser 3.x to fix warnings under ruby_parser 2.x
#
# ruby2ruby sets some constants, but not ONCE. ruby_parser 2.x checks for
# ONCE and then causes duplicate definitions of ENC_*.
class Regexp
ONCE = 0 unless defined? ONCE # FIX: remove this - it makes no sense
unless defined? ENC_NONE
ENC_NONE = ... | 28.466667 | 74 | 0.709602 |
3934a54bb99ee98e5be3a954be4b9125a63ee899 | 4,504 | require 'rails_helper'
module Spree
module PromotionHandler
RSpec.describe Cart, type: :model do
let(:line_item) { create(:line_item) }
let(:order) { line_item.order }
let(:promotion) { create(:promotion, apply_automatically: true) }
let(:calculator) { Calculator::FlatPercentItemTotal.new... | 34.381679 | 156 | 0.618339 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.