Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Create single item array filter code
# frozen_string_literal: true require_relative '../filter' require 'set' module OctocatalogDiff module CatalogDiff class Filter # Filter out changes in parameters when one catalog has a parameter that's a string and # the other catalog has that same parameter as an array containing the same string....
# frozen_string_literal: true require_relative '../filter' require 'set' module OctocatalogDiff module CatalogDiff class Filter # Filter out changes in parameters when one catalog has a parameter that's an object and # the other catalog has that same parameter as an array containing the same object...
Use name instead of to_s
require 'test_helper' class TestToriDefine < Test::Unit::TestCase setup do @orig = Tori.config.filename_callback Tori.config.filename_callback = ->(model){ model } Tori.config.backend = Tori::Backend::FileSystem.new Pathname("test").join("tmp") end teardown do Tori.config.filename_call...
require 'test_helper' class TestToriDefine < Test::Unit::TestCase setup do @orig = Tori.config.filename_callback Tori.config.filename_callback = ->(model){ model } Tori.config.backend = Tori::Backend::FileSystem.new Pathname("test").join("tmp") end teardown do Tori.config.filename_call...
Package version is increased from 2.2.8.0 to 2.3.0.0
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'evt-schema' s.summary = "Primitives for schema and data structure" s.version = '2.2.8.0' s.description = ' ' s.authors = ['The Eventide Project'] s.email = 'opensource@eventide-project.org' s.homepage = 'https://github.com/eventide-project...
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'evt-schema' s.summary = "Primitives for schema and data structure" s.version = '2.3.0.0' s.description = ' ' s.authors = ['The Eventide Project'] s.email = 'opensource@eventide-project.org' s.homepage = 'https://github.com/eventide-project...
Test if page has a link back to uploader
require 'spec_helper' describe "images/show" do before(:each) do @image = assign(:image, stub_model(Image)) end it "renders attributes in <p>" do render # Run the generator again with the --webrat flag if you want to use webrat matchers end it 'shows the user that uploaded this image' do up...
require 'spec_helper' describe "images/show" do before(:each) do @image = assign(:image, stub_model(Image)) end it "renders attributes in <p>" do render # Run the generator again with the --webrat flag if you want to use webrat matchers end it 'shows the user that uploaded this image' do up...
Add column_name options to sort in the collection table helper.
module Rails module AddOns module TableHelper def collection_table(options = {}, &block) Component::CollectionTable.new(self, options, &block).perform end def resource_table(options = {}, &block) Component::ResourceTable.new(self, options, &block).perform end def so...
module Rails module AddOns module TableHelper def collection_table(options = {}, &block) Component::CollectionTable.new(self, options, &block).perform end def resource_table(options = {}, &block) Component::ResourceTable.new(self, options, &block).perform end def so...
Fix place editions - displaying the results
class PublicationPresenter include GdsApi::PartMethods attr_reader :artefact attr_accessor :places def initialize(artefact) @artefact = artefact end PASS_THROUGH_KEYS = [ :title, :details, :web_url ] PASS_THROUGH_DETAILS_KEYS = [ :body, :introduction, :expectations, :video_url, :alterna...
class PublicationPresenter include GdsApi::PartMethods attr_reader :artefact attr_accessor :places def initialize(artefact) @artefact = artefact end PASS_THROUGH_KEYS = [ :title, :details, :web_url ] PASS_THROUGH_DETAILS_KEYS = [ :body, :introduction, :expectations, :video_url, :alterna...
Update gemspec to use README.md not README.rdoc
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "flair/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "flair" s.version = Flair::VERSION s.authors = ["TODO: Your name"] s.email = ["TODO: Your email"] ...
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "flair/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "flair" s.version = Flair::VERSION s.authors = ["TODO: Your name"] s.email = ["TODO: Your email"] ...
Add Spec for Version11 Api
require 'spec_helper' describe ManageEngine::AppManager::Api::Version11 do subject { ManageEngine::AppManager::Api.new("11") } it "returns the connect_path" do subject.should respond_to(:connect_path) subject.connect_path.should be_instance_of(String) end end
Add cask for Daisydisk Beta
cask :v1 => 'daisydisk-beta' do version :latest sha256 :no_check url 'http://daisydiskapp.com/downloads/DaisyDiskBeta.zip' appcast 'http://www.daisydiskapp.com/downloads/appcastFeed.php' name 'DaisyDisk' homepage 'http://www.daisydiskapp.com' license :freemium app 'DaisyDisk.app' depends_on :macos ...
Make podspec point to version 0.3
Pod::Spec.new do |s| s.name = 'LRImageManager' s.version = '0.2' s.license = 'MIT' s.summary = 'Objective-C simple image manager with memory and disk cache support.' s.homepage = 'https://github.com/luisrecuenco/LRImageManager.git' s.author = { "Luis Recuenco" => "luisrecuenco@gmail.com" } s.sour...
Pod::Spec.new do |s| s.name = 'LRImageManager' s.version = '0.3' s.license = 'MIT' s.summary = 'Objective-C simple image manager with memory and disk cache support.' s.homepage = 'https://github.com/luisrecuenco/LRImageManager.git' s.author = { "Luis Recuenco" => "luisrecuenco@gmail.com" } s.sour...
Fix feature spec for adding offers
require 'rails_helper' RSpec.describe "Company adds Offer" do let(:company) { Company.first || FactoryGirl.create(:company) } before do login_as(company, scope: :user) visit offers_path end subject { page.body } it { is_expected.to have_content I18n.t('offers.add_new_offer') } it "creates a new ...
require 'rails_helper' RSpec.describe "Company adds Offer" do let(:company) { Company.first || FactoryGirl.create(:company) } let!(:country) { FactoryGirl.create(:country) } before do login_as(company, scope: :user) visit offers_path end subject { page.body } it { is_expected.to have_content I18n...
Upgrade CMake 3 to v3.0.2
require 'formula' class NoExpatFramework < Requirement def expat_framework '/Library/Frameworks/expat.framework' end satisfy :build_env => false do not File.exist? expat_framework end def message; <<-EOS.undent Detected #{expat_framework} This will be picked up by CMake's build system and ...
require 'formula' class NoExpatFramework < Requirement def expat_framework '/Library/Frameworks/expat.framework' end satisfy :build_env => false do not File.exist? expat_framework end def message; <<-EOS.undent Detected #{expat_framework} This will be picked up by CMake's build system and ...
Add spec for appdmg_eula package provider
#! /usr/bin/env ruby require 'spec_helper' describe Puppet::Type.type(:package).provider(:appdmg_eula) do let(:resource) { Puppet::Type.type(:package).new(:name => 'foo', :provider => :appdmg_eula) } let(:provider) { described_class.new(resource) } describe "when installing an appdmg with an eula" do let(:...
Fix stop removal in efforts/show view for multi-lap events.
# frozen_string_literal: true class EffortShowView < EffortWithLapSplitRows delegate :full_name, :bib_number, :gender, :split_times, :finish_status, :report_url, :beacon_url, :photo, :overall_rank, :gender_rank, :started?, :finished?, :dropped?, :in_progress?, to: :effort delegate :event_name, :person,...
# frozen_string_literal: true class EffortShowView < EffortWithLapSplitRows delegate :full_name, :bib_number, :gender, :split_times, :finish_status, :report_url, :beacon_url, :photo, :overall_rank, :gender_rank, :started?, :finished?, :dropped?, :in_progress?, :final_lap, :stopped_lap, :final_...
Return plain body on error when parsing response for json
module {{call .Fnc.camelize .Pkg.Name}} module HttpClient # ResponseHandler takes care of decoding the response body into suitable type class ResponseHandler def self.get_body(response) type = response.headers["content-type"] body = response.body {{if .Api.Response.Formats.Json}} ...
module {{call .Fnc.camelize .Pkg.Name}} module HttpClient # ResponseHandler takes care of decoding the response body into suitable type class ResponseHandler def self.get_body(response) type = response.headers["content-type"] body = response.body {{if .Api.Response.Formats.Json}} ...
Add solution to problem 17
=begin If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? NOTE: Do not count spaces or hyphens. For example, 34...
Add sorting of the boards.
require 'sinatra' require 'haml' require 'leankitkanban' enable :sessions before do LeanKitKanban::Config.account = session[:account] LeanKitKanban::Config.email = session[:email] LeanKitKanban::Config.password = session[:password] end get '/' do haml :login end post '/' do @account = params[:accoun...
require 'sinatra' require 'haml' require 'leankitkanban' enable :sessions before do LeanKitKanban::Config.account = session[:account] LeanKitKanban::Config.email = session[:email] LeanKitKanban::Config.password = session[:password] end get '/' do haml :login end post '/' do @account = params[:accoun...
Set secret token from ENV in production and raise error if not done
# Be sure to restart your server when you modify this file. # Your secret key is used for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to diction...
# Be sure to restart your server when you modify this file. # Your secret key is used for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to diction...
Add all and use view for single display
get '/task/:id' do |id| @task = Task.find(id) @task.description end get '/tasks/new' do erb :'task/new' end post '/tasks' do puts params.inspect task = Task.create(params[:task]) redirect ("/task/#{task.id}") end get '/task/:id/edit' do |id| @task = Task.find(id) erb :'task/edit' end put '/task/:id'...
get '/task/:id' do |id| @task = Task.find(id) erb :'task/single', locals: {task: @task} end get '/tasks/all' do @tasks = Task.all erb :'task/all' end get '/tasks/new' do erb :'task/new' end post '/tasks' do puts params.inspect task = Task.create(params[:task]) redirect ("/task/#{task.id}") end get ...
Add task to poll queue
require 'chronic' # https://github.com/ssoroka/scheduler_daemon class PollInjectionResponsesTask < Scheduler::SchedulerTask environments :production, :demo every '1m' def run queue = Settings.aws.response_queue return unless queue log("Checking for messages on #{queue}") MessageQueue::AwsClient....
Add support for Watir::Browser.start, Watir::Browser.attach and any other Watir::Browser methods.
require File.expand_path('version', File.dirname(__FILE__)) module Watir class Browser class << self def new(browser=nil, *args) if browser && browser.to_sym != :ie && Watir.driver == :classic Watir.driver = :webdriver end Watir.load_driver if Watir.driver == :we...
require File.expand_path('version', File.dirname(__FILE__)) module Watir class Browser class << self def new(browser=nil, *args) load_driver_for browser if Watir.driver == :webdriver # remove this class method for WebDriver to avoid endless loop singleton_class = class...
Correct heading sizes in tests for visualization page
require_relative 'minitest_helper' class TestWeb < MiniTest::Unit::TestCase include Rack::Test::Methods def app RubyStats end def test_redirect get '/' follow_redirect! assert last_response.ok? end def test_ruby_targets get '/ruby_targets' assert last_response.ok? assert last_response.body.inclu...
require_relative 'minitest_helper' class TestWeb < MiniTest::Unit::TestCase include Rack::Test::Methods def app RubyStats end def test_redirect get '/' follow_redirect! assert last_response.ok? end def test_ruby_targets get '/ruby_targets' assert last_response.ok? assert last_response.body.inclu...
Add test for context option
RSpec.describe Hanami::Router do describe "context option" do let(:app) { Rack::MockRequest.new(router) } let(:router) { described_class.new(context: context, &routes) } let(:routes) { proc do |context| mount -> _ { [200, {}, ["context says #{context.greeting}"]] }, at: "...
Call the right method in the spec
require 'spec_helper' describe Dotenv::Environment do subject { env("OPTION_A=1\nOPTION_B=2") } describe 'initialize' do it 'reads the file' do expect(subject['OPTION_A']).to eq('1') expect(subject['OPTION_B']).to eq('2') end it 'fails if file does not exist' do expect { Dot...
require 'spec_helper' describe Dotenv::Environment do subject { env("OPTION_A=1\nOPTION_B=2") } describe 'initialize' do it 'reads the file' do expect(subject['OPTION_A']).to eq('1') expect(subject['OPTION_B']).to eq('2') end it 'fails if file does not exist' do expect { Dot...
Rename Dims -> Measurb. Add more specs.
require 'spec_helper' describe Dims do describe '.define' do before :example do clear_defined_inches end shared_context 'adding the Numeric method' do |method, options = {}| it 'adds the Numeric method' do int = 42 float = 3.14 expect { int.__send__(method) }.to ...
require 'spec_helper' describe Measurb do describe '.define' do before :example do clear_defined_inches end shared_context 'adding the Numeric method' do |method, options = {}| it 'adds the Numeric method' do int = 42 float = 3.14 expect { int.__send__(method) }.to...
Use finish_timeout constant rather than 15s in timer_game_end
module PugBot # The plugin to be imported into a cinch bot instance that actually interprets # the users input, tracks players and controls nearly all running of the pug # bot itself. class BotPlugin # When a game ends, start a timer until the game is actually deleted by # Game.timeout and the players c...
module PugBot # The plugin to be imported into a cinch bot instance that actually interprets # the users input, tracks players and controls nearly all running of the pug # bot itself. class BotPlugin # When a game ends, start a timer until the game is actually deleted by # Game.timeout and the players c...
Improve module namespacing for ResponseDecorator
module SolidusShipwire::Response def resource body['resource'].with_indifferent_access end def to_sku_id_hashmap Hash[resource[:items].map do |v| [v[:resource][:sku], v[:resource][:id]] end] end def next? resource[:next].present? end end end Shipwire::Response.prepend SolidusShip...
module SolidusShipwire module ResponseDecorator def resource body['resource'].with_indifferent_access end def to_sku_id_hashmap Hash[resource[:items].map do |v| [v[:resource][:sku], v[:resource][:id]] end] end def next? resource[:next].present? end Shipwi...
Replace playlist search with api search
require 'rubygems' require 'httparty' $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'httparty_ext.rb' class Tagooru autoload :Playlist, 'tagooru/playlist' autoload :Track, 'tagooru/track' include HTTParty base_uri 'http://tagoo.ru' default_params :for => :audio def self.search(query, page = 1) ...
require 'rubygems' require 'httparty' $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'httparty_ext.rb' class Tagooru autoload :Playlist, 'tagooru/playlist' autoload :Track, 'tagooru/track' include HTTParty base_uri 'http://tagoo.ru' default_params :for => :audio, :key => '74d8940f' headers 'Referer' ...
Remove version limitation on sidekiq
# -*- encoding: utf-8 -*- require File.expand_path('../lib/sidekiq-status/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ['Evgeniy Tsvigun'] gem.email = ['utgarda@gmail.com'] gem.summary = 'An extension to the sidekiq message processing to track your jobs' gem.homepage ...
# -*- encoding: utf-8 -*- require File.expand_path('../lib/sidekiq-status/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ['Evgeniy Tsvigun'] gem.email = ['utgarda@gmail.com'] gem.summary = 'An extension to the sidekiq message processing to track your jobs' gem.homepage ...
Change to be specific about dev dependencies
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'finite_machine/version' Gem::Specification.new do |spec| spec.name = "finite_machine" spec.version = FiniteMachine::VERSION spec.authors = ["Piotr Murach"] spec.email...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'finite_machine/version' Gem::Specification.new do |spec| spec.name = "finite_machine" spec.version = FiniteMachine::VERSION spec.authors = ["Piotr Murach"] spec.email...
Add new line to trigger TravisCI.
require 'httparty' require 'zoo_app/models/alligator' module ZooApp class AnimalServiceError < StandardError; end class AnimalServiceClient include HTTParty base_uri 'animal-service.com' def self.find_alligators response = get("/alligators", :headers => {'Accept' => 'application/json'}) ...
require 'httparty' require 'zoo_app/models/alligator' module ZooApp class AnimalServiceError < StandardError; end class AnimalServiceClient include HTTParty base_uri 'animal-service.com' def self.find_alligators response = get("/alligators", :headers => {'Accept' => 'application/json'}) ...
Add pry as development dependency
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = "fluent-plugin-midi" spec.version = "0.0.1" spec.authors = ["meganemura"] spec.email = ["mura2megane@gmail.com"] spec.su...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = "fluent-plugin-midi" spec.version = "0.0.1" spec.authors = ["meganemura"] spec.email = ["mura2megane@gmail.com"] spec.su...
Add @since to the latest helper
# # Copyright:: Copyright 2018-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # 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-...
# # Copyright:: Copyright 2018-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # 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-...
Add development dependency for running rake
# ecoding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'chinese_faker/version' Gem::Specification.new do |spec| spec.name = "chinese_faker" spec.version = ChineseFaker::VERSION spec.authors = ["Bernie Chiu"] spec.email ...
# ecoding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'chinese_faker/version' Gem::Specification.new do |spec| spec.name = "chinese_faker" spec.version = ChineseFaker::VERSION spec.authors = ["Bernie Chiu"] spec.email ...
Upgrade Thunderbird (Japanese) to 38.3.0
cask :v1 => 'thunderbird-ja' do version '38.2.0' sha256 '2014b6fac54d398f63c442cc531ddfa77b604ecd616a98e67b2197225135398b' url "https://download.mozilla.org/?product=thunderbird-#{version}&os=osx&lang=ja-JP-mac" name 'Mozilla Thunderbird' homepage 'https://www.mozilla.jp/thunderbird/' license :mpl tags :...
cask :v1 => 'thunderbird-ja' do version '38.3.0' sha256 '0b023a4173b05f59589124db197bac413c4d81f8d53894cb0e2c57ef2b2d53c4' url "https://download.mozilla.org/?product=thunderbird-#{version}&os=osx&lang=ja-JP-mac" name 'Mozilla Thunderbird' homepage 'https://www.mozilla.jp/thunderbird/' license :mpl tags :...
Update podspec versino: 0.6.0 -> 0.6.1
Pod::Spec.new do |s| s.name = 'POSRx' s.version = '0.6.0' s.license = 'MIT' s.summary = 'Utilities around ReactiveCocoa.' s.homepage = 'https://github.com/pavelosipov/POSRx' s.authors = { 'Pavel Osipov' => 'posipov84@gmail.com' } s.source = { :git => 'https://github.c...
Pod::Spec.new do |s| s.name = 'POSRx' s.version = '0.6.1' s.license = 'MIT' s.summary = 'Utilities around ReactiveCocoa.' s.homepage = 'https://github.com/pavelosipov/POSRx' s.authors = { 'Pavel Osipov' => 'posipov84@gmail.com' } s.source = { :git => 'https://github.c...
Increase version number to 1.0.1
Pod::Spec.new do |s| s.name = 'Verso' s.version = '1.0.0' s.summary = 'A multi-paged image viewer for iOS' s.description = <<-DESC Verso makes it easy to implement a flexible multi-page book-like layout. DESC s.homepage = 'https://github.com/...
Pod::Spec.new do |s| s.name = 'Verso' s.version = '1.0.1' s.summary = 'A multi-paged image viewer for iOS' s.description = <<-DESC Verso makes it easy to implement a flexible multi-page book-like layout. DESC s.homepage = 'https://github.com/...
Reimplement APICache but heavily reduce the cache time
require 'net/http' require 'json' module HttpRequest def self.json(key:, uri_string:) JSON.parse(get_request(key: key, uri_string: uri_string)) end def self.get_request(key:, uri_string:) # http://stackoverflow.com/a/4581116/4765379 url = URI.parse(uri_string) request = Net::HTTP::Get.new(url.to...
require 'net/http' require 'json' module HttpRequest def self.json(key:, uri_string:) JSON.parse(get_request(key: key, uri_string: uri_string)) end def self.get_request(key:, uri_string:) APICache.get(key, :cache => 60) do # http://stackoverflow.com/a/4581116/4765379 url = URI.parse(uri_stri...
Load crops from search, without hitting the database
# frozen_string_literal: true class CropSearchService # Crop.search(string) def self.search(query, page: 1, per_page: 12, current_member: nil) search_params = { page: page, per_page: per_page, fields: %i(name^5 alternate_names scientific_names), match: :word_sta...
# frozen_string_literal: true class CropSearchService # Crop.search(string) def self.search(query, page: 1, per_page: 12, current_member: nil) search_params = { page: page, per_page: per_page, fields: %i(name^5 alternate_names scientific_names), match: :word_sta...
Resolve offenses from new RuboCop
# frozen_string_literal: true require 'forwardable' class Filewatcher # Class for snapshots of file system class Snapshot extend Forwardable def_delegators :@data, :[], :each, :keys def initialize(filenames) @data = filenames.each_with_object({}) do |filename, data| data[filename] = Sna...
# frozen_string_literal: true require 'forwardable' class Filewatcher # Class for snapshots of file system class Snapshot extend Forwardable def_delegators :@data, :[], :each, :keys def initialize(filenames) @data = filenames.each_with_object({}) do |filename, data| data[filename] = Sna...
Fix JavaScript minification rake task
namespace :js do desc "Minify javascript src for production environment" task :min => :environment do # list of files to minify libs = ['public/javascripts/prototype.js', 'public/javascripts/effects.js', 'public/javascripts/application.js'] # paths to jsmin script and final mi...
namespace :js do desc "Minify javascript src for production environment" task :min => :environment do # list of files to minify libs = ['public/deezy/javascripts/prototype.js', 'public/deezy/javascripts/effects.js', 'public/deezy/javascripts/application.js'] # paths to jsmin s...
Rename parameter for the API
require 'httparty' class XboxLeaders::Api include HTTParty base_uri 'https://www.xboxleaders.com/api/1.0' attr_accessor :timeout def initialize(timeout: 6) @timeout = timeout end def fetch_achievements(gamertag, game_id) get('/achievements', gamertag: gamertag, gameid: game_id) end def f...
require 'httparty' class XboxLeaders::Api include HTTParty base_uri 'https://www.xboxleaders.com/api/1.0' attr_accessor :timeout def initialize(timeout: 6) @timeout = timeout end def fetch_achievements(gamertag, game_id) get('/achievements', gamertag: gamertag, titleid: game_id) end def ...
Add required ruby version to gem
$:.push File.expand_path("../lib", __FILE__) # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "addresses" s.authors = ["Wilbert Ribeiro", "Joice Taciana"] s.email = ["wkelyson@gmail.com", "joicetaciana@gmail.com"] s.version = '1.0.1' s.homepage ...
$:.push File.expand_path("../lib", __FILE__) # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "addresses" s.authors = ["Wilbert Ribeiro", "Joice Taciana"] s.email = ["wkelyson@gmail.com", "joicetaciana@gmail.com"] s.version = '1.0.1' s.homepage ...
Update gem version to 0.3.0
# frozen_string_literal: true Gem::Specification.new do |spec| spec.name = "no-style-please" spec.version = "0.2.0" spec.authors = ["Riccardo Graziosi"] spec.email = ["riccardo.graziosi97@gmail.com"] spec.summary = "A (nearly) no-CSS, fast, minimalist Jekyll theme." spec...
# frozen_string_literal: true Gem::Specification.new do |spec| spec.name = "no-style-please" spec.version = "0.3.0" spec.authors = ["Riccardo Graziosi"] spec.email = ["riccardo.graziosi97@gmail.com"] spec.summary = "A (nearly) no-CSS, fast, minimalist Jekyll theme." spec...
Update regexp to handle entity contains other components
module VhdlDoctest class DUT def self.parse(path) entity, ports, cases = DoctestParser.new(path).parse new(entity, ports, cases) end attr_accessor :entity, :ports, :cases def initialize(entity, ports, cases) @entity, @ports, @cases = entity, ports, cases end def test_file ...
module VhdlDoctest class DUT def self.parse(path) entity, ports, cases = DoctestParser.new(path).parse new(entity, ports, cases) end attr_accessor :entity, :ports, :cases def initialize(entity, ports, cases) @entity, @ports, @cases = entity, ports, cases end def test_file ...
Fix bad reference in rake task
namespace :cron do desc "Process Cron's 10 minute interval logic" task interval_10_minutes: :environment do Cron.interval_10_minutes end desc "Process Cron's 1 hour interval logic" task interval_1_hour: :environment do Cron.interval_1_hour end desc "Process Cron's 1 day interval logic" task in...
namespace :cron do desc "Process Cron's 10 minute interval logic" task interval_10_minutes: :environment do Cron.interval_10_min end desc "Process Cron's 1 hour interval logic" task interval_1_hour: :environment do Cron.interval_1_hour end desc "Process Cron's 1 day interval logic" task interv...
Add spec test showing is_pe detection failure
require 'spec_helper' describe 'puppetdb::server', :type => :class do basefacts = { :osfamily => 'RedHat', :operatingsystem => 'RedHat', :operatingsystemrelease => '6.5', :fqdn => 'test.domain.local' } context 'on a support...
Make the submodule support for inside_copy efficient
class GitRepo WORKING_DIR="#{Rails.root}/tmp/build-partition" class << self def inside_copy(cached_repo_name, ref = "master", submodules = false) # update local repo run! "cd #{WORKING_DIR}/#{cached_repo_name} && git fetch" Dir.mktmpdir(nil, WORKING_DIR) do |dir| Dir.chdir(dir) do ...
class GitRepo WORKING_DIR="#{Rails.root}/tmp/build-partition" class << self def inside_copy(cached_repo_name, ref = "master", submodules = false) cached_repo_path = File.join(WORKING_DIR, cached_repo_name) # update local repo run! "cd #{cached_repo_path} && git fetch && git submodule update -...
Add Evaluator, which given a parsed doctest. Evaluates the test and constructs a result for the Formatter
module Dest class Evaluator def initialize(parsed_attributes) @parsed_attributes = parsed_attributes end def evaluate expr_result = eval(parsed_attributes[1]) if expr_result == eval(parsed_attributes[2]) [true] else [false, parsed_attributes[0], parsed_attribute...
Add up field to vote factory
FactoryGirl.define do factory :vote do up: { [true, false].sample } end end
FactoryGirl.define do factory :vote do up { [true, false].sample } end end
Simplify general task factory (can always set an organizer now), and add an urgent_task factory.
FactoryGirl.define do factory :task do working_group sequence(:name) {|n| "Task #{n}" } sequence(:description) {|n| "Description #{n}" } due_date { Faker::Date.forward(20) } volunteer_count_required 1 # # use it like this to create a task with an organizer: # create(:task_with_orga...
FactoryGirl.define do factory :task do working_group sequence(:name) {|n| "Task #{n}" } sequence(:description) {|n| "Description #{n}" } due_date { Faker::Date.forward(20) } volunteer_count_required 1 # # use it like this to create a task with an organizer: # create(:task_with_orga...
Improve user factory to create usernames too
FactoryGirl.define do factory :user do email { Faker::Internet.email } password "password" password_confirmation "password" end end
FactoryGirl.define do factory :user do email { Faker::Internet.email } username {Faker::Internet.user_name} password "password" password_confirmation "password" end end
Add conditional to prevent NoMethodError
module Rambo module RamlModels class Method attr_reader :schema def initialize(raml_method) @schema = raml_method end def to_s schema.method end def request_body Rambo::RamlModels::Body.new(schema.bodies.first) end def description ...
module Rambo module RamlModels class Method attr_reader :schema def initialize(raml_method) @schema = raml_method end def to_s schema.method end def request_body Rambo::RamlModels::Body.new(schema.bodies.first) if schema.bodies.first end ...
Fix bug where are user agents were seen as humans
module VoightKampff class Test CRAWLERS_FILENAME = 'crawler-user-agents.json' attr_accessor :user_agent_string def initialize(user_agent_string) @user_agent_string = user_agent_string end def agent load_crawlers @agent ||= @@crawlers.find do |crawler| user_agent_strin...
module VoightKampff class Test CRAWLERS_FILENAME = 'crawler-user-agents.json' attr_accessor :user_agent_string def initialize(user_agent_string) @user_agent_string = user_agent_string end def agent load_crawlers @agent ||= @@crawlers.find do |crawler| self.user_agent_...
Fix 500 errors with some discussions
class DiscussionSerializer < ApplicationSerializer include ReadraptorTrackable include MarkdownHelper attributes :number, :title, :url, :description_html, :comments_count def url product_discussion_path(product, number) end def product @product ||= object.product end def description_html ...
class DiscussionSerializer < ApplicationSerializer include ReadraptorTrackable include MarkdownHelper attributes :number, :title, :url, :description_html, :comments_count def url product_discussion_path(product, number) end def product @product ||= object.product end def description_html ...
Fix for Redmine version => 4.0.3
require "json" class GithubHookController < ApplicationController skip_before_filter :verify_authenticity_token, :check_if_login_required def index message_logger = GithubHook::MessageLogger.new(logger) update_repository(message_logger) if request.post? messages = message_logger.messages.map { |log| l...
require "json" class GithubHookController < ApplicationController skip_before_action :verify_authenticity_token, :check_if_login_required def index message_logger = GithubHook::MessageLogger.new(logger) update_repository(message_logger) if request.post? messages = message_logger.messages.map { |log| l...
Uninstall all versions to avoid an interactive question, especially on automated build machines.
require 'rake' require 'rake/clean' require 'rubygems/package_task' require_relative 'version' STDOUT.sync = true STDERR.sync = true NAME = 'lambda_wrap' desc 'Clean' task :clean do Dir.glob('*.gem').each do |f| puts "Deleting file #{f}" File.delete(f) end end desc 'Creates...
require 'rake' require 'rake/clean' require 'rubygems/package_task' require_relative 'version' STDOUT.sync = true STDERR.sync = true NAME = 'lambda_wrap' desc 'Clean' task :clean do Dir.glob('*.gem').each do |f| puts "Deleting file #{f}" File.delete(f) end end desc 'Creates...
Add basic info to gemspec
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'month/version' Gem::Specification.new do |gem| gem.name = "month" gem.version = Month::VERSION gem.authors = ["Matt Royal"] gem.email = ["mroyal@gma...
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'month/version' Gem::Specification.new do |gem| gem.name = "month" gem.version = Month::VERSION gem.authors = ["Matt Royal"] gem.email = ["mroyal@gma...
Remove old tests for listable aliases.
require File.expand_path('../../test_helper', __FILE__) module Paid class AliasTest < Test::Unit::TestCase should "aliases should be listable" do @mock.expects(:get).once.returns(test_response(test_alias_array)) c = Paid::Alias.all assert c.data.kind_of? Array c.each do |paid_alias| ...
require File.expand_path('../../test_helper', __FILE__) module Paid class AliasTest < Test::Unit::TestCase should "aliases should not be deletable" do assert_raises NoMethodError do @mock.expects(:get).once.returns(test_response(test_customer)) c = Paid::Alias.retrieve("test_alias") ...
Remove headers cache only on logout
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception before_filter :set_cache_buster add_flash_types :error # strong_params in decent exposure decent_configuration...
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception add_flash_types :error # strong_params in decent exposure decent_configuration do strategy DecentExposure::S...
Add default protocol for urls
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception end
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception def default_url_options return { protocol: 'https' } if Rails.env.staging? || Rails.env.production? {} end ...
Add basic api status check and getmeas call
class WiScale end
require 'rubygems' require 'httparty' require 'json' require 'ostruct' class WiScale def initialize(*params) @publickey = params[0][:publickey] if params.length > 0 @userid = params[0][:userid] if params.length > 0 end def get_status() ret_val = JSON.parse(HTTParty.get(api_url + '/once', :query ...
Update gems, using Capybara 2.1.0
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'masque/version' Gem::Specification.new do |gem| gem.name = "masque" gem.version = Masque::VERSION gem.authors = ["uu59"] gem.email = ["k@uu59.org"] ...
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'masque/version' Gem::Specification.new do |gem| gem.name = "masque" gem.version = Masque::VERSION gem.authors = ["uu59"] gem.email = ["k@uu59.org"] ...
Fix if statement so a succesful login takes the user to their own user profile
class SessionsController < ApplicationController def new end def create user = User.find_by(username: params[:session][:username]) if user && user.autenticate(params[:session][:password]) #Log the user in and redirect to the user's show page (for now) # render new_user_path else fla...
class SessionsController < ApplicationController def new end def create user = User.find_by(username: params[:session][:username]) if user && (user.password == (params[:session][:password])) #Log the user in and redirect to the user's show page (for now) redirect_to user_path(user) else ...
Resolve and toggle action added
require_dependency "rscratch/application_controller" module Rscratch class ExceptionsController < ApplicationController include SmartListing::Helper::ControllerExtensions helper SmartListing::Helper def index @exceptions = Rscratch::Exception.order("updated_at desc") smart_listing_create ...
require_dependency "rscratch/application_controller" module Rscratch class ExceptionsController < ApplicationController include SmartListing::Helper::ControllerExtensions helper SmartListing::Helper before_filter :set_exception, :only => [:show, :toggle_ignore, :resolve] def index @except...
Refactor inject runner dependency in EventsHandler
require 'dredd_hooks/runner' module DreddHooks class Server class EventsHandler attr_reader :runner private :runner def initialize @runner = Runner.instance end def handle(event, transaction) if event == "beforeEach" transaction = runner.run_before_each...
require 'dredd_hooks/runner' module DreddHooks class Server class EventsHandler attr_reader :runner private :runner def initialize(runner=Runner.instance) @runner = runner end def handle(event, transaction) if event == "beforeEach" transaction = runner....
Set neutral feedback value to default 0
class SetNeutralFeedbackToZero < ActiveRecord::Migration def self.up change_table :reputation_ratings do |t| t.change :neutral_feedback, :integer, :default => 0 end people = Person.all people.each do | person | person.reputation_rating.update_attributes(:neutral_feedback => 0) end end...
Use erb, not erubis explicitly.
require 'sinatra' # from https://gist.github.com/119874 # stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb # and made a lot more robust by me # this implementation uses erb by default. if you want to use any other template mechanism # then replace `erb` on line 13 and line 17 with `haml...
require 'sinatra' # from https://gist.github.com/119874 # stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb # and made a lot more robust by me # this implementation uses erb by default. if you want to use any other template mechanism # then replace `erb` on line 13 and line 17 with `haml...
Make empty? available on `Pushing::Base.deliveries`
require 'active_support/core_ext/module/attribute_accessors' module Pushing module Adapters class TestAdapter class Deliveries include Enumerable def initialize @deliveries = [] end delegate :each, :clear, :<<, :length, :size, to: :@deliveries def apn ...
require 'active_support/core_ext/module/attribute_accessors' module Pushing module Adapters class TestAdapter class Deliveries include Enumerable def initialize @deliveries = [] end delegate :each, :empty?, :clear, :<<, :length, :size, to: :@deliveries d...
Update view helper. There was no need for them to call the param validation logic.
module SortableColumns module ActionViewExtension extend ActiveSupport::Concern module InstanceMethods def sortable(column, title = nil) title ||= column.titleize css_class = column == sort_column ? "current #{sort_direction}" : nil direction = column == sort_column && sort_...
module SortableColumns module ActionViewExtension extend ActiveSupport::Concern module InstanceMethods def sortable(column, title = nil) title ||= column.titleize css_class = column == params[:sort] ? "current #{ params[:direction] }" : nil direction = column == para...
Add implementation of seventh rule of disambiguator prefix
module Sastrawi module Morphology module Disambiguator class DisambiguatorPrefixRule7 def disambiguate(word) contains = /^ter([bcdfghjklmnpqrstvwxyz])er([aiueo].*)$/.match(word) if contains matches = contains.captures return if matches[0] == 'r' ...
Add the code to make previous spec commit pass
require 'Cinderella/version' require 'Cinderella/data_store' require 'crimp' module Cinderella def self.transforms(data, till_midnight = 60) identifier = Crimp.signature(data) cloned_data = deep_copy data transformed = yield cloned_data store({ :id => identifier, :original => data, ...
require 'Cinderella/version' require 'Cinderella/data_store' require 'crimp' module Cinderella def self.transforms(data, till_midnight = 60) identifier = Crimp.signature(data) cloned_data = deep_copy data transformed = yield cloned_data store({ :id => identifier, :original => data, ...
Move STAR importers lists out of constant
class SomervilleStarImporters def self.from_options(options) new(options).importer end IMPORTERS = [ StarReadingImporter, StarReadingImporter::HistoricalImporter, StarMathImporter, StarMathImporter::HistoricalImporter ] def initialize(options = {}) @school_scope = options["school"] ...
class SomervilleStarImporters def self.from_options(options) new(options).importer end def initialize(options = {}) @school_scope = options["school"] end def options { school_scope: @school_scope, client: SftpClient.for_star, data_transformer: CsvTransformer.new, file_imp...
Fix Seed to Check New Features
#Create Admin For the Site User.create(email:'nzeplowitz@gmail.com', name: 'admin', access: 'admin') #Create 5 Students 5.times do User.create(email: Faker::Internet.email, name: Faker::Name.name) end #Create 2 Questions For Each Student 2.times do User.all.each do |user| user.questions << Question.create(que...
#Create Admin For the Site User.create(email:'nzeplowitz@gmail.com', name: 'Nathan Zeplowitz', access: 'admin') #Create 5 Students 5.times do User.create(email: Faker::Internet.email, name: Faker::Name.name) end #Create 2 Questions For Each Student 2.times do User.all.each do |user| user.questions << Question...
Use the correct client name
# This configuration is suitable for development, it should be managed by puppet # in production. # TODO: Check if this is thread/forked process safe under passenger. Possible risk # that client connections get copied when passenger forks a process but the mutexes # protecting those connections do not. require 'messe...
# This configuration is suitable for development, it should be managed by puppet # in production. # TODO: Check if this is thread/forked process safe under passenger. Possible risk # that client connections get copied when passenger forks a process but the mutexes # protecting those connections do not. require 'messeng...
Fix spec that wasn't cleaning up after itself if it failed
require 'rspectacular' require 'chamber/commands/secure' require 'fileutils' module Chamber module Commands describe Secure do let(:rootpath) { Pathname.new(::File.expand_path('./spec/fixtures')) } let(:settings_filename) { rootpath + 'settings' + 'unencrypted.yml' } let(:options) { { ...
require 'rspectacular' require 'chamber/commands/secure' require 'fileutils' module Chamber module Commands describe Secure do let(:rootpath) { Pathname.new(::File.expand_path('./spec/fixtures')) } let(:settings_directory) { rootpath + 'settings' } let(:settings_filename) { settings_directory +...
Fix issue with undefined local variable or method `ui'
module Vagrant module Smartos module Zones module Command # Requires # # Define a COMMANDS constant, which is an array of method names: # # COMMANDS = %w(subcommand other_subcommand) # # Define an OPTION_PARSER constant, which is an instance of an ...
module Vagrant module Smartos module Zones module Command # Requires # # Define a COMMANDS constant, which is an array of method names: # # COMMANDS = %w(subcommand other_subcommand) # # Define an OPTION_PARSER constant, which is an instance of an ...
Fix rubocop error "Syntax - dynamic constant assignment"
Vmdb::Deprecation ||= begin deprecator = ActiveSupport::Deprecation.new("D-release", "ManageIQ") deprecator.behavior = [:stderr, :log] deprecator end
module Vmdb class Deprecation def self.instance @instance ||= begin deprecator = ActiveSupport::Deprecation.new("D-release", "ManageIQ") deprecator.behavior = [:stderr, :log] deprecator end end def self.method_missing(method_name, *args, &block) instance.respond_...
Clean up DeepStruct a little bit
require 'ostruct' # This is some code to create nested Structs from nested hash tables. # Code written by Andrea Pavoni, more information here: # http://andreapavoni.com/blog/2013/4/create-recursive-openstruct-from-a-ruby-hash class DeepStruct < OpenStruct def initialize(hash = nil) @table = {} @hash_table =...
require 'ostruct' # This is some code to create nested Structs from nested hash tables. # Code written by Andrea Pavoni, more information here: # http://andreapavoni.com/blog/2013/4/create-recursive-openstruct-from-a-ruby-hash # # This has been slightly modified to work with hashes nested inside of arrays class DeepSt...
Add additional tests to ensure the knapsack_pro detects time correctly
describe 'Time travel with ActiveSupport::Testing::TimeHelpers' do context 'travel_back' do before { travel_to Time.new(2004, 11, 24, 01, 04, 44) } after { travel_back } it do expect(Time.current.year).to eq 2004 end end context 'travel_to block' do let!(:yesterday) { 1.day.ago } ...
describe 'Time travel with ActiveSupport::Testing::TimeHelpers' do context 'travel_back' do before { travel_to Time.new(2004, 11, 24, 01, 04, 44) } after { travel_back } it do expect(Time.current.year).to eq 2004 expect(Time.now.year).to eq 2004 # ensure knapsack_pro adds raw method ...
Fix syntax error in create method on News area
module Podio module News include Podio::ResponseWrapper extend self def create(attributes) response = Podio.connection.post do |req| req.url = '/news' req.body = attributes end response.body['news_id'] end def update(id, attributes) response = Podio.connection.post do |req| req.url...
module Podio module News include Podio::ResponseWrapper extend self def create(attributes) response = Podio.connection.post do |req| req.url '/news/' req.body = attributes end response.body['news_id'] end def update(id, attributes) response = Podio.connection.post do |req| req.url ...
Use for finding a chapter for a given position rather than the array version
class ChaptersController < ApplicationController before_filter :find_book caches_action :show def show @chapter = @book.chapters.detect { |chapter| chapter.position == params[:id].to_i } end private def find_book @book = Book.find(params[:book_id]) end end
class ChaptersController < ApplicationController before_filter :find_book caches_action :show def show @chapter = @book.chapters.first(conditions: { position: params[:id] }) end private def find_book @book = Book.find(params[:book_id]) end end
Add missing require for dev_seeds rake task spec
require 'rails_helper' require 'rake' describe 'rake db:dev_seed' do let :run_rake_task do Rake.application.invoke_task('db:dev_seed') end it 'seeds the database without errors' do expect { run_rake_task }.not_to raise_error end end
require 'rake' require 'rails_helper' Rake::Task.define_task(:environment) Rake.application.rake_require('tasks/db') describe 'rake db:dev_seed' do let :run_rake_task do Rake.application.invoke_task('db:dev_seed') end it 'seeds the database without errors' do expect { run_rake_task }.not_to raise_error ...
Fix relative path issue when running ffcrm as an engine.
# Copyright (c) 2008-2013 Michael Dvorkin and contributors. # # Fat Free CRM is freely distributable under the terms of MIT license. # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ require './lib/missing_transl...
# Copyright (c) 2008-2013 Michael Dvorkin and contributors. # # Fat Free CRM is freely distributable under the terms of MIT license. # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ require 'missing_translation_...
Remove method that relates to stdin and stdout
require_relative 'tic_tac_toe' class Game attr_accessor :gametype, :ui def initialize(gametype = nil, ui = nil) @ui = ui @gametype = gametype end # def display_intro_msg # puts "Welcome to #{gametype.desc[:name]} \n#{gametype.desc[:instructions]}" # ui.show_board(gametype.board) # end d...
require_relative 'tic_tac_toe' class Game attr_accessor :gametype, :ui def initialize(gametype = nil, ui = nil) @ui = ui @gametype = gametype end def user_move(index_position) if gametype.valid_move?(index_position) @gametype = gametype.move(index_position) else "Invalid input tr...
Sort node names in reverse alphabetical order so nodes that are substrings of each other dont get replaced first
require 'chef/node' require 'chef/knife' require 'chef/config' module Shiv PROVIDERS = ['ec2', 'rackspace'] def self.edit(command) configure nodes.each do |node| command.gsub!(node, hostname_from(node)) if command.include? node end command end def self.nodes Chef::Node.list.keys...
require 'chef/node' require 'chef/knife' require 'chef/config' module Shiv PROVIDERS = ['ec2', 'rackspace'] def self.edit(command) configure nodes.each do |node| command.gsub!(node, hostname_from(node)) if command.include? node end command end def self.nodes Chef::Node.list.keys...
Make sure active record filters that are often used are indexed
class AddStatusStringIndices < ActiveRecord::Migration def change add_index :exports, :status add_index :subjects, :status add_index :users, :status add_index :variables, :variable_type end end
Return a list of results, where each result is a hash with node and weight.
require "rlrw/version" require "murmurhash3" module Rlrw module LRW MOD = 2147483648 def self.all(key, nodes) res = [] nodes.each do |node| res << [node, self.phash(key, node)] end res.sort_by { |_, val| -val } end def self.top(key, nodes, len) self.all(key, nod...
require "rlrw/version" require "murmurhash3" module Rlrw module LRW MOD = 2147483648 def self.all(key, nodes) res = [] nodes.each do |node| res << { node: node, weight: self.phash(key, node) } end res.sort_by { |res| -res[:weight] } end def self.top(key, nodes, len) ...
Remove automatically restart nodeJs App
include_recipe 'deploy' include_recipe "nginx::service" node[:deploy].each do |application, deploy| if deploy[:application_type] != 'nodejs' next end Chef::Log.info("Deploy Nginx Proxy Configuration for #{application}.") execute "proxy2ensite #{application} #{deploy[:deploy_to]}" do command "/usr/sbin/proxy2e...
include_recipe 'deploy' include_recipe "nginx::service" node[:deploy].each do |application, deploy| if deploy[:application_type] != 'nodejs' next end Chef::Log.info("Deploy Nginx Proxy Configuration for #{application}.") execute "proxy2ensite #{application} #{deploy[:deploy_to]}" do command "/usr/sbin/proxy2e...
Support target parameter as an alias for path
# # TODO # module Puppet newtype(:file_fragment) do @doc = "TODO" newparam(:name, :namevar => true) do desc "TODO" end newparam(:path) do desc "TODO" end newparam(:content) do desc "TODO" end newparam(:order) do desc "TODO" defaultto '10' valid...
# # TODO # module Puppet newtype(:file_fragment) do @doc = "TODO" newparam(:name, :namevar => true) do desc "TODO" end newparam(:target) do desc "Deprecated. Use *path* instead." end newparam(:path) do desc "TODO" defaultto do resource.value(:target) end ...
Remove a couple stop words before searching
require "spdx/version" require "spdx-licenses" require "text" module Spdx def self.find(name) SpdxLicenses[name] || closest(name) end def self.closest(name) match = names.sort_by do |key| Text::Levenshtein.distance(name, key) end.first SpdxLicenses[match] || find_by_name(match) end de...
require "spdx/version" require "spdx-licenses" require "text" module Spdx def self.find(name) SpdxLicenses[name] || closest(name) end def self.closest(name) name.gsub!(/software|license/i, '') match = names.sort_by do |key| Text::Levenshtein.distance(name, key) end.first SpdxLicenses[m...
Add version hint for depsolver
name "site-reviewtypo3org" maintainer "Steffen Gebert / TYPO3 Association" maintainer_email "steffen.gebert@typo3.org" license "Apache 2.0" description "Installs/configures something" version "0.2.3" depends "t3-base", "~> 0.2.0" depends "site-gittypo3org", "~> 0.1....
name "site-reviewtypo3org" maintainer "Steffen Gebert / TYPO3 Association" maintainer_email "steffen.gebert@typo3.org" license "Apache 2.0" description "Installs/configures something" version "0.2.3" depends "t3-base", "~> 0.2.0" depends "site-gittypo3org", "~> 0.1....
Change string type to text
class AddModuleFullNameToMatch < ActiveRecord::Migration def change add_column :automatic_exploitation_matches, :module_fullname, :string add_index :automatic_exploitation_matches, :module_fullname end end
class AddModuleFullNameToMatch < ActiveRecord::Migration def change add_column :automatic_exploitation_matches, :module_fullname, :text add_index :automatic_exploitation_matches, :module_fullname end end
Use factories to create data
require 'test/unit' require 'rubygems' require 'active_record' require 'trash' ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:") def setup_db silence_stream(STDOUT) do ActiveRecord::Schema.define(:version => 1) do create_table :entries do |t| t.string :title ...
require 'test/unit' require 'rubygems' require 'active_record' require 'trash' require 'factory_girl' ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:") def setup_db silence_stream(STDOUT) do ActiveRecord::Schema.define(:version => 1) do create_table :entries do |t| ...
Add a friendly message to NoStatsToCalculateError for the report
module BaseballStats module Calculators class ImprovedBattingAverage HEADER = "Most improved batting average from " attr_accessor :csv, :year def initialize(csv, year) @csv = csv @year = year end def calculate players = {} eligible_players.each do ...
module BaseballStats module Calculators class ImprovedBattingAverage HEADER = "Most improved batting average from " attr_accessor :csv, :year def initialize(csv, year) @csv = csv @year = year end def calculate players = {} eligible_players.each do ...
Move store back to a helper
require 'sinatra/base' require 'tilt/haml' require 's3browser/store' module S3Browser class Server < Sinatra::Base configure :development do set :port, 9292 set :bind, '0.0.0.0' enable :logging set :store, Store.new end get '/' do buckets = settings.store.buckets haml...
require 'sinatra/base' require 'tilt/haml' require 's3browser/store' module S3Browser class Server < Sinatra::Base configure :development do set :port, 9292 set :bind, '0.0.0.0' enable :logging end get '/' do buckets = store.buckets haml :index, locals: { title: 'S3Browser'...
Change cookbook to use new bind_v4 address
# # Cookbook Name:: loom_hosts # Recipe:: default # # Copyright 2013-2014, Continuuity, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
# # Cookbook Name:: loom_hosts # Recipe:: default # # Copyright 2013-2014, Continuuity, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
Put a mutex around creating the pool
module SuckerPunch class Queue attr_reader :job attr_accessor :pool def initialize(job) @job = job @pool = nil end def register unless registered? initialize_celluloid_pool register_celluloid_pool register_queue_with_master_list end end de...
require 'thread' module SuckerPunch class Queue attr_reader :job attr_accessor :pool def initialize(job) @job = job @pool = nil @mutex = Mutex.new end def register @mutex.synchronize { unless registered? initialize_celluloid_pool register_cell...
Support for language configuration from the config file
# encoding: utf-8 require 'xapian_db' require 'rails' module XapianDb # Configuration for a rails app # @author Gernot Kogler class Railtie < ::Rails::Railtie config.before_configuration do # Read the database configuration file if there is one config_file_path = "#{Rails.root}/config/xapian_...
# encoding: utf-8 require 'xapian_db' require 'rails' module XapianDb # Configuration for a rails app # @author Gernot Kogler class Railtie < ::Rails::Railtie config.before_configuration do # Read the database configuration file if there is one config_file_path = "#{Rails.root}/config/xapian_...
Update gemspec with correct github path
$:.push File.expand_path("../lib", __FILE__) require 'version' Gem::Specification.new do |s| s.name = 'u2f' s.version = U2F::VERSION s.summary = 'U2F library' s.description = 'Library for handling registration and authentication of U2F devices' s.authors = ['Johan Brissmyr', 'Sebastian Wa...
$:.push File.expand_path("../lib", __FILE__) require 'version' Gem::Specification.new do |s| s.name = 'u2f' s.version = U2F::VERSION s.summary = 'U2F library' s.description = 'Library for handling registration and authentication of U2F devices' s.authors = ['Johan Brissmyr', 'Sebastian Wa...