conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add code wars (5) - memoized fibonacci\n" }, { "from": "gpt", "value": "# http://www.codewars.com/kata/529adbf7533b761c560004e5/\n# --- iteration 1 ---\ndef fibonacci(n)\n a, b = 1, 1\n (n - 1).times do |i|\n a, b = b, a + b\n end\n a\nend\n\n# --- iteration 2...
ruby
chosen
[ { "from": "system", "value": "Fix minor nit in h plugin spec\n" }, { "from": "human", "value": "require File.expand_path(\"spec_helper\", File.dirname(__FILE__))\n\ndescribe \"h plugin\" do \n it \"adds h method for html escaping\" do\n app(:h) do |r|\n r.on do |id|\n h(\"<form>\...
ruby
chosen
[ { "from": "system", "value": "Fix issue when .rspec.out green\n" }, { "from": "human", "value": "\nBASE =\n %{ bundle exec rspec \\\n --require ~/.bash/rspec_dot_errors_formatter.rb \\\n --format DotErrorsFormatter --out .errors \\\n --format d --out .rspec.out \\\n --fo...
ruby
chosen
[ { "from": "system", "value": "Set table name for NotificationStatus\n" }, { "from": "human", "value": "module Notifiable\n class NotificationStatus < ActiveRecord::Base\n belongs_to :notification, :class_name => 'Notifiable::Notification'\n belongs_to :device_token, :class_name => 'Notifi...
ruby
chosen
[ { "from": "system", "value": "Use update_attributes (and the internal set_position handling) for position application also\n" }, { "from": "human", "value": "class PositionApplicationsController < ApplicationController\n\n before_filter :authorize_call_admin, except: [:index, :show]\n\n def in...
ruby
chosen
[ { "from": "system", "value": "Move the test log to /tmp as most won't have permission for /mnt\n" }, { "from": "human", "value": "# These ones take longer to run\n\nrequire 'test/unit'\nrequire File.join(File.dirname(__FILE__), \"/../lib/simple_record\")\nrequire File.join(File.dirname(__FILE__)...
ruby
chosen
[ { "from": "system", "value": "Fix on minitest to support 1.9.3\n" }, { "from": "human", "value": "require 'helper'\n\ndescribe Arel do\n before :all do\n @table = Arel::Table.new(:people)\n @attr = @table[:name]\n @conn = FakeRecord::Base.new\n end\n\n def compile node\n @visitor....
ruby
chosen
[ { "from": "system", "value": "Update Podspec for 1.0.0 version\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = \"MockInject\"\n s.version = \"0.1.1\"\n s.summary = \"A library that allows developers to globally mock any ObjectiveC class' initialization met...
ruby
chosen
[ { "from": "system", "value": "Add test 'can register member of set keys for a specific object'\n" }, { "from": "human", "value": "require 'test_helper'\n\ndescribe 'Redis::Breadcrumb' do\n before do\n Redis::Breadcrumb.redis = MockRedis.new\n end\n\n it 'can register owned keys for a speci...
ruby
chosen
[ { "from": "system", "value": "Allow any version bundler for Travis CI\n" }, { "from": "human", "value": "lib = File.expand_path(\"../lib\", __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire \"amakanize/version\"\n\nGem::Specification.new do |spec|\n spec.name ...
ruby
chosen
[ { "from": "human", "value": "Add the initial Page tests\n" }, { "from": "gpt", "value": "describe 'Page' do\n let(:site) { double }\n\n describe '#initialize' do\n context 'when a path is provided' do\n let(:page) { Dimples::Page.new(site, './pages/about.erb') }\n\n before do\n ...
ruby
chosen
[ { "from": "system", "value": "Fix homepage to use SSL in Dump Truck Cask\n\nThe HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly\nmakes it more secure and saves a HTTP round-trip.\n" }, { "from": "human", "value": "cask :v1 => 'dump-truck' do\n version :latest\n sh...
ruby
chosen
[ { "from": "system", "value": "Fix typo in documentation comment [skip ci]\n" }, { "from": "human", "value": "require 'thread'\n\nmodule Hanami\n module Assets\n # Store assets references when compile mode is on.\n #\n # This is expecially useful in development mode, where we want to co...
ruby
chosen
[ { "from": "system", "value": "Fix pod spec framework linking.\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = \"ZamzamKit\"\n s.version = \"0.9.1\"\n s.summary = \"A Swift framework for rapidly developing Apple mobile apps.\"\n s.descr...
ruby
chosen
[ { "from": "system", "value": "Update to forbid handle_asynchronously as well\n" }, { "from": "human", "value": "require \"rubocop_delayed_job/version\"\nrequire \"rubocop\"\n\nmodule RuboCop\n module Cop\n module Lint\n class DelayedJob < Cop\n def on_send(node)\n return...
ruby
chosen
[ { "from": "system", "value": "Change add new comment structure\n" }, { "from": "human", "value": "class CommentsController < ApplicationController\n\n def create\n comment = params[:comment]\n comment[:post_id] = params[:post_id]\n @new_comment = Comment.new(comment_params)\n if @ne...
ruby
chosen
[ { "from": "system", "value": "Fix receiver on new message\n" }, { "from": "human", "value": "class MessagesController < ApplicationController\n respond_to :html\n \n def create\n @message = Message.new params[:message]\n @message.sender = current_user\n @message.sender_deleted = fals...
ruby
chosen
[ { "from": "system", "value": "Write the controller for a logout route\n" }, { "from": "human", "value": "class SessionsController < ApplicationController\n\n def new\n @student = Student.new\n @professor = Professor.new\n end\n\n def create\n student = Student.find_by(email: params[:...
ruby
chosen
[ { "from": "human", "value": "Fix for retrieve order from Shipwire gem\n\nShipwire::Orders.new.find must return order information instead trackings\n" }, { "from": "gpt", "value": "# Fix for retrieve order from Shipwire gem\nmodule SolidusShipwire\n module FixFindOrder\n def find(id, params =...
ruby
chosen
[ { "from": "system", "value": "Add support for AWS STS tokens\n" }, { "from": "human", "value": "require \"fog\"\n\nmodule StaticSync\n class Storage\n\n def initialize(config)\n @config = config\n\n validate_credentials!\n end\n\n def has_file?(version)\n cache.has_file?...
ruby
chosen
[ { "from": "system", "value": "Add helpful comment to describe parameters to rake task\n" }, { "from": "human", "value": "namespace :api_clients do\n desc \"Create an API client for a registered application\"\n task :create, [:name, :email, :application_name, :permission] => :environment do |t,...
ruby
chosen
[ { "from": "system", "value": "Remove git dependency from gemspec.\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'mtransform/version'\n\nGem::Specification.new do |spec|\n spec.name...
ruby
chosen
[ { "from": "system", "value": "Update Gemspec to use a valid license\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = 'netuitived'\n s.version = '1.1.0'\n s.date = '2016-10-21'\n s.summary = 'Metric collection druby server'\n s.description = '...
ruby
chosen
[ { "from": "system", "value": "Support for test with jruby\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/active_git/version', __FILE__)\n\nGem::Specification.new do |s|\n s.name = \"active_git\"\n s.version = ActiveGit::VERSION\n ...
ruby
chosen
[ { "from": "system", "value": "Set rspec as test framework for generators\n" }, { "from": "human", "value": "module Blog\n class Engine < ::Rails::Engine\n isolate_namespace Blog\n\n initializer :factories, after: 'factory_girl.set_factory_paths' do\n if defined?(FactoryGirl)\n ...
ruby
chosen
[ { "from": "system", "value": "Update gemspec links and Rails dependency and humbly add myself as a coauthor\n" }, { "from": "human", "value": "$:.push File.expand_path(\"lib\", __dir__)\n\n# Maintain your gem's version:\nrequire \"action_text/version\"\n\n# Describe your gem and declare its depe...
ruby
chosen
[ { "from": "system", "value": "Add vcr to development dependencies\n" }, { "from": "human", "value": "$:.push File.expand_path(\"../lib\", __FILE__)\n\n# Maintain your gem's version:\nrequire \"fql/version\"\n\n# Describe your gem and declare its dependencies:\nGem::Specification.new do |s|\n s....
ruby
chosen
[ { "from": "system", "value": "Raise activesupport dep to one without security issues\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n$:.push File.expand_path('../lib', __FILE__)\nrequire 'vk/version'\n\nGem::Specification.new do |s|\n s.name = 'vk'\n s.version = Vk::VE...
ruby
chosen
[ { "from": "system", "value": "Add wrappers for popping lines off the stack\n" }, { "from": "human", "value": "module ReadlineNG\n\n VERSION_MAJOR = 0\n VERSION_MINOR = 0\n VERSION_PATCH = 1\n VERSION = \"#{VERSION_MAJOR}.#{VERSION_MINOR}.#{VERSION_PATCH}\"\n\n CONTROL_BS = \"\\x08\"\n CON...
ruby
chosen
[ { "from": "system", "value": "Add validation to put a format constraint on email attribute in User class\n" }, { "from": "human", "value": "class User < ActiveRecord::Base\n has_secure_password\n validates :username, :email, presence: true\n validates :email, uniqueness: true\n\n has_many :q...
ruby
chosen
[ { "from": "system", "value": "Add validations and fix associations\n" }, { "from": "human", "value": "class User < ActiveRecord::Base\n has_secure_password\n has_many :dogs, foreign_key: :owner\n has_many :bookings\n \n def age\n (Date.today - birthday).to_i / 365\n end\nend\n" }, {...
ruby
chosen
[ { "from": "system", "value": "Remove unhelpful comment from copy pasta\n" }, { "from": "human", "value": "ActiveAdmin.register_page 'Queue' do\n content do\n # Get runs that have a background worker\n workers = Sidekiq::Workers.new\n active_runs = workers.collect do |process_id, thread...
ruby
chosen
[ { "from": "system", "value": "Use '>=' for integer comparison\n" }, { "from": "human", "value": "class User < ActiveRecord::Base\n validates :first_name, presence: true\n validates :last_name, presence: true\n validates :email, presence: true, uniqueness: true\n has_secure_password\n\n def ...
ruby
chosen
[ { "from": "system", "value": "Add validations to the User model\n" }, { "from": "human", "value": "class User < ActiveRecord::Base\nend\n" }, { "from": "gpt", "value": "class User < ActiveRecord::Base\n VALID_EMAIL_REGEX = /\\A[\\w+\\-.]+@[a-z\\d\\-]+(\\.[a-z]+)*\\.[a-z]+\\z/i\n\n ...
ruby
chosen
[ { "from": "system", "value": "Use chef conditional instead of ruby conditional\n" }, { "from": "human", "value": "if node[\"lsb\"][\"codename\"] == 'precise'\n apt_repository \"boost-backports\" do\n uri \"http://ppa.launchpad.net/mapnik/boost/ubuntu\"\n distribution node[\"lsb\"...
ruby
chosen
[ { "from": "system", "value": "Create custom method to display actionable errors\n" }, { "from": "human", "value": "class User < ActiveRecord::Base\n attr_accessor :first_name, :last_name\n has_many :playlists, foreign_key: :admin_id\n has_many :votes\n\n has_secure_password\n before_validat...
ruby
chosen
[ { "from": "system", "value": "Store the http-referers of signups.\n" }, { "from": "human", "value": "class User\n include Mongoid::Document\n # Include default devise modules. Others available are: :token_authenticatable, :encryptable,\n # :confirmable, :lockable, :timeoutable, :database_auth...
ruby
chosen
[ { "from": "system", "value": "Add presence validation for votable_id in Vote class\n" }, { "from": "human", "value": "class Vote < ActiveRecord::Base\n belongs_to :votable, polymorphic: true\n\n validates :voter_id, presence: true\n validates :votable_type, presence: true\n validates :value,...
ruby
chosen
[ { "from": "system", "value": "Add license to gemspec and loosen version requirement for minitest\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n$:.push File.expand_path(\"../lib\", __FILE__)\nrequire \"possessify/version\"\n\nGem::Specification.new do |s|\n s.name = \"poss...
ruby
chosen
[ { "from": "system", "value": "Add development dependency, adjust summary text.\n" }, { "from": "human", "value": "require './lib/tchart/version'\n\nGem::Specification.new do |s|\n s.name = \"tchart\"\n s.summary = \"Generate TeX/TikZ charts.\"\n s.description ...
ruby
chosen
[ { "from": "system", "value": "Fix spec structure for pice\n" }, { "from": "human", "value": "require 'minitest/autorun'\n# require 'minitest/rg'\nrequire 'oga'\nrequire 'open-uri'\nrequire 'yaml'\nrequire 'json'\nrequire 'vcr'\nrequire 'webmock/minitest'\nrequire './lib/taiwan_tours/lonelyplanet...
ruby
chosen
[ { "from": "system", "value": "Support personal output for 2 people\n\nNow, when there are two people, you get a response like 'Bob and Alice'\ninstead of '2 people'. It'd be nice to know who you're going with if\nyou're a pair, so 3 is the limit for cardinal output.\n" }, { "from": "human", "va...
ruby
chosen
[ { "from": "system", "value": "Add validation of post text\n" }, { "from": "human", "value": "#encoding : utf-8\nrequire 'rubygems'\nrequire 'sinatra'\nrequire 'sinatra/reloader'\nrequire 'sqlite3'\n\ndef init_db\n\tdb = SQLite3::Database.new 'leprosorium.db'\n\tdb.results_as_hash = true\n\tretur...
ruby
chosen
[ { "from": "system", "value": "Add 32bit RHEL support for the nagios plugins directory\n\n\nFormer-commit-id: 73bc64ab57e2e2986ee985041d88b2940822a87a [formerly 4c6d5109c5c343f56ea43ac5b1b69969023b6a46] [formerly 2eb2a13bc4b9ec104dbb8c7b739851482f642e8e [formerly 48457e6f5fd0593a8257cfff2b84db3d7642f6a4]]\nF...
ruby
chosen
[ { "from": "human", "value": "Add iis ftp feature installation\n" }, { "from": "gpt", "value": "#\n# Author:: Kevin Rivers (<kevin@kevinrivers.com>)\n# Cookbook Name:: iis\n# Recipe:: mod_ftp\n#\n# Copyright 2014, Kevin Rivers\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\")...
ruby
chosen
[ { "from": "system", "value": "Change Dante dependency to allow v0.2.0 and play nice with Stripe Mocks\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/backburner/version', __FILE__)\n\nGem::Specification.new do |s|\n s.authors = [\"Nathan Esqu...
ruby
chosen
[ { "from": "system", "value": "Fix checksum in Inform Cask\n" }, { "from": "human", "value": "cask 'inform' do\n version '6M62'\n sha256 '6fd0442a4b64a66ee27f0d09caf27bcc117737bd997653b94e8404ef7795f963'\n\n url \"http://inform7.com/download/content/#{version}/I7-#{version}-OSX.dmg\"\n name '...
ruby
chosen
[ { "from": "system", "value": "Update Reeder to beta 5" }, { "from": "human", "value": "class Reeder < Cask\n url 'http://reederapp.com/beta-reeder-for-mac/Reeder2.0b2.zip'\n homepage 'http://reederapp.com/mac/'\n version '2.0b2'\n sha256 '67491dcfa999e753c1f220a4f1216f15e14bea32af7e5a9c31499...
ruby
chosen
[ { "from": "system", "value": "Fix homepage to use SSL in Skitch Cask\n\nThe HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly\nmakes it more secure and saves a HTTP round-trip.\n" }, { "from": "human", "value": "cask :v1 => 'skitch' do\n version '2.7.8'\n sha256 'f6...
ruby
chosen
[ { "from": "system", "value": "Update dev mode url on nfedobrasil spec\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe NfedoBrasil do\n describe '#client' do\n subject { NfedoBrasil.client({ssl_plcs_file: File.dirname(__FILE__) + '/../support/certificate.p12', ssl_plcs_pa...
ruby
chosen
[ { "from": "system", "value": "Make sure to test these models\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe BusStop do\n describe 'assign_completion_timestamp' do\n context 'bus stop is completed' do\n # need some time cop up in here\n it 'assigns the current ...
ruby
chosen
[ { "from": "system", "value": "Add pry as dev dependency\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'gittake/version'\n\nGem::Specification.new do |spec|\n spec.name = \...
ruby
chosen
[ { "from": "system", "value": "Use autoload for Resource classes\n" }, { "from": "human", "value": "require 'active_triples'\nrequire 'linked_vocabs'\n\nmodule DPLA\n require 'dpla/source_resource'\n require 'dpla/collection'\n require 'dpla/place'\n require 'dpla/time_span'\n require 'dpla/...
ruby
chosen
[ { "from": "system", "value": "Fix changing the timeout for the Publishing API client\n\nCalling the publishing_api_with_low_timeout function would cause the\nPublishing API client timeout to be set to 1, which would break parts\nof Whitehall that talk to the Publishing API, casuing it to \"hang up\"\nafter ...
ruby
chosen
[ { "from": "system", "value": "Remove migrated commands from imports\n" }, { "from": "human", "value": "require \"heroku/command/base\"\n\nmajor, minor, _ = Heroku::VERSION.split(/\\./).map(&:to_i)\nif (major > 3) || (major == 3 && minor >= 4)\n require File.expand_path('lib/heroku/client/heroku...
ruby
chosen
[ { "from": "system", "value": "Remove vedeu from Menu class.\n" }, { "from": "human", "value": "$LOAD_PATH.unshift(File.dirname(__FILE__))\n\nrequire \"too_dead/version\"\nrequire 'too_dead/init_db'\nrequire 'too_dead/user'\nrequire 'too_dead/todo_list'\nrequire 'too_dead/todo_item'\n\nrequire 'p...
ruby
chosen
[ { "from": "system", "value": "Include rails router and action number helper module to page base model\n" }, { "from": "human", "value": "require \"ule_page/version\"\nrequire 'rails'\nrequire 'active_record'\nrequire 'site_prism'\n\nmodule UlePage\n autoload :Page, 'ule_page/page'\n autoload :...
ruby
chosen
[ { "from": "system", "value": "Fix naming error produced from a copy and paste" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe 'astrill' do\n\n it { should contain_class('astrill') }\n it { should contain_package('Astrill').with_provider('appdmg') }\n it { should contain_pac...
ruby
chosen
[ { "from": "human", "value": "Add some unit tests for lib/api/helpers.rb\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe API::Helpers do\n subject { Class.new.include(described_class).new }\n\n describe '#find_namespace' do\n let(:namespace) { create(:namespace) }\n\n s...
ruby
chosen
[ { "from": "system", "value": "Use fixed values rather than repeat the calculation in specs" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Zxcvbn::Scoring::Entropy do\n include Zxcvbn::Scoring::Math\n\n let(:entropy) {\n Class.new do\n include Zxcvbn::Scoring::Entrop...
ruby
chosen
[ { "from": "system", "value": "Make homepage / Welsh test less coupled to Welsh locale file\n\nThe previous iteration of this test checked that 1) English text\nappeared, and 2) Welsh text did not appear.\nWhilst that fulfilled the needs of the test, 2) is a bit redundant,\ngiven that we don't render a Welsh...
ruby
chosen
[ { "from": "human", "value": "Add tests for the logger.\n\n\ngit-svn-id: 0b34dac3a39d255f46ac888f3fd4ecac3c863f70@93 b2217739-5cbd-4580-87d5-f689c6e5027b\n" }, { "from": "gpt", "value": "require File.expand_path('../../test_helper', __FILE__)\n\ndescribe \"CertificateDepot::Log\" do\n before do\...
ruby
chosen
[ { "from": "system", "value": "Rewrite tagging spreadsheet validations in consistent style\n" }, { "from": "human", "value": "class TaggingSpreadsheet < ActiveRecord::Base\n validates :url, presence: true\n validates_presence_of :state\n validates_inclusion_of :state, in: %w(uploaded errored r...
ruby
chosen
[ { "from": "system", "value": "Fix issue with cookbook dependency version constraint\n" }, { "from": "human", "value": "name 'octopus-deploy'\nmaintainer 'Montague, Brent'\nmaintainer_email 'BMontague@cvent.com'\nlicense 'Apache 2.0'\ndescription 'Handles installing Octopus Deploy Server &| Tenta...
ruby
chosen
[ { "from": "system", "value": "Send all command line parameters\n" }, { "from": "human", "value": "require 'amqp'\nrequire 'mq'\n\nexit(1) unless ARGV.size == 1\ndata = Marshal.dump(ARGV[0])\n\nSignal.trap('INT') { AMQP.stop{ EM.stop } }\n\nAMQP.start do\n\tmq = MQ.new\n\texchange = mq.direct('om...
ruby
chosen
[ { "from": "human", "value": "Add nested parameter support to Sinatra. Gets the job done till redux is out\n" }, { "from": "gpt", "value": "module Sinatra\n class EventContext\n def params\n @params ||= ParamsParser.new(@route_params.merge(@request.params)).to_hash\n end\n \n pr...
ruby
chosen
[ { "from": "system", "value": "Configure pathogen for autoload system-wide bundles\n" }, { "from": "human", "value": "add_vim_git_plugin({ \"vundle\" => \"https://github.com/gmarik/vundle.git\",\n \"unbundle\" => \"https://github.com/sunaku/vim-unbundle.git\",\n ...
ruby
chosen
[ { "from": "system", "value": "Remove oven from development dependency\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'pivnet_api/version'\n\nGem::Specification.new do |spec|\n spec....
ruby
chosen
[ { "from": "human", "value": "Print out packets that dont match fairly narrow expectations\n" }, { "from": "gpt", "value": "class KprobeOutput\n attr_reader :fn, :src_ip, :dst_ip, :type\n\n FN_TO_NAME = {\n 1 => 'netif_receive_skb',\n 2 => 'ip_rcv',\n 3 => 'ip_forward',\n 4 => 'ip_o...
ruby
chosen
[ { "from": "system", "value": "Update Light Table to 0.6.5\n" }, { "from": "human", "value": "class Lighttable < Cask\n url 'http://d35ac8ww5dfjyg.cloudfront.net/playground/bins/0.6.4/LightTableMac.zip'\n homepage 'http://www.lighttable.com/'\n version '0.6.4'\n sha256 'b6a925c50cb2dfe8de9b21...
ruby
chosen
[ { "from": "human", "value": "Add cask for Vienna RSS reader\n" }, { "from": "gpt", "value": "class ViennaRss < Cask\n url 'http://downloads.sourceforge.net/vienna-rss/Vienna3.0.0_beta11.tgz'\n homepage 'http://www.vienna-rss.org'\n version '3.0.0_beta11'\n sha1 'c1530387fb471331ed3947994e207...
ruby
chosen
[ { "from": "system", "value": "JariBakken: Update file detector Ruby example.\n\nr14082\n" }, { "from": "human", "value": "module Selenium\n module WebDriver\n\n #\n # @api private\n #\n\n module DriverExtensions\n module UploadsFiles\n\n #\n # Set the file detecto...
ruby
chosen
[ { "from": "system", "value": "Add test for the short variant\n" }, { "from": "human", "value": "require \"lita-googlefight\"\nrequire \"lita/rspec\"\n# A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin\n# was generated with Lita 4, the compatibility mode...
ruby
chosen
[ { "from": "system", "value": "Use shoulda matchers for spec refactors\n" }, { "from": "human", "value": "require 'rails_helper'\n\n# RSpec.describe User, type: :model do\n# pending \"add some examples to (or delete) #{__FILE__}\"\n# end\n\n\ndescribe User do\n before { @user = FactoryGirl.bui...
ruby
chosen
[ { "from": "system", "value": "Add update_rubygems to reserve list\n" }, { "from": "human", "value": "module Patterns\n extend ActiveSupport::Concern\n\n SPECIAL_CHARACTERS = \".-_\".freeze\n ALLOWED_CHARACTERS = \"[A-Za-z0-9#{Regexp.escape(SPECIAL_CHARACTERS)}]+\".freeze\n ROUTE_PATTER...
ruby
chosen
[ { "from": "system", "value": "Update rails version to 4.1.5\n" }, { "from": "human", "value": "# coding: UTF-8\n\n$:.push File.expand_path(\"../lib\", __FILE__)\n\n# Maintain your gem's version:\nrequire \"tematica/version\"\n\n# Describe your gem and declare its dependencies:\nGem::Specificatio...
ruby
chosen
[ { "from": "system", "value": "Customize the sanitization whitelist only once\n\nFixes #1651\n" }, { "from": "human", "value": "require 'html/pipeline/filter'\nrequire 'html/pipeline/sanitization_filter'\n\nmodule Gitlab\n module Markdown\n # Sanitize HTML\n #\n # Extends HTML::Pipeline...
ruby
chosen
[ { "from": "system", "value": "Add preview for new supervisor role mail notification\n" }, { "from": "human", "value": "class RoleMailerPreview < ActionMailer::Preview\n def user_added_to_team\n RoleMailer.user_added_to_team(Role.first)\n end\n\n def coach_added_to_team\n RoleMailer.user...
ruby
chosen
[ { "from": "system", "value": "Fix an offense reported by UnderscorePrefixedVariableName\n" }, { "from": "human", "value": "# encoding: utf-8\n\nmodule Rubocop\n module Cop\n module Style\n # This cop checks for methods invoked via the :: operator instead\n # of the . operator (like...
ruby
chosen
[ { "from": "system", "value": "Switch to Ruby 1.9 hash syntax\n" }, { "from": "human", "value": "#\n# Cookbook Name:: gluster\n# Resource:: mount\n#\n# Copyright 2015, Biola University\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in c...
ruby
chosen
[ { "from": "system", "value": "Update Vidyo client to newest package\n" }, { "from": "human", "value": "\n\ndeb_name = 'VidyoDesktopInstaller-ubuntu64-TAG_VD_3_5_4_010.deb'\ndeb_path = \"#{Chef::Config[:file_cache_path]}/#{deb_name}\"\nremote_file deb_path do\n source \"https://demo.vidyo.com/up...
ruby
chosen
[ { "from": "system", "value": "Update gemspec to use the latest version of loveseat" }, { "from": "human", "value": "$:.push File.expand_path(\"../lib\", __FILE__)\n\nrequire 'comfy_blog/version'\n\nGem::Specification.new do |s|\n s.name = 'comfy_blog'\n s.version = ComfyBlog::VERSIO...
ruby
chosen
[ { "from": "system", "value": "QUALITY: Use two space indentation for hash\n" }, { "from": "human", "value": "#\n# Finds or creates a student if not found\n#\ndef find_or_create_student(username)\n user_created = nil\n using_cache = !@user_cache.nil?\n if !using_cache || !@user_cache.key?(user...
ruby
chosen
[ { "from": "system", "value": "Remove monkey patches on render\n" }, { "from": "human", "value": "class ActionMailer::Base\n\n attr_accessor :environment\n\n # Monkey patch to:\n # 1) Allow multiple render calls, by keeping the body assigns into an instance variable\n # 2) Don't render layout...
ruby
chosen
[ { "from": "system", "value": "Return buffer from generator function.\n" }, { "from": "human", "value": "require \"json\"\n\nmodule Temple\n module CoffeeScript\n class Generator < Temple::Generator\n define_options :indent => 0\n\n def call(exp)\n @indent = options[:indent]\...
ruby
chosen
[ { "from": "system", "value": "Move user creation into setup.\n" }, { "from": "human", "value": "$:.unshift File.join(File.dirname(__FILE__),'..','lib')\n\nrequire 'test/unit'\nrequire 'user'\n\nclass UserTest < Test::Unit::TestCase\n def test_initialize\n user = User.new 'user@example.com'\n...
ruby
chosen
[ { "from": "system", "value": "Use serialized hashes instead of hand rolled JSON\n" }, { "from": "human", "value": "require \"bunny\"\r\nrequire \"json\"\r\n\r\nputs \"I want some pizza\"\r\n\r\nsession = Bunny.new(:host => \"localhost\", :username => \"craftsman\", :password => \"utahsc2015\")\r...
ruby
chosen
[ { "from": "system", "value": "Raise error when client is nil\n" }, { "from": "human", "value": "require 'active_support/core_ext/hash/keys'\nrequire 'erb'\nrequire 'yaml'\n\nmodule Mikoshi\n class Plan\n class Base\n attr_reader :data, :client\n\n def initialize(yaml_path: nil, cli...
ruby
chosen
[ { "from": "system", "value": "Fix files definition in gemspec.\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = 'mdspell'\n s.version = '0.1.0'\n\n s.author = 'Marek Tuchowski'\n s.email = 'marek@tuchowski.com.pl'\n s.home...
ruby
chosen
[ { "from": "system", "value": "Tweak gem's description and summary.\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'que/version'\n\nGem::Specification.new do |spec|\n spec.name ...
ruby
chosen
[ { "from": "human", "value": "Add cron job to refresh cache\n\nI went for 1 hour as that is the current refresh\nrate for caches.\n\nhttps://trello.com/c/knffA0Fb/786-import-the-new-topic-registry-on-a-schedule-s\n" }, { "from": "gpt", "value": "# Use this file to easily define all of your cron j...
ruby
chosen
[ { "from": "system", "value": "Add crons to check env\n" }, { "from": "human", "value": "# Use this file to easily define all of your cron jobs.\n#\n# It's helpful, but not entirely necessary to understand cron before proceeding.\n# http://en.wikipedia.org/wiki/Cron\n\n# Example:\n#\n# set :outpu...
ruby
chosen
[ { "from": "system", "value": "Move rake task to 1:30am\n\nSo not to conflic with export:redirector_mappings which is a heavy task\n" }, { "from": "human", "value": "$: << '.'\nrequire File.dirname(__FILE__) + \"/initializers/scheduled_publishing\"\n# default cron env is \"/usr/bin:/bin\" which i...
ruby
chosen
[ { "from": "system", "value": "Test that the group profile page is working.\n" }, { "from": "human", "value": "require \"spec_helper\"\n\ndescribe \"Group profiles\" do\n context \"as a group member\" do\n include_context \"signed in as a group member\"\n\n describe \"editing the group pro...
ruby
chosen
[ { "from": "system", "value": "Make sure client names are unique within a company\n" }, { "from": "human", "value": "class Customer < ActiveRecord::Base\n belongs_to :company\n has_many :projects, :order => \"name\", :dependent => :destroy\n has_many :work_logs\n has_many :p...
ruby
chosen
[ { "from": "system", "value": "Connect signal for destroy event.\n" }, { "from": "human", "value": "require 'rubygems'\nrequire 'ffi'\nmodule Gtk\n extend FFI::Library\n\n ffi_lib \"gtk-x11-2.0\"\n attach_function :gtk_init, [:pointer, :pointer], :void\n attach_function :gtk_main, [], :void\n...
ruby
chosen
[ { "from": "system", "value": "Add no-cache header to prevent Safari on IOS6 from caching POST requests (sic!)\n" }, { "from": "human", "value": "# encoding: utf-8\nrequire \"json\"\nrequire \"pebblebed/sinatra\"\n\nDir.glob(\"#{File.dirname(__FILE__)}/v1/**/*.rb\").each { |file| require file }\n...
ruby
chosen
[ { "from": "system", "value": "Remove the login_module requirement from rspec helper\n" }, { "from": "human", "value": "run \"rm -rf test\"\ngenerate \"cucumber:install\", \"--rspec\"\n\ndrop_config = <<-CODE\nconfig.before(:each) do \n MongoMapper.database.collections.select { |c| c.name != 's...
ruby
chosen
[ { "from": "system", "value": "Fix flags without arguments (`--with-cov --dump post`)\n" }, { "from": "human", "value": "args = ARGV.dup\nflag = nil\n$settings = {}\n\nwhile args.count > 0\n arg = args.shift.strip\n next if arg.empty?\n if flag.nil?\n if arg.start_with? '--'\n flag = a...
ruby
chosen
[ { "from": "system", "value": "Stop changing the times of results\n" }, { "from": "human", "value": "module Blocktrain\n module Aggregations\n class HistogramAggregation < Aggregation\n\n def aggs\n {\n results: {\n date_histogram: {\n field: 'time...
ruby
chosen