Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Change the aws bucket name to a env variable
CarrierWave.configure do |config| if Rails.env.production? config.fog_credentials = { :provider => 'AWS', :aws_access_key_id => ENV['AWS_ACCESS_KEY_ID'], :aws_secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'], :region => 'us-east-1', } config.fog...
CarrierWave.configure do |config| if Rails.env.production? config.fog_credentials = { :provider => 'AWS', :aws_access_key_id => ENV['AWS_ACCESS_KEY_ID'], :aws_secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'], :region => 'us-east-1', } config.fog...
Add a bm-ips that compares .$$is_number to isNaN()
# Why .$$is_number is better than isNaN: # # # Warming up -------------------------------------- # .$$is_number 106.722k i/100ms # isNaN() 105.040k i/100ms # obj.$$is_number 106.864k i/100ms # isNaN(obj) 89.287k i/100ms # Calculating ------------------------------------- # ...
Update Shared Desktop Ontologies to 0.5.
require 'formula' class SharedDesktopOntologies <Formula url 'http://downloads.sourceforge.net/project/oscaf/shared-desktop-ontologies/0.2/shared-desktop-ontologies-0.2.tar.bz2' homepage 'http://sourceforge.net/apps/trac/oscaf/' md5 '6c004e1c377f768cae5b321bc111876b' depends_on 'cmake' => :build def instal...
require 'formula' class SharedDesktopOntologies <Formula url 'http://downloads.sourceforge.net/project/oscaf/shared-desktop-ontologies/0.5/shared-desktop-ontologies-0.5.tar.bz2' homepage 'http://sourceforge.net/apps/trac/oscaf/' md5 '067ec9023c4a48e0d53fb15484d78971' depends_on 'cmake' => :build def instal...
Add updateddate to default list
module ICIMS require 'ostruct' class Job < OpenStruct DEFAULT_FIELDS = %w(id folder jobtitle positioncategory positiontype joblocation additionallocations overview) class << self def find job_id, fields: [] fields = DEFAULT_FIELDS unless fields.any? if job_id.is_a?(Array) ...
module ICIMS require 'ostruct' class Job < OpenStruct DEFAULT_FIELDS = %w(id updateddate folder jobtitle positioncategory positiontype joblocation additionallocations overview) class << self def find job_id, fields: [] fields = DEFAULT_FIELDS unless fields.any? if job_id.is_a?(Arr...
Add _shutdown_test_server impl for Android
module Calabash module Android module Operations def _start_test_server(options={}) test_options = options.dup test_options[:main_activity] ||= Environment.variable('MAIN_ACTIVITY') application_path = test_options[:application_path] || Environment.variable('APP_PATH') test_...
module Calabash module Android module Operations def _start_test_server(options={}) test_options = options.dup test_options[:main_activity] ||= Environment.variable('MAIN_ACTIVITY') application_path = test_options[:application_path] || Environment.variable('APP_PATH') test_...
Make sure we allow compression on old sprockets...
# Frozen-string-literal: true # Copyright: 2017 - 2018 - MIT License # Author: Jordon Bedwell # Encoding: utf-8 module Jekyll module Assets module Compressors class Scss < Sprockets::SassCompressor def call(input) out = super(input) Hook.trigger(:asset, :after_compression) do |h...
# Frozen-string-literal: true # Copyright: 2017 - 2018 - MIT License # Author: Jordon Bedwell # Encoding: utf-8 module Jekyll module Assets module Compressors class Scss < Sprockets::SassCompressor def call(input) out = super(input) Hook.trigger(:asset, :after_compression) do |h...
Add Amazon Service base class
require 'aws-sdk' require 'contracts' require_relative 'support/rate_limit_handler' require_relative '../config' module StackatoLKG module Amazon class Service include ::Contracts::Core include ::Contracts::Builtin include Support::RateLimitHandler Contract Maybe[Config] => Service ...
Add spec to destroy a general deal.
# -*- encoding : utf-8 -*- require 'spec_helper' RSpec.configure do |config| config.use_transactional_fixtures = false end describe DealsController, :js => true do fixtures :users, :accounts, :preferences set_fixture_class :accounts => Account::Base before do Deal::Base.delete_all end describe "残高明...
# -*- encoding : utf-8 -*- require 'spec_helper' RSpec.configure do |config| config.use_transactional_fixtures = false end describe DealsController, :js => true do fixtures :users, :accounts, :preferences set_fixture_class :accounts => Account::Base before do Deal::Base.delete_all end include_conte...
Update spec to include resources.
Pod::Spec.new do |s| s.name = "Conductor" s.version = "0.99" s.summary = "A framework for displaying an 'on-boarding' UI" s.homepage = "https://github.com/exsortis/Conductor" s.license = { :type => 'MIT', :file => 'LICENSE' } s.author ...
Pod::Spec.new do |s| s.name = "Conductor" s.version = "0.99.1" s.summary = "A framework for displaying an 'on-boarding' UI" s.homepage = "https://github.com/exsortis/Conductor" s.license = { :type => 'MIT', :file => 'LICENSE' } s.author ...
Stop ignoring html5rocks.com, disable SSL in link checks
#!/usr/bin/env ruby require 'html-proofer' HTMLProofer.check_directory('./_site', { :parallel => { :in_processes => 4, }, :check_html => true, :cache => { :timeframe => '1w', }, :typhoeus => { :timeout => 15, # seconds }, :url_ignore => [ /html5rocks.com/, ], }).run
#!/usr/bin/env ruby require 'html-proofer' HTMLProofer.check_directory('./_site', { :parallel => { :in_processes => 4, }, :check_html => true, :cache => { :timeframe => '1w', }, :typhoeus => { :ssl_verifypeer => false, :timeout => 15, # seconds }, :url_ignore => [ ], }).run
Add obvious dependency on restforce.
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'active_force/version' Gem::Specification.new do |spec| spec.name = "active_force" spec.version = ActiveForce::VERSION spec.authors = ["Eloy Espinaco"] spec.email ...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'active_force/version' Gem::Specification.new do |spec| spec.name = "active_force" spec.version = ActiveForce::VERSION spec.authors = ["Eloy Espinaco"] spec.email ...
Change git repo to wompt/wompt.com
load 'deploy' if respond_to?(:namespace) # cap2 differentiator set :application, "wompt" set :user, "ubuntu" set :host, "wompt.com" set :scm, :git set :repository, "git@github.com:abtinf/wompt.git" set :git_enable_submodules, true set :deploy_via, :remote_cache role :app, host set :use_sudo, true set :admin_runner...
load 'deploy' if respond_to?(:namespace) # cap2 differentiator set :application, "wompt" set :user, "ubuntu" set :host, "wompt.com" set :scm, :git set :repository, "git@github.com:Wompt/wompt.com.git" set :git_enable_submodules, true set :deploy_via, :remote_cache role :app, host set :use_sudo, true set :admin_run...
Add auto_updates flag to Marked
cask 'marked' do version '2.5.4915' sha256 '35f305d124b92724cc7a9140561580949f2d06e0747d4124d860412cb62dbe79' url 'http://marked2app.com/download/Marked.zip' appcast 'http://abyss.designheresy.com/marked/marked.xml', checkpoint: 'fac95d3b4091df5d80910403d0f78c0944b908a1098642fcb43b332b930c285c' nam...
cask 'marked' do version '2.5.4915' sha256 '35f305d124b92724cc7a9140561580949f2d06e0747d4124d860412cb62dbe79' url 'http://marked2app.com/download/Marked.zip' appcast 'http://abyss.designheresy.com/marked/marked.xml', checkpoint: 'fac95d3b4091df5d80910403d0f78c0944b908a1098642fcb43b332b930c285c' nam...
Add unit tests for client
require "spec_helper" module Vault describe Client do let(:client) { subject } context "configuration" do it "is a configurable object" do expect(client).to be_a(Configurable) end it "users the default configuration" do Defaults.options.each do |key, value| expec...
Add a digg scraping tool. WARNING: Currently does not work!
#!/usr/bin/ruby require 'rubygems' require 'open-uri' require 'hpricot' def BuildURL(query, pagenumber) return "http://digg.com/search/page" + pagenumber.to_s() + "?s=" + query + "&area=promoted&type=both&search-buried=0&sort=score&section=all" end def GetURLS(query) maxPage = 0 url = BuildURL(query, 1) ...
Make Rails version dependency open-ended
require File.expand_path("../lib/rails-embryo/version", __FILE__) Gem::Specification.new do |s| s.name = "rails-embryo" s.version = Rails::Embryo::VERSION s.platform = Gem::Platform::RUBY s.authors = ["Brian Auton"] s.email = ["brianauton@gmail.com"] s.homepage = "http://github.com/brianauton/rails-embryo"...
require File.expand_path("../lib/rails-embryo/version", __FILE__) Gem::Specification.new do |s| s.name = "rails-embryo" s.version = Rails::Embryo::VERSION s.platform = Gem::Platform::RUBY s.authors = ["Brian Auton"] s.email = ["brianauton@gmail.com"] s.homepage = "http://github.com/brianauton/rails-embryo"...
Check for ABPlugin.categories instead of tests in Helper
class ABPlugin module Helper private def a_b(category=nil, test=nil, extra=nil) @a_b_plugin ||= ABPlugin.new(self) if category || test || extra Test.new(category, test, extra) elsif ABPlugin.tests && Config.url "a_b_setup(#{{ :categories => A...
class ABPlugin module Helper private def a_b(category=nil, test=nil, extra=nil) @a_b_plugin ||= ABPlugin.new(self) if category || test || extra Test.new(category, test, extra) elsif ABPlugin.categories && Config.url "a_b_setup(#{{ :categories...
Remove unnecessary check for array
# encoding: utf-8 module Gimli # Class used to interact with directory structure class Path # Return an array of paths to valid markup file matching the passed pattern # @param [String] target # @param [Bool] recursive # @return [Array] an array of valid files def self.list_valid(target, recu...
# encoding: utf-8 module Gimli # Class used to interact with directory structure class Path # Return an array of paths to valid markup file matching the passed pattern # @param [String] target # @param [Bool] recursive # @return [Array] an array of valid files def self.list_valid(target, recu...
Make sure we're comparing UTC with UTC
require 'spec_helper' module Stash describe Harvester do describe 'log' do it 'logs to stdout in a timestamp-first format' do out = StringIO.new Harvester.log_device = out begin msg = 'I am a log message' Harvester.log.warn(msg) logged = out.string ...
require 'spec_helper' module Stash describe Harvester do describe 'log' do it 'logs to stdout in a timestamp-first format' do out = StringIO.new Harvester.log_device = out begin msg = 'I am a log message' Harvester.log.warn(msg) logged = out.string ...
Refactor Manifest.skeleton to use a hash.
module Heroku module Kensa module Manifest def self.init(filename) open(filename, 'w') {|f| f << skeleton_str } end def self.skeleton Yajl::Parser.parse(skeleton_str) end def self.skeleton_str return <<EOJSON { "id": "myaddon", "name": "My Addon", "pl...
module Heroku module Kensa module Manifest def self.init(filename) open(filename, 'w') {|f| f << skeleton_str } end def self.skeleton { 'id' => 'myaddon', 'name' => 'My Addon', 'plans' => [{ 'id' => 'basic', 'name' ...
Adjust `perform` override and call HTTP features wrapping request/response pairs.
module HTTP class Client alias_method :__perform__, :perform def perform(request, options) return __perform__(request, options) unless webmock_enabled? WebMockPerform.new(request) { __perform__(request, options) }.exec end def webmock_enabled? ::WebMock::HttpLibAdapters::HttpRbAdap...
module HTTP class Client alias_method :__perform__, :perform def perform(request, options) return __perform__(request, options) unless webmock_enabled? response = options.features.inject(response) do |response, (_name, feature)| feature.wrap_response(response) end resp...
Return an empty favicon.ico for browsers that request it (if it does not exist in static paths)
require 'webrick/httputils' module YARD module Server module Commands class StaticFileCommand < Base include WEBrick::HTTPUtils DefaultMimeTypes['js'] = 'text/javascript' STATIC_PATHS = [ File.join(YARD::TEMPLATE_ROOT, 'default', 'fulldoc', 'html'), File.join(F...
require 'webrick/httputils' module YARD module Server module Commands class StaticFileCommand < Base include WEBrick::HTTPUtils DefaultMimeTypes['js'] = 'text/javascript' STATIC_PATHS = [ File.join(YARD::TEMPLATE_ROOT, 'default', 'fulldoc', 'html'), File.join(F...
Revert "close the file after putting it on the grid"
module Joint module InstanceMethods def grid @grid ||= Mongo::Grid.new(database) end private def assigned_attachments @assigned_attachments ||= {} end def nil_attachments @nil_attachments ||= Set.new end # IO must respond to read and rewind def ...
module Joint module InstanceMethods def grid @grid ||= Mongo::Grid.new(database) end private def assigned_attachments @assigned_attachments ||= {} end def nil_attachments @nil_attachments ||= Set.new end # IO must respond to read and rewind def ...
Remove reference to the old EmailValidator
require 'spree/core/validators/email' Spree::CheckoutController.class_eval do before_action :check_authorization before_action :check_registration, except: [:registration, :update_registration] def registration @user = Spree::User.new end def update_registration if order_params[:email] =~ Devise.ema...
Spree::CheckoutController.class_eval do before_action :check_authorization before_action :check_registration, except: [:registration, :update_registration] def registration @user = Spree::User.new end def update_registration if order_params[:email] =~ Devise.email_regexp && current_order.update_attr...
Add specs for the new crondotdee class
require_relative '../../../../spec_helper' describe 'cron::crondotdee' do let(:title) { 'true_cron' } let (:default_params) {{ :command => '/bin/true', :hour => '12', :minute => '34', }} context 'with mandatory params' do let(:params) { default_params } it { should contain_file('/et...
Use arel style instead of dynamic finder.
module Refinery module Pages module Admin module InstanceMethods def error_404(exception=nil) if (@page = Page.find_by_menu_match("^/404$", :include => [:parts, :slugs])).present? params[:action] = 'error_404' # change any links in the copy to the admin_root_path ...
module Refinery module Pages module Admin module InstanceMethods def error_404(exception=nil) if (@page = Page.where(:menu_match => "^/404$").includes(:parts, :slugs).first).present? params[:action] = 'error_404' # change any links in the copy to the admin_root_pat...
Allow order_attributes to be appended to by extensions. Adds token attribute
module Sprangular class OrderSerializer < BaseSerializer attributes :id, :number, :item_total, :total, :ship_total, :state, :adjustment_total, :user_id, :created_at, :updated_at, :completed_at, :payment_total, :shipment_state, :payment_state, :email, :special_instructi...
module Sprangular class OrderSerializer < BaseSerializer attributes *order_attributes attributes | [:display_total, :display_item_total, :display_ship_total, :display_tax_total, :checkout_steps] attribute :total_quantity attribute :token def total_quantity object.line_items.sum(:quantity) ...
Update CONTENT_LENGTH after converting to underscore
module CamelCaser module Strategies class RawInput include Transformable attr_reader :env def self.handle(env) self.new(env).handle end def initialize(env) @env = env end def handle handle_raw_rack end private def han...
module CamelCaser module Strategies class RawInput include Transformable attr_reader :env def self.handle(env) self.new(env).handle end def initialize(env) @env = env end def handle handle_raw_rack end private def han...
Add orders migration from neigborly balanced
# This migration comes from neighborly_balanced (originally 20140817195359) class CreateNeighborlyBalancedOrders < ActiveRecord::Migration def change create_table :neighborly_balanced_orders do |t| t.references :project, index: true, null: false t.string :href, null: false t.timestamps end ...
Send along suggested stack rebase
require 'stackprofx' require 'rack' module Stackprofiler class Middleware attr_accessor :ui_url def initialize(app, options={}) @app = app pred = options[:predicate] || /profile=true/ if pred.respond_to? :call @predicate = pred else regex = Regexp.new pred @...
require 'stackprofx' require 'rack' module Stackprofiler class Middleware attr_accessor :ui_url def initialize(app, options={}) @app = app pred = options[:predicate] || /profile=true/ if pred.respond_to? :call @predicate = pred else regex = Regexp.new pred @...
Define db_config class method with site argument in GobiertoData::Connection
# frozen_string_literal: true require_dependency "gobierto_data" module GobiertoData class Connection < ActiveRecord::Base self.abstract_class = true class << self def execute_query(site, query) base_connection_config = connection_config return null_query unless (db_config = site&.gob...
# frozen_string_literal: true require_dependency "gobierto_data" module GobiertoData class Connection < ActiveRecord::Base self.abstract_class = true class << self def execute_query(site, query) base_connection_config = connection_config return null_query unless (db_conf = db_config(s...
Extend timeout on ZenDesk calls
require 'httmultiparty' module Zensana class Zendesk include HTTMultiParty default_timeout 10 #debug_output def self.inst @inst ||= new end module Access def zendesk_service @zendesk_service ||= Zensana::Zendesk.inst end end def initialize self.class...
require 'httmultiparty' module Zensana class Zendesk include HTTMultiParty default_timeout 20 #debug_output def self.inst @inst ||= new end module Access def zendesk_service @zendesk_service ||= Zensana::Zendesk.inst end end def initialize self.class...
Use UI.term instead of Interrupt in 'configure'
module Nehm module UI class Menu def initialize @choices = {} @inc_index = 1 @items = [] yield self select end def choice(index, desc, &block) # Visual index - index that you see in menu # Select index - index than can be selected ...
module Nehm module UI class Menu def initialize @choices = {} @inc_index = 1 @items = [] yield self select end def choice(index, desc, &block) # Visual index - index that you see in menu # Select index - index than can be selected ...
Add versioning for dependency gems
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'vignette/version' Gem::Specification.new do |gem| gem.name = "vignette" gem.version = Vignette::VERSION gem.authors = ["Geoff Hayes"] gem.email = ["...
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'vignette/version' Gem::Specification.new do |gem| gem.name = "vignette" gem.version = Vignette::VERSION gem.authors = ["Geoff Hayes"] gem.email = ["...
Add factory trait for current season's conference
FactoryGirl.define do factory :conference do name { [FFaker::CheesyLingo.title, 'Conf'].join ' ' } tickets 2 end end
FactoryGirl.define do factory :conference do name { [FFaker::CheesyLingo.title, 'Conf'].join ' ' } tickets 2 trait :current_season do season { Season.current } end end end
Add carlhuda/bundler/master to rails master gemfile
remove_file 'Gemfile' create_file 'Gemfile' do <<-GEMFILE source 'http://gemcutter.org' git 'git://github.com/rails/rails.git' git 'git://github.com/snusnu/dm-core.git', 'branch' => 'active_support' git "git://github.com/snusnu/dm-more.git", 'branch' => 'active_support' git 'git://github.com/dkubb/rails3_datamapper.g...
remove_file 'Gemfile' create_file 'Gemfile' do <<-GEMFILE source 'http://gemcutter.org' git 'git://github.com/carlhuda/bundler.git' gem 'bundler' git 'git://github.com/rails/rails.git' gem 'activesupport', :require => 'active_support' gem 'activemodel', :require => 'active_model' gem 'actionpack', :require => ...
Fix testing default search for association columns
require File.join(File.dirname(__FILE__), '../test_helper.rb') require File.join(File.dirname(__FILE__), '../model_stub') class AssociationColumnTest < Test::Unit::TestCase def setup @association_column = ActiveScaffold::DataStructures::Column.new('other_model', ModelStub) end def test_virtuality assert...
require File.join(File.dirname(__FILE__), '../test_helper.rb') require File.join(File.dirname(__FILE__), '../model_stub') class AssociationColumnTest < Test::Unit::TestCase def setup @association_column = ActiveScaffold::DataStructures::Column.new('other_model', ModelStub) end def test_virtuality assert...
Drop --source flag from update
module Bummr class Updater def initialize(outdated_gems) @outdated_gems = outdated_gems end def update_gems puts "Updating outdated gems".green @outdated_gems.each_with_index do |gem, index| update_gem(gem, index) end end def update_gem(gem, index) puts "Up...
module Bummr class Updater def initialize(outdated_gems) @outdated_gems = outdated_gems end def update_gems puts "Updating outdated gems".green @outdated_gems.each_with_index do |gem, index| update_gem(gem, index) end end def update_gem(gem, index) puts "Up...
Fix new submissions not being reported to Slack
# frozen_string_literal: true require "httparty" require "json" TODAY = Date.current.freeze WEBHOOK = ENV["SLACK_WEBHOOK_URL"].freeze HEADERS = { "Content-Type" => "application/json" }.freeze namespace :slack do desc "Send an update about the CFP status" task send_cfp_status_update: :environment do MESSAGE =...
# frozen_string_literal: true require "httparty" require "json" TODAY = Date.current.freeze WEBHOOK = ENV["SLACK_WEBHOOK_URL"].freeze HEADERS = { "Content-Type" => "application/json" }.freeze namespace :slack do desc "Send an update about the CFP status" task send_cfp_status_update: :environment do MESSAGE =...
Add transpec as a development dependency
lib = File.expand_path("../lib", __FILE__) $:.unshift lib unless $:.include? lib require "savon/multipart/version" Gem::Specification.new do |s| s.name = "savon-multipart" s.version = Savon::Multipart::VERSION s.authors = ["Martin Westin", "Daniel Harrington"] s.email = ["martin@eimermusi...
lib = File.expand_path("../lib", __FILE__) $:.unshift lib unless $:.include? lib require "savon/multipart/version" Gem::Specification.new do |s| s.name = "savon-multipart" s.version = Savon::Multipart::VERSION s.authors = ["Martin Westin", "Daniel Harrington"] s.email = ["martin@eimermusi...
Remove return params check as is no longer required due to save and complete button being removed
class ClaimsController < ApplicationController before_action :ensure_claim_in_progress, only: %i<show update> skip_before_action :ensure_claim_exists, except: %i<show update> def new @claim = Claim.new session.clear end def create claim = Claim.create session[:claim_reference] = claim.refe...
class ClaimsController < ApplicationController before_action :ensure_claim_in_progress, only: %i<show update> skip_before_action :ensure_claim_exists, except: %i<show update> def new @claim = Claim.new session.clear end def create claim = Claim.create session[:claim_reference] = claim.refe...
Comment out password line. Not using text passwords for now.
# # Cookbook Name:: basic_config # Recipe:: default # # Your application(s) shouldn't run as root. # Each should have a username assigned to it. # Allow Chef to set passwords package "libshadow-ruby1.8" node["users"].each do |app_user, user_data| # Set up app-specific user, group and home directory user app_user...
# # Cookbook Name:: basic_config # Recipe:: default # # Your application(s) shouldn't run as root. # Each should have a username assigned to it. # Allow Chef to set passwords package "libshadow-ruby1.8" node["users"].each do |app_user, user_data| # Set up app-specific user, group and home directory user app_user...
Update Podspec by removing "v" prefix in pod tag.
Pod::Spec.new do |spec| spec.name = "GAuth" spec.version = "0.1.0" spec.summary = "Authentication to Google services made easy." spec.homepage = "https://www.github.com/fabiomassimo/GAuth" spec.license = { type: 'MIT', file: 'LICENSE' } spec.authors = { "Fabio Milano" => 'fabio@touchwonders.com' } spec.so...
Pod::Spec.new do |spec| spec.name = "GAuth" spec.version = "0.1.0" spec.summary = "Authentication to Google services made easy." spec.homepage = "https://www.github.com/fabiomassimo/GAuth" spec.license = { type: 'MIT', file: 'LICENSE' } spec.authors = { "Fabio Milano" => 'fabio@touchwonders.com' } spec.so...
Remove debug logging that broke stuff
require 'shipitron' require 'shipitron/find_docker_volume_name' module Shipitron class S3Copy include Metaractor required :source required :destination required :region def call if ENV['FOG_LOCAL'] Logger.info `cp #{source.gsub('s3://', '/fog/')} #{destination.gsub('s3://', '/fog/...
require 'shipitron' require 'shipitron/find_docker_volume_name' module Shipitron class S3Copy include Metaractor required :source required :destination required :region def call if ENV['FOG_LOCAL'] Logger.info `cp #{source.gsub('s3://', '/fog/')} #{destination.gsub('s3://', '/fog/...
Update dependencies to work with rails4
# -*- encoding: utf-8 -*- require File.expand_path('../lib/asana/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Ryan Bright"] gem.email = ["ryan@rbright.net"] gem.description = %q{Ruby wrapper for the Asana REST API} gem.summary = %q{Ruby wrapper for the Asana REST AP...
# -*- encoding: utf-8 -*- require File.expand_path('../lib/asana/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Ryan Bright"] gem.email = ["ryan@rbright.net"] gem.description = %q{Ruby wrapper for the Asana REST API} gem.summary = %q{Ruby wrapper for the Asana REST AP...
Update required Compass version for gem
require './lib/spinners' Gem::Specification.new do |s| # Release Specific Information s.version = ModernizrMixin::VERSION s.date = ModernizrMixin::DATE # Gem Details s.name = "spinners" s.description = %q{A Sass mixin and Compass extension to generate pure CSS3 loading/busy indicators} s.summary = %q{Us...
require './lib/spinners' Gem::Specification.new do |s| # Release Specific Information s.version = ModernizrMixin::VERSION s.date = ModernizrMixin::DATE # Gem Details s.name = "spinners" s.description = %q{A Sass mixin and Compass extension to generate pure CSS3 loading/busy indicators} s.summary = %q{Us...
Update comment - we acutally do need this in Rails, not just PHP
require 'spec_helper' describe FeedsController, :type => :request do include HTMLCompareHelper fixtures :all before :each do # The PHP app uses cache tables for rankings that aren't part of our fixtures # whereas the Rails app dynamically generates these rankings so we need to update # those caches ...
require 'spec_helper' describe FeedsController, :type => :request do include HTMLCompareHelper fixtures :all before :each do # FIXME: PHP cache calculation is still needed for the below tests `cd #{::Rails.root}/php/loader && ./calc_caches.php` end describe '#mp-info' do it { compare_static '/f...
Change require rom to rom-core only
require 'rom' require 'rom/yaml/version' require 'rom/yaml/gateway' require 'rom/yaml/relation' ROM.register_adapter(:yaml, ROM::YAML)
require 'rom-core' require 'rom/yaml/version' require 'rom/yaml/gateway' require 'rom/yaml/relation' ROM.register_adapter(:yaml, ROM::YAML)
Disable rate-limiter rejection tracking on notification email worker
class NotificationEmailWorker include Sidekiq::Worker sidekiq_options congestion: { interval: 1.hour, max_in_interval: 10, min_delay: 5.minutes, reject_with: :reschedule, key: ->(user_id, digest) { "user_#{ user_id }_notification_emails" } }, retry: true, backtrace: true def ...
class NotificationEmailWorker include Sidekiq::Worker sidekiq_options congestion: { interval: 1.hour, max_in_interval: 10, min_delay: 5.minutes, reject_with: :reschedule, track_rejected: false, key: ->(user_id, digest) { "user_#{ user_id }_notification_emails" } }, retry: true...
Add require Client on top
require 'amazon-drs/version' module AmazonDrs # Your code goes here... end
require 'amazon-drs/version' require 'amazon-drs/client' module AmazonDrs # Your code goes here... end
Convert ternary expression into if/else in S3Storage.build
require 's3_storage/null' class S3Storage NotConfiguredError = Class.new(StandardError) def self.build(bucket_name) bucket_name.present? ? new(bucket_name) : Null.new end def initialize(bucket_name) @bucket_name = bucket_name end def save(asset, options = {}) unless md5_from_metadata_for(ass...
require 's3_storage/null' class S3Storage NotConfiguredError = Class.new(StandardError) def self.build(bucket_name) if bucket_name.present? new(bucket_name) else Null.new end end def initialize(bucket_name) @bucket_name = bucket_name end def save(asset, options = {}) unle...
Add space at bottom of file
require "hanvox/proc_audio" require "hanvox/raw" require "hanvox/version" module Hanvox end
require "hanvox/proc_audio" require "hanvox/raw" require "hanvox/version" module Hanvox end
Fix production code for passing test.
require "ruzai2/version" require "active_support" require "active_support/core_ext" require "active_record" module Ruzai2 class RuzaiList < ActiveRecord::Base class << self def ban!(id_params, expired_at: nil) params = id_params.merge( expired_at: expired_at || Time.now + 7.days )...
require "ruzai2/version" require "active_support" require "active_support/core_ext" require "active_record" module Ruzai2 class RuzaiList < ActiveRecord::Base class << self def ban!(id_params, expired_at: nil) params = id_params.merge( expired_at: expired_at || Time.now + 7.days )...
Remove unnecessary class specification from factory
# -*- encoding : utf-8 -*- # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :organ do factory :tasa_arvotyoryhma, :class => Organ do name 'Tasa-arvotyöryhmä' _id "4f6b1edf91bc2b3301010101" association :organization, :factory => :kemian_laitos...
# -*- encoding : utf-8 -*- # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :organ do factory :tasa_arvotyoryhma do name 'Tasa-arvotyöryhmä' _id "4f6b1edf91bc2b3301010101" association :organization, :factory => :kemian_laitos end fact...
Add rake-compiler to development dependencies.
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rb_tuntap/version' Gem::Specification.new do |spec| spec.name = "rb_tuntap" spec.version = RbTunTap::VERSION::STRING spec.authors = ["Akshay Moghe"] spec.email ...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rb_tuntap/version' Gem::Specification.new do |spec| spec.name = "rb_tuntap" spec.version = RbTunTap::VERSION::STRING spec.authors = ["Akshay Moghe"] spec.email ...
Check if there's a taxon_concept before trying to update it...
class ChangeObserver < ActiveRecord::Observer observe :taxon_common, :distribution, :eu_decision, :listing_change, :taxon_concept_reference, :taxon_instrument, :taxon_relationship, :trade_restriction def after_save(model) model.taxon_concept. update_column(:dependents_updated_at, Time.now) end ...
class ChangeObserver < ActiveRecord::Observer observe :taxon_common, :distribution, :eu_decision, :listing_change, :taxon_concept_reference, :taxon_instrument, :taxon_relationship, :trade_restriction def after_save(model) if model.taxon_concept model.taxon_concept. update_column(:dependen...
Add some documentation to the PATTERN
require "paml/version" require "paml/stream" require "paml/node" require "paml/tag" module Paml HAML_PATTERN = / # In HAML, the whitespace between the beginning of a line and an # element definition determines the element's depth in the tree # generated from the haml source. ^(?<whitespace>\s*) # A tag can ...
require "paml/version" require "paml/line" require "paml/stream" require "paml/node" require "paml/tag" module Paml PATTERN = / # In Paml, the whitespace between the beginning of a line and an # element definition determines the element's depth in the tree # generated from the haml source. ^(?<whitespace>\t*)...
Add Rake task for importing database from prod
namespace :db do desc 'Import database from db/import/production.dump' task import: :environment do database = Rails.configuration.database_configuration[Rails.env]['database'] sh( 'pg_restore', '--verbose', '--clean', '--no-acl', '--no-owner', "-d#{database}", 'db/...
Clean up unused routes in WatirSpec
module WatirSpec class Server class App def response(path, data = nil) case path when '/' respond(self.class.name) when '/big' html = '<html><head><title>Big Content</title></head><body>' html << 'hello' * 205 html << '</body></html>' ...
module WatirSpec class Server class App def response(path, data = nil) case path when '/' respond(self.class.name) when '/post_to_me' respond("You posted the following content:\n#{data}") when '/plain_text' respond('This is text/plain', 'Content-...
Add factory for language and modify factory for query
FactoryGirl.define do factory :user do sequence(:username) { |n| "user#{n}"} sequence(:email) {|n| "email#{n}@gmail.com" } password "password" end factory :fluency do end factory :language do end factory :query do sequence(:english) {|n| "Hello #{n}"} title "Need help" descripti...
FactoryGirl.define do factory :user do sequence(:username) { |n| "user#{n}"} sequence(:email) {|n| "email#{n}@gmail.com" } password "password" end factory :fluency do end factory :language do lingua "Spanish" end factory :query do sequence(:english) {|n| "Hello #{n}"} title "Nee...
Remove tasks no longer defined by Jeweler
require 'spec/rake/spectask' require 'spec/rake/verify_rcov' spec_defaults = lambda do |spec| spec.pattern = 'spec/**/*_spec.rb' spec.libs << 'lib' << 'spec' spec.spec_opts << '--options' << 'spec/spec.opts' end Spec::Rake::SpecTask.new(:spec, &spec_defaults) Spec::Rake::SpecTask.new(:rcov) do |rcov| ...
require 'spec/rake/spectask' require 'spec/rake/verify_rcov' spec_defaults = lambda do |spec| spec.pattern = 'spec/**/*_spec.rb' spec.libs << 'lib' << 'spec' spec.spec_opts << '--options' << 'spec/spec.opts' end Spec::Rake::SpecTask.new(:spec, &spec_defaults) Spec::Rake::SpecTask.new(:rcov) do |rcov| ...
Use the new notification syntax
# # Copyright 2011, Peter Donald # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
# # Copyright 2011, Peter Donald # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
Fix DublinCore titles spec expectations
# -*- encoding : utf-8 -*- require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') require 'uwdc' describe UWDC::DublinCore do context 'PBO' do before(:each) do get_publishers_bindings_mets @dublin_core = UWDC::DublinCore.new(@id) end it "should have a titles" do ...
# -*- encoding : utf-8 -*- require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') require 'uwdc' describe UWDC::DublinCore do context 'PBO' do before(:each) do get_publishers_bindings_mets @dublin_core = UWDC::DublinCore.new(@id) end it "should have a titles" do ...
Set the default run_list back to the default recipe instead of uninstall
name 'national_parks' maintainer 'The Authors' maintainer_email 'you@example.com' license 'all_rights' description 'Installs/Configures national_parks' long_description 'Installs/Configures national_parks' version '0.1.3' # The `issues_url` points to the location where issues for this cookbook are # tracked. A `View ...
name 'national_parks' maintainer 'Bill Meyer' maintainer_email 'bill@chef.io' license 'all_rights' description 'Installs/Configures national_parks' long_description 'Installs/Configures national_parks' version '0.1.4' # The `issues_url` points to the location where issues for this cookbook are # tracked. A `View Issu...
Fix a bug in example
lang = automaton <<-ADL 3 5 0 true true 1 false false 2 false true 0 1 a 1 1 a 1 2 b 2 2 b 2 0 a ADL # In a canonical automaton A(lang) of language `lang`, the set of short prefixes # is the set of first strings in standard order, each leading to a particular # state of the canonical automaton. As ...
lang = automaton <<-ADL 3 5 0 true true 1 false false 2 false true 0 1 a 1 1 a 1 2 b 2 2 b 2 0 a ADL # In a canonical automaton A(lang) of language `lang`, the set of short prefixes # is the set of first strings in standard order, each leading to a particular # state of the canonical automaton. As ...
Add rudimentary recipients to serializer
class InvitableSerializer < ActiveModel::Serializer attributes :name, :subtitle, :image def subtitle case object when Group then "Add all members (#{object.members.count})" when Contact then "<#{object.email}>" when User then "I'm a user!" end end ...
class InvitableSerializer < ActiveModel::Serializer attributes :name, :subtitle, :image, :recipients def subtitle case object when Group then "Add all members (#{object.members.count})" when Contact then "<#{object.email}>" when User then "I'm a user!" ...
Add prompt: '> ' to player_input in while loop
require_relative "world_command.rb" # Runs the main game loop. # # @param [Player] player the player of the game. def run_driver(player) input = player_input prompt: '> ' while (input.casecmp("quit") != 0) interpret_command(input, player) input = player_input end end
require_relative "world_command.rb" # Runs the main game loop. # # @param [Player] player the player of the game. def run_driver(player) input = player_input prompt: '> ' while (input.casecmp("quit") != 0) interpret_command(input, player) input = player_input prompt: '> ' end end
Test version of Fisher-Yate's array shuffle
# Cannot create a temporary array or make copies of the input array # Must move the elements in place # Two elements may swap places # Shouldn't be able to predict what the shuffled array looks like # The shuffled array could look the same as the input array # The larger the input array the higher the likelihood you wi...
Add a couple of features tests
require 'spec_helper' describe "index page" do it "has Highest-Rated games" do visit('/') expect(page).to have_content("Highest-Rated") end it "has Recently Added games" do visit('/') expect(page).to have_content("Recently Added") end it "has Recently Added games" do visit('/') expe...
Update rake requirement from ~> 12.0 to ~> 13.0
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'boundary_days/version' Gem::Specification.new do |spec| spec.name = 'boundary_days' spec.version = BoundaryDays::VERSION spec.authors = ['Kazuhiro Serizawa'] spec.ema...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'boundary_days/version' Gem::Specification.new do |spec| spec.name = 'boundary_days' spec.version = BoundaryDays::VERSION spec.authors = ['Kazuhiro Serizawa'] spec.ema...
Update rspec_junit_formatter requirement from ~> 0.4.1 to ~> 0.5.1
# coding: utf-8 # frozen_string_literal: true lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "business/version" Gem::Specification.new do |spec| spec.name = "business" spec.version = Business::VERSION spec.authors = ["Harry Marr"] sp...
# coding: utf-8 # frozen_string_literal: true lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "business/version" Gem::Specification.new do |spec| spec.name = "business" spec.version = Business::VERSION spec.authors = ["Harry Marr"] sp...
Simplify selection of curatable artefacts
require "curated_list" class CuratedList def usable_artefacts artefacts.select { |a| ["draft", "live"].include?(a.state) } end end
require "curated_list" class CuratedList def usable_artefacts artefacts.reject { |a| a.archived? } end end
Add tests for valid transportation
require 'rails_helper' RSpec.describe Transportation, :type => :model do pending "add some examples to (or delete) #{__FILE__}" end
require 'rails_helper' describe Transportation do let(:transportation) { FactoryGirl.create(:transportation) } context "valid transportation" do it "has valid factory" do expect(transportation.valid?).to be_truthy end it "has description" do transportation.description = nil expect(transpo...
Fix call-route for cases where only path is passed
# Calls an app route and returns a response, just like an HTTP request! # Pakyow::Realtime.handler :'call-route' do |message, session, response| path, qs = message['uri'].split('?') path_parts = path.split('/') path_parts << 'index' if path_parts.count == 3 path_parts[-1] += '.json' uri = [path_parts.join('/'...
# Calls an app route and returns a response, just like an HTTP request! # Pakyow::Realtime.handler :'call-route' do |message, session, response| path, qs = message['uri'].split('?') path_parts = path.split('/') if path =~ /^https?:\/\// path_parts << 'index' if path_parts.count == 3 else path_parts << ...
Remove set_time_zone method from before_action
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_action :set_time_zone, :set_mailer_host def set_time_zone Time.zone = 'Tokyo' end def set_mailer_h...
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_action :set_mailer_host def set_mailer_host ActionMailer::Base.default_url_options = {:host => request....
Bump the number of iterations for the get/set benchmark.
require 'benchmark' require File.dirname(__FILE__) + '/../harness' LARGE_NUMBER = 20_000 Benchmark.bmbm do |b| b.report('get/set remix-stash') do LARGE_NUMBER.times {|n| stash[:abcxyz123] = n stash[:abcxyz123] } end b.report('get/set remix-stash named') do LARGE_NUMBER.times {|n| s...
require 'benchmark' require File.dirname(__FILE__) + '/../harness' LARGE_NUMBER = 50_000 Benchmark.bmbm do |b| b.report('get/set remix-stash') do LARGE_NUMBER.times {|n| stash[:abcxyz123] = n stash[:abcxyz123] } end b.report('get/set remix-stash named') do LARGE_NUMBER.times {|n| s...
Remove redundant call to update
require 'core_audio' graph = AudioToolbox::AUGraph.new graph.add_node(:type => 'aumu', :sub_type => 'dls ', :manufacturer => 'appl') graph.add_node(:type => 'auou', :sub_type => 'def ', :manufacturer => 'appl') mus = graph.node_at(0) out = graph.node_at(1) graph.connect_node_input(mus, 0, out, 0) graph.update graph.o...
require 'core_audio' graph = AudioToolbox::AUGraph.new graph.add_node(:type => 'aumu', :sub_type => 'dls ', :manufacturer => 'appl') graph.add_node(:type => 'auou', :sub_type => 'def ', :manufacturer => 'appl') mus = graph.node_at(0) out = graph.node_at(1) graph.connect_node_input(mus, 0, out, 0) graph.open graph.ini...
Add attr_accessible back to User model
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable validates_pre...
class User < ActiveRecord::Base # Setup accessible (or protected) attributes for your model attr_accessible :email, :password, :password_confirmation, :remember_me # Include default devise modules. Others available are: # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniautha...
Allow all emails to be disabled
class SubmissionMailer < ApplicationMailer def queued(submission) @submission = submission mail(to: @submission.user.email, subject: 'Submission Received') end def deposited(submission) @submission = submission mail(to: @submission.user.email, subject: 'Submission Complete') end def rejected...
class SubmissionMailer < ApplicationMailer def queued(submission) return if ENV['DISABLE_ALL_EMAIL'] @submission = submission mail(to: @submission.user.email, subject: 'Submission Received') end def deposited(submission) return if ENV['DISABLE_ALL_EMAIL'] @submission = submission mail(to:...
Change controller to retrieve API info for creating objects
require 'rubygems' require 'rest-client' require 'json' # All of these endpoints should use https://www.inaturalist.org as the base URL, particularly endpoints that require auth. get '/' do # url = "https://www.inaturalist.org/observations.json?q=#{params['q']}" response = RestClient.get("https://www.inaturalist....
require 'rubygems' require 'rest-client' require 'json' # All of these endpoints should use https://www.inaturalist.org as the base URL, particularly endpoints that require auth. get '/' do response = RestClient.get("https://www.inaturalist.org/observations.json") parsed_response = JSON.parse(response,:symbolize_...
Use 'arel_table' instead of the (apparently-incorrect) 'table'
module Spree Order.class_eval do has_many :fishbowl_logs attr_accessible :fishbowl_id, :so_number scope :fishbowl_submitted, lambda { where(table[:fishbowl_id].not_eq(nil)) } scope :fishbowl_unsubmitted, lambda { where(table[:fishbowl_id].eq(nil)) } alias_method :original_can_ship?, :can_ship? ...
module Spree Order.class_eval do has_many :fishbowl_logs attr_accessible :fishbowl_id, :so_number scope :fishbowl_submitted, lambda { where(arel_table[:fishbowl_id].not_eq(nil)) } scope :fishbowl_unsubmitted, lambda { where(arel_table[:fishbowl_id].eq(nil)) } alias_method :original_can_ship?, :c...
Update error messages to use correct class name
module ContentManager module ClassResolution def self.content_class(name) content_class_name(name).constantize end def self.content_class_name(class_name) klass = class_name.classify if Object.const_defined?(klass) return klass elsif file_path = rails_constant_file_path(...
module ContentManager module ClassResolution def self.content_class(name) content_class_name(name).constantize end def self.content_class_name(class_name) klass = class_name.classify if Object.const_defined?(klass) return klass elsif file_path = rails_constant_file_path(c...
Fix `url` stanza comment for StepMania.
cask 'stepmania' do version '5.0.10' sha256 '7e852089ff4cb13217e4a8debb76b1bffb3d8ff6ca31c903ff768577742b50a0' url "https://github.com/stepmania/stepmania/releases/download/v#{version}/StepMania-#{version}-mac.dmg" name 'StepMania' homepage 'http://www.stepmania.com/' license :mit app "StepMania-#{versi...
cask 'stepmania' do version '5.0.10' sha256 '7e852089ff4cb13217e4a8debb76b1bffb3d8ff6ca31c903ff768577742b50a0' # github.com/stepmania/stepmania was verified as official when first introduced to the cask url "https://github.com/stepmania/stepmania/releases/download/v#{version}/StepMania-#{version}-mac.dmg" na...
Use symbol instead of string in RedisCacheable attribute definitions
module RedisCacheable extend ActiveSupport::Concern include Gitlab::Utils::StrongMemoize CACHED_ATTRIBUTES_EXPIRY_TIME = 24.hours class_methods do def cached_attr_reader(*attributes) attributes.each do |attribute| define_method("#{attribute}") do cached_attribute(attribute) || read...
module RedisCacheable extend ActiveSupport::Concern include Gitlab::Utils::StrongMemoize CACHED_ATTRIBUTES_EXPIRY_TIME = 24.hours class_methods do def cached_attr_reader(*attributes) attributes.each do |attribute| define_method(attribute) do cached_attribute(attribute) || read_attr...
Add nmap to osx development
include_recipe "wel_station::github_for_mac" include_recipe "wel_station::homebrew" include_recipe "wel_station::iterm2" include_recipe "wel_station::workspace_directory" include_recipe "wel_station::git_projects" include_recipe "wel_station::sublime_text" include_recipe "wel-osx-settings::global_environment_variables"...
include_recipe "wel_station::github_for_mac" include_recipe "wel_station::homebrew" include_recipe "wel_station::iterm2" include_recipe "wel_station::workspace_directory" include_recipe "wel_station::git_projects" include_recipe "wel_station::sublime_text" include_recipe "wel-osx-settings::global_environment_variables"...
Move appium.txt loading to appium_lib
# encoding: utf-8 require 'rubygems' Gem::Specification.class_eval { def self.warn( args ); end } require 'pry' module Appium; end unless defined? Appium module Appium::Console # Check for env vars in .txt toml = File.join Dir.pwd, 'appium.txt' class Env def initialize data @data = data end ...
# encoding: utf-8 require 'rubygems' Gem::Specification.class_eval { def self.warn( args ); end } require 'pry' module Appium; end unless defined? Appium module Appium::Console require 'appium_lib' load_appium_txt file: Dir.pwd + '/appium.txt' start = File.expand_path '../start.rb', __FILE__ cmd = ['-r', sta...
Refactor of building the morse instructions - first pass
module Vail class Generator def initialize(config) @config = config @config[:repetitions] ||= 1 Dot.class_variable_set(:@@duration, @config[:dot][:duration]) Dot.class_variable_set(:@@pause, @config[:dot][:pause]) Dash.class_variable_set(:@@duration, @config[:dash][:duration]) ...
module Vail class Generator def initialize(config) @config = config @config[:repetitions] ||= 1 Dot.class_variable_set(:@@duration, @config[:dot][:duration]) Dot.class_variable_set(:@@pause, @config[:dot][:pause]) Dash.class_variable_set(:@@duration, @config[:dash][:duration]) ...
Leverage association when building model
module Renalware class EventsController < BaseController before_action :load_patient, :only => [:new, :create, :index] def new @event = Event.new authorize @event @event_type = EventType.new end def create @event = Event.new(event_params) authorize @event @event....
module Renalware class EventsController < BaseController before_action :load_patient, :only => [:new, :create, :index] def new @event = Event.new authorize @event @event_type = EventType.new end def create @event = @patient.events.new(event_params) authorize @event ...
Update Tinkey URL and SHA-256 hash for Tink 1.6.0.
# A Homebrew formula for Tinkey on Linux and macOS. # Usage: # brew tap google/tink https://github.com/google/tink # brew install tinkey class Tinkey < Formula desc "A command line tool to generate and manipulate keysets for the Tink cryptography library" homepage "https://github.com/google/tink/tree/master/tools/...
# A Homebrew formula for Tinkey on Linux and macOS. # Usage: # brew tap google/tink https://github.com/google/tink # brew install tinkey class Tinkey < Formula desc "A command line tool to generate and manipulate keysets for the Tink cryptography library" homepage "https://github.com/google/tink/tree/master/tools/...
Add one more tech debt todo
module Services class TaskTwitter include Import[:twitter, 'services.url_shortener'] def call(task) tweet text(task) end private def link_to_task(task_id) url_shortener.call("http://www.ossboard.org/tasks/#{task_id}") end def text(task) tag_and_link = "#ossboard #{lin...
module Services class TaskTwitter include Import[:twitter, 'services.url_shortener'] def call(task) tweet text(task) end private def link_to_task(task_id) url_shortener.call("http://www.ossboard.org/tasks/#{task_id}") end def text(task) tag_and_link = "#ossboard #{lin...
Fix a file name error in the gemspec.
Gem::Specification.new do |s| s.name = "jsrebuild" s.version = "0.1.0" s.author = "Benedict Eastaugh" s.email = "benedict@eastaugh.net" s.homepage = "https://github.com/othermedia/jsrebuild" s.summary = "Dynamic rebuilder for JavaScript projects" s.description = "Dynamic...
Gem::Specification.new do |s| s.name = "jsrebuild" s.version = "0.1.0" s.author = "Benedict Eastaugh" s.email = "benedict@eastaugh.net" s.homepage = "https://github.com/othermedia/jsrebuild" s.summary = "Dynamic rebuilder for JavaScript projects" s.description = "Dynamic...
Fix migration for better search
class CreateRepositoryListValues < ActiveRecord::Migration[5.1] def change create_table :repository_list_items do |t| t.references :repository, index: true, foreign_key: true t.references :repository_column, index: true, foreign_key: true t.text :data, index: true, using: :gin, null: false ...
require File.expand_path('app/helpers/database_helper') class CreateRepositoryListValues < ActiveRecord::Migration[5.1] include DatabaseHelper def up create_table :repository_list_items do |t| t.references :repository, index: true, foreign_key: true t.references :repository_column, index: true, fo...
Update method for finding visible Comments
class Idea < ActiveRecord::Base belongs_to :owner, :class_name => 'User' belongs_to :current has_many :votes, :dependent => :destroy, :foreign_key => [:user_id, :idea_id] has_many :voters, :through => :votes, :source => :user, :class_name => 'User' has_many :comments, -> { order(created_at: :asc) }, :depend...
class Idea < ActiveRecord::Base belongs_to :owner, :class_name => 'User' belongs_to :current has_many :votes, :dependent => :destroy, :foreign_key => [:user_id, :idea_id] has_many :voters, :through => :votes, :source => :user, :class_name => 'User' has_many :comments, -> { order(created_at: :asc) }, :depend...
Use real brain instead of stub
require 'spec_helper' describe Ruboty::ToggleSwitch::Storage do subject(:storage) { Ruboty::ToggleSwitch::Storage.new(brain) } let(:brain) { double('brain', data: {}) } let(:key) { 'key' } describe '#[](key)' do context 'nil' do it { expect(storage[key]).to be_nil } end context 'on' do ...
require 'spec_helper' describe Ruboty::ToggleSwitch::Storage do subject(:storage) { Ruboty::ToggleSwitch::Storage.new(brain) } let(:brain) { Ruboty::Brains::Memory.new } let(:key) { 'key' } describe '#[](key)' do context 'nil' do it { expect(storage[key]).to be_nil } end context 'on' do ...
Add totals to allocation output.
$LOAD_PATH.unshift File.expand_path("../../../lib", __FILE__) require 'rspec/core' require 'allocation_stats' def benchmark_allocations(burn: 1, min_allocations: 0) stats = AllocationStats.new(burn: burn).trace do yield end columns = if ENV['DETAIL'] [:sourcefile, :sourceline, :class_plus] ...
$LOAD_PATH.unshift File.expand_path("../../../lib", __FILE__) require 'rspec/core' require 'allocation_stats' def benchmark_allocations(burn: 1, min_allocations: 0) stats = AllocationStats.new(burn: burn).trace do yield end columns = if ENV['DETAIL'] [:sourcefile, :sourceline, :class_plus] ...
Revert "Remove a needless file"
mtimes = {} loop do Dir.glob("*.{rb,csv}") do |path| mtime = File.mtime(path) if mtimes[path].nil? or mtimes[path] != mtime system("ruby", "test-calculator.rb") mtimes[path] = mtime end end sleep 1 end
Fix reference in Tracker spec
require 'spec_helper' describe Tracker do context "validations" do it { should have_valid_factory(:tracker) } end end
require 'spec_helper' describe Spree::Tracker do context "validations" do it { should have_valid_factory(:tracker) } end end
Set timeout for newer ruby versions
class NameResolver < Scout::Plugin needs 'resolv' OPTIONS=<<-EOS nameserver: default: 8.8.8.8 resolve_address: default: google.com EOS def build_report resolver = Resolv::DNS.new(:nameserver => [option(:nameserver)]) begin resolver.getaddress(option(:resolve_address)) res...
class NameResolver < Scout::Plugin needs 'resolv' OPTIONS=<<-EOS nameserver: default: 8.8.8.8 resolve_address: default: google.com timeout: default: 30 EOS # Doesn't work :( TIMEOUT=77 def build_report resolver = Resolv::DNS.new(:nameserver => [option(:nameserver)]) #...
Remove require for deleted file
require "active_enumerable/version" require "active_enumerable/base" require "active_enumerable/record_not_found" require "active_enumerable/comparable" require "active_enumerable/enumerable" require "active_enumerable/finder" require "active_enumerable/method_caller" require "active_enumerable/scope_method" require "a...
require "active_enumerable/version" require "active_enumerable/base" require "active_enumerable/record_not_found" require "active_enumerable/comparable" require "active_enumerable/enumerable" require "active_enumerable/finder" require "active_enumerable/method_caller" require "active_enumerable/scope_method" require "a...
Use ActiveRecord's includes finder to avoid N+1 problem
class DashboardsController < ApplicationController before_action :authenticate_user! def show @posts = Post.all end end
class DashboardsController < ApplicationController before_action :authenticate_user! def show @posts = Post.all.includes(:user) end end