conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix setting current org with debugging on\n" }, { "from": "human", "value": "\nmodule Grafana\n\n module User\n\n def get_current_user()\n endpoint = \"/api/user\"\n @logger.info(\"Getting user current user (GET #{endpoint})\") if @debug\n return ...
ruby
chosen
[ { "from": "system", "value": "Fix migration generator for >= 4.1\n\n`create_migration` method is reserved\r\n\r\nMore details is here: https://github.com/muratguzel/letsrate/issues/76#issuecomment-76588483" }, { "from": "human", "value": "require 'rails/generators/active_record'\n\nclass Transla...
ruby
chosen
[ { "from": "system", "value": "Modify ReverseEach to use NodePattern\n" }, { "from": "human", "value": "# encoding: utf-8\n# frozen_string_literal: true\n\nmodule RuboCop\n module Cop\n module Performance\n # This cop is used to identify usages of `reverse.each` and\n # change them ...
ruby
chosen
[ { "from": "human", "value": "Add the start of a Output::Media spec\n" }, { "from": "gpt", "value": "require 'pp' # Helps prevent an error like: 'superclass mismatch for class File'\nrequire 'bundler/setup'\nBundler.require(:default)\nrequire './lib/everything/blog/output/index'\nrequire 'fakefs/...
ruby
chosen
[ { "from": "system", "value": "Load middleware, processor and finalizers from lib root\n" }, { "from": "human", "value": "require \"roger_themes/version\"\n\nmodule RogerThemes\n # Your code goes here...\nend\n" }, { "from": "gpt", "value": "require \"roger_themes/version\"\n\nmodule...
ruby
chosen
[ { "from": "system", "value": "Switch Repo to class << self\n" }, { "from": "human", "value": "require 'forwardable'\nrequire 'pathname'\nrequire 'yaml/store'\nrequire_relative 'signature'\nrequire_relative 'tags'\n\nmodule Signore\n class Repo\n extend Forwardable\n\n def self.default_pat...
ruby
chosen
[ { "from": "system", "value": "Add some private methods back to Order\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nmodule Stripe\n class Order < APIResource\n extend Stripe::APIOperations::Create\n extend Stripe::APIOperations::List\n include Stripe::APIOperations...
ruby
chosen
[ { "from": "system", "value": "Make lat_lng test machine precision safe\n" }, { "from": "human", "value": "require 'test_helper'\n\ndescribe MapPrint::LatLng do\n let(:lat_lng) { MapPrint::LatLng.new(-29.980172, -52.959305) }\n\n it 'assigns latitude' do\n lat_lng.lat.must_equal -29.980172\n...
ruby
chosen
[ { "from": "system", "value": "Replace removed method alias_method_chain with Module prepend\n\nReplace removed method alias_method_chain (removed in Rails 6) with Module prepend\n" }, { "from": "human", "value": "require 'spec_helper'\nrequire 'fileutils'\n\nclass ActiveRecord::Migration\n def ...
ruby
chosen
[ { "from": "system", "value": "Add external requirements to gemspec.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n$:.push File.expand_path(\"../lib\", __FILE__)\n\nrequire \"mini_magick/version\"\n\nGem::Specification.new do |s|\n s.name = \"mini_magick\"\n s.version ...
ruby
chosen
[ { "from": "human", "value": "Add code wars (8) - say hello\n" }, { "from": "gpt", "value": "# http://www.codewars.com/kata/grasshopper-debug-sayhello/\n# --- iteration 1 ---\ndef say_hello(name)\n \"Hello, #{name}\"\nend\n" } ]
ruby
chosen
[ { "from": "system", "value": "Add test for index on user_id and meeting_id for an attendance.\n" }, { "from": "human", "value": "require 'test_helper'\n\n# AttendanceTest is the model test for attendances\nclass AttendanceTest < ActiveSupport::TestCase\n def setup\n @attendance = attendances...
ruby
chosen
[ { "from": "system", "value": "Set HSTS to 1 year\n" }, { "from": "human", "value": "::SecureHeaders::Configuration.configure do |config|\n config.hsts = {:max_age => 1.month.to_i}\n config.x_frame_options = 'DENY'\n config.x_content_type_options = \"nosniff\"\n config.x_xss_protection = {:va...
ruby
chosen
[ { "from": "system", "value": "Revert \"Let rack know if we're running relative to a subdirectory\"\n\nThis reverts commit 2c03f05bb3d48f02472cf096fbdf0d069bc21583.\n" }, { "from": "human", "value": "# This file is used by Rack-based servers to start the application.\n\nrequire ::File.expand_path...
ruby
chosen
[ { "from": "system", "value": "Remove ip restriction on admin page\n" }, { "from": "human", "value": "module Admin\n class AccessDenied < RuntimeError; end\n\n class AdminController < ApplicationController\n include Authentication, FlashI18n, FlashRender\n\n skip_before_action :service_un...
ruby
chosen
[ { "from": "system", "value": "Allow card to be updated\n" }, { "from": "human", "value": "class Admin::CardsController < AdminController\n before_action :load_card, only: [:edit, :update, :move_higher, :move_lower]\n\n def index\n @cards = Card.sorted\n end\n\n def edit\n end\n\n def up...
ruby
chosen
[ { "from": "system", "value": "Remove redundant method to set order\n\nIt was being incorrectly detected as used in a dangerous send. We can\nget rid of the warning by taking advantage of the `has_orders` method\nand getting rid of this code.\n" }, { "from": "human", "value": "class CommunitiesCo...
ruby
chosen
[ { "from": "system", "value": "Allow for longer Setting values." }, { "from": "human", "value": "module MerbSettings\n module Adapter\n module DataMapper\n\n def self.included(base)\n # Ensure base is a resource\n base.send(:include, ::DataMapper::Resource) unless ::DataMap...
ruby
chosen
[ { "from": "system", "value": "Remove unused `rank_to_s` from `Placement`\n\nThis was from when I was still figuring out the appropriate interface\nfor converting the rank.\n" }, { "from": "human", "value": "class Placement < ActiveRecord::Base\n belongs_to :couple\n belongs_to :event\n\n # Re...
ruby
chosen
[ { "from": "system", "value": "Fix building C-API spec extensions with MRI.\n" }, { "from": "human", "value": "require File.dirname(__FILE__) + '/../spec_helper'\n\nrequire 'rbconfig'\n\ndef compile_extension(path, ext, ext_source)\n signature = \"#{path}compiled_by\"\n\n return if File.exists?...
ruby
chosen
[ { "from": "system", "value": "Set refreshed_at to current time upon record creation\n" }, { "from": "human", "value": "class Skill < ActiveRecord::Base\n belongs_to :user\n validates :title, presence: true\n before_save :set_refreshed_at\n\n def set_refreshed_at\n self.new_record? ? self....
ruby
chosen
[ { "from": "system", "value": "Use Vagrant::Util::Subprocess.execute instead of SafeExec\n" }, { "from": "human", "value": "module VagrantPlugins\n module Ansible\n class Provisioner < Vagrant.plugin(\"2\", :provisioner)\n def provision\n ssh = @machine.ssh_info\n \n ...
ruby
chosen
[ { "from": "system", "value": "Remove number parsing from FakeCSV reader\n\nAn appointment type of `50_54` was being coerced as a number\nand resulting in `5054`. As we no longer have any numbers in the\nCSV, we it is no longer required.\n" }, { "from": "human", "value": "require 'csv'\n\nCSV::Co...
ruby
chosen
[ { "from": "system", "value": "Update istat menus 4 download link to https" }, { "from": "human", "value": "cask :v1 => 'istat-menus4' do\n version '4.22'\n sha256 '4e6873b24d18578e359b9363f02b9c98bdeda999afab1aaa8802af254ecb35b6'\n\n url \"http://s3.amazonaws.com/bjango/files/istatmenus4/ista...
ruby
chosen
[ { "from": "human", "value": "Use named constants for HTTP response codes.\n\n\n" }, { "from": "gpt", "value": "class ExportController < ApplicationController\n def start\n render :update do |page|\n page.replace_html :sidebar_content, :partial => 'start'\n page.call \"openSidebar\"...
ruby
chosen
[ { "from": "system", "value": "Fix encoding problem where uptime check on keyword fails\n" }, { "from": "human", "value": "\nclass UptimeController < ApplicationController\n before_action :check_token\n\n def index\n url = sanitized_url\n\n easy = Curl::Easy.new\n easy.follow_location ...
ruby
chosen
[ { "from": "system", "value": "Add a helper that will make sure that we have a given number of associated objects. We use this to build relationships for our nested model forms\n" }, { "from": "human", "value": "module Admin::EditionsHelper\nend\n" }, { "from": "gpt", "value": "module...
ruby
chosen
[ { "from": "system", "value": "Change flash type for success message\n" }, { "from": "human", "value": "class ReservationsController < ApplicationController\n def index\n @reservations = Reservation.all.order(start_date: :asc)\n end\n\n def new\n @reservation = Reservation.new\n data_...
ruby
chosen
[ { "from": "system", "value": "Remove need for REDIS_HOST and REDIS_PORT env vars\n\nThis is one of the few GOV.UK projects that uses this old approach to\nconfiguring Redis - whereas most of the other ones use the approach\nsupported natively by the Redis gem [1] of using REDIS_URL. Removing\nthis will allo...
ruby
chosen
[ { "from": "system", "value": "Include Employee.salaries association definition in BookytSalary::Employee.\n" }, { "from": "human", "value": "module BookytSalary\n module Employee\n extend ActiveSupport::Concern\n\n included do\n has_many :salary_templates, :foreign_key => :person_id\...
ruby
chosen
[ { "from": "system", "value": "Fix the required opal version\n\nPrevious version was lacking #to_n and still using\n#to_native." }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/opal/jquery/version', __FILE__)\n\nGem::Specification.new do |s|\n s.name ...
ruby
chosen
[ { "from": "system", "value": "Add base path to redirects." }, { "from": "human", "value": "class RedirectPresenter\n attr_reader :redirect\n\n def initialize(redirect)\n @redirect = redirect\n end\n\n def render_for_publishing_api\n {\n content_id: redirect.content_id,\n form...
ruby
chosen
[ { "from": "system", "value": "Fix for bad point math; probably picked the right side of begm/endm to exclude; don't use roads in decreasing direction\n" }, { "from": "human", "value": "class Event < ActiveRecord::Base\n def self.find_lat_lon\n self.find_by_sql <<-SQL\n select st_x(point...
ruby
chosen
[ { "from": "system", "value": "Remove validations from Event model\n" }, { "from": "human", "value": "class Event < ApplicationRecord\n has_many :shifts, dependent: :destroy\n\n validates :volunteers_needed, :starts_at, :ends_at, presence: true\n validates :shift_length, :address, presence: tr...
ruby
chosen
[ { "from": "system", "value": "Add formatted values and default scope\n" }, { "from": "human", "value": "class Field < ActiveRecord::Base\n has_many :field_enumerators\n belongs_to :field_type\n belongs_to :field_unit\n has_many :parameter_group_fields\n has_many :parameter_groups, through: ...
ruby
chosen
[ { "from": "system", "value": "Remove duplicate packages from the page speed module attributes\n\nWe're already installing these all in build-essential which comes in via the source recipe\n\nSigned-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>\n" }, { "from": "human", "val...
ruby
chosen
[ { "from": "system", "value": "Make sure we have capistrano 2.x\n" }, { "from": "human", "value": "require \"deployable/version\"\n\nmodule Deployable\n # Your code goes here...\nend\n" }, { "from": "gpt", "value": "require \"deployable/version\"\n\nunless Capistrano::Configuration.r...
ruby
chosen
[ { "from": "system", "value": "Update gemspec according to Bundler scaffold\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/periodicity/version', __FILE__)\n\nGem::Specification.new do |gem|\n gem.name = 'periodicity'\n gem.version = Per...
ruby
chosen
[ { "from": "human", "value": "Add Blind Date series calculations\n" }, { "from": "gpt", "value": "class BlindDateAtTheDairyOverall < Overall\n def self.parent_event_name\n \"Blind Date at the Dairy\"\n end\n\n def category_names\n [\n \"Beginner Men\",\n \"Beginner Women\",\n ...
ruby
chosen
[ { "from": "system", "value": "Add gem dependencis to gemspec\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = \"growl_windows\"\n s.version = \"0.1.0\"\n\n s.authors = \"debbbbie\"\n s.date = \"2013-12-09\"\n s.description = \"Make ...
ruby
chosen
[ { "from": "system", "value": "Make thumbnail a little bigger\n" }, { "from": "human", "value": "module PhotoswipeHelpers\n def gallery_image_tag(image)\n size = image_size(image.url)\n w = size.w\n h = size.h\n link = link_to thumbnail(image, w: 200), image.url, 'data-size': \...
ruby
chosen
[ { "from": "system", "value": "Support a arquivos pptx e xlsx\n" }, { "from": "human", "value": "# == Schema Information\n#\n# Table name: assets\n#\n# id :integer not null, primary key\n# file_file_name :string(255)\n# file_content_type :string(255)\n# file_file_si...
ruby
chosen
[ { "from": "system", "value": "Fix issue with md5 validation." }, { "from": "human", "value": "class Image < ActiveRecord::Base\n attr_accessible :image\n\n belongs_to :album, counter_cache: true\n\n mount_uploader :image, ImageUploader\n\n paginates_per 100\n\n validates :md5, uniqueness: {...
ruby
chosen
[ { "from": "system", "value": "Fix path to test files\n" }, { "from": "human", "value": "# encoding: utf-8\n\nrequire File.expand_path('../lib/axiom/types/version', __FILE__)\n\nGem::Specification.new do |gem|\n gem.name = 'axiom-types'\n gem.version = Axiom::Types::VERSION.dup\n ge...
ruby
chosen
[ { "from": "system", "value": "Switch to the standard heroku billing message\n" }, { "from": "human", "value": "require 'heroku/command/run'\nrequire 'describer'\nrequire 'bootstrapper'\n\n$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), '../../../vendor/json_pure/lib'))\nreq...
ruby
chosen
[ { "from": "system", "value": "Use CSV rather than EOS for the heredoc\n\nAs this is more informative.\n" }, { "from": "human", "value": "require \"test_helper\"\n\nclass CSVParserTest < ActiveSupport::TestCase\n test \"should raise an exception if the file is empty\" do\n parser = CSVParser....
ruby
chosen
[ { "from": "system", "value": "Fix syntax error and Style/TrailingCommaInLiteral offense\n" }, { "from": "human", "value": "require 'resque/failure/base'\n\nmodule ExceptionNotification\n class Resque < Resque::Failure::Base\n def self.count\n ::Resque::Stat[:failed]\n end\n\n def ...
ruby
chosen
[ { "from": "system", "value": "Fix typo in method name.\n" }, { "from": "human", "value": "module Delayed\n module Web\n class InstallGenerator < Rails::Generators::Base\n source_root File.expand_path('../templates', __FILE__)\n desc 'Installs Delayed::Web'\n\n def installe\n ...
ruby
chosen
[ { "from": "system", "value": "Fix description option and update text.\n" }, { "from": "human", "value": "require 'rails/generators'\nrequire 'rails/generators/migration'\nrequire 'rails/generators/active_record/migration'\n\nmodule PaperTrail\n class InstallGenerator < Rails::Generators::Base\n...
ruby
chosen
[ { "from": "system", "value": "Use string difference in watch\n" }, { "from": "human", "value": "class Pry\n class Command::WatchExpression\n class Expression\n NODUP = [TrueClass, FalseClass, NilClass, Numeric, Symbol].freeze\n attr_reader :target, :source, :value, :previous_value\...
ruby
chosen
[ { "from": "system", "value": "Rename form builder helper to just 'anaconda'\n" }, { "from": "human", "value": "module Anaconda\n module FormBuilderHelpers\n\n def anaconda_form_fields( anaconda_field_name )\n output = \"\"\n\n output += self.hidden_field \"#{anaconda_field_name}_fi...
ruby
chosen
[ { "from": "system", "value": "Add networking_basic cookbook to Ubuntu\n" }, { "from": "human", "value": "#Make sure that this recipe only runs on ubuntu systems\nif platform?(\"ubuntu\")\n\n#Base recipes necessary for a functioning system\ninclude_recipe \"ubuntu\"\ninclude_recipe \"apt\"\n#incl...
ruby
chosen
[ { "from": "system", "value": "Package version increased from 2.3.1.2 to 2.3.1.3\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nGem::Specification.new do |s|\n s.name = 'evt-schema'\n s.summary = \"Primitives for schema and data structure\"\n s.version = '2.3.1.1'\n s.descripti...
ruby
chosen
[ { "from": "system", "value": "Fix blowing up gary found. Why do we have no tests for this???\n" }, { "from": "human", "value": "require 'stacks/environment'\nrequire 'puppet/node'\nrequire 'puppet/indirector/node/plain'\n\nclass Puppet::Node::Stacks < Puppet::Node::Plain\n desc \"generates the ...
ruby
chosen
[ { "from": "system", "value": "Add random clean expired token method; set expired time to 10 minutes\n" }, { "from": "human", "value": "require 'active_support/concern'\n\nmodule SubmitOnce\n module ControllerHelper\n extend ActiveSupport::Concern\n\n included do\n if respond_to?(:hel...
ruby
chosen
[ { "from": "system", "value": "Package version is increased from 0.0.2.2 to 0.0.2.3\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = 'http-commands'\n s.version = '0.0.2.2'\n s.summary = 'Convenience abstractions for common HTTP operations, such as post and get'\n s...
ruby
chosen
[ { "from": "system", "value": "Patch phonon-kde to avoid incorrect error.\n\nFixes Homebrew/homebrew#5480.\n" }, { "from": "human", "value": "require 'formula'\n\nclass KdePhonon < Formula\n url 'ftp://ftp.kde.org/pub/kde/stable/phonon/4.5.0/src/phonon-4.5.0.tar.bz2'\n homepage 'http://phonon.k...
ruby
chosen
[ { "from": "system", "value": "Fix rerunning sample specs without new dummy app.\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe \"Load samples\" do\n it \"doesn't raise any error\" do\n expect {\n SpreeSample::Engine.load_samples\n }.to_not raise_error\n end\nen...
ruby
chosen
[ { "from": "system", "value": "JariBakken: Update spec to check host of proxied HTTP client.\n\nr10680\n" }, { "from": "human", "value": "require File.expand_path(\"../../../spec_helper\", __FILE__)\n\nmodule Selenium\n module WebDriver\n module Remote\n module Http\n describe Def...
ruby
chosen
[ { "from": "human", "value": "Add cmd-line utility to diff a git repo against a rubygem\n" }, { "from": "gpt", "value": "#!/usr/bin/ruby\n# Diff a Git Gem Against its Rubygems equivalent\n# \n# ./git_gem_diff.rb\n#\n# Licensed under the MIT license\n# Copyright (C) 2014 Red Hat, Inc.\n###########...
ruby
chosen
[ { "from": "system", "value": "Allow maintain_test_database_schema usage for development as well\n\nHandy if you programmatically want to create the database schema in development.\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nmodule Sequent\n module Test\n module Databa...
ruby
chosen
[ { "from": "system", "value": "Use a case/when statement in QueryParams.dump.\n" }, { "from": "human", "value": "require 'uri'\n\nmodule URI\n module QueryParams\n #\n # Parses a URI query string.\n #\n # @param [String] query_string\n # The URI query string.\n #\n # @retu...
ruby
chosen
[ { "from": "system", "value": "Update baseline Rails version to 2.3.5" }, { "from": "human", "value": "RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION\n\nrequire File.join(File.dirname(__FILE__), 'boot')\nrequire 'plugin_under_test_locator'\n\nRails::Initializer.run do |config|\n c...
ruby
chosen
[ { "from": "system", "value": "Use FactoryGirl.build_stubbed instead of a hand-rolled solution.\n\n`FactoryGirl.build_stubbed` takes care of all this (and more).\n\nI had run into problems with the previous implementation where, because\nthe \"stub record\" was still an instance of the `ActiveRecord::Base`\n...
ruby
chosen
[ { "from": "system", "value": "Allow straight eight boogie alternating to support a regression\n" }, { "from": "human", "value": "# Section 2, Lesson 2 - Rhythm 2 - Straight Eight Boogie\nrequire \"#{Dir.home}/ruby/pianoforall/utilities\"\n\ndef straight_eight_boogie_alternating_treble(note, qual...
ruby
chosen
[ { "from": "system", "value": "Fix rule factory class name\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nFactoryBot.define do\n factory :janus_instance, class: RubyRabbitmqJanus::Models::JanusInstance do\n enable { true }\n end\nend\n" }, { "from": "gpt", "v...
ruby
chosen
[ { "from": "system", "value": "Use FactoryBot for validating Coronavirus::LiveStream\n\nThis is a more conventional approach for setting the model up\nvalidation. It also using build rather than create which saves having to\nhit the DB for a test.\n\nThis removes the tests for formatted_stream_date as it see...
ruby
chosen
[ { "from": "system", "value": "Add default true to draft\n" }, { "from": "human", "value": "class CreateRetailersRetailers < ActiveRecord::Migration\n\n def up\n create_table :refinery_retailers do |t|\n t.string :title\n t.string :contact\n t.string :address\n t.string :z...
ruby
chosen
[ { "from": "system", "value": "Fix error in js code so that click blocks now function properly (hide/unhide)\n" }, { "from": "human", "value": "\n\nrequire 'asciidoctor'\nrequire 'asciidoctor/extensions'\nrequire 'asciidoctor/latex/core_ext/colored_string'\n\n#\nmodule Asciidoctor::LaTeX\n\n cla...
ruby
chosen
[ { "from": "system", "value": "Add expected East 2017 date\n\nFrom https://web.archive.org/web/20150406071050/http://massconvention.com/events/2017/02" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nmodule Cinch\n module Plugins\n # Versioning info\n class PaxTimer\n PAXES...
ruby
chosen
[ { "from": "system", "value": "Use example.com in sample gemspec\n" }, { "from": "human", "value": "# encoding: UTF-8\n$:.push File.expand_path(\"../lib\", __FILE__)\nrequire \"<%= file_name %>/version\"\n\nGem::Specification.new do |s|\n s.name = \"<%= file_name %>\"\n s.version = <...
ruby
chosen
[ { "from": "system", "value": "Fix DEPRECATION WARNING for spec/controllers/gestionnaires/*.rb\n" }, { "from": "human", "value": "require \"spec_helper\"\n\ndescribe Gestionnaires::PasswordsController, type: :controller do\n before do\n @request.env[\"devise.mapping\"] = Devise.mappings[:gest...
ruby
chosen
[ { "from": "system", "value": "Update plugin output pattern to include global context\n" }, { "from": "human", "value": "require \"vagrant-spec/acceptance/output\"\n\nmodule Vagrant\n module Spec\n # Default plugins within plugin list when run mode\n # is set as \"plugin\"\n DEFAULT_PLU...
ruby
chosen
[ { "from": "system", "value": "Handle system signals and correct exit from app\n" }, { "from": "human", "value": "#!/usr/bin/env ruby\n\nrequire 'rubygems'\nrequire 'yaml'\nrequire 'transmission-client'\nrequire 'lib/transmission-connect'\n\nCONFIG = \"config/transmission.yml\"\nresult = []\n\nwh...
ruby
chosen
[ { "from": "system", "value": "Expire the redis session in 72 hours.\n" }, { "from": "human", "value": "# Be sure to restart your server when you modify this file.\n\n# Cloudsdale::Application.config.session_store :mongo_store, key: '_cloudsdale_session', collection: lambda { Mongoid.master.colle...
ruby
chosen
[ { "from": "system", "value": "Fix variable reference with dimmer control\n" }, { "from": "human", "value": "module MiOS\n module Services\n module Dimming1\n\n URN = 'urn:upnp-org:serviceId:Dimming1'\n\n def level\n value_for(URN, 'LoadLevelStatus', as: Integer)\n end\n...
ruby
chosen
[ { "from": "system", "value": "Remove RC dependency on em-winrm, bump to release\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n$:.push File.expand_path(\"../lib\", __FILE__)\nrequire \"knife-windows/version\"\n\nGem::Specification.new do |s|\n s.name = \"knife-windows\"\n ...
ruby
chosen
[ { "from": "system", "value": "Allow for an option to skip the protocol part of the url - useful in rails caching.\n" }, { "from": "human", "value": "# url_mapper.rb:\n#\n# Some functions for transforming relative URLs within an application\n# to absolute URLs pointing at either the main applicat...
ruby
chosen
[ { "from": "system", "value": "Make sure to follow any redirects for Textmate download\n" }, { "from": "human", "value": "include_recipe \"pivotal_workstation::user_owns_usr_local\"\n\nunless File.exists?(\"/Applications/TextMate.app\")\n execute \"download text mate to temp dir\" do\n comman...
ruby
chosen
[ { "from": "system", "value": "Use travel_to to mock Time.now\n" }, { "from": "human", "value": "require 'test_helper'\n\nclass DrawTest < ActiveSupport::TestCase\n test \"draws record when they are sent\" do\n secretsanta = events :secretsanta\n santa = participants :santa\n santaswife...
ruby
chosen
[ { "from": "system", "value": "Use Time.zone.today instead of Date.today\n" }, { "from": "human", "value": "class LogsController < ApplicationController\n def new\n @project = Project.find(params[:project_id])\n @log = Log.new(worked_at: Date.today)\n end\n\n def create\n @project = P...
ruby
chosen
[ { "from": "system", "value": "Update to new spree method of canceling\n" }, { "from": "human", "value": "module Spree\n class Gateway::Affirm < Gateway\n preference :api_key, :string\n preference :secret_key, :string\n preference :test_mode, :boolean, default: true\n preference :ser...
ruby
chosen
[ { "from": "system", "value": "Enable upload of Powerpoint files\n" }, { "from": "human", "value": "class DocumentUploader < TransamAbstractUploader\n \n def store_dir\n \"document_uploads/#{model.object_key}\"\n end\n\n # A white list of extensions which are allowed to be uploaded.\...
ruby
chosen
[ { "from": "system", "value": "Upgrade Webmock to official 2.0 release\n" }, { "from": "human", "value": "$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))\n\nrequire 'chargehound/version'\n\nGem::Specification.new do |spec|\n spec.name = 'chargehound'\n spec.version = Cha...
ruby
chosen
[ { "from": "system", "value": "Make the scenario even clearer with accessing valid bsr\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire 'spec_helper'\n\ndescribe BusStopsRoute do\n describe 'validations' do\n context 'same route and direction' do\n let!(:route)...
ruby
chosen
[ { "from": "system", "value": "Remove missing assignment from JS curriculum\n" }, { "from": "human", "value": "class Exercism\n class JavascriptCurriculum\n def slugs\n %w(\n bob word-count anagram beer-song nucleotide-count\n rna-transcription point-mutations phone-number\...
ruby
chosen
[ { "from": "system", "value": "Use `path` instead of `url`\n" }, { "from": "human", "value": "require 'serverkit/resources/base'\n\nmodule Serverkit\n module Resources\n class GoPackage < Base\n attribute :url, required: true, type: String\n\n # @note Override\n def apply\n ...
ruby
chosen
[ { "from": "human", "value": "Add a rake task to clear out sessions records over 25 hours old\n" }, { "from": "gpt", "value": "desc \"Clear the sessions table of records that are over 25 hours old.\"\ntask :clear_expired_sessions => :environment do\n puts \"Deleting sessions over 25 hours old......
ruby
chosen
[ { "from": "human", "value": "Add task to export editions that have an alternative title\n" }, { "from": "gpt", "value": "desc \"Export all Editions that have an alternate title as a CSV\"\n\ntask :export_alternate_title => :environment do\n require \"csv\"\n\n editions_with_alternative_titles ...
ruby
chosen
[ { "from": "system", "value": "Cashnet: Add a few remote tests\n\nWe now test that failures are working as expected.\n\nCloses #1203.\n" }, { "from": "human", "value": "require 'test_helper'\n\nclass CashnetTest < Test::Unit::TestCase\n def setup\n @gateway = CashnetGateway.new(fixtures(:cash...
ruby
chosen
[ { "from": "system", "value": "Update Gemspec to version 0.3.2" }, { "from": "human", "value": "# encoding: utf-8\nGem::Specification.new do |s|\n s.name = 'postkode'\n s.version = '0.3.1'\n s.date = '2015-02-17'\n s.summary = 'postkode'\n s.description = 'Postcode vali...
ruby
chosen
[ { "from": "human", "value": "Add spec for mutable enumerator\n" }, { "from": "gpt", "value": "# encoding: utf-8\n\nrequire 'spec_helper'\n\n# tests that tuple enumerators do not get frozen\n\nclass MutableEnumerator < Enumerator\n attr_reader :mutable_array\n def initialize(tuple_source)\n ...
ruby
chosen
[ { "from": "system", "value": "Improve ruby script to also get the number of downloads from npmjs.com\n\nAnd now we also get top depended (and not only top starred). Kehelian\nuses top depended\n" }, { "from": "human", "value": "\nrequire 'rubygems'\nrequire 'nokogiri'\nrequire 'open-uri'\n\n# US...
ruby
chosen
[ { "from": "human", "value": "Add tests for sitemaps controller\n" }, { "from": "gpt", "value": "require 'test_helper'\n\nclass SitemapsControllerTest < ActionController::TestCase\n test 'should return an XML sitemap' do\n get :index, :format => 'xml'\n assert_response :success\n end\nend...
ruby
chosen
[ { "from": "system", "value": "Update chef client to 17.10.3\n" }, { "from": "human", "value": "# Add the opscode APT source for chef\ndefault[:apt][:sources] = node[:apt][:sources] | [\"opscode\"]\n\n# Set the default server version\ndefault[:chef][:server][:version] = \"12.17.33\"\n\n# Set the ...
ruby
chosen
[ { "from": "system", "value": "Add support for older versions of Rack.\n" }, { "from": "human", "value": "module Konacha\n class Engine < Rails::Engine\n config.konacha = ActiveSupport::OrderedOptions.new\n\n def self.application(app)\n Rack::Builder.app do\n map app.config.ass...
ruby
chosen
[ { "from": "system", "value": "Remove unused & unspec'd method.\n" }, { "from": "human", "value": "module Spree\n class ZoneMember < Spree::Base\n belongs_to :zone, class_name: 'Spree::Zone', counter_cache: true, inverse_of: :zone_members\n belongs_to :zoneable, polymorphic: true\n\n de...
ruby
chosen
[ { "from": "system", "value": "Order step adapter requires alphabetically" }, { "from": "human", "value": "require \"call_sheet/step\"\nrequire \"call_sheet/step_adapters\"\nrequire \"call_sheet/step_adapters/base\"\nrequire \"call_sheet/step_adapters/raw\"\nrequire \"call_sheet/step_adapters/map...
ruby
chosen
[ { "from": "system", "value": "Set up an environment variable to disable the automatic RSpec injection." }, { "from": "human", "value": "RSpec.configure do |config|\n config.include(ChefSpec::API)\n config.include(ChefSpec::Macros)\n\n config.after(:each) do\n ChefSpec::Stubs::CommandRegist...
ruby
chosen
[ { "from": "system", "value": "Remove deprecated plugin install option\n" }, { "from": "human", "value": "module VagrantPlugins\n module CommandPlugin\n module Command\n module MixinInstallOpts\n def build_install_opts(o, options)\n options[:plugin_sources] = [\n ...
ruby
chosen