Skip to content

Instantly share code, notes, and snippets.

@owenr
owenr / keybase.md
Created December 5, 2016 02:31
keybase.md

Keybase proof

I hereby claim:

  • I am owenr on github.
  • I am rodda (https://keybase.io/rodda) on keybase.
  • I have a public key whose fingerprint is A66F 638A B22D 971E 61F2 558D ECE2 9C3C 6B61 F19A

To claim this, I am signing this object:

@owenr
owenr / .block
Last active October 13, 2017 11:39
Curve interpolation of radial lines
license: mit
scrolling: no
@owenr
owenr / .block
Last active September 8, 2016 02:26
Horizon Chart
license: gpl-3.0
@owenr
owenr / .block
Created September 5, 2016 12:02
.Astronomy Star Chart
license: mit
@owenr
owenr / viewpoint_limit.rb
Created January 12, 2016 19:11
How to limit the number of email messages returned by the Ruby gem viewpoint, querying Exchange EWS (outlook mail)
inbox.items indexed_page_item_view: {
max_entries_returned: 100,
offset: 0,
base_point: 'Beginning'
}
@owenr
owenr / bug.rb
Created December 31, 2015 04:54
Rails 5/PaperTrail/belongs_to_required_by_default issue
# Failing test for versioning destroyed objects using PaperTrail and Rails 5 (with new AR default config option)
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
ruby '2.3.0'
@owenr
owenr / torquebox_scheduler_adapter.rb
Created July 10, 2015 01:17
ActiveJob adapter for TorqueBox 4.0 scheduler (torquebox-scheduling). Seems to work; place into config/initializers/ and specify the adapter in config/application.rb as follows: config.active_job.queue_adapter = :torquebox_scheduler
require 'torquebox-scheduling'
module ActiveJob
module QueueAdapters
class TorqueboxSchedulerAdapter
class << self
def enqueue(job) #:nodoc:
TorqueBox::Scheduling::Scheduler.schedule(job.hash, in: 35) do
Base.execute(job.serialize)
end
end
@owenr
owenr / capybara_ext.rb
Last active December 30, 2015 15:48
Extend Capybara's #set and #fill_in methods to support select boxes. Save to Rails directory config/initializers/
require 'capybara'
module Capybara
module Node
module ElementExt
def set(value, fill_options={})
if self.tag_name == 'select'
opt = find(:option, value)
if opt.blank?
warn "Could not find option '#{value}' in '#{self.inspect}"
else