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
39af844f97f21fb772d5101833359ebabbe61486
113
module RatingsHelper def all_rating_type Rating.where(status: true).collect {|r| [r.value, r.id]} end end
18.833333
59
0.716814
bb6bc8b530560baac0cce4febdf827c69ec3c785
157
module TreeNode class Service < Node set_attribute(:image) { @object.picture ? "/pictures/#{@object.picture.basename}" : '100/service.png' } end end
26.166667
107
0.694268
267ee9d0f07c13bc6d438aa33a529bedbedb1dde
135
Analytics = Segment::Analytics.new({ write_key: ENV['segment_write_key'], on_error: Proc.new { |status, msg| print msg } })
27
51
0.659259
1ab7ba45bac1c61b7e20b88cf573017c5141cf96
13,760
# 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 invalid all existing # confirmation, reset password and unlock tokens in the database. # Devise will use the `secret_key_base` as its `secret_key` # by default. You can change it below and use your own secret key. # config.secret_key = '09a9c4f4b1befd4a2e86ce5d114d4ab7fd865301e0bd920834fda2b285334344f2f14ad3688f0ba395794746821388943a114e9c018e1647c8c2b7f02163e9ef' # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class # with default "from" parameter. config.mailer_sender = '[email protected]' # Configure the class responsible to send e-mails. # config.mailer = 'Devise::Mailer' # Configure the parent class responsible to send e-mails. # config.parent_mailer = 'ActionMailer::Base' # ==> ORM configuration # Load and configure the ORM. Supports :active_record (default) and # :mongoid (bson_ext recommended) by default. Other ORMs may be # available as additional gems. require 'devise/orm/active_record' # ==> Configuration for any authentication mechanism # Configure which keys are used when authenticating a user. The default is # just :email. You can configure it to use [:username, :subdomain], so for # authenticating a user, both parameters are required. Remember that those # parameters are used only when authenticating and not when retrieving from # session. If you need permissions, you should implement that in a before filter. # You can also supply a hash where the value is a boolean determining whether # or not authentication should be aborted when the value is not present. # config.authentication_keys = [:email] # Configure parameters from the request object used for authentication. Each entry # given should be a request method and it will automatically be passed to the # find_for_authentication method and considered in your model lookup. For instance, # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. # The same considerations mentioned for authentication_keys also apply to request_keys. # config.request_keys = [] # Configure which authentication keys should be case-insensitive. # These keys will be downcased upon creating or modifying a user and when used # to authenticate or find a user. Default is :email. config.case_insensitive_keys = [:email] # Configure which authentication keys should have whitespace stripped. # These keys will have whitespace before and after removed upon creating or # modifying a user and when used to authenticate or find a user. Default is :email. config.strip_whitespace_keys = [:email] # Tell if authentication through request.params is enabled. True by default. # It can be set to an array that will enable params authentication only for the # given strategies, for example, `config.params_authenticatable = [:database]` will # enable it only for database (email + password) authentication. # config.params_authenticatable = true # Tell if authentication through HTTP Auth is enabled. False by default. # It can be set to an array that will enable http authentication only for the # given strategies, for example, `config.http_authenticatable = [:database]` will # enable it only for database authentication. The supported strategies are: # :database = Support basic authentication with authentication key + password # config.http_authenticatable = false # If 401 status code should be returned for AJAX requests. True by default. # config.http_authenticatable_on_xhr = true # The realm used in Http Basic Authentication. 'Application' by default. # config.http_authentication_realm = 'Application' # It will change confirmation, password recovery and other workflows # to behave the same regardless if the e-mail provided was right or wrong. # Does not affect registerable. # config.paranoid = true # By default Devise will store the user in session. You can skip storage for # particular strategies by setting this option. # Notice that if you are skipping storage for all authentication paths, you # may want to disable generating routes to Devise's sessions controller by # passing skip: :sessions to `devise_for` in your config/routes.rb config.skip_session_storage = [:http_auth] # By default, Devise cleans up the CSRF token on authentication to # avoid CSRF token fixation attacks. This means that, when using AJAX # requests for sign in and sign up, you need to get a new CSRF token # from the server. You can disable this option at your own risk. # config.clean_up_csrf_token_on_authentication = true # When false, Devise will not attempt to reload routes on eager load. # This can reduce the time taken to boot the app but if your application # requires the Devise mappings to be loaded during boot time the application # won't boot properly. # config.reload_routes = true # ==> Configuration for :database_authenticatable # For bcrypt, this is the cost for hashing the password and defaults to 11. If # using other algorithms, it sets how many times you want the password to be hashed. # # Limiting the stretches to just one in testing will increase the performance of # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use # a value less than 10 in other environments. Note that, for bcrypt (the default # algorithm), the cost increases exponentially with the number of stretches (e.g. # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). config.stretches = Rails.env.test? ? 1 : 11 # Set up a pepper to generate the hashed password. # config.pepper = 'bdeb47f58d969005148a70dd15cf709a63560d2ee94d8dcae18e27a0284c14bc4c86859d7a7b8627e86bfc1a23a03a35b5dca6d047a23793a01da1f0f711403c' # Send a notification to the original email when the user's email is changed. # config.send_email_changed_notification = false # Send a notification email when the user's password is changed. # config.send_password_change_notification = false # ==> Configuration for :confirmable # A period that the user is allowed to access the website even without # confirming their account. For instance, if set to 2.days, the user will be # able to access the website for two days without confirming their account, # access will be blocked just in the third day. Default is 0.days, meaning # the user cannot access the website without confirming their account. # config.allow_unconfirmed_access_for = 2.days # A period that the user is allowed to confirm their account before their # token becomes invalid. For example, if set to 3.days, the user can confirm # their account within 3 days after the mail was sent, but on the fourth day # their account can't be confirmed with the token any more. # Default is nil, meaning there is no restriction on how long a user can take # before confirming their account. # config.confirm_within = 3.days # If true, requires any email changes to be confirmed (exactly the same way as # initial account confirmation) to be applied. Requires additional unconfirmed_email # db field (see migrations). Until confirmed, new email is stored in # unconfirmed_email column, and copied to email column on successful confirmation. config.reconfirmable = true # Defines which key will be used when confirming an account # config.confirmation_keys = [:email] # ==> Configuration for :rememberable # The time the user will be remembered without asking for credentials again. # config.remember_for = 2.weeks # Invalidates all the remember me tokens when the user signs out. config.expire_all_remember_me_on_sign_out = true # If true, extends the user's remember period when remembered via cookie. # config.extend_remember_period = false # Options to be passed to the created cookie. For instance, you can set # secure: true in order to force SSL only cookies. # config.rememberable_options = {} # ==> Configuration for :validatable # Range for password length. config.password_length = 6..128 # Email regex used to validate email formats. It simply asserts that # one (and only one) @ exists in the given string. This is mainly # to give user feedback and not to assert the e-mail validity. config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ # ==> Configuration for :timeoutable # The time you want to timeout the user session without activity. After this # time the user will be asked for credentials again. Default is 30 minutes. # config.timeout_in = 30.minutes # ==> Configuration for :lockable # Defines which strategy will be used to lock an account. # :failed_attempts = Locks an account after a number of failed attempts to sign in. # :none = No lock strategy. You should handle locking by yourself. # config.lock_strategy = :failed_attempts # Defines which key will be used when locking and unlocking an account # config.unlock_keys = [:email] # Defines which strategy will be used to unlock an account. # :email = Sends an unlock link to the user email # :time = Re-enables login after a certain amount of time (see :unlock_in below) # :both = Enables both strategies # :none = No unlock strategy. You should handle unlocking by yourself. # config.unlock_strategy = :both # Number of authentication tries before locking an account if lock_strategy # is failed attempts. # config.maximum_attempts = 20 # Time interval to unlock the account if :time is enabled as unlock_strategy. # config.unlock_in = 1.hour # Warn on the last attempt before the account is locked. # config.last_attempt_warning = true # ==> Configuration for :recoverable # # Defines which key will be used when recovering the password for an account # config.reset_password_keys = [:email] # Time interval you can reset your password with a reset password key. # Don't put a too small interval or your users won't have the time to # change their passwords. config.reset_password_within = 6.hours # When set to false, does not sign a user in automatically after their password is # reset. Defaults to true, so a user is signed in automatically after a reset. # config.sign_in_after_reset_password = true # ==> Configuration for :encryptable # Allow you to use another hashing or encryption algorithm besides bcrypt (default). # You can use :sha1, :sha512 or algorithms from others authentication tools as # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 # for default behavior) and :restful_authentication_sha1 (then you should set # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). # # Require the `devise-encryptable` gem when using anything other than bcrypt # config.encryptor = :sha512 # ==> Scopes configuration # Turn scoped views on. Before rendering "sessions/new", it will first check for # "users/sessions/new". It's turned off by default because it's slower if you # are using only default views. # config.scoped_views = false # Configure the default scope given to Warden. By default it's the first # devise role declared in your routes (usually :user). # config.default_scope = :user # Set this configuration to false if you want /users/sign_out to sign out # only the current scope. By default, Devise signs out all scopes. # config.sign_out_all_scopes = true # ==> Navigation configuration # Lists the formats that should be treated as navigational. Formats like # :html, should redirect to the sign in page when the user does not have # access, but formats like :xml or :json, should return 401. # # If you have any extra navigational formats, like :iphone or :mobile, you # should add them to the navigational formats lists. # # The "*/*" below is required to match Internet Explorer requests. # config.navigational_formats = ['*/*', :html] # The default HTTP method used to sign out a resource. Default is :delete. config.sign_out_via = :delete # ==> OmniAuth # Add a new OmniAuth provider. Check the wiki for more information on setting # up on your models and hooks. # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' config.omniauth :salesforce, ENV['SALESFORCE_API_KEY'], ENV['SALESFORCE_API_SECRET'] # ==> Warden configuration # If you want to use other strategies, that are not supported by Devise, or # change the failure app, you can configure them inside the config.warden block. # # config.warden do |manager| # manager.intercept_401 = false # manager.default_strategies(scope: :user).unshift :some_external_strategy # end # ==> Mountable engine configurations # When using Devise inside an engine, let's call it `MyEngine`, and this engine # is mountable, there are some extra configurations to be taken into account. # The following options are available, assuming the engine is mounted as: # # mount MyEngine, at: '/my_engine' # # The router that invoked `devise_for`, in the example above, would be: # config.router_name = :my_engine # # When using OmniAuth, Devise cannot automatically set OmniAuth path, # so you need to do it manually. For the users scope, it would be: # config.omniauth_path_prefix = '/my_engine/users/auth' end
48.967972
154
0.751744
26c6b1038df9d3146912bb0c0c0440b00d09f1a5
1,616
# frozen_string_literal: true require 'telegram/core_ext' module Telegram module API module Bot module Types # See the {https://core.telegram.org/bots/api#callbackquery official documentation}. # # @!attribute [rw] id # @return [String] # @!attribute [rw] from # @return [User] # @!attribute [rw] message # @return [Message, nil] # @!attribute [rw] inline_message_id # @return [String, nil] # @!attribute [rw] chat_instance # @return [String] # @!attribute [rw] data # @return [String, nil] # @!attribute [rw] game_short_name # @return [String, nil] CallbackQuery = Struct.new( :id, :from, :message, :inline_message_id, :chat_instance, :data, :game_short_name ) do include Telegram::CoreExt::Struct def initialize( id:, from:, message: nil, inline_message_id: nil, chat_instance:, data: nil, game_short_name: nil ) super( id&.to_s, Types::User.new(**from.to_h), (Types::Message.new(**message.to_h) unless message.nil?), (inline_message_id&.to_s unless inline_message_id.nil?), chat_instance&.to_s, (data&.to_s unless data.nil?), (game_short_name&.to_s unless game_short_name.nil?) ) end end end end end end
26.933333
92
0.502475
bb9d2ea082851bbee721d870095e00bcd5b66c83
434
require 'puppet/module_tool' require 'puppet/util' module Puppet::ModuleTool::Tar require 'puppet/module_tool/tar/gnu' require 'puppet/module_tool/tar/mini' def self.instance if Puppet.features.minitar? && Puppet.features.zlib? Mini.new elsif Puppet::Util.which('tar') && ! Puppet::Util::Platform.windows? Gnu.new else raise RuntimeError, 'No suitable tar implementation found' end end end
24.111111
72
0.705069
9162a18f11b919f8c3ac678e9bd0027a89450f97
1,016
require File.expand_path("../../Abstract/abstract-php-extension", __FILE__) class Php56Pspell < AbstractPhp56Extension init homepage "http://php.net/manual/en/book.pspell.php" url PHP_SRC_TARBALL sha256 PHP_CHECKSUM[:sha256] version PHP_VERSION bottle do revision 2 sha256 "8184fcaaa58fef7646e98655aa59d67a6576e5a748f8839fed3f55b347077962" => :el_capitan sha256 "2d06c4fc1d01b0148fbbbd69900a8535076b892af9fc8fce4510ddb9e44ab55e" => :yosemite sha256 "4042ff744c201e998619101691421e51292b7b5e7921f425fc8bd9eeebcff789" => :mavericks end depends_on "aspell" def install Dir.chdir "ext/pspell" ENV.universal_binary if build.universal? safe_phpize system "./configure", "--prefix=#{prefix}", phpconfig, "--disable-debug", "--with-pspell=#{Formula["aspell"].opt_prefix}" system "make" prefix.install "modules/pspell.so" write_config_file if build.with? "config-file" end end
29.882353
92
0.69685
33a9c845b55143a98e8ab2ec70e1057e907d5641
491
FactoryBot.define do factory 'Post' do _id { BSON::ObjectId.new } created_at { Faker::Time.between_dates(from: Date.today.ago(1.year), to: Date.today, period: :all) } updated_at { Faker::Time.between_dates(from: Date.today.ago(1.year), to: Date.today, period: :all) } name { Faker::String.random(length: [0, 255]) } body { Faker::String.random(length: [0, 255]) } hook_id { BSON::ObjectId.new } schedule_id { BSON::ObjectId.new } _type { "Post" } end end
37.769231
104
0.651731
26b7102a700517256c1ac1e17fef947db78def28
14,877
#-- copyright # OpenProject is a project management system. # Copyright (C) 2012-2018 the OpenProject Foundation (OPF) # # 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 ChiliProject, which is a fork of Redmine. The copyright follows: # Copyright (C) 2006-2017 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # See docs/COPYRIGHT.rdoc for more details. #++ require 'spec_helper' require 'features/projects/project_settings_page' describe 'form configuration', type: :feature, js: true do let(:admin) { FactoryGirl.create :admin } let(:type) { FactoryGirl.create :type } let(:project) { FactoryGirl.create :project, types: [type] } let(:category) { FactoryGirl.create :category, project: project } let(:work_package) do FactoryGirl.create :work_package, project: project, type: type, done_ratio: 10, category: category end let(:wp_page) { Pages::FullWorkPackage.new(work_package) } let(:add_button) { page.find '.form-configuration--add-group' } let(:reset_button) { page.find '.form-configuration--reset' } let(:inactive_group) { page.find '#type-form-conf-inactive-group' } let(:inactive_drop) { page.find '#type-form-conf-inactive-group .attributes' } def group_selector(name) ".type-form-conf-group[data-key='#{name}']" end def checkbox_selector(attribute) ".type-form-conf-attribute[data-key='#{attribute}'] .attribute-visibility input" end def attribute_selector(attribute) ".type-form-conf-attribute[data-key='#{attribute}']" end def find_group_handle(label) page.find("#{group_selector(label)} .group-handle") end def find_attribute_handle(attribute) page.find("#{attribute_selector(attribute)} .attribute-handle") end def expect_attribute(key:, translation: nil) attribute = page.find(attribute_selector(key)) unless translation.nil? expect(attribute).to have_selector('.attribute-name', text: translation) end end def move_to(attribute, group_label) handle = find_attribute_handle(attribute) group = find(group_selector(group_label)) drag_and_drop(handle, group) expect_group(group_label, group_label, key: attribute) end def remove_attribute(attribute) attribute = page.find(attribute_selector(attribute)) attribute.find('.delete-attribute').click end def drag_and_drop(handle, group) target = group.find('.attributes') scroll_to_element(group) page .driver .browser .action .move_to(handle.native) .click_and_hold(handle.native) .perform scroll_to_element(group) page .driver .browser .action .move_to(target.native) .release .perform end def add_group(name, expect: true) add_button.click input = find('.group-edit-in-place--input') input.set(name) input.send_keys(:return) expect_group(name, name) if expect end def rename_group(from, to) find('.group-edit-handler', text: from.upcase).click input = find('.group-edit-in-place--input') input.click input.set(to) input.send_keys(:return) expect(page).to have_selector('.group-edit-handler', text: to.upcase) end def expect_no_attribute(attribute, group) expect(page).not_to have_selector("#{group_selector(group)} #{attribute_selector(attribute)}") end def expect_group(label, translation, *attributes) expect(page).to have_selector("#{group_selector(label)} .group-edit-handler", text: translation.upcase) within group_selector(label) do attributes.each do |attribute| expect_attribute(attribute) end end end def expect_inactive(attribute) expect(inactive_drop).to have_selector(".type-form-conf-attribute[data-key='#{attribute}']") end describe "with EE token" do before do with_enterprise_token(:edit_attribute_groups) end describe 'default configuration' do let(:dialog) { ::NgConfirmationDialog.new } before do login_as(admin) visit edit_type_tab_path(id: type.id, tab: "form_configuration") end it 'resets the form properly after changes' do rename_group('Details', 'Whatever') expect_attribute(key: :assignee) # Reset and cancel reset_button.click dialog.expect_open dialog.cancel expect(page).to have_selector(group_selector('Whatever')) # Click the dialog again after some time # Otherwise this may cause issues due to the animation, # which is why sleep is okay. sleep 1 # Reset and confirm reset_button.click dialog.expect_open dialog.confirm # Wait for page reload sleep 1 expect(page).to have_no_selector(group_selector('Whatever')) expect_group('details', 'Details') expect_attribute(key: :assignee) end it 'detects errors for duplicate group names' do add_group('New Group') add_group('New Group', expect: false) # would fail since two selectors exist now expect(page).to have_selector("#{group_selector('New Group')}.-error", count: 1) end it 'allows modification of the form configuration' do # # Test default set of groups # expect_group 'people', 'People', key: :responsible, translation: 'Responsible' expect_group 'estimates_and_time', 'Estimates and time', { key: :estimated_time, translation: 'Estimated time' }, { key: :spent_time, translation: 'Spent time' } expect_group 'details', 'Details', { key: :category, translation: 'Category' }, { key: :date, translation: 'Date' }, { key: :percentage_done, translation: 'Progress (%)' }, { key: :priority, translation: 'Priority' }, { key: :version, translation: 'Version' } # # Modify configuration # # Disable version drag_and_drop(find_attribute_handle(:version), inactive_group) expect_inactive(:version) # Rename group rename_group('Details', 'Whatever') rename_group('People', 'Cool Stuff') # Start renaming, but cancel find('.group-edit-handler', text: 'COOL STUFF').click input = find('.group-edit-in-place--input') input.set('FOOBAR') input.send_keys(:escape) expect(page).to have_selector('.group-edit-handler', text: 'COOL STUFF') expect(page).to have_no_selector('.group-edit-handler', text: 'FOOBAR') # Create new group add_group('New Group') move_to(:category, 'New Group') # Delete attribute from group remove_attribute('assignee') # Save configuration # click_button doesn't seem to work when the button is out of view!? page.execute_script('jQuery(".form-configuration--save").click()') expect(page).to have_selector('.flash.notice', text: 'Successful update.', wait: 10) # Expect configuration to be correct now expect_no_attribute('assignee', 'Cool Stuff') expect_group 'Cool Stuff', 'Cool Stuff', { key: :responsible, translation: 'Responsible' } expect_group 'estimates_and_time', 'Estimates and time', { key: :estimated_time, translation: 'Estimated time' }, { key: :spent_time, translation: 'Spent time' } expect_group 'Whatever', 'Whatever', { key: :date, translation: 'Date' }, { key: :percentage_done, translation: 'Progress (%)' } expect_group 'New Group', 'New Group', { key: :category, translation: 'Category' } expect_inactive(:version) # Test the actual type backend type.reload expect(type.attribute_groups.map { |el| el[0] }) .to include('Cool Stuff', :estimates_and_time, 'Whatever', 'New Group') # Visit work package with that type wp_page.visit! wp_page.ensure_page_loaded # Version should be hidden wp_page.expect_hidden_field(:version) wp_page.expect_group('New Group') do wp_page.expect_attributes category: category.name end wp_page.expect_group('Whatever') do wp_page.expect_attributes percentageDone: '10' end wp_page.expect_group('Cool Stuff') do wp_page.expect_attributes responsible: '-' end # Empty attributes should be shown on toggle wp_page.expect_hidden_field(:assignee) wp_page.expect_hidden_field(:spent_time) wp_page.expect_group('Estimates and time') do wp_page.expect_attributes estimated_time: '-' wp_page.expect_attributes spent_time: '-' end # New work package has the same configuration wp_page.expect_hidden_field(:assignee) wp_page.expect_hidden_field(:spent_time) wp_page.click_create_wp_button(type) wp_page.expect_group('Estimates and time') do expect(page).to have_selector('.wp-edit-field.estimatedTime') end find('#work-packages--edit-actions-cancel').click expect(wp_page).not_to have_alert_dialog loading_indicator_saveguard end end describe 'required custom field' do let(:custom_fields) { [custom_field] } let(:custom_field) { FactoryGirl.create(:integer_issue_custom_field, is_required: true, name: 'MyNumber') } let(:cf_identifier) { "custom_field_#{custom_field.id}" } let(:cf_identifier_api) { "customField#{custom_field.id}" } before do project custom_field login_as(admin) visit edit_type_tab_path(id: type.id, tab: "form_configuration") end it 'shows the field' do # Should be initially disabled expect_inactive(cf_identifier) # Add into new group add_group('New Group') move_to(cf_identifier, 'New Group') expect_attribute(key: cf_identifier) page.execute_script('jQuery(".form-configuration--save").click()') expect(page).to have_selector('.flash.notice', text: 'Successful update.', wait: 10) end end describe 'custom fields' do let(:project_settings_page) { ProjectSettingsPage.new(project) } let(:custom_fields) { [custom_field] } let(:custom_field) { FactoryGirl.create(:integer_issue_custom_field, name: 'MyNumber') } let(:cf_identifier) { "custom_field_#{custom_field.id}" } let(:cf_identifier_api) { "customField#{custom_field.id}" } before do project custom_field login_as(admin) visit edit_type_tab_path(id: type.id, tab: "form_configuration") # Should be initially disabled expect_inactive(cf_identifier) # Add into new group add_group('New Group') move_to(cf_identifier, 'New Group') # Make visible expect_attribute(key: cf_identifier) page.execute_script('jQuery(".form-configuration--save").click()') expect(page).to have_selector('.flash.notice', text: 'Successful update.', wait: 10) end context 'inactive in project' do it 'can be added to the type, but is not shown' do # Visit work package with that type wp_page.visit! wp_page.ensure_page_loaded # CF should be hidden wp_page.expect_no_group('New Group') wp_page.expect_attribute_hidden(cf_identifier_api) # Enable in project, should then be visible project_settings_page.visit_settings_tab('custom_fields') expect(page).to have_selector(".custom-field-#{custom_field.id} td", text: 'MyNumber') expect(page).to have_selector(".custom-field-#{custom_field.id} td", text: type.name) id_checkbox = find("#project_work_package_custom_field_ids_#{custom_field.id}") expect(id_checkbox).to_not be_checked id_checkbox.set(true) click_button 'Save' # Visit work package with that type wp_page.visit! wp_page.ensure_page_loaded # Category should be hidden wp_page.expect_group('New Group') do wp_page.expect_attributes cf_identifier_api => '-' end end end context 'active in project' do let(:project) do FactoryGirl.create :project, types: [type], work_package_custom_fields: custom_fields end it 'can be added to type and is visible' do # Visit work package with that type wp_page.visit! wp_page.ensure_page_loaded # Category should be hidden wp_page.expect_group('New Group') do wp_page.expect_attributes cf_identifier_api => '-' end # Ensure CF is checked project_settings_page.visit_settings_tab('custom_fields') expect(page).to have_selector(".custom-field-#{custom_field.id} td", text: 'MyNumber') expect(page).to have_selector(".custom-field-#{custom_field.id} td", text: type.name) expect(page).to have_selector("#project_work_package_custom_field_ids_#{custom_field.id}[checked]") end end end end describe "without EE token" do let(:dialog) { ::NgConfirmationDialog.new } it "should disable adding and renaming groups" do with_enterprise_token(nil) login_as(admin) visit edit_type_tab_path(id: type.id, tab: "form_configuration") find('.group-edit-handler', text: "DETAILS").click dialog.expect_open end end end
32.768722
113
0.640384
abf4fed236a3b25b41d33353d48db2b7221cc78c
913
# This is a test for a bug that was happening when the JUnit Reporter was # creating filenames from `describe`s that contained slashes, which would crash # since it was trying to create directories then. require 'bundler/setup' require 'minitest/autorun' require 'minitest/reporters' Minitest::Reporters.use! Minitest::Reporters::JUnitReporter.new describe 'something/other' do it 'does something' do 1.must_equal 1 end end describe 'something/other' do it 'does something else' do 1.must_equal 2 end end class Eval class Issue258Tset < Minitest::Test def test_true assert true end [ ["bool1", "true", "true"], ["bool2", "false", "false"] ].each do |a| (type, expectation1, expectation2) = a eval(%{ def test_eval_#{type}_#{expectation1} assert_equal(#{expectation1}, #{expectation2}) end }) end end end
21.738095
79
0.668127
28db61e67d530b13db1f667755b3f41859a67ea4
2,402
namespace :comatose do # # Data Migration Tasks # namespace :data do def page_to_hash(page) data = page.attributes.clone # Pull out the specific, or unnecessary fields %w(id parent_id updated_at author position version created_at full_path).each {|key| data.delete(key)} if !page.children.empty? data['children'] = [] page.children.each do |child| data['children'] << page_to_hash(child) end end data end def hash_to_page_tree(hsh, page) child_ary = hsh.delete 'children' page.update_attributes(hsh) page.save child_ary.each do |child_hsh| if child_pg = page.children.find_by_slug( child_hsh['slug'] ) hash_to_page_tree( child_hsh, child_pg ) else hash_to_page_tree( child_hsh, page.children.create ) end end if child_ary end desc "Saves a page tree from page FROM or '' to file TO_FILE or db/comatose-pages.yml" task :export do require "#{Rails.root}/config/environment" root = ENV['FROM'] || '' target = ENV['TO_FILE'] || 'db/comatose-pages.yml' # Nested hash of the page tree... from = Comatose::Page.find_by_path(root) if from data = page_to_hash( from ) File.open(target, 'w') {|f| f.write data.to_yaml } else puts "Could not find the page at '#{root}', export aborted!" end puts "Finished." end desc "Loads page tree data FROM_FILE or db/comatose-pages.yml in to TO or Comatose::Page.root" task :import do require "#{Rails.root}/config/environment" src = ENV['FROM_FILE'] || 'db/comatose-pages.yml' root = ENV['TO'] || '' target = (root == '') ? Comatose::Page.root : Comatose::Page.find_by_path(root) data = YAML::load( File.open(src) ) #hash_to_page(data, target) if target if root == '' hash_to_page_tree(data, target) else if page = target.children.find_by_slug(data['slug']) hash_to_page_tree(data, page) else hash_to_page_tree(data, target.children.create) end end else puts "Could not find the page at '#{root}', import aborted!" # TODO: Ask to create the specified path if it doesn't exist? end puts "Finished." end end end
30.025
108
0.598251
abb77083331fee0fdec53301ebbc744a5ab2e663
8,088
# 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 license. require 'date' require_relative 'create_deploy_stage_details' # rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength module OCI # Specifies the manual approval stage. class Devops::Models::CreateManualApprovalDeployStageDetails < Devops::Models::CreateDeployStageDetails # This attribute is required. # @return [OCI::Devops::Models::ApprovalPolicy] attr_accessor :approval_policy # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'description': :'description', 'display_name': :'displayName', 'deploy_stage_type': :'deployStageType', 'deploy_pipeline_id': :'deployPipelineId', 'deploy_stage_predecessor_collection': :'deployStagePredecessorCollection', 'freeform_tags': :'freeformTags', 'defined_tags': :'definedTags', 'approval_policy': :'approvalPolicy' # rubocop:enable Style/SymbolLiteral } end # Attribute type mapping. def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'description': :'String', 'display_name': :'String', 'deploy_stage_type': :'String', 'deploy_pipeline_id': :'String', 'deploy_stage_predecessor_collection': :'OCI::Devops::Models::DeployStagePredecessorCollection', 'freeform_tags': :'Hash<String, String>', 'defined_tags': :'Hash<String, Hash<String, Object>>', 'approval_policy': :'OCI::Devops::Models::ApprovalPolicy' # rubocop:enable Style/SymbolLiteral } end # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity # rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral # Initializes the object # @param [Hash] attributes Model attributes in the form of hash # @option attributes [String] :description The value to assign to the {OCI::Devops::Models::CreateDeployStageDetails#description #description} proprety # @option attributes [String] :display_name The value to assign to the {OCI::Devops::Models::CreateDeployStageDetails#display_name #display_name} proprety # @option attributes [String] :deploy_pipeline_id The value to assign to the {OCI::Devops::Models::CreateDeployStageDetails#deploy_pipeline_id #deploy_pipeline_id} proprety # @option attributes [OCI::Devops::Models::DeployStagePredecessorCollection] :deploy_stage_predecessor_collection The value to assign to the {OCI::Devops::Models::CreateDeployStageDetails#deploy_stage_predecessor_collection #deploy_stage_predecessor_collection} proprety # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {OCI::Devops::Models::CreateDeployStageDetails#freeform_tags #freeform_tags} proprety # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {OCI::Devops::Models::CreateDeployStageDetails#defined_tags #defined_tags} proprety # @option attributes [OCI::Devops::Models::ApprovalPolicy] :approval_policy The value to assign to the {#approval_policy} property def initialize(attributes = {}) return unless attributes.is_a?(Hash) attributes['deployStageType'] = 'MANUAL_APPROVAL' super(attributes) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.approval_policy = attributes[:'approvalPolicy'] if attributes[:'approvalPolicy'] raise 'You cannot provide both :approvalPolicy and :approval_policy' if attributes.key?(:'approvalPolicy') && attributes.key?(:'approval_policy') self.approval_policy = attributes[:'approval_policy'] if attributes[:'approval_policy'] end # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity # rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines # Checks equality by comparing each attribute. # @param [Object] other the other object to be compared def ==(other) return true if equal?(other) self.class == other.class && description == other.description && display_name == other.display_name && deploy_stage_type == other.deploy_stage_type && deploy_pipeline_id == other.deploy_pipeline_id && deploy_stage_predecessor_collection == other.deploy_stage_predecessor_collection && freeform_tags == other.freeform_tags && defined_tags == other.defined_tags && approval_policy == other.approval_policy end # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines # @see the `==` method # @param [Object] other the other object to be compared def eql?(other) self == other end # rubocop:disable Metrics/AbcSize, Layout/EmptyLines # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash [description, display_name, deploy_stage_type, deploy_pipeline_id, deploy_stage_predecessor_collection, freeform_tags, defined_tags, approval_policy].hash end # rubocop:enable Metrics/AbcSize, Layout/EmptyLines # rubocop:disable Metrics/AbcSize, Layout/EmptyLines # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) public_method("#{key}=").call( attributes[self.class.attribute_map[key]] .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? public_method("#{key}=").call( OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]) ) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end # rubocop:enable Metrics/AbcSize, Layout/EmptyLines # Returns the string representation of the object # @return [String] String presentation of the object def to_s to_hash.to_s end # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = public_method(attr).call next if value.nil? && !instance_variable_defined?("@#{attr}") hash[param] = _to_hash(value) end hash end private # Outputs non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value # @param [Object] value Any valid value # @return [Hash] Returns the value in the form of hash def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end end end # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
43.251337
274
0.700915
61dc877333583d79dcfed2640724d3a30abf7198
2,837
class Cronbox class CliWrapper def initialize(app) @app = app end def report(type=nil, include_only=nil) if include_only include_ids = include_only.map(&:to_i) include_labels = include_only.map(&:to_s) end any_output = false report = @app.report(type.eql? 'errors') report[:entries].each do |e| if e['label'].to_s.empty? e['f_label'] = e['id'].to_s else e['f_label'] = %("#{e['label']}" #{e['id']}) end if e['has_output'] any_output = true e['f_status'] = '*' + e['status'].to_s else e['f_status'] = e['status'].to_s end end fw = self.class.calc_widths_of_fields(report[:entries], { f_label: [2], command: [10, 70], f_status: [4], when: [4] }) w = fw.values.reduce(:+) + fw.size*3 + 1 ## BRAND puts '' brand = '| Cronbox |' if any_output puts "%s%#{w-brand.length}s" % [brand, '*=Output'] else puts brand end puts '=' * w ## HEADER ROW tpl = [nil, "%#{fw[:f_label]}s", "%-#{fw[:command]}s", "%#{fw[:f_status]}s", "%#{fw[:when]}s", nil].join(' | ').strip puts tpl % %w(ID COMMAND EXIT WHEN) puts '=' * w ## ENTRY ROWS report[:entries].each do |e| if include_only next unless include_ids.include? e['id'] or include_labels.include? e['label'] end puts tpl % [ e['f_label'], e['command'], e['f_status'], e['when'] ] if type == 'errors' or type === true if e['has_output'] puts 'v' * w puts '' puts e['output'].join("\n").sub(/\s*\z/, '') puts '' end puts '-' * w else puts '-' * w end end puts '' end def delete(entry) if (entry = @app.delete(entry)) STDERR.write("Deleted entry ##{entry['id']}\n") end end def self.calc_widths_of_fields(table, fields_with_opts) result = Hash.new fields = fields_with_opts.keys table.each do |e| fields.each do |f| w = e[f.to_s].to_s.length result[f] = [result[f].to_i, w].max end end fields_with_opts.each do |f, opts| opts = [0, 99] unless opts opts.push(99) unless opts.length > 1 result[f] = [[result[f].to_i, opts[0]].max, opts[1]].min end result end def self.calc_width_of_field(table, field, min=0, max=99) field = field.to_s width = table.inject(0) do |w, e| [w, e[field].to_s.length].max end [[width, min].max, max].min end end end
25.106195
88
0.478322
18869c0a21fe9429a1e1969146b0591b6b80c0a6
2,638
class Stunnel < Formula desc "SSL tunneling program" homepage "https://www.stunnel.org/" url "https://www.stunnel.org/downloads/stunnel-5.53.tar.gz" sha256 "80439896ee14269eb70bc8bc669433c7d619018a62c9f9c5c760a24515302585" bottle do root_url "https://linuxbrew.bintray.com/bottles" cellar :any sha256 "1b7e4203b2e0a2a1ae24a49b2fe8bc5057d7129f3618f63348fc70a23add2e65" => :mojave sha256 "aa84651b5c2e1c8180610c7cd3d31ac97d981abe4bc13d3759655326befc58d1" => :high_sierra sha256 "bd3f13ff08fef09c247d088d52ca111d7e60b3c1786902b9b4bd227488b5a2f7" => :sierra sha256 "7a0a38caf87f8b5eaa705c559a9067ed2b52ae95672c46b15f595be588354b7c" => :x86_64_linux end depends_on "openssl" def install system "./configure", "--disable-dependency-tracking", "--disable-silent-rules", "--prefix=#{prefix}", "--sysconfdir=#{etc}", "--localstatedir=#{var}", "--mandir=#{man}", "--disable-libwrap", "--disable-systemd", "--with-ssl=#{Formula["openssl"].opt_prefix}" system "make", "install" # This programmatically recreates pem creation used in the tools Makefile # which would usually require interactivity to resolve. cd "tools" do args = %w[req -new -x509 -days 365 -rand stunnel.rnd -config openssl.cnf -out stunnel.pem -keyout stunnel.pem -sha256 -subj /C=PL/ST=Mazovia\ Province/L=Warsaw/O=Stunnel\ Developers/OU=Provisional\ CA/CN=localhost/] system "dd", "if=/dev/urandom", "of=stunnel.rnd", "bs=256", "count=1" system "#{Formula["openssl"].opt_bin}/openssl", *args chmod 0600, "stunnel.pem" (etc/"stunnel").install "stunnel.pem" end end def caveats <<~EOS A bogus SSL server certificate has been installed to: #{etc}/stunnel/stunnel.pem This certificate will be used by default unless a config file says otherwise! Stunnel will refuse to load the sample configuration file if left unedited. In your stunnel configuration, specify a SSL certificate with the "cert =" option for each service. EOS end test do (testpath/"tstunnel.conf").write <<~EOS cert = #{etc}/stunnel/stunnel.pem setuid = nobody setgid = nobody [pop3s] accept = 995 connect = 110 [imaps] accept = 993 connect = 143 EOS assert_match "successful", pipe_output("#{bin}/stunnel #{testpath}/tstunnel.conf 2>&1") end end
35.173333
107
0.634193
6161bd6c5e44a4b399b566530e4885baabf197cb
1,768
require "test_helper" class FollowingTest < ActionDispatch::IntegrationTest def setup @user = users(:raymond) @other = users(:yasmin) log_in_as(@user) end test "following page" do get following_user_path(@user) assert_not @user.following.empty? assert_match @user.following.count.to_s, response.body @user.following.each do |user| assert_select "a[href=?]", user_path(user) end end test "followers page" do get followers_user_path(@user) assert_not @user.followers.empty? assert_match @user.followers.count.to_s, response.body @user.followers.each do |user| assert_select "a[href=?]", user_path(user) end end test "should follow a user the standard way" do assert_difference '@user.following.count', 1 do post relationships_path, params: { followed_id: @other.id } end end test "should follow a user with Ajax" do assert_difference '@user.following.count', 1 do post relationships_path, xhr: true, params: { followed_id: @other.id } end end test "should unfollow a user the standard way" do @user.follow(@other) relationship = @user.active_relationships.find_by(followed_id: @other.id) assert_difference '@user.following.count', -1 do delete relationship_path(relationship) end end test "should unfollow a user with Ajax" do @user.follow(@other) relationship = @user.active_relationships.find_by(followed_id: @other.id) assert_difference '@user.following.count', -1 do delete relationship_path(relationship), xhr: true end end end
30.482759
82
0.636878
624e6aeeec63e390a26015297718d87be91c03b6
438
cask 'acorn' do version '5.6.5' sha256 '6209061f5c0b443bca6061644a92553d71e15c2e8be59ba6ad4dbafb5000c747' url 'https://secure.flyingmeat.com/download/Acorn.zip' appcast "http://www.flyingmeat.com/download/acorn#{version.major}update.xml", checkpoint: 'c867ac62b7ddd8e1903123feabe869a3960ac1d696caed0ee108ac145122acce' name 'Acorn' homepage 'http://flyingmeat.com/acorn/' auto_updates true app 'Acorn.app' end
29.2
88
0.771689
7ab0645fb0e8ae2c76aca9778b45d3eaf956c5c8
169
class CreateFormats < ActiveRecord::Migration def change create_table :formats do |t| t.string :name t.timestamps null: false end end end
16.9
45
0.650888
288e9c8c6a83632ce69fc6492368de247afd13aa
979
require File.expand_path('../boot', __FILE__) require 'rails/all' # Assets should be precompiled for production (so we don't need the gems loaded then) Bundler.require(*Rails.groups(assets: %w(development test))) module Dummy4 class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # config.time_zone = 'Central Time (US & Canada)' # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de end end
42.565217
99
0.724208
ed1f707e13e106f62f84ac3ed5290a0bddf811de
1,582
# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your # database schema. If you need to create the application database on another # system, you should be using db:schema:load, not running all the migrations # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 20160505040550) do create_table "categories", force: :cascade do |t| t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "categories_productions", id: false, force: :cascade do |t| t.integer "production_id", null: false t.integer "category_id", null: false end add_index "categories_productions", ["category_id", "production_id"], name: "index_categories_productions_on_category_id_and_production_id" add_index "categories_productions", ["production_id", "category_id"], name: "index_categories_productions_on_production_id_and_category_id" create_table "productions", force: :cascade do |t| t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end end
42.756757
141
0.762958
f77747aa57183edd2e17e9c1247cea66483287d3
1,077
# frozen_string_literal: true require 'spec_helper' describe 'cis_hardening::logaudit::journald' do on_supported_os.each do |os, os_facts| context "on #{os}" do let(:facts) { os_facts } # Check for default class it { is_expected.to contain_class('cis_hardening::logaudit::journald') } # Ensure journald is configured to send logs to rsyslog - Section 4.2.2.1 it { is_expected.to contain_file_line('journald_to_rsyslog').with( 'ensure' => 'present', 'path' => '/etc/systemd/journald.conf', 'line' => 'ForwardToSyslog=yes', 'match' => '^ForwardToSyslog\=', ) } # Ensure journald is configured to compress large log files - Section 4.2.2.2 it { is_expected.to contain_file_line('journald_compress').with( 'ensure' => 'present', 'path' => '/etc/systemd/journald.conf', 'line' => 'Compress=' ) } # Ensure manifest compiles with all dependencies it { is_expected.to compile } end end end
29.108108
83
0.600743
1db2d4b4b273a1d3130223326b1bab5bbf3e571f
5,166
require 'google/api_client' require 'google/api_client/client_secrets' require 'google/api_client/auth/installed_app' require 'securerandom' require 'cgi' require 'rexml/document' require 'uri' require 'net/http' require 'net/https' require 'json' class Googl API_VERSION = 'v1' CACHED_API_FILE = "urlshortener-#{API_VERSION}.cache" CREDENTIAL_STORE_FILE = 'oauth2.json' def configure_client unique_client_id = ENV['unique_client_id'] if unique_client_id.nil? or unique_client_id.to_s.strip.length == 0 unique_client_id = urlsafe_base64 $dz.save_value('unique_client_id', unique_client_id) end temp_file_base_path = "#{$dz.temp_folder}/#{unique_client_id}" @client = Google::APIClient.new(:application_name => 'Dropzone 3 action for Goo.gl', :application_version => '1.0.0') @client.authorization = get_authorization @urlshortener = nil temp_cached_api_file = "#{temp_file_base_path}_#{CACHED_API_FILE}" if File.exists? temp_cached_api_file File.open(temp_cached_api_file) do |file| @urlshortener = Marshal.load(file) end else @urlshortener = @client.discovered_api('urlshortener', API_VERSION) File.open(temp_cached_api_file, 'w') do |file| Marshal.dump(@urlshortener, file) end end end def get_authorization authorization = nil unless ENV['expires_at'].nil? or ENV['access_token'].nil? token_expiration_time_ms = ENV['expires_at'].to_i if token_expiration_time_ms > Time.now.to_i authorization = Signet::OAuth2::Client.new({ :authorization_uri => 'https://accounts.google.com/o/oauth2/auth', :token_credential_uri => 'https://accounts.google.com/o/oauth2/token', :client_id => ENV['client_id'], :client_secret => ENV['client_secret'], :access_token => ENV['access_token'] }) else authorization = Signet::OAuth2::Client.new({ :authorization_uri => 'https://accounts.google.com/o/oauth2/auth', :token_credential_uri => 'https://accounts.google.com/o/oauth2/token', :client_id => ENV['client_id'], :client_secret => ENV['client_secret'], :refresh_token => ENV['refresh_token'] }) authorization.fetch_access_token! $dz.save_value('access_token', authorization.access_token) $dz.save_value('expires_at', (Time.now + authorization.expires_in).to_i) end else @client.key = ENV['api_key'] unless ENV['api_key'].nil? end authorization end def process(item) if item =~ /http:\/\/goo\.gl\/*$/ or item =~ /https:\/\/goo\.gl\/*$/ $dz.error('Invalid URL', 'You cannot expand or shorten the Google url shortener base domain!') end begin url = URI.parse(item) url = URI.parse("http://" + item) unless url.scheme rescue URI::InvalidURIError $dz.fail("Invalid URL") end url_as_string = url.to_s if url_as_string =~ /https?:\/\/goo\.gl\// expand_url(url_as_string) else shorten_url(url_as_string) end end def shorten_url(url_to_shorten) url_details = @urlshortener.url.insert.request_schema.new( { :longUrl => url_to_shorten } ) result = @client.execute( :api_method => @urlshortener.url.insert, :body_object => url_details ) unless result.success? $dz.error('Failed to shorten URL', "#{result.status} #{result.error_message}") end short_url = result.data.id if short_url.nil? || short_url.to_s.strip.length == 0 $dz.fail('Error shortening URL') else $dz.finish("URL is now on clipboard") $dz.url(short_url) end end def expand_url(url_to_expand) result = @client.execute( :api_method => @urlshortener.url.get, :parameters => { :shortUrl => url_to_expand }) unless result.success? $dz.error('Failed to Expand URL', "#{result.status} #{result.error_message}") end expanded_url = result.data['longUrl'] if expanded_url.nil? || expanded_url.to_s.strip.length == 0 # Failed Expand URL $dz.fail('Error expanding URL') else # Expand URL $dz.finish("Expanded URL is now on clipboard") $dz.url(expanded_url) end end def read_clipboard IO.popen('pbpaste') { |clipboard| clipboard.read } end def urlsafe_base64(n=nil, padding=false) s = [SecureRandom.random_bytes(n)].pack('m*') s.delete!("\n") s.tr!('+/', '-_') s.delete!('=') unless padding s end end
33.545455
125
0.573751
ab83aa15fae398c159ca9caec9fde302744afbff
372
cask 'logitech-myharmony' do version '1.0' sha256 'de3c4d3a6d71dcccf45acf92fca496558bab95f70461c8466ba4ade3f5986740' url "https://app.myharmony.com/prod/mac/#{version}/MyHarmony-App.dmg" name 'MyHarmony' homepage 'https://setup.myharmony.com/' pkg 'MyHarmonySetup.pkg' uninstall quit: 'org.logitech.MyHarmony', pkgutil: 'MyHarmony.pkg' end
26.571429
75
0.731183
21d402519ef2e96a810f0d2ef09fbaefbcb8ee4a
817
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'ip_reverse/version' Gem::Specification.new do |gem| gem.name = "ip_reverse" gem.version = IpReverse::VERSION gem.authors = ["chad_lwm"] gem.email = ["[email protected]"] gem.description = %q{ip address reverse} gem.summary = %q{ip address reverse, keep it simple, stupid} gem.homepage = "https://github.com/chadlwm/ip_reverse" gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] gem.add_runtime_dependency "rest-client", '~> 0' gem.license = 'MIT' end
37.136364
75
0.637699
b9181e5d8694c1bb5fdb1b4ec63ed015b3e8b660
1,327
class IgnitionLaunch3 < Formula desc "Launch libraries for robotics applications" homepage "https://github.com/ignitionrobotics/ign-launch" url "https://osrf-distributions.s3.amazonaws.com/ign-launch/releases/ignition-launch3-3.1.0.tar.bz2" sha256 "3b5937ba5c59d64c89225c0830a71419b8b2151c4471a29b95eadec912f20c78" license "Apache-2.0" head "https://github.com/ignitionrobotics/ign-launch", branch: "ign-launch3" bottle do root_url "https://osrf-distributions.s3.amazonaws.com/bottles-simulation" sha256 "4e2697b91afac1c2ea1300e96faa7b8feef4bd2519c28da14877c708defe950a" => :mojave end depends_on "cmake" => :build depends_on "pkg-config" => :build depends_on "ignition-cmake2" depends_on "ignition-common3" depends_on "ignition-gazebo4" depends_on "ignition-gui4" depends_on "ignition-msgs6" depends_on "ignition-plugin1" depends_on "ignition-tools" depends_on "ignition-transport9" depends_on "qt@5" depends_on "tinyxml2" def install system "cmake", ".", *std_cmake_args system "make", "install" end test do ENV["IGN_CONFIG_PATH"] = "#{opt_share}/ignition" system "ign", "launch", "--versions" # check for Xcode frameworks in bottle cmd_not_grep_xcode = "! grep -rnI 'Applications[/]Xcode' #{prefix}" system cmd_not_grep_xcode end end
31.595238
102
0.743029
79cc50abb41d8d6486732e48284bb32fd6c146c6
2,639
module Tarona class Action # Command which gives player ability to move his entities # # It mobilizes only entities with tags `:movable` and `:user_controlled`. # `:movable` entities must be {Workable}. # # It moves entities when it is requested through `io` event `:move_request` # with argument: `Hash` with keys: `:entity_id` ({Entity#id}) and # `:to` ([x, y]). # Of course, it moves entity only if it has enough energy and path # is available. # # You must set attributes below using `Tardvig::Command` interface to # start this command. # @!attribute [r] act # @return [Tarona::Action] entities will be mobilized for this act. # @!attribute [r] map # @return [Tarona::Action::Landscape] landscape of the current action # @!attribute [r] entities_index # @return [Hash] hash with entities' identificators as keys and their # coordinates (see {Tarona::Action::PlaceEntity}) as values. # @!attribute [r] catalyst # @return [#call] object (proc, for example) which rules: whether the # `entity` (1st argument given; {Tarona::Action::Entity}) can be # placed `here` (2nd argument given; `[x, y]` coordinates). # It must return `true` if it can be placed or `false` otherwise. class Mobilize < Tarona::PrManager include Tardvig::Events private def job_type :move end def job(msg) id = msg[:entity_id] from = @entities_index[id] entity = PlaceEntity.find @map, @entities_index, id return unless movable_by_player?(entity) return unless move_it(entity, from, msg[:to], msg) happen :after_move, entity: entity, from: from, to: msg[:to] end def movable_by_player?(entity) entity && entity.tags.include?(:user_controlled) && entity.tags.include?(:movable) end def move_it(entity, from, to, msg) path_data = get_path entity, from, to return false unless path_data[:found] total_move_cost = path_data[:costs][to][:total] if entity.tire(total_move_cost) update_pos entity, from, to @act.io.happen :move, msg true else false end end def update_pos(entity, from, to) PlaceEntity.move @map, entity, from, to @entities_index[entity.id] = to end def get_path(entity, from, to) Tarona::Action::Pathfinder::FindPath.call( map: @map, entity: entity, from: from, to: to, catalyst: @catalyst ).result end end end end
33.833333
79
0.614627
1cdeec65b3727c239e685573461f2ed4a93d745f
2,272
class Wownero < Formula desc "Official wallet and node software for the Wownero cryptocurrency" homepage "https://wownero.org" url "https://git.wownero.com/wownero/wownero.git", tag: "v0.8.0.2", revision: "7d1693b1601cb4b3d56191953f403c92a1c51f64" license "BSD-3-Clause" bottle do rebuild 1 sha256 cellar: :any, catalina: "f68be29309c6d6fe1e9f4d3a96938d9884390e1cd5a94175513f8d6e9a882b8f" sha256 cellar: :any, mojave: "7a828b16ea78869a1ab52d349b2f3a4821b56d28d6a4d726a397bd02cb648868" sha256 cellar: :any, high_sierra: "544f680ced811219370bd6aa5dc7eb303fa7e90edb771192dbf9528afd09fd25" end depends_on "cmake" => :build depends_on "pkg-config" => :build depends_on "boost" depends_on "hidapi" depends_on "libsodium" depends_on "[email protected]" depends_on "protobuf" depends_on "readline" depends_on "unbound" depends_on "zeromq" conflicts_with "miniupnpc", because: "wownero ships its own copy of miniupnpc" def install system "cmake", ".", *std_cmake_args system "make", "install" end plist_options manual: "wownerod --non-interactive" def plist <<~EOS <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{opt_bin}/wownerod</string> <string>--non-interactive</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist> EOS end test do cmd = "yes '' | #{bin}/wownero-wallet-cli --restore-deterministic-wallet " \ "--password brew-test --restore-height 238084 --generate-new-wallet wallet " \ "--electrum-seed 'maze vixen spiders luggage vibrate western nugget older " \ "emails oozed frown isolated ledge business vaults budget " \ "saucepan faxed aloof down emulate younger jump legion saucepan'" \ "--command address" address = "Wo3YLuTzJLTQjSkyNKPQxQYz5JzR6xi2CTS1PPDJD6nQAZ1ZCk1TDEHHx8CRjHNQ9JDmwCDGhvGF3CZXmmX1sM9a1YhmcQPJM" assert_equal address, shell_output(cmd).lines.last.split[1] end end
33.910448
113
0.6875
5d941f950ff0e1d1efe7e39f4cc246ea4506adc3
1,250
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "saml/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "libsaml" s.version = Saml::VERSION s.authors = ["Benoist Claassen"] s.email = ["[email protected]"] s.homepage = "https://www.digidentity.eu" s.license = "MIT" s.summary = "A gem to easily create SAML 2.0 messages." s.description = "Libsaml makes the creation of SAML 2.0 messages easy. The object structure is modeled after the SAML Core 2.0 specification from OASIS. Supported bindings are HTTP-Post, HTTP-Redirect, HTTP-Artifact and SOAP. Features include XML signing, XML verification and a pluggable backend for providers (FileStore backend included)." s.files = Dir["{lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md"] s.add_dependency "activesupport", ">= 4.2" s.add_dependency "activemodel", ">= 4.2" s.add_dependency "xmlmapper", '~> 0.7.2' s.add_dependency 'nokogiri', '~> 1.6', '>= 1.6.8' s.add_dependency "xmldsig", '>= 0.5.1', '< 0.7.0' s.add_dependency "xmlenc", '>= 0.6.9', '< 0.7.0' s.add_development_dependency "coveralls", "~> 0.7" end
44.642857
344
0.656
f79df6eb0e7859829559b25d2a9afa2a3c3a296d
2,852
#-- encoding: UTF-8 #-- copyright # OpenProject is an open source project management software. # Copyright (C) 2012-2020 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 ChiliProject, which is a fork of Redmine. The copyright follows: # Copyright (C) 2006-2017 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # See docs/COPYRIGHT.rdoc for more details. #++ namespace :ldap_groups do desc 'Synchronize groups and their users from the LDAP auth source.' \ 'Will only synchronize for those users already present in the application.' task synchronize: :environment do ::LdapGroups::SynchronizationJob.perform_now end namespace :development do desc 'Create a development LDAP server from the fixtures LDIF' task :ldap_server do require 'ladle' ldif = ENV['LDIF_FILE'] || Rails.root.join('spec/fixtures/ldap/users.ldif') ldap_server = Ladle::Server.new(quiet: false, port: '12389', domain: 'dc=example,dc=com', ldif: ldif).start puts <<~EOS LDAP server ready at localhost:12389 Users Base dn: ou=people,dc=example,dc=com Admin account: uid=admin,ou=system Admin password: secret -------------------------------------------------------- Attributes Login: uid First name: givenName Last name: sn Email: mail memberOf: (Hard-coded, not virtual) -------------------------------------------------------- Users: uid=aa729,ou=people,dc=example,dc=com (Password: smada) uid=bb459,ou=people,dc=example,dc=com (Password: niwdlab) uid=cc414,ou=people,dc=example,dc=com (Password: retneprac) -------------------------------------------------------- Groups: cn=foo,ou=groups,dc=example,dc=com (Members: aa729) cn=bar,ou=groups,dc=example,dc=com (Members: aa729, bb459, cc414) EOS puts "Send CTRL+D to stop the server" require 'irb'; binding.irb ldap_server.stop end end end
34.780488
113
0.66094
038b50d1c2ae30aa76f8568ac93e7a3a0148631d
160
# frozen_string_literal: true module NXT module Connector # Holds implementations of connectors that are input based. module Input end end end
16
63
0.7375
03f812ce83a0b004a4b84d1f353026f479270df6
2,685
require 'rack/cache' # So we can subclass the storage types require 'rack/cache/storage' require 'rack/cache/metastore' require 'rack/cache/entitystore' module Radiant module Cache mattr_accessor :meta_stores, :entity_stores, :use_x_sendfile, :use_x_accel_redirect self.meta_stores ||= [] self.entity_stores ||= [] self.use_x_sendfile = false self.use_x_accel_redirect = nil def self.new(app, options={}) self.use_x_sendfile = options.delete(:use_x_sendfile) if options[:use_x_sendfile] self.use_x_accel_redirect = options.delete(:use_x_accel_redirect) if options[:use_x_accel_redirect] Rack::Cache.new(app, { :entitystore => "radiant:cache/entity", :metastore => "radiant:cache/meta", :verbose => false, :allow_reload => false, :allow_revalidate => false}.merge(options)) end def self.clear meta_stores.each {|ms| ms.clear } entity_stores.each {|es| es.clear } end class EntityStore < Rack::Cache::EntityStore::Disk def initialize(root="#{Rails.root}/cache/entity") super Radiant::Cache.entity_stores << self end def clear Dir[File.join(self.root, "*")].each {|file| FileUtils.rm_rf(file) } end end class MetaStore < Rack::Cache::MetaStore::Disk def initialize(root="#{Rails.root}/cache/meta") super Radiant::Cache.meta_stores << self end def clear Dir[File.join(self.root, "*")].each {|file| FileUtils.rm_rf(file) } end private def restore_response(hash, body=nil) # Cribbed from the Rack::Cache source status = hash.delete('X-Status').to_i response = Rack::Cache::Response.new(status, hash, body) # Add acceleration headers if Radiant::Cache.use_x_sendfile accelerate(response, 'X-Sendfile', File.expand_path(body.path)) elsif Radiant::Cache.use_x_accel_redirect virtual_path = File.expand_path(body.path) entity_path = File.expand_path(Radiant::Cache.entity_stores.first.root) virtual_path[entity_path] = Radiant::Cache.use_x_accel_redirect accelerate(response,'X-Accel-Redirect', virtual_path) end response end def accelerate(response, header, value) response.headers[header] = value response.body = [] response.headers['Content-Length'] = '0' end end end end # Add our classes as fake constants in the right place class Rack::Cache::EntityStore RADIANT = Radiant::Cache::EntityStore end class Rack::Cache::MetaStore RADIANT = Radiant::Cache::MetaStore end
31.22093
105
0.652886
3903f71fdd95e5a595968411f93ef52da2cc829b
4,910
require 'vcap/component' require 'vcap/ring_buffer' require 'vcap/rest_api' require 'vcap/request' require 'presenters/error_presenter' require 'sinatra/reloader' require 'securerandom' require 'steno' module Sinatra module VCAP module Helpers def varz ::VCAP::Component.varz[:vcap_sinatra] end def in_test_mode? ENV['CC_TEST'] end end # Called when the caller registers the sinatra extension. Sets up # the standard sinatra environment for vcap. def self.registered(app) init_varz app.helpers VCAP::Helpers app.not_found do # sinatra wants to drive us through the not_found block for *every* # 404, with no way of disabling it. We want the logic in this block # for access to non-existent urls, but not for 404s that we return # from our logic. This is a check to see if we already did a 404 below. # We don't really have a class to attach a member variable to, so we have to # use the env to flag this. unless request.env['vcap_exception_body_set'] error = ::VCAP::Errors::NotFound.new presenter = ErrorPresenter.new(error) body Yajl::Encoder.encode(presenter.sanitized_hash) end end app.error do error = request.env['sinatra.error'] presenter = ErrorPresenter.new(error) raise error if in_test_mode? && !presenter.api_error? status(presenter.response_code) if presenter.client_error? logger.info(presenter.log_message) else logger.error(presenter.log_message) end payload = Yajl::Encoder.encode(presenter.sanitized_hash) ::VCAP::Component.varz.synchronize do varz[:recent_errors] << payload end request.env['vcap_exception_body_set'] = true body payload.concat("\n") end end # A user of the VCAP sinatra extension must call vcap_configure # in order to setup error handling correctly. Unfortunately, # we are not able to do this from inside self.registered as sinatra # doesn't honor the settings we make there. # # @option opts [String] :logger_name Name of the Steno logger to use. # Defaults to vcap.rest_api # # @option opts [String] :reload_path If specified and the app is running in # :development mode, sinatra will reload all files under the provided path # whenever they change. def vcap_configure(opts = {}) # we can't just do this in registered sinatra seems to reset # our configuration after register configure do set(:show_exceptions, false) set(:raise_errors, false) set(:dump_errors, false) end configure :development do register Sinatra::Reloader if opts[:reload_path] Dir["#{opts[:reload_path]}/**/*.rb"].each do |file| also_reload file end end end before do ::VCAP::Component.varz.synchronize do varz[:requests][:outstanding] += 1 end logger_name = opts[:logger_name] || 'vcap.api' env['rack.logger'] = Steno.logger(logger_name) @request_guid = env['X_VCAP_REQUEST_ID'] @request_guid ||= env['X_REQUEST_ID'] # we append a new guid to the request because we have no idea if the # caller is really going to be giving us a unique guid, i.e. they might # generate the guid and then turn around and make 3 api calls using it. if @request_guid @request_guid = "#{@request_guid}::#{SecureRandom.uuid}" else @request_guid ||= SecureRandom.uuid end ::VCAP::Request.current_id = @request_guid Steno.config.context.data['request_guid'] = @request_guid end after do ::VCAP::Component.varz.synchronize do varz[:requests][:outstanding] -= 1 varz[:requests][:completed] += 1 varz[:http_status][response.status] += 1 end headers['Content-Type'] = 'application/json;charset=utf-8' headers[::VCAP::Request::HEADER_NAME] = @request_guid ::VCAP::Request.current_id = nil Steno.config.context.data.delete('request_guid') nil end end private def self.init_varz ::VCAP::Component.varz.threadsafe! requests = {:outstanding => 0, :completed => 0} http_status = {} [(100..101), (200..206), (300..307), (400..417), (500..505)].each do |r| r.each { |c| http_status[c] = 0 } end recent_errors = ::VCAP::RingBuffer.new(50) vcap_sinatra = { :requests => requests, :http_status => http_status, :recent_errors => recent_errors } ::VCAP::Component.varz.synchronize do ::VCAP::Component.varz[:vcap_sinatra] ||= vcap_sinatra end end end end
31.075949
84
0.625051
ffd7b457e48fa4ab6345dfecaa5f6973a2a06195
4,789
# stolen wholesale from capistrano, thanks Jamis! class Git # Performs a clone on the remote machine, then checkout on the branch # you want to deploy. def initialize(opts={}) @configuration = opts end def configuration @configuration end def git res = configuration[:git_ssh_wrapper] ? "GIT_SSH=#{configuration[:git_ssh_wrapper]} git" : 'git' res = "sudo -u #{configuration[:user]} #{res}" if configuration[:user] res end def respository configuration[:repository] end def checkout(revision, destination) remote = origin args = [] args << "-o #{remote}" unless remote == 'origin' if depth = configuration[:git_shallow_clone] args << "--depth #{depth}" end execute = [] execute << "rm -rf #{destination}" if args.empty? execute << "#{git} clone #{verbose} #{configuration[:repository]} #{destination}" else execute << "#{git} clone #{verbose} #{args.join(' ')} #{configuration[:repository]} #{destination}" end # checkout into a local branch rather than a detached HEAD execute << "cd #{destination} && #{git} checkout #{verbose} -b deploy #{revision}" if configuration[:git_enable_submodules] execute << "#{git} submodule #{verbose} init" execute << "#{git} submodule #{verbose} update" end execute.join(" && ") end # An expensive export. Performs a checkout as above, then # removes the repo. def export(revision, destination) checkout(revision, destination) << " && rm -Rf #{destination}/.git" end # Merges the changes to 'head' since the last fetch, for remote_cache # deployment strategy def sync(revision, destination) remote = origin execute = [] execute << "cd #{destination}" # Use git-config to setup a remote tracking branches. Could use # git-remote but it complains when a remote of the same name already # exists, git-config will just silenty overwrite the setting every # time. This could cause wierd-ness in the remote cache if the url # changes between calls, but as long as the repositories are all # based from each other it should still work fine. if remote != 'origin' execute << "#{git} config remote.#{remote}.url #{configuration[:repository]}" execute << "#{git} config remote.#{remote}.fetch +refs/heads/*:refs/remotes/#{remote}/*" end # since we're in a local branch already, just reset to specified revision rather than merge execute << "#{git} fetch #{verbose} #{remote} && #{git} reset #{verbose} --hard #{revision}" if configuration[:git_enable_submodules] execute << "#{git} submodule #{verbose} init" execute << "#{git} submodule #{verbose} update" end execute.join(" && ") end # Returns a string of diffs between two revisions def diff(from, to=nil) from << "..#{to}" if to scm :diff, from end # Returns a log of changes between the two revisions (inclusive). def log(from, to=nil) scm :log, "#{from}..#{to}" end # Getting the actual commit id, in case we were passed a tag # or partial sha or something - it will return the sha if you pass a sha, too def query_revision(reference) raise ArgumentError, "Deploying remote branches is no longer supported. Specify the remote branch as a local branch for the git repository you're deploying from (ie: '#{reference.gsub('origin/', '')}' rather than '#{reference}')." if reference =~ /^origin\// sha_hash = '[0-9a-f]{40}' return reference if reference =~ /^#{sha_hash}$/ # it's already a sha command = scm('ls-remote', configuration[:repository], reference) result = nil begin result = yield(command) rescue ChefDeployFailure => e raise obvious_error("Could not access the remote Git repository. If this is a private repository, please verify that the deploy key for your application has been added to your remote Git account.", e) end unless result =~ /^(#{sha_hash})\s+(\S+)/ raise "Unable to resolve reference for '#{reference}' on repository '#{configuration[:repository]}'." end newrev = $1 newref = $2 return newrev end def scm(*args) [git, *args].compact.join(" ") end def head configuration[:branch] || 'HEAD' end def origin configuration[:remote] || 'origin' end private # If verbose output is requested, return nil, otherwise return the # command-line switch for "quiet" ("-q"). def verbose nil#configuration[:scm_verbose] ? nil : "-q" end # Build an error string that stands out in a log file def obvious_error(message, e) "#{stars}\n#{message}\n#{stars}\n#{e.message}#{stars}" end def stars ("\n"+'*'*80)*2 end end
31.506579
263
0.648361
bb63ecc1f311e15603e7a83173b7567334b7aaea
370
# frozen_string_literal: true module AwsRekognitionClient class ImageValidator class BaseValidator def initialize(image) @image = image @valid = false end def validate raise NotImplemented end def valid? validate end def message raise NotImplemented end end end end
14.8
29
0.6
1a92bbfacb3b23fcfa504013096180b21658d76d
1,981
module Tarona # It is container class for different useful objects. It is easier to pass # these objects to methods when they are in the container. What is more, it # also acts as a dependency injection container for some of these tools. # @!attribute [r] settings # @return [Tardvig::HashContainer] hash containing user's settings. It is # default settings overwritten with user's settings (it is because user's # settings can be incomplete). You can see names of the settings' files # in the constants of the toolkit. # @!attribute [r] i18n # @return [Tardvig::HashContainer] hash containing translations for some # phrases for the current language (it is taken from the settings). # You can see translations inside the /game/i18n directory. # @!attribute [r] session # @return [Tardvig::HashContainer] hash containing everything about player's # progress in a game. It can be written to a file in order to save user's # progress. class Toolkit < Tardvig::Toolkit # @see #settings DEFAULT_SETTINGS_PATH = 'game/default_settings.yml'.freeze # @see #settings SETTINGS_PATH = 'player/settings.yml'.freeze class << self def load_hash(from) hash = Tardvig::HashContainer.new if from.is_a? String file = File.new from, 'r', encoding: Encoding::UTF_8 hash.load file else hash.load from end yield hash if block_given? hash end private :load_hash end tool :settings do |_, params| load_hash(params[:default_settings] || DEFAULT_SETTINGS_PATH) do |hash| if params[:settings] || File.exist?(SETTINGS_PATH) hash.load(params[:settings] || SETTINGS_PATH) end end end tool :i18n do |tk, params| load_hash(params[:i18n] || "game/i18n/#{tk.settings['language']}.yml") end tool :session do Tardvig::HashContainer.new end end end
35.375
80
0.660273
e955e4b7d377fc45c2f9a2863f37c8253d608969
971
require "carrierwave" require "carrierwave/ffmpeg/audio/version" require "carrierwave/ffmpeg/audio/processor" module CarrierWave module Ffmpeg module Audio extend ActiveSupport::Concern module ClassMethods def convert options={} process convert: [ options ] end def watermark options={} process watermark: [ options ] end end def convert options={} cache_stored_file! if !cached? audio_filename = Processor.convert(current_path, options) File.rename audio_filename, current_path self.file.instance_variable_set(:@content_type, "audio/mpeg3") end def watermark options={} cache_stored_file! if !cached? audio_filename = Processor.watermark(current_path, options) File.rename audio_filename, current_path self.file.instance_variable_set(:@content_type, "audio/mpeg3") end end end end
25.552632
70
0.659114
bf2a23367657599568b8d197877d5ad4983e49ec
2,827
# frozen_string_literal: true require "rails_helper" describe "mailing lists", js: true do let!(:group) { create(:group, name: "Knitting Club", availability: "open", kind: "club") } let(:actor) { create(:admin) } before do use_user_subdomain(actor) login_as(actor, scope: :user) end context "with no domains" do scenario "show, edit list" do visit(groups_group_path(group)) expect(page).to have_content("This group has no attached email list") click_link("Edit") expect(page).to have_content("You can't create an email list because there are no domains") end end context "with domains" do let!(:domain) { create(:domain, name: "fluff.com") } context "with few add'l senders" do let(:api_response) do { entries: [ {email: "[email protected]", role: "nonmember", moderation_action: "defer", display_name: "A Tuzz"}, {email: "[email protected]", role: "nonmember", moderation_action: "accept", display_name: "Bo Fuzz"}, {email: "[email protected]", role: "nonmember", display_name: "Cal Biz"} # default moderation ] } end scenario "show, edit, delete list" do with_env("STUB_MAILMAN" => api_response.to_json) do visit(groups_group_path(group)) click_link("Edit") fill_in("groups_group_mailman_list_attributes_name", with: "knitting") expect(page).to have_content("List members are synchronized") click_button("Save") click_link("Knitting Club") expect(page).to have_content("[email protected]") expect(page).to have_content(/These additional senders.*A Tuzz\nBo Fuzz\n/m) expect(page).not_to have_content(/Cal Biz/) click_link("Edit") check("Delete this list?") accept_alert { click_button("Save") } click_link("Knitting Club") expect(page).to have_content("This group has no attached email list") end end end context "with many add'l senders" do let(:api_response) do { entries: 15.times.map do |i| {email: "#{i}@a.com", role: "nonmember", moderation_action: "accept", display_name: "Lad #{i}"} end } end scenario "show, edit, delete list" do with_env("STUB_MAILMAN" => api_response.to_json) do visit(groups_group_path(group)) click_link("Edit") fill_in("groups_group_mailman_list_attributes_name", with: "knitting") click_button("Save") click_link("Knitting Club") expect(page).to have_content("[email protected]") expect(page).to have_content(/These additional senders.*Lad 0\nLad 1\n/m) expect(page).to have_content("+5 more") end end end end end
34.060241
107
0.614079
ff90db6dbb0ba4148371ff5e50dd784dbff624bf
253
# typed: strict # frozen_string_literal: true require "sorbet-runtime" require_relative "struct" module LunchMoney extend T::Sig class Tag < T::Struct prop :id, Integer prop :name, String prop :description, T.nilable(String) end end
16.866667
40
0.715415
d52a240eaa0a289bd2c689607b982a39a69547c8
672
require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module AdminBryankroesbeekNl class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.2 # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers # -- all .rb files in that directory are automatically loaded after loading # the framework and any gems in your application. end end
33.6
82
0.769345
1c1f3ada2c4cd798ab0a07bc218dce8519638660
495
# 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::Network::Mgmt::V2018_04_01 module Models # # Defines values for PcError # module PcError InternalError = "InternalError" AgentStopped = "AgentStopped" CaptureFailed = "CaptureFailed" LocalFileFailed = "LocalFileFailed" StorageFailed = "StorageFailed" end end end
24.75
70
0.70101
e842aefd14cd4e0e4a117110f9061269a8f4c820
2,632
class PollsController < ApplicationController include AutoCompleteFor::BusinessUnit before_action :load_privileges, :auth, except: [:edit, :update, :show] before_action :check_privileges, except: [:edit, :update, :show] before_action :set_poll, only: [:show, :edit, :update, :destroy] before_action :set_questionnaire, only: [:index] before_action :set_title, except: :destroy before_action :set_current_module, except: [:reports] respond_to :html # GET /polls # GET /polls.json def index @polls = (@questionnaire&.polls || Poll.list). includes(:questionnaire, :user). search(**search_params). default_order. references(:questionnaire, :user). page params[:page] respond_with @polls end # GET /polls/1 def show end # GET /polls/new def new @poll = Poll.new end # GET /polls/1/edit def edit if @poll.nil? redirect_to login_url, alert: t('polls.not_found') elsif @poll.answered? || (params[:token] != @poll.access_token) redirect_to @poll end end # POST /polls def create @poll = Poll.list.new poll_params polls = Poll.between_dates(Date.today.at_beginning_of_day, Date.today.end_of_day).where( questionnaire_id: @poll.questionnaire_id, user_id: @poll.user_id ) respond_to do |format| if polls.present? format.html { redirect_to new_poll_path, alert: t('polls.already_exists', user: @poll.user&.full_name) } elsif @poll.save format.html { redirect_to @poll } else format.html { render 'new' } end end end # PATCH /polls/1 def update update_resource @poll, poll_params respond_with @poll, location: poll_url(@poll) unless response_body end # DELETE /polls/1 def destroy @poll.destroy respond_with @poll end def reports end private def poll_params params.require(:poll).permit( :user_id, :questionnaire_id, :comments, :lock_version, :about_id, :about_type, answers_attributes: [ :id, :answer, :comments, :answer_option_id, :type ] ) end def set_questionnaire @questionnaire = Questionnaire.list.find_by id: params[:questionnaire_id] end def set_poll @poll = Poll.list.preload(answers: { question: :answer_options }).find params[:id] end def set_current_module @current_module = 'administration_questionnaires_polls' end def load_privileges @action_privileges.update( reports: :read, auto_complete_for_business_unit: :read ) if @action_privileges end end
24.146789
112
0.663754
1806b7eebf49279727300a54a7e3b47455cb75f6
1,186
class SurveysController < ApplicationController admin_tab :all before_action :authenticate_user! before_action :check_acting_as, except: :complete before_action :init_current_facility before_action :init_service before_action :init_survey, only: [:activate, :deactivate] load_and_authorize_resource class: "ExternalService" def initialize @active_tab = "admin_products" super end # PUT /facilities/1/services/1/surveys/2/activate def activate @survey.activate flash[:notice] = "Survey activated" redirect_to request.referer end # PUT /facilities/1/services/1/surveys/2/deactivate def deactivate @survey.deactivate flash[:notice] = "Survey de-activated" redirect_to request.referer end def complete begin SurveyResponse.new(params).save! rescue => e Rails.logger.error("Could not save external surveyor response! #{e.message}\n#{e.backtrace.join("\n")}") end redirect_to params[:referer] end private def init_survey @survey = Survey.new @service, params end def init_service @service = current_facility.services.find_by!(url_name: params[:service_id]) end end
22.807692
110
0.724283
39a7d029496b64adf28db509ac7fa741a98fcdad
5,553
require 'fog/identity/openstack' module Fog module Identity class OpenStack class V3 < Fog::Service requires :openstack_auth_url recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_service_type, :openstack_service_name, :openstack_tenant, :openstack_endpoint_type, :openstack_region, :openstack_domain_id, :openstack_project_name, :openstack_domain_name, :openstack_user_domain, :openstack_project_domain, :openstack_user_domain_id, :openstack_project_domain_id, :openstack_api_key, :openstack_current_user_id, :openstack_userid, :openstack_username, :current_user, :current_user_id, :current_tenant, :provider, :openstack_identity_prefix, :openstack_endpoint_path_matches, :openstack_cache_ttl model_path 'fog/identity/openstack/v3/models' model :domain collection :domains model :endpoint collection :endpoints model :project collection :projects model :service collection :services model :token collection :tokens model :user collection :users model :group collection :groups model :role collection :roles model :role_assignment collection :role_assignments model :os_credential collection :os_credentials model :policy collection :policies request_path 'fog/identity/openstack/v3/requests' request :list_users request :get_user request :create_user request :update_user request :delete_user request :list_user_groups request :list_user_projects request :list_groups request :get_group request :create_group request :update_group request :delete_group request :add_user_to_group request :remove_user_from_group request :group_user_check request :list_group_users request :list_roles request :list_role_assignments request :get_role request :create_role request :update_role request :delete_role request :auth_domains request :auth_projects request :list_domains request :get_domain request :create_domain request :update_domain request :delete_domain request :list_domain_user_roles request :grant_domain_user_role request :check_domain_user_role request :revoke_domain_user_role request :list_domain_group_roles request :grant_domain_group_role request :check_domain_group_role request :revoke_domain_group_role request :list_endpoints request :get_endpoint request :create_endpoint request :update_endpoint request :delete_endpoint request :list_projects request :get_project request :create_project request :update_project request :delete_project request :list_project_user_roles request :grant_project_user_role request :check_project_user_role request :revoke_project_user_role request :list_project_group_roles request :grant_project_group_role request :check_project_group_role request :revoke_project_group_role request :list_services request :get_service request :create_service request :update_service request :delete_service request :token_authenticate request :token_validate request :token_check request :token_revoke request :list_os_credentials request :get_os_credential request :create_os_credential request :update_os_credential request :delete_os_credential request :list_policies request :get_policy request :create_policy request :update_policy request :delete_policy class Mock include Fog::OpenStack::Core def initialize(options = {}) end end def self.get_api_version(uri, connection_options = {}) connection = Fog::Core::Connection.new(uri, false, connection_options) response = connection.request(:expects => [200], :headers => {'Content-Type' => 'application/json', 'Accept' => 'application/json'}, :method => 'GET') body = Fog::JSON.decode(response.body) version = nil unless body['version'].empty? version = body['version']['id'] end if version.nil? raise Fog::OpenStack::Errors::ServiceUnavailable, "No version available at #{uri}" end version end class Real < Fog::Identity::OpenStack::Real private def default_service_type(_) DEFAULT_SERVICE_TYPE_V3 end def initialize_endpoint_path_matches(options) if options[:openstack_endpoint_path_matches] @openstack_endpoint_path_matches = options[:openstack_endpoint_path_matches] else @openstack_endpoint_path_matches = %r{/v3} unless options[:openstack_identity_prefix] end end end end end end end
34.067485
112
0.627949
873e5480b283bd1024ac46d960f399549dc461c1
1,118
# Encoding: UTF-8 [{content: "for {${1:set i 0}} {${2:\\$i < \\$n}} {${3:incr i}} {\n\t${4}\n}\n", name: "for...", scope: "source.tcl", tabTrigger: "for", uuid: "35FD4583-34CA-446A-958B-D6446220B2BF"}, {content: "foreach ${1:var} ${2:\\$list} {\n\t${3}\n}\n", name: "foreach...", scope: "source.tcl", tabTrigger: "foreach", uuid: "686ACE8E-AF2D-4429-BD3D-DB2272DE22FE"}, {content: "if {${1:condition}} {\n\t${2}\n}\n", name: "if...", scope: "source.tcl", tabTrigger: "if", uuid: "3BF57469-548C-4745-BB68-127C29CE70A1"}, {content: "proc ${1:name} {${2:args}} \\\\\n{\n\t${3}\n}\n", name: "proc...", scope: "source.tcl", tabTrigger: "proc", uuid: "16FB1812-6644-416D-8544-03F7E9C7C45E"}, {content: "switch ${1:-exact} -- ${2:\\$var} {\n\t${3:match} {\n\t\t${4}\n\t}\n\tdefault {${5}}\n}\n", name: "switch...", scope: "source.tcl", tabTrigger: "switch", uuid: "9301C846-1EED-4749-AB9D-2728EA661E97"}, {content: "while {${1:condition}} {\n\t${2}\n}\n", name: "while...", scope: "source.tcl", tabTrigger: "while", uuid: "6F958C1C-2A05-4794-A551-4C3ABAAEE817"}]
31.942857
95
0.567979
2679bac3769fac1953c73df8f9b3bfae757af4d0
507
# frozen_string_literal: true class Tramway::Core::ExtendedApplicationForm < Tramway::Core::ApplicationForm class << self def properties(*args) @@extendable_properties ||= [] @@extendable_properties += args super(*args) end end def initialize(model) @@extendable_properties.each do |prop| next if model.respond_to? prop model.class.define_method prop do end model.class.define_method "#{prop}=" do |value| end end super end end
21.125
77
0.658777
089cf46f1fdcd75a4ad792a5afed62c94a129799
1,322
class Xhyve < Formula desc "Lightweight macOS virtualization solution based on FreeBSD's bhyve" homepage "https://github.com/machyve/xhyve" url "https://github.com/machyve/xhyve/archive/v0.2.0.tar.gz" sha256 "32c390529a73c8eb33dbc1aede7baab5100c314f726cac14627d2204ad9d3b3c" head "https://github.com/machyve/xhyve.git" bottle do rebuild 1 sha256 cellar: :any, catalina: "b81d7e54464f0870eabe1fead9d31627ad5342fd2e9aaff47535a7bcc738751f" sha256 cellar: :any, mojave: "babcee304193c68f484434c551732e5657878095f00c4149fc88867317f9252e" sha256 cellar: :any, high_sierra: "9643b72b869ec57653668f1ed2db0c3a2c7fad77d8000931933824622032d476" sha256 cellar: :any, sierra: "edc2e17147d4ae9333033e7317590a48b752b418df689a6dae45bd29a12eaca8" sha256 cellar: :any, el_capitan: "b0a94f72b09c71aa3bfbbf55669cd9e64ea309d6be8c838f6bc98aeaf8a6895c" sha256 cellar: :any, yosemite: "e61ee4b3d2d3b5bba47f4288af54980f5de7991cadf6aa83dc058cb36854c789" end depends_on :macos def install args = [] args << "GIT_VERSION=#{version}" if build.stable? system "make", *args bin.install "build/xhyve" pkgshare.install "test/" pkgshare.install Dir["xhyverun*.sh"] man1.install "xhyve.1" if build.head? end test do system "#{bin}/xhyve", "-v" end end
38.882353
104
0.760968
5d928d87dcef92ddadb9b26aa79d374dfe55e6d3
3,517
Dummy::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 thread web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true # Enable Rack::Cache to put a simple HTTP cache in front of your application # Add `rack-cache` to your Gemfile before enabling this. # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. # config.action_dispatch.rack_cache = true # Disable Rails's static asset server (Apache or nginx will already do this). config.serve_static_assets = false # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass # Whether to fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false # Generate digests for assets URLs. config.assets.digest = true # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true # Set to :debug to see everything in the log. config.log_level = :info # Prepend all log lines with the following tags. # config.log_tags = [ :subdomain, :uuid ] # Use a different logger for distributed setups. # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) # Use a different cache store in production. # config.cache_store = :mem_cache_store # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = "http://assets.example.com" # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # config.assets.precompile += %w( search.js ) # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation can not be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify # Log the query plan for queries taking more than this (works # with SQLite, MySQL, and PostgreSQL). # config.active_record.auto_explain_threshold_in_seconds = 0.5 # Disable automatic flushing of the log to improve performance. # config.autoflush_log = false # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new # Default the production mode queue to an synchronous queue. You will probably # want to replace this with an out-of-process queueing solution. # config.queue = ActiveSupport::SynchronousQueue.new end
40.895349
104
0.75917
d5f215b3adf89bb9ebb8f3e43df3fa18a3e0dd1c
59
ActiveRecord::Base.send :include, AirBlade::ActsAsParentOf
29.5
58
0.830508
0395f1469cebfc8db1f9ad288840f661c79a7d14
397
# frozen_string_literal: true require "active_analysis/version" require "active_analysis/engine" module ActiveAnalysis extend ActiveSupport::Autoload autoload :FixtureSet mattr_accessor :logger mattr_accessor :image_library mattr_accessor :image_analyzer mattr_accessor :audio_analyzer mattr_accessor :pdf_analyzer mattr_accessor :video_analyzer mattr_accessor :addons end
18.904762
33
0.823678
d57e488fb8ab802838eadbf1ec5b390740913090
420
module Rmega module Nodes class File < Node include Deletable include Downloadable def storage_url @storage_url ||= begin query_params = data["__n"] ? {n: data["__n"]} : {} data['g'] || request({a: 'g', g: 1, n: handle}, query_params)['g'] end end def size data['s'] end def filesize size end end end end
17.5
76
0.502381
1ce8feac4ab03a2575a868c86bbbbf0e5037e418
695
# frozen_string_literal: true module API class UsageDataQueries < ::API::Base before { authenticated_as_admin! } feature_category :service_ping namespace 'usage_data' do before do not_found! unless Feature.enabled?(:usage_data_queries_api, default_enabled: :yaml, type: :ops) end desc 'Get raw SQL queries for usage data SQL metrics' do detail 'This feature was introduced in GitLab 13.11.' end get 'queries' do Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/325534') queries = Gitlab::UsageDataQueries.data(force_refresh: true) present queries end end end end
24.821429
103
0.677698
87f0ef569c4745273b82621ec483911675bfd2ea
57
# encoding: utf-8 module Backup VERSION = '4.1.2' end
9.5
19
0.649123
bb999a10865db82cffc6568446fd44bd1a7fd03d
11,805
class StringTest < MrubycTestCase description "String.new with arg" def string_new_with_arg str = String.new("a string instance") assert_equal "a string instance", str end description "String.new without arg" def string_new_without_arg str = String.new assert_equal "", str end description "==, !=" def op_eq_case assert_equal true, "abc" == "abc" assert_equal false, "abc" == "ABC" assert_equal false, "abc" == "abcd" assert_equal false, "abc" != "abc" assert_equal true, "abc" != "ABC" end description "self * times -> String" def mul_case s1 = "ABCDEFG" s2 = "0123456789" assert_equal "ABCDEFGABCDEFG", s1 * 2 assert_equal "abcabc", "abc" * 2 end description "self + other -> String" def add_case s1 = "ABCDEFG" s2 = "0123456789" assert_equal "ABCDEFG0123456789", s1 + s2 assert_equal "ABCDEFG123", s1 + "123" assert_equal "abc0123456789", "abc" + s2 assert_equal "abc123", "abc" + "123" end description "self << other -> self" def addi_case s1 = "ABCDEFG" s2 = "0123456789" s1 << s2 assert_equal "ABCDEFG0123456789", s1 s1 << "abc" assert_equal "ABCDEFG0123456789abc", s1 assert_equal "abcdef", "abc" << "def" s1 << 65 assert_equal "ABCDEFG0123456789abcA", s1 end description "self <=> other -> (minus) | 0 | (plus) | nil" def compare_case assert ("aaa" <=> "xxx") < 0 assert ("aaa" <=> "aaa") == 0 assert ("xxx" <=> "aaa") > 0 assert ("string" <=> "stringAA") < 0 assert ("string" <=> "string") == 0 assert ("stringAA" <=> "string") > 0 end description "self == other -> bool" def op_eq_2_case s1 = "ABCDEFG" assert_equal "ABCDEFG", s1 end description "self[nth] -> String | nil" def nth_case assert_equal "r", 'bar'[2] assert_equal true, 'bar'[2] == ?r assert_equal "r", 'bar'[-1] assert_equal nil, 'bar'[3] assert_equal nil, 'bar'[-4] end description "self[nth, len] -> String | nil" def nth_len_case str0 = "bar" assert_equal "r", str0[2, 1] assert_equal "", str0[2, 0] assert_equal "r", str0[2, 100] # (右側を超えても平気 assert_equal "r", str0[-1, 1] assert_equal "r", str0[-1, 2] # (あくまでも「右に向かって len 文字」 assert_equal "", str0[3, 1] assert_equal nil, str0[4, 1] assert_equal nil, str0[-4, 1] str1 = str0[0, 2] # (str0 の「一部」を str1 とする assert_equal "ba", str1 str1[0] = "XYZ" assert_equal "XYZa", str1 #(str1 の内容が破壊的に変更された assert_equal "bar", str0 #(str0 は無傷、 str1 は str0 と内容を共有していない end description "境界値チェックを詳細にかけておく" def boundary_value_case s1 = "0123456" assert_equal "012", s1[0,3] assert_equal "123", s1[1,3] assert_equal "", s1[1,0] assert_equal "123456", s1[1,30] assert_equal nil, s1[3,-1] assert_equal nil, s1[3,-3] assert_equal nil, s1[3,-4] assert_equal nil, s1[3,-5] assert_equal "6", s1[6,1] assert_equal "", s1[6,0] assert_equal "", s1[7,1] # ?? assert_equal "", s1[7,0] # ?? assert_equal nil, s1[7,-1] assert_equal nil, s1[7,-2] assert_equal nil, s1[8,1] assert_equal nil, s1[8,0] assert_equal nil, s1[8,-1] assert_equal nil, s1[8,-2] assert_equal "", s1[-3,0] assert_equal "45", s1[-3,2] assert_equal "456", s1[-3,3] assert_equal "456", s1[-3,4] assert_equal "", s1[-1,0] assert_equal "6", s1[-1,1] assert_equal "6", s1[-1,2] assert_equal "12", s1[-6,2] assert_equal "01", s1[-7,2] assert_equal nil, s1[-8,0] assert_equal nil, s1[-8,1] assert_equal nil, s1[-3,-1] end description "self[nth] = val" def nth_replace_case s1 = "0123456789" s1[0] = "ab" assert_equal "ab123456789", s1 s1 = "0123456789" s1[1] = "ab" assert_equal "0ab23456789", s1 s1 = "0123456789" s1[9] = "ab" assert_equal "012345678ab", s1 s1 = "0123456789" s1[10] = "ab" assert_equal "0123456789ab", s1 s1 = "0123456789" s1[-1] = "ab" assert_equal "012345678ab", s1 s1 = "0123456789" s1[-2] = "ab" assert_equal "01234567ab9", s1 s1 = "0123456789" s1[-10] = "ab" assert_equal "ab123456789", s1 s1 = "0123456789" s1[0] = "" assert_equal "123456789", s1 s1 = "0123456789" s1[1] = "" assert_equal "023456789", s1 s1 = "0123456789" s1[9] = "" assert_equal "012345678", s1 s1 = "0123456789" s1[10] = "" assert_equal "0123456789", s1 s1 = "0123456789" s1[-1] = "" assert_equal "012345678", s1 s1 = "0123456789" s1[-2] = "" assert_equal "012345679", s1 s1 = "0123456789" s1[-10] = "" assert_equal "123456789", s1 end description "self[nth, len] = val" def nth_len_replace_case s1 = "0123456789" s1[2,5] = "ab" assert_equal "01ab789", s1 s1 = "0123456789" s1[2,8] = "ab" assert_equal "01ab", s1 s1 = "0123456789" s1[2,9] = "ab" assert_equal "01ab", s1 s1 = "0123456789" s1[2,1] = "ab" assert_equal "01ab3456789", s1 s1 = "0123456789" s1[2,0] = "ab" assert_equal "01ab23456789", s1 s1 = "0123456789" s1[0,5] = "ab" assert_equal "ab56789", s1 s1 = "0123456789" s1[0,10] = "ab" assert_equal "ab", s1 s1 = "0123456789" s1[0,99] = "ab" assert_equal "ab", s1 s1 = "0123456789" s1[9,1] = "ab" assert_equal "012345678ab", s1 s1 = "0123456789" s1[10,1] = "ab" assert_equal "0123456789ab", s1 s1 = "0123456789" s1[10,0] = "ab" assert_equal "0123456789ab", s1 s1 = "0123456789" s1[2,5] = "" assert_equal "01789", s1 s1 = "0123456789" s1[2,8] = "" assert_equal "01", s1 s1 = "0123456789" s1[2,9] = "" assert_equal "01", s1 s1 = "0123456789" s1[2,1] = "" assert_equal "013456789", s1 s1 = "0123456789" s1[2,0] = "" assert_equal "0123456789", s1 s1 = "0123456789" s1[0,5] = "" assert_equal "56789", s1 s1 = "0123456789" s1[0,10] = "" assert_equal "", s1 s1 = "0123456789" s1[0,99] = "" assert_equal "", s1 s1 = "0123456789" s1[9,1] = "" assert_equal "012345678", s1 s1 = "0123456789" s1[10,1] = "" assert_equal "0123456789", s1 s1 = "0123456789" s1[10,0] = "" assert_equal "0123456789", s1 end description "minus" def minus_case s1 = "0123456789" s1[-8,5] = "ab" assert_equal "01ab789", s1 s1 = "0123456789" s1[-8,8] = "ab" assert_equal "01ab", s1 s1 = "0123456789" s1[-8,9] = "ab" assert_equal "01ab", s1 s1 = "0123456789" s1[-8,1] = "ab" assert_equal "01ab3456789", s1 s1 = "0123456789" s1[-8,0] = "ab" assert_equal "01ab23456789", s1 s1 = "0123456789" s1[-1,1] = "ab" assert_equal "012345678ab", s1 s1 = "0123456789" s1[-1,0] = "ab" assert_equal "012345678ab9", s1 end description "ord" def ord_case assert_equal 97, "a".ord assert_equal 97, "abcde".ord end description "binary string" def binary_case s1 = "ABC\x00\x0d\x0e\x0f" assert_equal 7, s1.size i = 0 while i < 3 s1[i] = i.chr i += 1 end assert_equal "\x00\x01\x02\x00\x0d\x0e\x0f", s1 while i < 10 s1[i] = i.chr i += 1 end assert_equal 10, s1.size assert_equal "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09", s1 end description "index" def index_case assert_equal 0, "abcde".index("") assert_equal 0, "abcde".index("a") assert_equal 0, "abcde".index("abc") assert_equal 1, "abcde".index("bcd") assert_equal 3, "abcde".index("de") assert_equal nil, "abcde".index("def") assert_equal 2, "abcde".index("c",1) assert_equal 2, "abcde".index("c",2) assert_equal nil, "abcde".index("c",3) end description "tr" def tr_case assert_equal "123defg", "abcdefg".tr("abc", "123") assert_equal "123d456", "abcdefg".tr("abcefg", "123456") assert_equal "123333g", "abcdefg".tr("abcdef", "123") assert_equal "123defg", "abcdefg".tr("a-c", "123") assert_equal "123d456", "abcdefg".tr("a-ce-g", "123456") assert_equal "123d456", "abcdefg".tr("a-cefg", "123456") assert_equal "143defg", "abcdefg".tr("a-cb", "123456") assert_equal "143de56", "abcdefg".tr("a-cbfg", "123456") assert_equal "14567fg", "abcdefg".tr("a-cb-e", "123456789") assert_equal "a999999", "abcdefg".tr("^a", "123456789") assert_equal "abc9999", "abcdefg".tr("^abc", "123456789") assert_equal "abc9999", "abcdefg".tr("^a-c", "123456789") assert_equal "^23defg", "abcdefg".tr("abc", "^23456789") # Illegal Cases assert_equal "abcdefg", "abcdefg".tr("", "123456789") assert_equal "abc1defg", "abc^defg".tr("^", "123456789") assert_equal "abc1defg", "abc-defg".tr("-", "123456789") assert_equal "1bc2defg", "abc-defg".tr("a-", "123456789") assert_equal "123-defg", "abc-defg".tr("a-c", "123456789") assert_equal "ab21defg", "abc-defg".tr("-c", "123456789") # delete assert_equal "defg", "abcdefg".tr("abc", "") assert_equal "abc", "abcdefg".tr("^abc", "") # range replace assert_equal "FOO", "foo".tr('a-z', 'A-Z') assert_equal "foo", "FOO".tr('A-Z', 'a-z') assert_equal "12cABC", "abcdef".tr("abd-f", "12A-C") end description "start_with?" def start_with_case assert_true "abc".start_with?("") assert_true "abc".start_with?("a") assert_true "abc".start_with?("ab") assert_true "abc".start_with?("abc") assert_false "abc".start_with?("abcd") assert_false "abc".start_with?("A") assert_false "abc".start_with?("aA") assert_false "abc".start_with?("b") end description "end_with?" def end_with_case assert_true "abc".end_with?("") assert_true "abc".end_with?("c") assert_true "abc".end_with?("bc") assert_true "abc".end_with?("abc") assert_false "abc".end_with?(" abc") assert_false "abc".end_with?("C") assert_false "abc".end_with?("Bc") assert_false "abc".end_with?("b") end description "include?" def include_case assert_true "abc".include?("") assert_true "abc".include?("a") assert_true "abc".include?("b") assert_true "abc".include?("c") assert_true "abc".include?("ab") assert_true "abc".include?("bc") assert_true "abc".include?("abc") assert_false "abc".include?("abcd") assert_false "abc".include?(" abc") assert_false "abc".include?("A") assert_false "abc".include?("aB") assert_false "abc".include?("abC") end description "to_f, to_i, to_s" def to_something_case assert_equal 10.0, "10".to_f assert_equal 1000.0, "10e2".to_f assert_equal 0.01, "1e-2".to_f assert_equal 0.1, ".1".to_f # not support this case. #assert_equal 0.0, "nan".to_f #assert_equal 0.0, "INF".to_f #assert_equal( -0.0, "-Inf".to_f ) assert_equal 0.0, "".to_f #assert_equal 100.0, "1_0_0".to_f assert_equal 10.0, " \n10".to_f #assert_equal 0.0, "0xa.a".to_f assert_equal 10, " 10".to_i assert_equal 10, "+10".to_i assert_equal( -10, "-10".to_i ) assert_equal 10, "010".to_i assert_equal( -10, "-010".to_i ) assert_equal 0, "0x11".to_i assert_equal 0, "".to_i assert_equal 1, "01".to_i(2) #assert_equal 1, "0b1".to_i(2) assert_equal 7, "07".to_i(8) #assert_equal 7, "0o7".to_i(8) assert_equal 31, "1f".to_i(16) #assert_equal 31, "0x1f".to_i(16) # not support this case. #assert_equal 2, "0b10".to_i(0) #assert_equal 8, "0o10".to_i(0) #assert_equal 8, "010".to_i(0) #assert_equal 10, "0d10".to_i(0) #assert_equal 16, "0x10".to_i(0) assert_equal "str", "str".to_s end end
23.993902
69
0.591105
7af76edadf577f50bac5aac145dbfb4f4084add6
1,164
# frozen_string_literal: true require "rails_helper" describe SignOutController, type: :controller do include DfESignInUserHelper let(:user) { create(:user) } let(:dfe_sign_in_user) do { "email" => user.email, "last_active_at" => Time.zone.now, "id_token" => "id_token", "provider" => provider, } end let(:request_index) do session["dfe_sign_in_user"] = dfe_sign_in_user get :index end describe "#signout" do context "existing DfE user" do let(:provider) { "dfe" } it "redirects to the session/end" do request_index expect(response).to redirect_to(dfe_logout_url) end end context "developer user" do let(:provider) { "developer" } it "redirects to the developer/sign-out" do request_index expect(response).to redirect_to("/auth/developer/sign-out") end end end private def dfe_logout_url uri = URI("#{Settings.dfe_sign_in.issuer}/session/end") uri.query = { id_token_hint: "id_token", post_logout_redirect_uri: "#{Settings.base_url}/auth/dfe/sign-out", }.to_query uri.to_s end end
21.163636
73
0.642612
61fc18ef57c13b7df647c78de421fd9444695c18
7,142
module Fog module Compute class ProfitBricks class Real # Creates a volume within the data center. This will NOT attach the volume to a server. # # ==== Parameters # * datacenter_id<~String> - Required, UUID of virtual data center # * options<~Hash>: # * name<~String> - The name of the volume # * size<~Integer> - Required, the size of the volume in GB # * bus<~String> - The bus type of the volume (VIRTIO or IDE). Default: VIRTIO. # * image<~String> - Required**, the image or snapshot ID # * type<~String> - The volume type, HDD or SSD # * licenceType<~String> - Required**, the licence type of the volume. Options: LINUX, WINDOWS, UNKNOWN, OTHER # * imagePassword<~String> - One-time password is set on the Image for the appropriate account. # This field may only be set in creation requests. When reading, it always returns null. # Password has to contain 8-50 characters. # Only these characters are allowed: [abcdefghjkmnpqrstuvxABCDEFGHJKLMNPQRSTUVX23456789] # * sshKeys<~String> - SSH keys to allow access to the volume via SSH # # ** Either the image or the licenceType parameters need to be provided. # licenceType is required, but if image is supplied, it will already have a licenceType set. # # ==== Returns # * response<~Excon::Response>: # * body<~Hash>: # * id<~String> - The resource's unique identifier # * type<~String> - The type of the created resource # * href<~String> - URL to the object's representation (absolute path) # * metadata<~Hash> - Hash containing the volume metadata # * createdDate<~String> - The date the resource was created # * createdBy<~String> - The user who created the resource # * etag<~String> - The etag for the resource # * lastModifiedDate<~String> - The last time the resource has been modified # * lastModifiedBy<~String> - The user who last modified the resource # * state<~String> - Volume state # * properties<~Hash> - Hash containing the volume properties # * name<~String> - The name of the volume. # * type<~String> - The volume type, HDD or SSD. # * size<~Integer> - The size of the volume in GB. # * image<~String> - The image or snapshot ID. # * imagePassword<~String> - Indicates if a password is set on the image. # * sshKeys<~String> - SSH keys # * bus<~String> - The bus type of the volume (VIRTIO or IDE). Default: VIRTIO. # * licenceType<~String> - Volume licence type. ( WINDOWS, LINUX, OTHER, UNKNOWN) # * cpuHotPlug<~Boolean> - This volume is capable of CPU hot plug (no reboot required) # * cpuHotUnplug<~Boolean> - This volume is capable of CPU hot unplug (no reboot required) # * ramHotPlug<~Boolean> - This volume is capable of memory hot plug (no reboot required) # * ramHotUnplug<~Boolean> - This volume is capable of memory hot unplug (no reboot required) # * nicHotPlug<~Boolean> - This volume is capable of nic hot plug (no reboot required) # * nicHotUnplug<~Boolean> - This volume is capable of nic hot unplug (no reboot required) # * discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot plug (no reboot required) # * discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot unplug (no reboot required) # * discScsiHotPlug<~Boolean> - This volume is capable of Scsi drive hot plug (no reboot required) # * discScsiHotUnplug<~Boolean> - This volume is capable of Scsi drive hot unplug (no reboot required) # * deviceNumber<~Integer> - The LUN ID of the volume volume # # {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#create-volume] def create_volume(datacenter_id, options = {}) volume = { :properties => options } request( :expects => [202], :method => 'POST', :path => "/datacenters/#{datacenter_id}/volumes", :body => Fog::JSON.encode(volume) ) end end class Mock def create_volume(datacenter_id, options = {}) response = Excon::Response.new response.status = 202 if datacenter = data[:datacenters]['items'].find do |attrib| attrib['id'] == datacenter_id end datacenter['version'] += 1 if datacenter['version'] else raise Fog::Errors::NotFound, 'Data center resource could not be found' end volume_id = Fog::UUID.uuid volume = { 'id' => volume_id, 'type' => 'volume', 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{datacenter['id']}/volumes/#{volume_id}", 'metadata' => { 'createdDate' => '2015-03-18T19=>00=>51Z', 'createdBy' => '[email protected]', 'etag' => 'c4a2fde6ba91a038ff953b939cc21efe', 'lastModifiedDate' => '2015-03-18T19=>00=>51Z', 'lastModifiedBy' => '[email protected]', 'state' => 'AVAILABLE' }, 'properties' => { 'name' => options[:name], 'type' => options[:type], 'size' => options[:size], 'image' => options[:image], 'availabilityZone' => options[:availabilityZone], 'bus' => 'VIRTIO', 'licenceType' => 'OTHER', 'cpuHotPlug' => 'true', 'cpuHotUnplug' => 'false', 'ramHotPlug' => 'false', 'ramHotUnplug' => 'false', 'nicHotPlug' => 'true', 'nicHotUnplug' => 'true', 'discVirtioHotPlug' => 'true', 'discVirtioHotUnplug' => 'true', 'discScsiHotPlug' => 'false', 'discScsiHotUnplug' => 'false', 'deviceNumber' => 1 }, 'datacenter_id' => datacenter['id'] } data[:volumes]['items'] << volume response.body = volume response end end end end end
53.298507
126
0.512882
bbeb29b6aed6029046f74d3ebe43ff9aee751fb0
1,293
class Libsndfile < Formula desc "C library for files containing sampled sound" homepage "http://www.mega-nerd.com/libsndfile/" url "http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28.tar.gz" sha256 "1ff33929f042fa333aed1e8923aa628c3ee9e1eb85512686c55092d1e5a9dfa9" bottle do cellar :any sha256 "e7cb1a29d931a1637ec84a5ba6b71d37801dc0bb4eab38051df19755cb048667" => :mojave sha256 "d06bf0bf936cde67857ac3d3599944d2050ea8dc6237bad8b4c27ef86ac2eb3c" => :high_sierra sha256 "4e4bde6464cfbefcf7f2a9001af0ea34c6273b466ffa71ac953b2bb41eb619ec" => :sierra sha256 "49d17fa55815680936b529b7bbb8e5cf180c98722c7f8b45d763bfe2d1f0a5de" => :el_capitan sha256 "9df59790751d64c7f61682233a733030de9e6406682f3a15e30e708103930038" => :yosemite end depends_on "pkg-config" => :build depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build depends_on "flac" depends_on "libogg" depends_on "libvorbis" def install system "autoreconf", "-fvi" system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}" system "make", "install" end test do output = shell_output("#{bin}/sndfile-info #{test_fixtures("test.wav")}") assert_match "Duration : 00:00:00.064", output end end
36.942857
93
0.755607
bfd4b2c068cb8354334e701e4dbf6e9e19baeb33
162
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run CruiseControl::Application
40.5
67
0.783951
5df7fc7952527d8bf107372b0cae151c195a3a20
3,893
require File.dirname(__FILE__) + '/exceptions' require File.dirname(__FILE__) + '/identity' module Authorization module ObjectRolesTable module UserExtensions def self.included( recipient ) recipient.extend( ClassMethods ) end module ClassMethods def acts_as_authorized_user(roles_relationship_opts = {}) has_and_belongs_to_many :roles, roles_relationship_opts include Authorization::ObjectRolesTable::UserExtensions::InstanceMethods include Authorization::Identity::UserExtensions::InstanceMethods # Provides all kinds of dynamic sugar via method_missing end end module InstanceMethods def has_role?( role_name, authorizable_obj = nil ) if authorizable_obj.nil? case role_name when String then self.roles.detect { |role| role.name == role_name } ? true : false when Array then role_name.inject(false) { |memo,role| memo ? memo : has_role?(role) } else false end else role = get_role( role_name, authorizable_obj ) role ? self.roles.exists?( role.id ) : false end end def has_role( role_name, authorizable_obj = nil ) role = get_role( role_name, authorizable_obj ) if role.nil? if authorizable_obj.is_a? Class role = Role.create( :name => role_name, :authorizable_type => authorizable_obj.to_s ) elsif authorizable_obj role = Role.create( :name => role_name, :authorizable => authorizable_obj ) else role = Role.create( :name => role_name ) end end self.roles << role if role and not self.roles.exists?( role.id ) end def has_no_role( role_name, authorizable_obj = nil ) role = get_role( role_name, authorizable_obj ) if role self.roles.delete( role ) role.destroy if role.users.empty? end end private def get_role( role_name, authorizable_obj ) if authorizable_obj.is_a? Class Role.where('name = ? and authorizable_type = ? and authorizable_id IS NULL', role_name, authorizable_obj.to_s).first elsif authorizable_obj Role.where('name = ? and authorizable_type = ? and authorizable_id = ?', role_name, authorizable_obj.class.base_class.to_s, authorizable_obj.id).first else Role.where('name = ? and authorizable_type IS NULL and authorizable_id IS NULL', role_name).first end end end end module ModelExtensions def self.included( recipient ) recipient.extend( ClassMethods ) end module ClassMethods def acts_as_authorizable has_many :accepted_roles, :as => :authorizable, :class_name => 'Role' def accepts_role?( role_name, user ) user.has_role? role_name, self end def accepts_role( role_name, user ) user.has_role role_name, self end def accepts_no_role( role_name, user ) user.has_no_role role_name, self end include Authorization::ObjectRolesTable::ModelExtensions::InstanceMethods include Authorization::Identity::ModelExtensions::InstanceMethods # Provides all kinds of dynamic sugar via method_missing end end module InstanceMethods # If roles aren't overriden in model then check roles table def accepts_role?( role_name, user ) user.has_role? role_name, self end def accepts_role( role_name, user ) user.has_role role_name, self end def accepts_no_role( role_name, user ) user.has_no_role role_name, self end end end end end
33.560345
162
0.621629
61f56b92854edb50e816a5f6c4c1698c8e6b2a8f
344
module UsersHelper # Returns the Gravatar for the given user. def gravatar_for(user, options = { size: 80}) gravatar_id = Digest::MD5::hexdigest(user.email.downcase) size = options[:size] gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}" image_tag(gravatar_url, alt: user.name, class: "gravatar") end end
34.4
70
0.712209
7a8dcc7789070d950160181b89a3f4dd60b19b38
815
require_relative "boot" require "rails/all" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) require "no_password" module Dummy class Application < Rails::Application config.load_defaults Rails::VERSION::STRING.to_f # Configuration for the application, engines, and railties goes here. # # These settings can be overridden in specific environments using the files # in config/environments, which are processed later. # # config.time_zone = "Central Time (US & Canada)" # config.eager_load_paths << Rails.root.join("extras") config.action_mailer.asset_host = "http://localhost:3090" config.i18n.available_locales = [:en, :es] config.i18n.default_locale = :es end end
30.185185
79
0.727607
217bfa33a0180330b3956ffa72eed869b0d01cbe
1,233
module WNS module Abbreviations INNER_DOTS_EXPRESSION = /([a-zA-Z]\.)([a-zA-Z]\.)([a-zA-Z]\.|)([a-zA-Z]\.|)([a-zA-Z]\.|)(,|) / INNER_DOTS_REPLACEMENT = "\\1&#8239;\\2&#8239;\\3&#8239;\\4&#8239;\\5&#8239;\\6&nbsp;" TITLE_EXPRESSION = /(Mr|Ms|Mrs|Messrs|Mmes|Msgr|Prof|Rev|Dr|Sr|St|[A-Z][a-z]|[A-Z][a-z][a-z])(\.|\.,|,) / TITLE_REPLACEMENT = "\\1\\2&nbsp;" PREFIX_EXPRESSION = /, ([a-zA-Z]\.&)/ PREFIX_REPLACEMENT = ",&nbsp;\\1" COLLAPSE_SPACES_EXPRESSION = /(&#8239;)*(&nbsp;|,)/ COLLAPSE_SPACES_REPLACEMENT = "\\2" def self.enabled?(doc) wns = doc.site.config["wns"] || {} wns["abbreviations"] || false end def self.replace_abbreviations!(doc) if Abbreviations::enabled?(doc) doc.content = doc.content.gsub(Abbreviations::INNER_DOTS_EXPRESSION, Abbreviations::INNER_DOTS_REPLACEMENT) doc.content = doc.content.gsub(Abbreviations::TITLE_EXPRESSION, Abbreviations::TITLE_REPLACEMENT) doc.content = doc.content.gsub(Abbreviations::PREFIX_EXPRESSION, Abbreviations::PREFIX_REPLACEMENT) doc.content = doc.content.gsub(Abbreviations::COLLAPSE_SPACES_EXPRESSION, Abbreviations::COLLAPSE_SPACES_REPLACEMENT) end end end end
41.1
125
0.650446
f713e4af36c30df5abeea1085a7324d1dc96fd02
276
require 'spec_helper' describe NYNY do it 'root points to pwd' do NYNY.root.should == Pathname.pwd end it 'has the correct env' do NYNY.env.should be_test end it 'root can join a path' do NYNY.root.join("foo").should == Pathname.pwd + "foo" end end
17.25
56
0.663043
26f7bb2904909c5e45e38415e98777c0738c8fb4
2,778
class Pushpin < Formula desc "Reverse proxy for realtime web services" homepage "https://pushpin.org/" url "https://dl.bintray.com/fanout/source/pushpin-1.17.2.tar.bz2" sha256 "f30c12b147d39c52617403b40f11737a14020dc93f223faa7214d73db8af1d77" head "https://github.com/fanout/pushpin.git" bottle do sha256 "33219cdbd31298f00209282e5ff588187245f7a5a5652c39263717a372e9b290" => :high_sierra sha256 "2233ed69e470f3cf507ff933bb8eb78783b5e8523673fa9b8ad09418b6426a72" => :sierra sha256 "2ee66b7f78d4b25641651f34151adbd1a07b89441a5e1930796e6337fc56807b" => :el_capitan sha256 "eee9d774b7210606f332efc71f0bc78ea6d4048117cf1f8bf6f5c5e12b017f44" => :x86_64_linux end depends_on "pkg-config" => :build depends_on "qt" depends_on "zeromq" depends_on "mongrel2" depends_on "zurl" def install system "./configure", "--prefix=#{prefix}", "--configdir=#{etc}", "--rundir=#{var}/run", "--logdir=#{var}/log", "--extraconf=QMAKE_MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}" system "make" system "make", "check" system "make", "install" end test do conffile = testpath/"pushpin.conf" routesfile = testpath/"routes" runfile = testpath/"test.py" cp HOMEBREW_PREFIX/"etc/pushpin/pushpin.conf", conffile inreplace conffile do |s| s.gsub! "rundir=#{HOMEBREW_PREFIX}/var/run/pushpin", "rundir=#{testpath}/var/run/pushpin" s.gsub! "logdir=#{HOMEBREW_PREFIX}/var/log/pushpin", "logdir=#{testpath}/var/log/pushpin" end routesfile.write <<~EOS * localhost:10080 EOS runfile.write <<~EOS import urllib2 import threading from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer class TestHandler(BaseHTTPRequestHandler): def do_GET(self): self.send_response(200) self.end_headers() self.wfile.write('test response\\n') def server_worker(c): global port server = HTTPServer(('', 10080), TestHandler) port = server.server_address[1] c.acquire() c.notify() c.release() try: server.serve_forever() except: server.server_close() c = threading.Condition() c.acquire() server_thread = threading.Thread(target=server_worker, args=(c,)) server_thread.daemon = True server_thread.start() c.wait() c.release() f = urllib2.urlopen('http://localhost:7999/test') body = f.read() assert(body == 'test response\\n') EOS pid = fork do exec "#{bin}/pushpin", "--config=#{conffile}" end begin sleep 3 # make sure pushpin processes have started system "python", runfile ensure Process.kill("TERM", pid) Process.wait(pid) end end end
31.213483
177
0.666307
1d561b2dcb1cc89672a7980d2d52203e788f14da
110
class DeleteTypeColumn < ActiveRecord::Migration[6.1] def change remove_column :sports, :type end end
18.333333
53
0.745455
f8d794194c1c61976623c77351bc1fa8b33cff75
958
require File.expand_path('../boot', __FILE__) require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module DummyApp class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers config.assets.paths << Rails.root.join("..", "..", "vendor", "assets", "javascripts") config.active_record.raise_in_transactional_callbacks = true if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR == 2 config.active_record.time_zone_aware_types = [:datetime, :time] if Rails::VERSION::MAJOR >= 5 config.active_record.sqlite3.represent_boolean_as_integer = true if config.active_record.sqlite3.respond_to?(:represent_boolean_as_integer=) && Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR == 2 end end
50.421053
204
0.746347
61672df33b0038026e476ad2aa10b88a33f29a0c
34,958
# # a language data file for Ruby/CLDR # # Generated by: CLDR::Generator # # CLDR version: 1.3 # # Original file name: common/main/en_MT.xml # Original file revision: 1.30 $ # # Copyright (C) 2006 Masao Mutoh # # This file is distributed under the same license as the Ruby/CLDR. # private def init_data @languages = {} @languages["aa"] = "Afar" @languages["ab"] = "Abkhazian" @languages["ace"] = "Achinese" @languages["ach"] = "Acoli" @languages["ada"] = "Adangme" @languages["ady"] = "Adyghe" @languages["ae"] = "Avestan" @languages["af"] = "Afrikaans" @languages["afa"] = "Afro-Asiatic (Other)" @languages["afh"] = "Afrihili" @languages["ak"] = "Akan" @languages["akk"] = "Akkadian" @languages["ale"] = "Aleut" @languages["alg"] = "Algonquian Languages" @languages["alt"] = "Southern Altai" @languages["am"] = "Amharic" @languages["an"] = "Aragonese" @languages["ang"] = "Old English (ca.450-1100)" @languages["apa"] = "Apache Languages" @languages["ar"] = "Arabic" @languages["arc"] = "Aramaic" @languages["arn"] = "Araucanian" @languages["arp"] = "Arapaho" @languages["art"] = "Artificial (Other)" @languages["arw"] = "Arawak" @languages["as"] = "Assamese" @languages["ast"] = "Asturian" @languages["ath"] = "Athapascan Languages" @languages["aus"] = "Australian Languages" @languages["av"] = "Avaric" @languages["awa"] = "Awadhi" @languages["ay"] = "Aymara" @languages["az"] = "Azerbaijani" @languages["ba"] = "Bashkir" @languages["bad"] = "Banda" @languages["bai"] = "Bamileke Languages" @languages["bal"] = "Baluchi" @languages["ban"] = "Balinese" @languages["bas"] = "Basa" @languages["bat"] = "Baltic (Other)" @languages["be"] = "Belarusian" @languages["bej"] = "Beja" @languages["bem"] = "Bemba" @languages["ber"] = "Berber" @languages["bg"] = "Bulgarian" @languages["bh"] = "Bihari" @languages["bho"] = "Bhojpuri" @languages["bi"] = "Bislama" @languages["bik"] = "Bikol" @languages["bin"] = "Bini" @languages["bla"] = "Siksika" @languages["bm"] = "Bambara" @languages["bn"] = "Bengali" @languages["bnt"] = "Bantu" @languages["bo"] = "Tibetan" @languages["br"] = "Breton" @languages["bra"] = "Braj" @languages["bs"] = "Bosnian" @languages["btk"] = "Batak" @languages["bua"] = "Buriat" @languages["bug"] = "Buginese" @languages["byn"] = "Blin" @languages["ca"] = "Catalan" @languages["cad"] = "Caddo" @languages["cai"] = "Central American Indian (Other)" @languages["car"] = "Carib" @languages["cau"] = "Caucasian (Other)" @languages["ce"] = "Chechen" @languages["ceb"] = "Cebuano" @languages["cel"] = "Celtic (Other)" @languages["ch"] = "Chamorro" @languages["chb"] = "Chibcha" @languages["chg"] = "Chagatai" @languages["chk"] = "Chuukese" @languages["chm"] = "Mari" @languages["chn"] = "Chinook Jargon" @languages["cho"] = "Choctaw" @languages["chp"] = "Chipewyan" @languages["chr"] = "Cherokee" @languages["chy"] = "Cheyenne" @languages["cmc"] = "Chamic Languages" @languages["co"] = "Corsican" @languages["cop"] = "Coptic" @languages["cpe"] = "Other English-based Creoles and Pidgins" @languages["cpf"] = "Other French-based Creoles and Pidgins" @languages["cpp"] = "Other Portuguese-based Creoles and Pidgins" @languages["cr"] = "Cree" @languages["crh"] = "Crimean Turkish; Crimean Tatar" @languages["crp"] = "Creoles and Pidgins (Other)" @languages["cs"] = "Czech" @languages["csb"] = "Kashubian" @languages["cu"] = "Church Slavic" @languages["cus"] = "Cushitic (Other)" @languages["cv"] = "Chuvash" @languages["cy"] = "Welsh" @languages["da"] = "Danish" @languages["dak"] = "Dakota" @languages["dar"] = "Dargwa" @languages["day"] = "Dayak" @languages["de"] = "German" @languages["del"] = "Delaware" @languages["den"] = "Slave" @languages["dgr"] = "Dogrib" @languages["din"] = "Dinka" @languages["doi"] = "Dogri" @languages["dra"] = "Dravidian (Other)" @languages["dsb"] = "Lower Sorbian" @languages["dua"] = "Duala" @languages["dum"] = "Middle Dutch" @languages["dv"] = "Divehi" @languages["dyu"] = "Dyula" @languages["dz"] = "Dzongkha" @languages["ee"] = "Ewe" @languages["efi"] = "Efik" @languages["egy"] = "Egyptian (Ancient)" @languages["eka"] = "Ekajuk" @languages["el"] = "Greek" @languages["elx"] = "Elamite" @languages["en"] = "English" @languages["enm"] = "Middle English" @languages["eo"] = "Esperanto" @languages["es"] = "Spanish" @languages["et"] = "Estonian" @languages["eu"] = "Basque" @languages["ewo"] = "Ewondo" @languages["fa"] = "Persian" @languages["fan"] = "Fang" @languages["fat"] = "Fanti" @languages["ff"] = "Fulah" @languages["fi"] = "Finnish" @languages["fil"] = "Filipino" @languages["fiu"] = "Finno - Ugrian (Other)" @languages["fj"] = "Fijian" @languages["fo"] = "Faroese" @languages["fon"] = "Fon" @languages["fr"] = "French" @languages["frm"] = "Middle French" @languages["fro"] = "Old French" @languages["fur"] = "Friulian" @languages["fy"] = "Frisian" @languages["ga"] = "Irish" @languages["gaa"] = "Ga" @languages["gay"] = "Gayo" @languages["gba"] = "Gbaya" @languages["gd"] = "Scottish Gaelic" @languages["gem"] = "Germanic (Other)" @languages["gez"] = "Geez" @languages["gil"] = "Gilbertese" @languages["gl"] = "Gallegan" @languages["gmh"] = "Middle High German" @languages["gn"] = "Guarani" @languages["goh"] = "Old High German" @languages["gon"] = "Gondi" @languages["gor"] = "Gorontalo" @languages["got"] = "Gothic" @languages["grb"] = "Grebo" @languages["grc"] = "Ancient Greek" @languages["gu"] = "Gujarati" @languages["gv"] = "Manx" @languages["gwi"] = "Gwichʼin" @languages["ha"] = "Hausa" @languages["hai"] = "Haida" @languages["haw"] = "Hawaiian" @languages["he"] = "Hebrew" @languages["hi"] = "Hindi" @languages["hil"] = "Hiligaynon" @languages["him"] = "Himachali" @languages["hit"] = "Hittite" @languages["hmn"] = "Hmong" @languages["ho"] = "Hiri Motu" @languages["hr"] = "Croatian" @languages["hsb"] = "Upper Sorbian" @languages["ht"] = "Haitian" @languages["hu"] = "Hungarian" @languages["hup"] = "Hupa" @languages["hy"] = "Armenian" @languages["hz"] = "Herero" @languages["ia"] = "Interlingua" @languages["iba"] = "Iban" @languages["id"] = "Indonesian" @languages["ie"] = "Interlingue" @languages["ig"] = "Igbo" @languages["ii"] = "Sichuan Yi" @languages["ijo"] = "Ijo" @languages["ik"] = "Inupiaq" @languages["ilo"] = "Iloko" @languages["inc"] = "Indic (Other)" @languages["ine"] = "Indo-European (Other)" @languages["inh"] = "Ingush" @languages["io"] = "Ido" @languages["ira"] = "Iranian" @languages["iro"] = "Iroquoian languages" @languages["is"] = "Icelandic" @languages["it"] = "Italian" @languages["iu"] = "Inuktitut" @languages["ja"] = "Japanese" @languages["jbo"] = "Lojban" @languages["jpr"] = "Judeo-Persian" @languages["jrb"] = "Judeo-Arabic" @languages["jv"] = "Javanese" @languages["ka"] = "Georgian" @languages["kaa"] = "Kara-Kalpak" @languages["kab"] = "Kabyle" @languages["kac"] = "Kachin" @languages["kam"] = "Kamba" @languages["kar"] = "Karen" @languages["kaw"] = "Kawi" @languages["kbd"] = "Kabardian" @languages["kg"] = "Kongo" @languages["kha"] = "Khasi" @languages["khi"] = "Khoisan (Other)" @languages["kho"] = "Khotanese" @languages["ki"] = "Kikuyu" @languages["kj"] = "Kuanyama" @languages["kk"] = "Kazakh" @languages["kl"] = "Kalaallisut" @languages["km"] = "Khmer" @languages["kmb"] = "Kimbundu" @languages["kn"] = "Kannada" @languages["ko"] = "Korean" @languages["kok"] = "Konkani" @languages["kos"] = "Kosraean" @languages["kpe"] = "Kpelle" @languages["kr"] = "Kanuri" @languages["krc"] = "Karachay-Balkar" @languages["kro"] = "Kru" @languages["kru"] = "Kurukh" @languages["ks"] = "Kashmiri" @languages["ku"] = "Kurdish" @languages["kum"] = "Kumyk" @languages["kut"] = "Kutenai" @languages["kv"] = "Komi" @languages["kw"] = "Cornish" @languages["ky"] = "Kirghiz" @languages["la"] = "Latin" @languages["lad"] = "Ladino" @languages["lah"] = "Lahnda" @languages["lam"] = "Lamba" @languages["lb"] = "Luxembourgish" @languages["lez"] = "Lezghian" @languages["lg"] = "Ganda" @languages["li"] = "Limburgish" @languages["ln"] = "Lingala" @languages["lo"] = "Lao" @languages["lol"] = "Mongo" @languages["loz"] = "Lozi" @languages["lt"] = "Lithuanian" @languages["lu"] = "Luba-Katanga" @languages["lua"] = "Luba-Lulua" @languages["lui"] = "Luiseno" @languages["lun"] = "Lunda" @languages["luo"] = "Luo" @languages["lus"] = "Lushai" @languages["lv"] = "Latvian" @languages["mad"] = "Madurese" @languages["mag"] = "Magahi" @languages["mai"] = "Maithili" @languages["mak"] = "Makasar" @languages["man"] = "Mandingo" @languages["map"] = "Austronesian" @languages["mas"] = "Masai" @languages["mdf"] = "Moksha" @languages["mdr"] = "Mandar" @languages["men"] = "Mende" @languages["mg"] = "Malagasy" @languages["mga"] = "Middle Irish" @languages["mh"] = "Marshallese" @languages["mi"] = "Maori" @languages["mic"] = "Micmac" @languages["min"] = "Minangkabau" @languages["mis"] = "Miscellaneous Languages" @languages["mk"] = "Macedonian" @languages["mkh"] = "Mon-Khmer (Other)" @languages["ml"] = "Malayalam" @languages["mn"] = "Mongolian" @languages["mnc"] = "Manchu" @languages["mni"] = "Manipuri" @languages["mno"] = "Manobo Languages" @languages["mo"] = "Moldavian" @languages["moh"] = "Mohawk" @languages["mos"] = "Mossi" @languages["mr"] = "Marathi" @languages["ms"] = "Malay" @languages["mt"] = "Maltese" @languages["mul"] = "Multiple Languages" @languages["mun"] = "Munda Languages" @languages["mus"] = "Creek" @languages["mwl"] = "Mirandese" @languages["mwr"] = "Marwari" @languages["my"] = "Burmese" @languages["myn"] = "Mayan" @languages["myv"] = "Erzya" @languages["na"] = "Nauru" @languages["nah"] = "Nahuatl" @languages["nai"] = "North American Indian (Other)" @languages["nap"] = "Neapolitan" @languages["nb"] = "Norwegian Bokmål" @languages["nd"] = "North Ndebele" @languages["nds"] = "Low German; Low Saxon" @languages["ne"] = "Nepali" @languages["new"] = "Newari" @languages["ng"] = "Ndonga" @languages["nia"] = "Nias" @languages["nic"] = "Niger - Kordofanian (Other)" @languages["niu"] = "Niuean" @languages["nl"] = "Dutch" @languages["nn"] = "Norwegian Nynorsk" @languages["no"] = "Norwegian" @languages["nog"] = "Nogai" @languages["non"] = "Norse, Old" @languages["nr"] = "South Ndebele" @languages["nso"] = "Northern Sotho" @languages["nub"] = "Nubian Languages" @languages["nv"] = "Navajo" @languages["nwc"] = "Classical Newari" @languages["ny"] = "Nyanja; Chichewa; Chewa" @languages["nym"] = "Nyamwezi" @languages["nyn"] = "Nyankole" @languages["nyo"] = "Nyoro" @languages["nzi"] = "Nzima" @languages["oc"] = "Occitan (post 1500); Provençal" @languages["oj"] = "Ojibwa" @languages["om"] = "Oromo" @languages["or"] = "Oriya" @languages["os"] = "Ossetic" @languages["osa"] = "Osage" @languages["ota"] = "Ottoman Turkish" @languages["oto"] = "Otomian Languages" @languages["pa"] = "Punjabi" @languages["paa"] = "Papuan (Other)" @languages["pag"] = "Pangasinan" @languages["pal"] = "Pahlavi" @languages["pam"] = "Pampanga" @languages["pap"] = "Papiamento" @languages["pau"] = "Palauan" @languages["peo"] = "Old Persian" @languages["phi"] = "Philippine (Other)" @languages["phn"] = "Phoenician" @languages["pi"] = "Pali" @languages["pl"] = "Polish" @languages["pon"] = "Pohnpeian" @languages["pra"] = "Prakrit Languages" @languages["pro"] = "Old Provençal" @languages["ps"] = "Pashto (Pushto)" @languages["pt"] = "Portuguese" @languages["qu"] = "Quechua" @languages["raj"] = "Rajasthani" @languages["rap"] = "Rapanui" @languages["rar"] = "Rarotongan" @languages["rm"] = "Rhaeto-Romance" @languages["rn"] = "Rundi" @languages["ro"] = "Romanian" @languages["roa"] = "Romance (Other)" @languages["rom"] = "Romany" @languages["root"] = "Root" @languages["ru"] = "Russian" @languages["rw"] = "Kinyarwanda" @languages["sa"] = "Sanskrit" @languages["sad"] = "Sandawe" @languages["sah"] = "Yakut" @languages["sai"] = "South American Indian (Other)" @languages["sal"] = "Salishan languages" @languages["sam"] = "Samaritan Aramaic" @languages["sas"] = "Sasak" @languages["sat"] = "Santali" @languages["sc"] = "Sardinian" @languages["scn"] = "Sicilian" @languages["sco"] = "Scots" @languages["sd"] = "Sindhi" @languages["se"] = "Northern Sami" @languages["sel"] = "Selkup" @languages["sem"] = "Semitic (Other)" @languages["sg"] = "Sango" @languages["sga"] = "Old Irish" @languages["sgn"] = "Sign Languages" @languages["sh"] = "Serbo-Croatian" @languages["shn"] = "Shan" @languages["si"] = "Sinhalese" @languages["sid"] = "Sidamo" @languages["sio"] = "Siouan Languages" @languages["sit"] = "Sino-Tibetan (Other)" @languages["sk"] = "Slovak" @languages["sl"] = "Slovenian" @languages["sla"] = "Slavic (Other)" @languages["sm"] = "Samoan" @languages["sma"] = "Southern Sami" @languages["smi"] = "Sami languages (Other)" @languages["smj"] = "Lule Sami" @languages["smn"] = "Inari Sami" @languages["sms"] = "Skolt Sami" @languages["sn"] = "Shona" @languages["snk"] = "Soninke" @languages["so"] = "Somali" @languages["sog"] = "Sogdien" @languages["son"] = "Songhai" @languages["sq"] = "Albanian" @languages["sr"] = "Serbian" @languages["srn"] = "Sranan Tongo" @languages["srr"] = "Serer" @languages["ss"] = "Swati" @languages["ssa"] = "Nilo-Saharan (Other)" @languages["st"] = "Southern Sotho" @languages["su"] = "Sundanese" @languages["suk"] = "Sukuma" @languages["sus"] = "Susu" @languages["sux"] = "Sumerian" @languages["sv"] = "Swedish" @languages["sw"] = "Swahili" @languages["syr"] = "Syriac" @languages["ta"] = "Tamil" @languages["tai"] = "Tai (Other)" @languages["te"] = "Telugu" @languages["tem"] = "Timne" @languages["ter"] = "Tereno" @languages["tet"] = "Tetum" @languages["tg"] = "Tajik" @languages["th"] = "Thai" @languages["ti"] = "Tigrinya" @languages["tig"] = "Tigre" @languages["tiv"] = "Tiv" @languages["tk"] = "Turkmen" @languages["tkl"] = "Tokelau" @languages["tl"] = "Tagalog" @languages["tlh"] = "Klingon" @languages["tli"] = "Tlingit" @languages["tmh"] = "Tamashek" @languages["tn"] = "Tswana" @languages["to"] = "Tonga (Tonga Islands)" @languages["tog"] = "Tonga (Nyasa)" @languages["tpi"] = "Tok Pisin" @languages["tr"] = "Turkish" @languages["ts"] = "Tsonga" @languages["tsi"] = "Tsimshian" @languages["tt"] = "Tatar" @languages["tum"] = "Tumbuka" @languages["tup"] = "Tupi languages" @languages["tut"] = "Altaic (Other)" @languages["tvl"] = "Tuvalu" @languages["tw"] = "Twi" @languages["ty"] = "Tahitian" @languages["tyv"] = "Tuvinian" @languages["udm"] = "Udmurt" @languages["ug"] = "Uighur" @languages["uga"] = "Ugaritic" @languages["uk"] = "Ukrainian" @languages["umb"] = "Umbundu" @languages["und"] = "Undetermined" @languages["ur"] = "Urdu" @languages["uz"] = "Uzbek" @languages["vai"] = "Vai" @languages["ve"] = "Venda" @languages["vi"] = "Vietnamese" @languages["vo"] = "Volapük" @languages["vot"] = "Votic" @languages["wa"] = "Walloon" @languages["wak"] = "Wakashan Languages" @languages["wal"] = "Walamo" @languages["war"] = "Waray" @languages["was"] = "Washo" @languages["wen"] = "Sorbian Languages" @languages["wo"] = "Wolof" @languages["xal"] = "Kalmyk" @languages["xh"] = "Xhosa" @languages["yao"] = "Yao" @languages["yap"] = "Yapese" @languages["yi"] = "Yiddish" @languages["yo"] = "Yoruba" @languages["ypk"] = "Yupik Languages" @languages["za"] = "Zhuang" @languages["zap"] = "Zapotec" @languages["zen"] = "Zenaga" @languages["zh"] = "Chinese" @languages["znd"] = "Zande" @languages["zu"] = "Zulu" @languages["zun"] = "Zuni" @territories = {} @territories["001"] = "World" @territories["002"] = "Africa" @territories["003"] = "North America" @territories["005"] = "South America" @territories["009"] = "Oceania" @territories["011"] = "Western Africa" @territories["013"] = "Central America" @territories["014"] = "Eastern Africa" @territories["015"] = "Northern Africa" @territories["017"] = "Middle Africa" @territories["018"] = "Southern Africa" @territories["019"] = "Americas" @territories["021"] = "Northern America" @territories["029"] = "Caribbean" @territories["030"] = "Eastern Asia" @territories["035"] = "South-eastern Asia" @territories["039"] = "Southern Europe" @territories["053"] = "Australia and New Zealand" @territories["054"] = "Melanesia" @territories["057"] = "Micronesian Region" @territories["061"] = "Polynesia" @territories["062"] = "South-central Asia" @territories["142"] = "Asia" @territories["145"] = "Western Asia" @territories["150"] = "Europe" @territories["151"] = "Eastern Europe" @territories["154"] = "Northern Europe" @territories["155"] = "Western Europe" @territories["172"] = "Commonwealth of Independent States" @territories["200"] = "Czechoslovakia" @territories["419"] = "Latin America and the Caribbean" @territories["830"] = "Channel Islands" @territories["833"] = "Isle of Man" @territories["AD"] = "Andorra" @territories["AE"] = "United Arab Emirates" @territories["AF"] = "Afghanistan" @territories["AG"] = "Antigua and Barbuda" @territories["AI"] = "Anguilla" @territories["AL"] = "Albania" @territories["AM"] = "Armenia" @territories["AN"] = "Netherlands Antilles" @territories["AO"] = "Angola" @territories["AQ"] = "Antarctica" @territories["AR"] = "Argentina" @territories["AS"] = "American Samoa" @territories["AT"] = "Austria" @territories["AU"] = "Australia" @territories["AW"] = "Aruba" @territories["AX"] = "Aland Islands" @territories["AZ"] = "Azerbaijan" @territories["BA"] = "Bosnia and Herzegovina" @territories["BB"] = "Barbados" @territories["BD"] = "Bangladesh" @territories["BE"] = "Belgium" @territories["BF"] = "Burkina Faso" @territories["BG"] = "Bulgaria" @territories["BH"] = "Bahrain" @territories["BI"] = "Burundi" @territories["BJ"] = "Benin" @territories["BM"] = "Bermuda" @territories["BN"] = "Brunei" @territories["BO"] = "Bolivia" @territories["BQ"] = "British Antarctic Territory" @territories["BR"] = "Brazil" @territories["BS"] = "Bahamas" @territories["BT"] = "Bhutan" @territories["BV"] = "Bouvet Island" @territories["BW"] = "Botswana" @territories["BY"] = "Belarus" @territories["BZ"] = "Belize" @territories["CA"] = "Canada" @territories["CC"] = "Cocos (Keeling) Islands" @territories["CD"] = "Congo (Kinshasa)" @territories["CF"] = "Central African Republic" @territories["CG"] = "Congo (Brazzaville)" @territories["CH"] = "Switzerland" @territories["CI"] = "Ivory Coast" @territories["CK"] = "Cook Islands" @territories["CL"] = "Chile" @territories["CM"] = "Cameroon" @territories["CN"] = "China" @territories["CO"] = "Colombia" @territories["CR"] = "Costa Rica" @territories["CS"] = "Serbia And Montenegro" @territories["CT"] = "Canton and Enderbury Islands" @territories["CU"] = "Cuba" @territories["CV"] = "Cape Verde" @territories["CX"] = "Christmas Island" @territories["CY"] = "Cyprus" @territories["CZ"] = "Czech Republic" @territories["DD"] = "East Germany" @territories["DE"] = "Germany" @territories["DJ"] = "Djibouti" @territories["DK"] = "Denmark" @territories["DM"] = "Dominica" @territories["DO"] = "Dominican Republic" @territories["DZ"] = "Algeria" @territories["EC"] = "Ecuador" @territories["EE"] = "Estonia" @territories["EG"] = "Egypt" @territories["EH"] = "Western Sahara" @territories["ER"] = "Eritrea" @territories["ES"] = "Spain" @territories["ET"] = "Ethiopia" @territories["FI"] = "Finland" @territories["FJ"] = "Fiji" @territories["FK"] = "Falkland Islands" @territories["FM"] = "Micronesia" @territories["FO"] = "Faroe Islands" @territories["FQ"] = "French Southern and Antarctic Territories" @territories["FR"] = "France" @territories["FX"] = "Metropolitan France" @territories["GA"] = "Gabon" @territories["GB"] = "United Kingdom" @territories["GD"] = "Grenada" @territories["GE"] = "Georgia" @territories["GF"] = "French Guiana" @territories["GH"] = "Ghana" @territories["GI"] = "Gibraltar" @territories["GL"] = "Greenland" @territories["GM"] = "Gambia" @territories["GN"] = "Guinea" @territories["GP"] = "Guadeloupe" @territories["GQ"] = "Equatorial Guinea" @territories["GR"] = "Greece" @territories["GS"] = "South Georgia and the South Sandwich Islands" @territories["GT"] = "Guatemala" @territories["GU"] = "Guam" @territories["GW"] = "Guinea-Bissau" @territories["GY"] = "Guyana" @territories["HK"] = "Hong Kong S.A.R., China" @territories["HM"] = "Heard Island and McDonald Islands" @territories["HN"] = "Honduras" @territories["HR"] = "Croatia" @territories["HT"] = "Haiti" @territories["HU"] = "Hungary" @territories["ID"] = "Indonesia" @territories["IE"] = "Ireland" @territories["IL"] = "Israel" @territories["IN"] = "India" @territories["IO"] = "British Indian Ocean Territory" @territories["IQ"] = "Iraq" @territories["IR"] = "Iran" @territories["IS"] = "Iceland" @territories["IT"] = "Italy" @territories["JM"] = "Jamaica" @territories["JO"] = "Jordan" @territories["JP"] = "Japan" @territories["JT"] = "Johnston Island" @territories["KE"] = "Kenya" @territories["KG"] = "Kyrgyzstan" @territories["KH"] = "Cambodia" @territories["KI"] = "Kiribati" @territories["KM"] = "Comoros" @territories["KN"] = "Saint Kitts and Nevis" @territories["KP"] = "North Korea" @territories["KR"] = "South Korea" @territories["KW"] = "Kuwait" @territories["KY"] = "Cayman Islands" @territories["KZ"] = "Kazakhstan" @territories["LA"] = "Laos" @territories["LB"] = "Lebanon" @territories["LC"] = "Saint Lucia" @territories["LI"] = "Liechtenstein" @territories["LK"] = "Sri Lanka" @territories["LR"] = "Liberia" @territories["LS"] = "Lesotho" @territories["LT"] = "Lithuania" @territories["LU"] = "Luxembourg" @territories["LV"] = "Latvia" @territories["LY"] = "Libya" @territories["MA"] = "Morocco" @territories["MC"] = "Monaco" @territories["MD"] = "Moldova" @territories["MG"] = "Madagascar" @territories["MH"] = "Marshall Islands" @territories["MI"] = "Midway Islands" @territories["MK"] = "Macedonia" @territories["ML"] = "Mali" @territories["MM"] = "Myanmar" @territories["MN"] = "Mongolia" @territories["MO"] = "Macao S.A.R., China" @territories["MP"] = "Northern Mariana Islands" @territories["MQ"] = "Martinique" @territories["MR"] = "Mauritania" @territories["MS"] = "Montserrat" @territories["MT"] = "Malta" @territories["MU"] = "Mauritius" @territories["MV"] = "Maldives" @territories["MW"] = "Malawi" @territories["MX"] = "Mexico" @territories["MY"] = "Malaysia" @territories["MZ"] = "Mozambique" @territories["NA"] = "Namibia" @territories["NC"] = "New Caledonia" @territories["NE"] = "Niger" @territories["NF"] = "Norfolk Island" @territories["NG"] = "Nigeria" @territories["NI"] = "Nicaragua" @territories["NL"] = "Netherlands" @territories["NO"] = "Norway" @territories["NP"] = "Nepal" @territories["NQ"] = "Dronning Maud Land" @territories["NR"] = "Nauru" @territories["NT"] = "Neutral Zone" @territories["NU"] = "Niue" @territories["NZ"] = "New Zealand" @territories["OM"] = "Oman" @territories["PA"] = "Panama" @territories["PC"] = "Pacific Islands Trust Territory" @territories["PE"] = "Peru" @territories["PF"] = "French Polynesia" @territories["PG"] = "Papua New Guinea" @territories["PH"] = "Philippines" @territories["PK"] = "Pakistan" @territories["PL"] = "Poland" @territories["PM"] = "Saint Pierre and Miquelon" @territories["PN"] = "Pitcairn" @territories["PR"] = "Puerto Rico" @territories["PS"] = "Palestinian Territory" @territories["PT"] = "Portugal" @territories["PU"] = "U.S. Miscellaneous Pacific Islands" @territories["PW"] = "Palau" @territories["PY"] = "Paraguay" @territories["PZ"] = "Panama Canal Zone" @territories["QA"] = "Qatar" @territories["QO"] = "Outlying Oceania" @territories["RE"] = "Reunion" @territories["RO"] = "Romania" @territories["RU"] = "Russia" @territories["RW"] = "Rwanda" @territories["SA"] = "Saudi Arabia" @territories["SB"] = "Solomon Islands" @territories["SC"] = "Seychelles" @territories["SD"] = "Sudan" @territories["SE"] = "Sweden" @territories["SG"] = "Singapore" @territories["SH"] = "Saint Helena" @territories["SI"] = "Slovenia" @territories["SJ"] = "Svalbard and Jan Mayen" @territories["SK"] = "Slovakia" @territories["SL"] = "Sierra Leone" @territories["SM"] = "San Marino" @territories["SN"] = "Senegal" @territories["SO"] = "Somalia" @territories["SR"] = "Suriname" @territories["ST"] = "Sao Tome and Principe" @territories["SU"] = "Union of Soviet Socialist Republics" @territories["SV"] = "El Salvador" @territories["SY"] = "Syria" @territories["SZ"] = "Swaziland" @territories["TC"] = "Turks and Caicos Islands" @territories["TD"] = "Chad" @territories["TF"] = "French Southern Territories" @territories["TG"] = "Togo" @territories["TH"] = "Thailand" @territories["TJ"] = "Tajikistan" @territories["TK"] = "Tokelau" @territories["TL"] = "East Timor" @territories["TM"] = "Turkmenistan" @territories["TN"] = "Tunisia" @territories["TO"] = "Tonga" @territories["TR"] = "Turkey" @territories["TT"] = "Trinidad and Tobago" @territories["TV"] = "Tuvalu" @territories["TW"] = "Taiwan" @territories["TZ"] = "Tanzania" @territories["UA"] = "Ukraine" @territories["UG"] = "Uganda" @territories["UM"] = "United States Minor Outlying Islands" @territories["US"] = "United States" @territories["UY"] = "Uruguay" @territories["UZ"] = "Uzbekistan" @territories["VA"] = "Vatican" @territories["VC"] = "Saint Vincent and the Grenadines" @territories["VD"] = "North Vietnam" @territories["VE"] = "Venezuela" @territories["VG"] = "British Virgin Islands" @territories["VI"] = "U.S. Virgin Islands" @territories["VN"] = "Vietnam" @territories["VU"] = "Vanuatu" @territories["WF"] = "Wallis and Futuna" @territories["WK"] = "Wake Island" @territories["WS"] = "Samoa" @territories["YD"] = "People's Democratic Republic of Yemen" @territories["YE"] = "Yemen" @territories["YT"] = "Mayotte" @territories["ZA"] = "South Africa" @territories["ZM"] = "Zambia" @territories["ZW"] = "Zimbabwe" @scripts = {} @scripts["Arab"] = "Arabic" @scripts["Armn"] = "Armenian" @scripts["Bali"] = "Balinese" @scripts["Batk"] = "Batak" @scripts["Beng"] = "Bengali" @scripts["Blis"] = "Blissymbols" @scripts["Bopo"] = "Bopomofo" @scripts["Brah"] = "Brahmi" @scripts["Brai"] = "Braille" @scripts["Bugi"] = "Buginese" @scripts["Buhd"] = "Buhid" @scripts["Cans"] = "Unified Canadian Aboriginal Symbols" @scripts["Cher"] = "Cherokee" @scripts["Cirt"] = "Cirth" @scripts["Copt"] = "Coptic" @scripts["Cprt"] = "Cypriot" @scripts["Cyrl"] = "Cyrillic" @scripts["Cyrs"] = "Cyrillic (Old Church Slavonic variant)" @scripts["Deva"] = "Devanagari" @scripts["Dsrt"] = "Deseret" @scripts["Egyd"] = "Egyptian demotic" @scripts["Egyh"] = "Egyptian hieratic" @scripts["Egyp"] = "Egyptian hieroglyphs" @scripts["Ethi"] = "Ethiopic" @scripts["Geok"] = "Khutsuri (Asomtavruli and Nuskhuri)" @scripts["Geor"] = "Georgian" @scripts["Glag"] = "Glagolitic" @scripts["Goth"] = "Gothic" @scripts["Grek"] = "Greek" @scripts["Gujr"] = "Gujarati" @scripts["Guru"] = "Gurmukhi" @scripts["Hang"] = "Hangul" @scripts["Hani"] = "Han" @scripts["Hano"] = "Hanunoo" @scripts["Hans"] = "Simplified Han" @scripts["Hant"] = "Traditional Han" @scripts["Hebr"] = "Hebrew" @scripts["Hira"] = "Hiragana" @scripts["Hmng"] = "Pahawh Hmong" @scripts["Hrkt"] = "Katakana or Hiragana" @scripts["Hung"] = "Old Hungarian" @scripts["Inds"] = "Indus (Harappan)" @scripts["Ital"] = "Old Italic" @scripts["Java"] = "Javanese" @scripts["Kali"] = "Kayah Li" @scripts["Kana"] = "Katakana" @scripts["Khar"] = "Kharoshthi" @scripts["Khmr"] = "Khmer" @scripts["Knda"] = "Kannada" @scripts["Laoo"] = "Lao" @scripts["Latf"] = "Latin (Fraktur variant)" @scripts["Latg"] = "Latin (Gaelic variant)" @scripts["Latn"] = "Latin" @scripts["Lepc"] = "Lepcha (Róng)" @scripts["Limb"] = "Limbu" @scripts["Lina"] = "Linear A" @scripts["Linb"] = "Linear B" @scripts["Mand"] = "Mandaean" @scripts["Maya"] = "Mayan hieroglyphs" @scripts["Mero"] = "Meroitic" @scripts["Mlym"] = "Malayalam" @scripts["Mong"] = "Mongolian" @scripts["Mymr"] = "Myanmar" @scripts["Nkoo"] = "N’Ko" @scripts["Ogam"] = "Ogham" @scripts["Orkh"] = "Orkhon" @scripts["Orya"] = "Oriya" @scripts["Osma"] = "Osmanya" @scripts["Perm"] = "Old Permic" @scripts["Phag"] = "Phags-pa" @scripts["Phnx"] = "Phoenician" @scripts["Plrd"] = "Pollard Phonetic" @scripts["Qaai"] = "Inherited" @scripts["Roro"] = "Rongorongo" @scripts["Runr"] = "Runic" @scripts["Sara"] = "Sarati" @scripts["Shaw"] = "Shavian" @scripts["Sinh"] = "Sinhala" @scripts["Sylo"] = "Syloti Nagri" @scripts["Syrc"] = "Syriac" @scripts["Syre"] = "Syriac (Estrangelo variant)" @scripts["Syrj"] = "Syriac (Western variant)" @scripts["Syrn"] = "Syriac (Eastern variant)" @scripts["Tagb"] = "Tagbanwa" @scripts["Tale"] = "Tai Le" @scripts["Talu"] = "New Tai Lue" @scripts["Taml"] = "Tamil" @scripts["Telu"] = "Telugu" @scripts["Teng"] = "Tengwar" @scripts["Tfng"] = "Tifinagh (Berber)" @scripts["Tglg"] = "Tagalog" @scripts["Thaa"] = "Thaana" @scripts["Tibt"] = "Tibetan" @scripts["Ugar"] = "Ugaritic" @scripts["Vaii"] = "Vai" @scripts["Visp"] = "Visible Speech" @scripts["Xpeo"] = "Old Persian" @scripts["Xsux"] = "Sumero-Akkadian Cuneiform" @scripts["Yiii"] = "Yi" @scripts["Zxxx"] = "Code for unwritten languages" @scripts["Zyyy"] = "Common" @scripts["Zzzz"] = "Code for uncoded script" @character_exemplar_characters = {} @character_exemplar_characters["default"] = "[a-z]" @character_exemplar_characters["auxiliary"] = "[áà éè íì óò úù âêîôû æœ äëïöüÿ āēīōū ăĕĭŏŭ åø çñß]" @delimiter_quotation_start = "‘" @delimiter_quotation_end = "’" @delimiter_alternate_quotation_start = "“" @delimiter_alternate_quotation_end = "”" @measurement_system = "metric" @measurement_papersize_height = "297" @measurement_papersize_width = "210" @variants = {} @variants["1901"] = "Traditional German orthography" @variants["1996"] = "German orthography of 1996" @variants["BOONT"] = "Boontling" @variants["GAULISH"] = "Gaulish" @variants["GUOYU"] = "Mandarin or Standard Chinese" @variants["HAKKA"] = "Hakka" @variants["LOJBAN"] = "Lojban" @variants["NEDIS"] = "Natisone dialect" @variants["POSIX"] = "Computer" @variants["REVISED"] = "Revised Orthography" @variants["ROZAJ"] = "Resian" @variants["SCOUSE"] = "Scouse" @variants["XIANG"] = "Xiang or Hunanese" @keys = {} @keys["calendar"] = "Calendar" @keys["collation"] = "Collation" @keys["currency"] = "Currency" @types = {} @types["big5han"] = "Traditional Chinese (Big5)" @types["buddhist"] = "Buddhist Calendar" @types["chinese"] = "Chinese Calendar" @types["direct"] = "Direct Order" @types["gb2312han"] = "Simplified Chinese (GB2312)" @types["gregorian"] = "Gregorian Calendar" @types["hebrew"] = "Hebrew Calendar" @types["islamic"] = "Islamic Calendar" @types["islamic-civil"] = "Islamic-Civil Calendar" @types["japanese"] = "Japanese Calendar" @types["phonebook"] = "Phonebook Order" @types["pinyin"] = "Pinyin Order" @types["stroke"] = "Stroke Order" @types["traditional"] = "Traditional" @yesstr = "yes:y" @nostr = "no:n" @yesexpr = "^[yY]([eE][sS])?" @noexpr = "^[nN][oO]?" @references = {} end public attr_reader :languages attr_reader :territories attr_reader :scripts attr_reader :layout_orientation attr_reader :layout_inlist_casing attr_reader :character_exemplar_characters attr_reader :character_mapping attr_reader :delimiter_quotation_start attr_reader :delimiter_quotation_end attr_reader :delimiter_alternate_quotation_start attr_reader :delimiter_alternate_quotation_end attr_reader :measurement_system attr_reader :measurement_papersize_height attr_reader :measurement_papersize_width attr_reader :variants attr_reader :keys attr_reader :types attr_reader :yesstr attr_reader :nostr attr_reader :yesexpr attr_reader :noexpr attr_reader :references
36.376691
103
0.586161
2855dc924345720f8ad7ddb35ab8d8d519d7f3b6
1,034
require File.expand_path('../boot', __FILE__) require 'rails/all' Bundler.require(*Rails.groups) require "trado_pdf_invoice_module" module Dummy class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # config.time_zone = 'Central Time (US & Canada)' # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de # Do not swallow errors in after_commit/after_rollback callbacks. config.active_record.raise_in_transactional_callbacks = true end end
38.296296
99
0.73501
5d57ea0ba6f065d95934ce14d011cca5ff6b574f
135
class StaticPagesController < ApplicationController def home end def about end def help end def contact end end
9.642857
51
0.696296
18b5860760b319a62eeedb3dc44dfd761447d53d
6,703
require "eventmachine" require "json" require "mail" require "sqlite3" module MailCatcher::Mail extend self def db @__db ||= begin SQLite3::Database.new(":memory:", :type_translation => true).tap do |db| db.execute(<<-SQL) CREATE TABLE message ( id INTEGER PRIMARY KEY ASC, sender TEXT, recipients TEXT, subject TEXT, source BLOB, size TEXT, type TEXT, created_at DATETIME DEFAULT CURRENT_DATETIME ) SQL db.execute(<<-SQL) CREATE TABLE message_part ( id INTEGER PRIMARY KEY ASC, message_id INTEGER NOT NULL, cid TEXT, type TEXT, is_attachment INTEGER, filename TEXT, charset TEXT, body BLOB, size INTEGER, created_at DATETIME DEFAULT CURRENT_DATETIME ) SQL end end end def add_message(message) @add_message_query ||= db.prepare("INSERT INTO message (sender, recipients, subject, source, type, size, created_at) VALUES (?, ?, ?, ?, ?, ?, datetime('now'))") mail = Mail.new(message[:source]) @add_message_query.execute(message[:sender], JSON.generate(message[:recipients]), mail.subject, message[:source], mail.mime_type || "text/plain", message[:source].length) message_id = db.last_insert_row_id parts = mail.all_parts parts = [mail] if parts.empty? parts.each do |part| body = part.body.to_s # Only parts have CIDs, not mail cid = part.cid if part.respond_to? :cid add_message_part(message_id, cid, part.mime_type || "text/plain", part.attachment? ? 1 : 0, part.filename, part.charset, body, body.length) end EventMachine.next_tick do message = MailCatcher::Mail.message message_id MailCatcher::Events::MessageAdded.push message end end def add_message_part(*args) @add_message_part_query ||= db.prepare "INSERT INTO message_part (message_id, cid, type, is_attachment, filename, charset, body, size, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, datetime('now'))" @add_message_part_query.execute(*args) end def latest_created_at @latest_created_at_query ||= db.prepare "SELECT created_at FROM message ORDER BY created_at DESC LIMIT 1" @latest_created_at_query.execute.next end def messages @messages_query ||= db.prepare "SELECT id, sender, recipients, subject, size, created_at FROM message ORDER BY created_at, id ASC" @messages_query.execute.map do |row| Hash[row.fields.zip(row)].tap do |message| message["recipients"] &&= JSON.parse(message["recipients"]) end end end def message(id) @message_query ||= db.prepare "SELECT * FROM message WHERE id = ? LIMIT 1" row = @message_query.execute(id).next row && Hash[row.fields.zip(row)].tap do |message| message["recipients"] &&= JSON.parse(message["recipients"]) message["splitted_recipients"] = splitted_recipients(message) end end def splitted_recipients(message) mail = Mail.new(message['source']) { :to => mail.to, :cc => mail.cc, :bcc => bcc_recipients(mail, recipients_list_without_brackets(message)) } end def bcc_recipients(mail, all_recipients) not_listed_recipients(mail, all_recipients) + mail.bcc.to_a end def not_listed_recipients(mail, all_recipients) all_recipients.reject do |recipient| (mail.to.to_a + mail.cc.to_a + mail.bcc.to_a).include? recipient end end def recipients_list_without_brackets(message) message["recipients"].map do |recipient| recipient.gsub(/\A<(.*)>\z/,'\1') end end def message_has_html?(id) @message_has_html_query ||= db.prepare "SELECT 1 FROM message_part WHERE message_id = ? AND is_attachment = 0 AND type IN ('application/xhtml+xml', 'text/html') LIMIT 1" (!!@message_has_html_query.execute(id).next) || ["text/html", "application/xhtml+xml"].include?(message(id)["type"]) end def message_has_plain?(id) @message_has_plain_query ||= db.prepare "SELECT 1 FROM message_part WHERE message_id = ? AND is_attachment = 0 AND type = 'text/plain' LIMIT 1" (!!@message_has_plain_query.execute(id).next) || message(id)["type"] == "text/plain" end def message_parts(id) @message_parts_query ||= db.prepare "SELECT cid, type, filename, size FROM message_part WHERE message_id = ? ORDER BY filename ASC" @message_parts_query.execute(id).map do |row| Hash[row.fields.zip(row)] end end def message_attachments(id) @message_parts_query ||= db.prepare "SELECT cid, type, filename, size FROM message_part WHERE message_id = ? AND is_attachment = 1 ORDER BY filename ASC" @message_parts_query.execute(id).map do |row| Hash[row.fields.zip(row)] end end def message_part(message_id, part_id) @message_part_query ||= db.prepare "SELECT * FROM message_part WHERE message_id = ? AND id = ? LIMIT 1" row = @message_part_query.execute(message_id, part_id).next row && Hash[row.fields.zip(row)] end def message_part_type(message_id, part_type) @message_part_type_query ||= db.prepare "SELECT * FROM message_part WHERE message_id = ? AND type = ? AND is_attachment = 0 LIMIT 1" row = @message_part_type_query.execute(message_id, part_type).next row && Hash[row.fields.zip(row)] end def message_part_html(message_id) part = message_part_type(message_id, "text/html") part ||= message_part_type(message_id, "application/xhtml+xml") part ||= begin message = message(message_id) message if message and ["text/html", "application/xhtml+xml"].include? message["type"] end end def message_part_plain(message_id) message_part_type message_id, "text/plain" end def message_part_cid(message_id, cid) @message_part_cid_query ||= db.prepare "SELECT * FROM message_part WHERE message_id = ?" @message_part_cid_query.execute(message_id).map do |row| Hash[row.fields.zip(row)] end.find do |part| part["cid"] == cid end end def delete! @delete_all_messages_query ||= db.prepare "DELETE FROM message" @delete_all_message_parts_query ||= db.prepare "DELETE FROM message_part" @delete_all_messages_query.execute and @delete_all_message_parts_query.execute end def delete_message!(message_id) @delete_messages_query ||= db.prepare "DELETE FROM message WHERE id = ?" @delete_message_parts_query ||= db.prepare "DELETE FROM message_part WHERE message_id = ?" @delete_messages_query.execute(message_id) and @delete_message_parts_query.execute(message_id) end end
35.84492
200
0.676563
bbdcd307bd68cd0e472a64010ed1f99f39973b09
150
module GchartInfo #:nodoc: module VERSION #:nodoc: MAJOR = 1 MINOR = 4 TINY = 0 STRING = [MAJOR, MINOR, TINY].join('.') end end
15
43
0.573333
1d71e51e83851e4487ad5e2e052d4225683e065b
679
cask "kext-updater" do version "3.7.2" sha256 "c11a4c66ede5cc41c4e8c3a9b987ec752e05da9edd83d26c618e10b1602eab3e" url "https://update.kextupdater.de/kextupdater/kextupdaterng.zip" appcast "https://update.kextupdater.de/kextupdater/appcastng.xml" name "Kext Updater" desc "Automatic updater for kernel extensions required by 'Hackintoshes'" homepage "https://kextupdater.de/" app "Kext Updater.app" zap trash: [ "~/Library/Caches/kextupdater.slsoft.de", "~/Library/Preferences/kextupdater.slsoft.de.plist", "~/Library/Preferences/kextupdaterhelper.slsoft.de.plist", "~/Library/Saved Application State/kextupdater.slsoft.de.savedState", ] end
33.95
75
0.756996
e9e6d8f0e144184533ed554e46a9ed47a6d6d7ed
2,459
class Stubby < Formula desc "DNS privacy enabled stub resolver service based on getdns" homepage "https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Daemon+-+Stubby" url "https://github.com/getdnsapi/stubby/archive/v0.3.0.tar.gz" sha256 "b37a0e0ec2b7cfcdcb596066a6fd6109e91a2766b17a42c47d3703d9be41d000" head "https://github.com/getdnsapi/stubby.git", :branch => "develop" bottle do sha256 "ad68e436a7243e41453e644529964001b45602473326fba37e7dbfe57be20686" => :catalina sha256 "581ab7f709c5736d868fa394a91a3e917a97d518eadbb06525bae1b448bc8908" => :mojave sha256 "d929b09280c4f602e6b81b9f39f31574199221bf6b48f163da677295a2ebfb2c" => :high_sierra end depends_on "cmake" => :build depends_on "libtool" => :build depends_on "getdns" depends_on "libyaml" def install system "cmake", ".", *std_cmake_args system "make", "install" end plist_options :startup => true, :manual => "sudo stubby -C #{HOMEBREW_PREFIX}/etc/stubby/stubby.yml" def plist <<~EOS <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>#{plist_name}</string> <key>KeepAlive</key> <true/> <key>RunAtLoad</key> <true/> <key>ProgramArguments</key> <array> <string>#{opt_bin}/stubby</string> <string>-C</string> <string>#{etc}/stubby/stubby.yml</string> </array> </dict> </plist> EOS end test do assert_predicate etc/"stubby/stubby.yml", :exist? (testpath/"stubby_test.yml").write <<~EOS resolution_type: GETDNS_RESOLUTION_STUB dns_transport_list: - GETDNS_TRANSPORT_TLS - GETDNS_TRANSPORT_UDP - GETDNS_TRANSPORT_TCP listen_addresses: - 127.0.0.1@5553 idle_timeout: 0 upstream_recursive_servers: - address_data: 145.100.185.15 - address_data: 145.100.185.16 - address_data: 185.49.141.37 EOS output = shell_output("#{bin}/stubby -i -C stubby_test.yml") assert_match "bindata for 145.100.185.15", output fork do exec "#{bin}/stubby", "-C", testpath/"stubby_test.yml" end sleep 2 output = shell_output("dig @127.0.0.1 -p 5553 getdnsapi.net") assert_match "status: NOERROR", output end end
31.935065
108
0.650264
0149ad717fb3e0e87f03687926c7f42164435e3c
1,877
module Byebug begin require 'methodsig' have_methodsig = true rescue LoadError have_methodsig = false end # Implements byebug's 'method sig' command. class MethodSigCommand < Command def regexp /^\s* m(?:ethod)? \s+ sig(?:nature)? \s+ (\S+) \s*$/x end def execute obj = bb_eval('method(:%s)' % @match[1]) if obj.is_a?(Method) begin print "%s\n", obj.signature.to_s rescue errmsg("Can't get signature for '#{@match[1]}'\n") end else errmsg("Can't make method out of '#{@match[1]}'\n") end end class << self def names %w(method) end def description %{m[ethod] sig[nature] <obj>\tshow the signature of a method} end end end if have_methodsig # Implements byebug's 'method' command. class MethodCommand < Command include Columnize def regexp /^\s* m(?:ethod)? \s+ ((iv)|(i(:?nstance)?)\s+)?/x end def execute obj = bb_eval(@match.post_match) if @match[1] == "iv" obj.instance_variables.sort.each do |v| print "#{v} = #{obj.instance_variable_get(v).inspect}\n" end elsif @match[1] print "#{columnize(obj.methods.sort(), Command.settings[:width])}\n" else return print "Should be Class/Module: #{@match.post_match}\n" unless obj.kind_of? Module print "#{columnize(obj.instance_methods(false).sort(), Command.settings[:width])}\n" end end class << self def names %w(method) end def description %{m[ethod] i[nstance] <obj>\tshow methods of object m[ethod] iv <obj>\t\tshow instance variables of object m[ethod] <class|module>\t\tshow instance methods of class or module} end end end end
24.064103
78
0.564198
79996d0f407ec1074afc4d2f457f94a28471ae52
1,836
# This file is copied to ~/spec when you run 'ruby script/generate rspec' # from the project root directory. ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'spec' require 'spec/rails' ActiveRecord::Migrator.migrate("#{RAILS_ROOT}/db/migrate") ############################################################################################ # customize require File.dirname(__FILE__) + '/spec_extensions' Spec::Runner.configure do |config| # If you're not using ActiveRecord you should remove these # lines, delete config/database.yml and disable :active_record # in your config/boot.rb config.use_transactional_fixtures = true config.use_instantiated_fixtures = false config.fixture_path = RAILS_ROOT + '/spec/fixtures/' config.include(PlanB::SpecExtensions) config.include(PlanB::SpecMatchers) PlanB::SpecExtensions::ModelData.model_data = File.open(File.dirname(__FILE__) + '/fixtures/test_model.yml') {|yf| YAML::load(yf)} PlanB::SpecExtensions::ModelData.model_data.symbolize_keys! # == Fixtures # # You can declare fixtures for each example_group like this: # describe "...." do # fixtures :table_a, :table_b # # Alternatively, if you prefer to declare them only once, you can # do so right here. Just uncomment the next line and replace the fixture # names with your fixtures. # # config.global_fixtures = :table_a, :table_b # # If you declare global fixtures, be aware that they will be declared # for all of your examples, even those that don't use them. # # == Mock Framework # # RSpec uses it's own mocking framework by default. If you prefer to # use mocha, flexmock or RR, uncomment the appropriate line: # # config.mock_with :mocha # config.mock_with :flexmock # config.mock_with :rr end
37.469388
132
0.6939
0156abf21c8901e5f2383d3819d28334a9cfb9de
955
# Copyright 2020 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. module Google module Apis module OndemandscanningV1beta1 # Version of the google-apis-ondemandscanning_v1beta1 gem GEM_VERSION = "0.17.0" # Version of the code generator used to generate this client GENERATOR_VERSION = "0.4.1" # Revision of the discovery document this client was generated from REVISION = "20220107" end end end
32.931034
74
0.736126
1a637a3257eca7a5ed4d98b094e94d99309c8ab2
655
# name: category # about: Category list # version: 0.0.1 # authors: Evg register_asset "stylesheets/portal.scss" after_initialize do # add info category add_to_serializer(:basic_category, :categorization, false) { object.custom_fields['categorization'] } add_to_serializer(:basic_category, :categorqa, false) { object.custom_fields['categorqa'] } add_to_serializer(:basic_category, :categorimg, false) { object.custom_fields['categorimg'] } add_to_serializer(:basic_category, :categordiscr, false) { object.custom_fields['categordiscr'] } add_to_serializer(:basic_category, :categortxt, false) { object.custom_fields['categortxt'] } end
36.388889
103
0.770992
e8255a0e5a7e1e07e570ceecbe3288308ecfecca
5,089
#!/usr/bin/env ruby module SOACSV2MT940 ## # Represents a Statement Of Account (SOA) file in the SWIFT mt940[https://de.wikipedia.org/wiki/MT940] format for 1822direktBank. # - TODO: ERB template for the mt940 file? Or objects (for the records?)? class SOAMT9401822 def initialize(csv_data, filename_mt940, soa_nbr, soa_opening_balance) @csv_data = csv_data @soa_nbr = soa_nbr @soa_opening_balance = Amount.new(soa_opening_balance) @soa_closing_balance = Amount.new(soa_opening_balance) @filename_mt940 = filename_mt940 filename_index = 0 while File.exist? @filename_mt940 filename_index += 1 @filename_mt940 = "#{@filename_mt940}.#{filename_index}" end end ## # Generates an .mt940 file from csv_data def csv2mt940 header body footer end private def header LOGGER.info "- Eröffnungs-Saldo: #{@soa_opening_balance}" write_mt940 record_type_20 write_mt940 record_type_21 write_mt940 record_type_25 write_mt940 record_type_28 write_mt940 record_type_60 end def body nbr_of_relevant_rows = 0 @csv_data.each do |csv_record| next unless csv_record LOGGER.debug "- <write_body> Datensatz #{nbr_of_relevant_rows}: #{csv_record}" write_mt940 record_type_61(csv_record) write_mt940 record_type_86(csv_record) nbr_of_relevant_rows += 1 end LOGGER.info "- Umsatz-relevante Datensätze: #{nbr_of_relevant_rows}" end def footer write_mt940 record_type_62 LOGGER.info "- Schluß-Saldo: #{@soa_closing_balance}" end def record_type_20 ':20:SOACSV2MT940' end def record_type_21 ':21:NONREF' end def record_type_25 blzkonto = "#{@csv_data.first.empfngerauftraggeber_iban[4, 8]}/#{@csv_data.first.empfngerauftraggeber_iban[12, 10]}" LOGGER.info "- BLZ/Konto: #{blzkonto}" ":25:#{blzkonto}" end def record_type_28 ":28C:#{@soa_nbr}" end def record_type_60 datum_kontoauszug = Date.strptime(@csv_data.last.datumzeit[0, 10], '%d.%m.%Y') LOGGER.info "- Kontoauszugsdatum: #{datum_kontoauszug}" ":60F:#{@soa_opening_balance.credit_debit_indicator}#{datum_kontoauszug.strftime('%y%m%d')}EUR#{@soa_opening_balance}" end def record_type_61(csv_record) buchungsdatum = Date.strptime(csv_record.buchungstag, '%d.%m.%Y') valutadatum = convert_valuta_date(csv_record.wertstellung) || buchungsdatum umsatz = Amount.new(csv_record.sollhaben) @soa_closing_balance.amount += umsatz.amount ":61:#{valutadatum.strftime('%y%m%d')}#{buchungsdatum.strftime('%m%d')}#{umsatz.credit_debit_indicator}#{umsatz.without_sign}NONREF" end def record_type_62 datum_kontoauszug = Date.strptime(@csv_data.last.datumzeit[0, 10], '%d.%m.%Y') ":62F:#{@soa_closing_balance.credit_debit_indicator}#{datum_kontoauszug.strftime('%y%m%d')}EUR#{@soa_closing_balance.without_sign}" end def record_type_86(csv_record) gvc = '999' # evtl. :buchungsschlssel? buchungstext = convert_umlaut(csv_record.vwz0).delete('"') + convert_umlaut(csv_record.vwz1).delete('"') + convert_umlaut(csv_record.vwz2).delete('"') + convert_umlaut(csv_record.vwz3).delete('"') + convert_umlaut(csv_record.vwz4).delete('"') + convert_umlaut(csv_record.vwz5).delete('"') + convert_umlaut(csv_record.vwz6).delete('"') + convert_umlaut(csv_record.vwz7).delete('"') + convert_umlaut(csv_record.vwz8).delete('"') + convert_umlaut(csv_record.vwz9).delete('"') + convert_umlaut(csv_record.vwz10).delete('"') + convert_umlaut(csv_record.vwz11).delete('"') + convert_umlaut(csv_record.vwz12).delete('"') + convert_umlaut(csv_record.vwz13).delete('"') + convert_umlaut(csv_record.vwz14).delete('"') + convert_umlaut(csv_record.vwz15).delete('"') + convert_umlaut(csv_record.vwz16).delete('"') + convert_umlaut(csv_record.vwz17).delete('"') buchungsart = convert_umlaut(csv_record.buchungsart).upcase ":86:#{gvc}#{buchungsart}:#{buchungstext}" end def write_mt940(record) File.open(@filename_mt940, 'a') do |file| file.puts record end end def convert_umlaut(text) return '' unless text text.gsub('ä', 'ae').gsub('Ä', 'AE').gsub('ö', 'oe').gsub('Ö', 'OE').gsub('ü', 'ue').gsub('Ü', 'UE').gsub('ß', 'ss') end def convert_valuta_date(valuta_date) return nil unless valuta_date day = valuta_date[0, 2].to_i month = valuta_date[3, 2].to_i year = valuta_date[6, 4].to_i return nil unless Date.valid_date?(year, month, day) Date.strptime(valuta_date, '%d.%m.%Y') end end end
33.480263
138
0.630576
3314722c7ad8a73ac58000c88cd4097e8d294345
578
Rails.application.configure do config.cache_classes = true config.eager_load = true config.consider_all_requests_local = false config.action_controller.perform_caching = true config.serve_static_assets = false config.assets.js_compressor = :uglifier config.assets.compile = false config.assets.digest = true config.assets.version = '1.0' config.log_level = :info config.i18n.fallbacks = true config.active_support.deprecation = :notify config.log_formatter = ::Logger::Formatter.new config.active_record.dump_schema_after_migration = false end
34
58
0.778547
ab670a65d8a1e0dd36cfb6d13984bc18b980d2cb
546
require "rest_client" module MetricsSatellite class Reporter attr_reader :host, :service, :section def initialize(host, service, section) @host = host @service = service @section = section end def report(summaries) summaries.each do |key, count| post(key, count) end end private def post(key, count) RestClient.post(compose_url(key), :number => count) end def compose_url(graph) "http://#{host}/api/#{service}/#{section}/#{graph}" end end end
18.2
57
0.60989
f84f09aebd408eee1de1f4619a88d9af453ce829
2,863
# frozen_string_literal: true module Capybara::Cuprite class Browser class Targets def initialize(browser) @mutex = Mutex.new @browser = browser @_default = targets.first["targetId"] if !targets.empty? @browser.subscribe("Target.detachedFromTarget") do |params| page = remove_page(params["targetId"]) page&.close_connection end reset end def push(target_id, page = nil) @targets[target_id] = page end def refresh @mutex.synchronize do targets.each { |t| push(t["targetId"]) if !default?(t) && !has?(t) } end end def page raise NoSuchWindowError unless @page @page end def window_handle page.target_id end def window_handles @mutex.synchronize { @targets.keys } end def switch_to_window(target_id) page = @targets[target_id] page ||= Page.new(target_id, @browser) @targets[target_id] ||= page @page = page end def open_new_window target_id = @browser.command("Target.createTarget", url: "about:blank", browserContextId: @_context_id)["targetId"] page = Page.new(target_id, @browser) push(target_id, page) target_id end def close_window(target_id) remove_page(target_id)&.close end def within_window(locator) original = window_handle if window_handles.include?(locator) target_id = locator elsif Capybara::VERSION.to_f < 3.0 target_id = window_handles.find { |target_id| locator == Page.new(target_id, @browser).frame_name } end if target_id switch_to_window(target_id) yield else raise NoSuchWindowError end ensure switch_to_window(original) end def reset if @page @page.close @browser.command("Target.disposeBrowserContext", browserContextId: @_context_id) end @page = nil @targets = {} @_context_id = nil @_context_id = @browser.command("Target.createBrowserContext")["browserContextId"] target_id = @browser.command("Target.createTarget", url: "about:blank", browserContextId: @_context_id)["targetId"] @page = Page.new(target_id, @browser) push(target_id, @page) end private def remove_page(target_id) page = @targets.delete(target_id) @page = nil if page && @page == page page end def targets @browser.command("Target.getTargets")["targetInfos"] end def default?(target) @_default == target["targetId"] end def has?(target) @targets.key?(target["targetId"]) end end end end
24.681034
123
0.587496
6ab36bff6c46d53374b52aa24ee258501015b8d5
316
require_relative '../../../spec_helper' require 'net/http' describe "Net::HTTPFatalError" do it "is a subclass of Net::ProtoFatalError" do Net::HTTPFatalError.should < Net::ProtoFatalError end it "includes the Net::HTTPExceptions module" do Net::HTTPFatalError.should < Net::HTTPExceptions end end
24.307692
53
0.731013
4a79d9a70b5f1ee2857839c20811ca7e70e38695
72
# frozen_string_literal: true module TodoAgent VERSION = "0.1.0" end
12
29
0.736111
18358b738261849f54d09e253fca4ed889716394
474
cask 'actotracker' do version :latest sha256 :no_check # dropboxusercontent.com is the official download host per the vendor homepage url 'https://dl.dropboxusercontent.com/u/7614970/ActoTracker.zip' name 'ActoTracker' appcast 'https://onflapp.appspot.com/actotracker', :sha256 => '0d79b9232c6a18446e56fd91c7b65962b5486164c3a269dc5e1867b1a5354778' homepage 'https://onflapp.wordpress.com/actotracker/' license :gratis app 'ActoTracker.app' end
31.6
87
0.767932
1c9d9dc2be22e87011e498ca94b88c3010cc1883
410
class MakeOldRecurringTodosValidate < ActiveRecord::Migration def self.up RecurringTodo.all.each do |rt| # show_always may not be nil rt.show_always = false if rt.show_always.nil? # start date should be filled rt.start_from = rt.created_at if rt.start_from.nil? || rt.start_from.blank? rt.save! end end def self.down # no down: leave them validatable end end
25.625
81
0.687805
1a63257fb3cf98a9326ce6a4895163955dfeddb0
173
# frozen_string_literal: true module Stupidedi module TransactionSets module Validation # # # class Implementation end end end end
13.307692
29
0.624277
112cb789f2aa785c5f9988de8d2d0c47ec972c85
317
# frozen_string_literal: false # # [incr Tk] support # by Hidetoshi NAGAI ([email protected]) # # call setup script for general 'tkextlib' libraries require 'tkextlib/setup.rb' # call setup script require 'tkextlib/itk/setup.rb' # load library require 'tkextlib/itk/incr_tk.rb'
21.133333
75
0.678233
ed6f33861b17cc25cfd32d6749b2508ec82c1223
2,602
project 'pdk-runtime' do |proj| # Used in component configurations to conditionally include dependencies proj.setting(:runtime_project, "pdk") platform = proj.get_platform proj.inherit_settings 'pdk', 'git://github.com/puppetlabs/pdk-vanagon', 'master' proj.version_from_git proj.generate_archives true proj.generate_packages false proj.description "The PDK runtime contains third-party components needed for the puppet developer kit" proj.license "See components" proj.vendor "Puppet, Inc. <[email protected]>" proj.homepage "https://puppet.com" if platform.is_macos? proj.identifier "com.puppetlabs" end # These flags are applied in addition to the defaults in configs/component/openssl.rb. proj.setting(:openssl_extra_configure_flags, [ 'enable-cms', 'enable-seed', 'no-gost', 'no-rc5', 'no-srp', ]) # What to build? # -------------- # Common deps proj.component "openssl" proj.component "curl" # Git and deps proj.component "git" # Ruby and deps proj.component "runtime-pdk" proj.component "puppet-ca-bundle" proj.component "augeas" unless platform.is_windows? proj.component "libxml2" unless platform.is_windows? proj.component "libxslt" unless platform.is_windows? proj.component "ruby-#{proj.ruby_version}" proj.component "ruby-augeas" unless platform.is_windows? # We only build ruby-selinux for EL 5-7 if platform.name =~ /^el-(5|6|7)-.*/ || platform.is_fedora? proj.component "ruby-selinux" end proj.component "ruby-stomp" if proj.respond_to?(:additional_rubies) proj.additional_rubies.keys.each do |rubyver| proj.component "ruby-#{rubyver}" ruby_minor = rubyver.split('.')[0,2].join('.') proj.component "ruby-#{ruby_minor}-augeas" unless platform.is_windows? proj.component "ruby-#{ruby_minor}-selinux" if platform.name =~ /^el-(5|6|7)-.*/ || platform.is_fedora? proj.component "ruby-#{ruby_minor}-stomp" end end # Platform specific deps proj.component "ansicon" if platform.is_windows? # What to include in package? proj.directory proj.install_root proj.directory proj.prefix proj.directory proj.link_bindir unless platform.is_windows? proj.timeout 7200 if platform.is_windows? # Here we rewrite public http urls to use our internal source host instead. # Something like https://www.openssl.org/source/openssl-1.0.0r.tar.gz gets # rewritten as # https://artifactory.delivery.puppetlabs.net/artifactory/generic/buildsources/openssl-1.0.0r.tar.gz proj.register_rewrite_rule 'http', proj.buildsources_url end
29.908046
109
0.720215
bb1a669f647739b7827cb7a4cef203867c74c228
5,461
# Code we only want to run when in the Rails console. # This needs to be required in your console starter (.irbrc or .pryrc). # eg.: # # console_init = File.join Dir.getwd, 'config', 'console.rb' # if File.exist?(console_init) # puts "Loading #{console_init}" # require console_init # end # For pry console, include the following in .pryrc # # if defined? Hirb # # Slightly dirty hack to fully support in-session Hirb.disable/enable toggling # Hirb::View.instance_eval do # def enable_output_method # @output_method = true # @old_print = Pry.config.print # Pry.config.print = proc do |*args| # Hirb::View.view_or_page_output(args[1]) || @old_print.call(*args) # end # end # # def disable_output_method # Pry.config.print = @old_print # @output_method = nil # end # end # # Hirb.enable # old_print = Pry.config.print # Pry.config.print = proc do |*args| # Hirb::View.view_or_page_output(args[1]) || old_print.call(*args) # end # # end require 'hirb' silence_warnings { Object.const_set( "RAILS_CONSOLE", true ) } puts "Initializing Hfhinv Rails console." # Set the acts_as_audited user so we can track changes made from the console. Thread.current[:audited_user] = "Rails Console" module HfhinvConsoleHelpers def self.simple_time(time) if time.is_a?(Time) time.strftime("%Y-%m-%d %H:%M:%S").slice(2..-1) else time.strftime("%Y-%m-%d").slice(2..-1) end end # module Album # # ===================== # # = Console Shortcuts = # # ===================== # # ======================= # # = Hirb Helper methods = # # ======================= # def p_cnt; photos.count; end # def p_approved; HfhinvConsoleHelpers.simple_time(photographer_approved_at) rescue "nil"; end # def c_approved; HfhinvConsoleHelpers.simple_time(customer_approved_at) rescue "nil"; end # end module AdminUser # ===================== # = Console Shortcuts = # ===================== # ======================= # = Hirb Helper methods = # ======================= def last_sign_in_at; HfhinvConsoleHelpers.simple_time(super) rescue "nil"; end end module Donation # ===================== # = Console Shortcuts = # ===================== # ======================= # = Hirb Helper methods = # ======================= def p; pickup? ? "T" : "F"; end def p_date; HfhinvConsoleHelpers.simple_time(pickup_date) rescue "nil"; end def d_id; donor_id; end end module Item # ===================== # = Console Shortcuts = # ===================== # ======================= # = Hirb Helper methods = # ======================= def d_id; donation_id; end def item_type_desc; item_type.description rescue nil; end def use; use_of_item_name; end end module ItemType # ===================== # = Console Shortcuts = # ===================== # ======================= # = Hirb Helper methods = # ======================= def d_id; department_id; end def d_name; department.name; end end module ActiveRecord extend ActiveSupport::Concern module ClassMethods def [](id) find(id) end end def to_s output = [] self.attributes.sort{|a,b|a.first <=> b.first}.each do |a| output << "#{'%30s' % a.first}: #{a.last}" end output * "\n" end # General Hirb Helper methods def created; HfhinvConsoleHelpers.simple_time(created_at) rescue "nil"; end def updated; HfhinvConsoleHelpers.simple_time(updated_at) rescue "nil"; end end module HirbView extend ActiveSupport::Concern included do class << self alias :orig_render_output :render_output def render_output(*args) ::ActiveRecord::Base.logger.with_level(:warn) do orig_render_output(*args) end end end end end end class Object def self.descendants ObjectSpace.each_object(Class).select { |klass| klass < self } end # Hirb Printer shortcut def hp(*args) puts Hirb::Helpers::AutoTable.render(*args) end # Hirb resizer and helper reloader shortcut def hr Hirb::View.resize ActiveRecord::Base.send(:include, HfhinvConsoleHelpers::ActiveRecord) AdminUser.send(:include, HfhinvConsoleHelpers::AdminUser) Donation.send(:include, HfhinvConsoleHelpers::Donation) Item.send(:include, HfhinvConsoleHelpers::Item) ItemType.send(:include, HfhinvConsoleHelpers::ItemType) silence_warnings { # Shortcut aliases for common AR classes # Object.const_set "A", Audit # Object.const_set "AA", ArchivedAudit Object.const_set "AC", ActiveAdmin::Comment Object.const_set "DO", Donor Object.const_set "DA", Donation Object.const_set "DP", Department Object.const_set "IT", ItemType Object.const_set "I", Item Object.const_set "AU", AdminUser Object.const_set "Z", ZipCode } true end def hirb_off Hirb.enable :pager=>false Hirb.enable :formatter=>false end def hirb_on Hirb.enable :pager=>true Hirb.enable :formatter=>true # Hirb::View.send(:include, HfhinvConsoleHelpers::HirbView) end def reload ActionDispatch::Reloader.cleanup! ActionDispatch::Reloader.prepare! hr true end end hirb_on hr unless Rails.env.test? # require 'pry'
25.050459
98
0.59403
010eba2fbec25e1b31f22952fc3c2c1fd727e595
881
require 'helper' class PwnedTest < Test::Unit::TestCase #Minitest::Test def test_abc123_is_found assert_equal true, HaveIBeenPwned.pwned('abc123') end def test_password_timeout starting = Time.now result = HaveIBeenPwned.pwned('abc123', timeout: 1) ending = Time.now elapsed = (ending - starting).floor assert_operator elapsed, :<=, 1 end def test_password_is_found assert_equal true, HaveIBeenPwned.pwned('password') end def test_crazy_long_password_is_not_found assert_equal false, HaveIBeenPwned.pwned('dfsfk;lngfdsjlmkvsdlmjkvf8um54b89u5438mu0p435u0m5b409u54b09um5309um50u9m3b56u90m54jmgtrgv') end def test_not_actually_providing_a_password_is_silly assert_equal false, HaveIBeenPwned.pwned('') end def test_no_password_at_all_raises assert_raise("RuntimeError") { HaveIBeenPwned.pwned } end end
25.171429
137
0.76504
d5c6bfe9b746d2a235d521b6a9cec3adc4472935
356
describe "Vanguard" do include_context "db", "pvan", "pmoa" it "Vanguard cards" do "t:*" .should equal_search "t:vanguard" "layout:vanguard".should equal_search "t:vanguard" "sakashima" .should return_cards "Sakashima the Impostor Avatar" "sakashima t:*" .should return_cards "Sakashima the Impostor Avatar" end end
32.363636
73
0.679775
1a0e04016743304a251f78d4522d8b1bbe6c1aff
666
# -*- coding: utf-8 -*- module Jekyll class RTLifyTag < Liquid::Tag def initialize(tag_name, variable, tokens) super if match = variable.match(/{{\s*(.*)\s*}}/) @variable, = match.captures else raise 'invalid variable' end end def render(context) html = context.find_variable(@variable) tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'ul', 'ol'] tags.each { |tag| html = html.gsub(/<#{tag}\s/, "<#{tag} dir=\"auto\" ")} tags.each { |tag| html = html.gsub(/<#{tag}>/, "<#{tag} dir=\"auto\">")} html end end end Liquid::Template.register_tag('rtlify', Jekyll::RTLifyTag)
24.666667
79
0.540541
879489a5214477e38cd5609546ef8ca1fe5916ce
520
require 'test_helper' class OpenTSDBBackendTest < Minitest::Test def setup StatsD.stubs(:backend).returns(@backend = StatsD::Instrument::Backends::OpenTSDBBackend.new) @backend.stubs(:rand).returns(0.0) UDPSocket.stubs(:new).returns(@socket = mock('socket')) @socket.stubs(:connect) @socket.stubs(:send).returns(1) end def test_support_tags_syntax @backend.expects(:write_packet).with('fooc._t_topic.foo._t_bar:3|c') StatsD.increment('fooc', 3, tags: ['topic:foo', 'bar']) end end
28.888889
96
0.703846
7a21cf3e168fa98f517fe4890c642465644e2840
988
module People class HousesController < ApplicationController before_action :data_check, :build_request ROUTE_MAP = { index: proc { |params| ParliamentHelper.parliament_request.person_houses.set_url_params({ person_id: params[:person_id] }) }, current: proc { |params| ParliamentHelper.parliament_request.person_current_house.set_url_params({ person_id: params[:person_id] }) } }.freeze def index @person, @incumbencies = RequestHelper.filter_response_data( @request, 'http://id.ukpds.org/schema/Person', 'http://id.ukpds.org/schema/Incumbency' ) @person = @person.first @incumbencies = @incumbencies.reverse_sort_by(:start_date) end def current @person, @house = RequestHelper.filter_response_data( @request, 'http://id.ukpds.org/schema/Person', 'http://id.ukpds.org/schema/House' ) @person = @person.first @house = @house.first end end end
29.939394
139
0.665992
61ccdf30aa23dba1ee858d3212af863d5807785a
1,378
# Encoding: utf-8 require 'rspec/expectations' require 'chefspec' require 'chefspec/berkshelf' require 'chef/application' require 'json' Dir['./test/unit/spec/support/**/*.rb'].sort.each { |f| require f } # use node.default to put stub data for every node in every test # could also use this method to stub other node-related things like environment def node_resources(node) # Stub the node and any calls to Environment.Load to return this environment env = Chef::Environment.new env.name 'chefspec' # matches ./test/integration/ allow(node).to receive(:chef_environment).and_return(env.name) allow(Chef::Environment).to receive(:load).and_return(env) end # use to stub commands or files or other ruby calls # e.g. stub_command('/usr/sbin/httpd -t').and_return(0) def stub_resources; end def stub_chef_zero(platform, version, server) Dir['./test/fixtures/nodes/*.json'].sort.each do |f| node_data = JSON.parse(IO.read(f), symbolize_names: false) node_name = node_data['name'] server.create_node(node_name, node_data) platform.to_s # pacify rubocop version.to_s # pacify rubocop end Dir['./test/fixtures/environments/*.json'].sort.each do |f| env_data = JSON.parse(IO.read(f), symbolize_names: false) env_name = env_data['name'] server.create_environment(env_name, env_data) end end at_exit { ChefSpec::Coverage.report! }
32.809524
79
0.733672
0189a76c71e3b4c291e3972b15ad58bf84d6c6de
772
cask 'gogs' do version '0.11.43' sha256 'cdb4e2178d0e0a4f2ef79c31326150c7cbd9a029cc4fa565a12a5e3c67292a41' # github.com/gogits/gogs was verified as official when first introduced to the cask url "https://github.com/gogits/gogs/releases/download/v#{version}/darwin_amd64.zip" appcast 'https://github.com/gogits/gogs/releases.atom', checkpoint: '9c96f53b46dcf12c568b093001360acce49ed5eb25d2408218f4b68cfca1bc8e' name 'Go Git Service' homepage 'https://gogs.io/' # shim script (https://github.com/caskroom/homebrew-cask/issues/18809) shimscript = "#{staged_path}/gogs.wrapper.sh" binary shimscript, target: 'gogs' preflight do IO.write shimscript, <<~EOS #!/bin/sh cd '#{staged_path}/gogs' && ./gogs "$@" EOS end end
32.166667
88
0.724093
d5d3e6fa850b741171957665683d428c1a0cbf21
1,634
# # Be sure to run `pod lib lint RLNetworking.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 = 'BJNetworking' s.version = '0.1.0' s.summary = 'BJNetworking is for networking.' # This description is used to generate tags and improve search results. # * Think: What does it do? Why did you write it? What is the focus? # * Try to keep it short, snappy and to the point. # * Write the description between the DESC delimiters below. # * Finally, don't worry about the indent, CocoaPods strips it! s.description = <<-DESC TODO: Add long description of the pod here. DESC s.homepage = 'https://github.com/Sovannra/RLNetworking' # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'Sovannra' => '[email protected]' } s.source = { :git => 'https://github.com/Sovannra/RLNetworking.git', :tag => s.version.to_s } # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>' s.ios.deployment_target = '9.0' s.swift_version = "4.2" s.source_files = 'RLNetworking/Classes/**/*' # s.resource_bundles = { # 'RLNetworking' => ['RLNetworking/Assets/*.png'] # } # s.public_header_files = 'Pod/Classes/**/*.h' # s.frameworks = 'UIKit', 'MapKit' # s.dependency 'AFNetworking', '~> 2.3' end
37.136364
105
0.640759
ffe6175f1b1ce46b7cbe8cbe108617badc38a9a1
1,544
class EmailAddress < ApplicationRecord # https://www.regular-expressions.info/email.html EMAIL_REGEX = /\A[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\z/ belongs_to :user, inverse_of: :email_address validates :address, presence: true, confirmation: true, format: { with: EMAIL_REGEX } validates :normalized_address, uniqueness: true validates :user_id, uniqueness: true validate :validate_deliverable, on: :deliverable after_save :update_user def self.visible(user) if user.is_moderator? where(user: User.where("level < ?", user.level)).or(where(user: user)) else none end end def address=(value) self.normalized_address = EmailValidator.normalize(value) || address super end def nondisposable? EmailValidator.nondisposable?(normalized_address) end def validate_deliverable if EmailValidator.undeliverable?(address) errors.add(:address, "is invalid or does not exist") end end def update_user user.update!(is_verified: is_verified? && nondisposable?) end def self.search(params) q = search_attributes(params, :id, :created_at, :updated_at, :user, :address, :normalized_address, :is_verified, :is_deliverable) q = q.apply_default_order(params) q end concerning :VerificationMethods do def verifier @verifier ||= Danbooru::MessageVerifier.new(:email_verification_key) end def verification_key verifier.generate(id) end def valid_key?(key) id == verifier.verified(key) end end end
25.311475
133
0.700777
1cdf590388e0cb301b97cd53afe4119d7a71c9a9
229
require 'quovo/api' module Quovo module Resources class Base class << self # Proxy for resource classes. def request(*args) Quovo::API.request(*args) end end end end end
15.266667
37
0.567686
6aa55e3355bf24b5a175797a6735cf47b636c283
1,693
# 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::AlertsManagement::Mgmt::V2019_05_05_preview module Models # # Suppression logic for a given action rule # class SuppressionConfig include MsRestAzure # @return [SuppressionType] Specifies when the suppression should be # applied. Possible values include: 'Always', 'Once', 'Daily', 'Weekly', # 'Monthly' attr_accessor :recurrence_type # @return [SuppressionSchedule] suppression schedule configuration attr_accessor :schedule # # Mapper for SuppressionConfig class as Ruby Hash. # This will be used for serialization/deserialization. # def self.mapper() { client_side_validation: true, required: false, serialized_name: 'SuppressionConfig', type: { name: 'Composite', class_name: 'SuppressionConfig', model_properties: { recurrence_type: { client_side_validation: true, required: true, serialized_name: 'recurrenceType', type: { name: 'String' } }, schedule: { client_side_validation: true, required: false, serialized_name: 'schedule', type: { name: 'Composite', class_name: 'SuppressionSchedule' } } } } } end end end end
27.754098
78
0.551683
edfa3c077f4e7e828cb256cc01fdb84ecb9b57e3
2,783
# frozen_string_literal: true class ClaimEventValidator < ActiveModel::Validator MAXIMUM_CLAIM_COUNT_PER_IP_PER_DAY = 8 MAXIMUM_PAYMENT_AMOUNT_PER_DAY = 4_000_000 * 10**8 MINIMUM_ADDRESS_HASH_LENGTH = 40 def validate(record) record.errors.add(:address_hash, "Address is invalid.") && (return) if record.address_hash.blank? || record.address_hash.length < MINIMUM_ADDRESS_HASH_LENGTH claim_interval_must_be_greater_than_3hours(record) receive_up_to_10_rewards_per_IP_per_day(record) address_hash_must_be_a_testnet_address(record) address_hash_cannot_be_short_multisig(record) address_hash_cannot_be_official_address(record) payment_amount_must_be_less_or_equal_to_daily_limit(record) end private def address_hash_cannot_be_official_address(record) record.errors.add(:address_hash, "Does not support transfers to official address.") if Account.exists?(address_hash: record.address_hash) end def payment_amount_must_be_less_or_equal_to_daily_limit(record) if ClaimEvent.daily.sum(:capacity) >= MAXIMUM_PAYMENT_AMOUNT_PER_DAY record.errors.add(:address_hash, "Faucet payment amount exceeds the daily limit.") end end def address_hash_must_be_a_testnet_address(record) parsed_address = CKB::AddressParser.new(record.address_hash).parse if parsed_address.mode != CKB::MODE::TESTNET record.errors.add(:address_hash, "Address must be a testnet address.") end rescue NoMethodError, CKB::AddressParser::InvalidFormatTypeError record.errors.add(:address_hash, "Address is invalid.") end def address_hash_cannot_be_short_multisig(record) parsed_address = CKB::AddressParser.new(record.address_hash).parse if parsed_address.address_type == "SHORTMULTISIG" record.errors.add(:address_hash, "Address cannot be multisig short payload format.") end rescue NoMethodError, CKB::AddressParser::InvalidFormatTypeError record.errors.add(:address_hash, "Address is invalid.") end def receive_up_to_10_rewards_per_IP_per_day(record) if ClaimEvent.where(ip_addr: record.ip_addr).daily.count >= MAXIMUM_CLAIM_COUNT_PER_IP_PER_DAY record.errors.add(:address_hash, "Get up to 8 times claim per IP per day.") end end def claim_interval_must_be_greater_than_3hours(record) claim_event = ClaimEvent.where(address_hash: record.address_hash).where("created_at_unixtimestamp > ?", 3.hours.ago.to_i).order(:id).first if claim_event.present? next_valid_time = Time.at(claim_event.created_at_unixtimestamp + 3.hours) record.errors.add(:address_hash, "Claim interval must be greater than 3 hours for the same address. Next valid time is #{next_valid_time}.") end end end
44.174603
161
0.765361
08c1214881e9efc0c6ed64e8694ec7ab1ce0bf05
720
Deface::Override.new( virtual_path: 'spree/shared/_order_details', name: 'add_digital_downloads_to_invoice', insert_bottom: '[data-hook="order_item_description"]', text: <<-HTML <% if @order.state == 'complete' && @order.paid? && item.variant.digital? %> <div data-hook='download_links'> <ul> <% item.digital_links.each do |digital_link| %> <li> <%= link_to Spree.t('digitals.digital_download', filename: raw(digital_link.digital.attachment_file_name)), digital_url(secret: digital_link.secret) %> </li> <% end %> </ul> </div> <% end %> HTML )
37.894737
171
0.543056