This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
USAGE: | |
ruby ssh_into_ey_cloud.rb [name of environment] | |
=end | |
environment = ARGV[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rspec/core/formatters/base_text_formatter" | |
require 'headless' | |
require 'fileutils' | |
class AcceptanceVideoFormatter < RSpec::Core::Formatters::BaseTextFormatter | |
def initialize(output) | |
@headless = Headless.new( | |
video: { | |
nomouse: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):001:0> A = [1,2,3] | |
=> [1, 2, 3] | |
irb(main):002:0> def test_next | |
irb(main):003:1> puts A.map{|x| next x}.inspect | |
irb(main):004:1> puts "Finished nexting!" | |
irb(main):005:1> end | |
=> nil | |
irb(main):006:0> test_next | |
[1, 2, 3] | |
Finished nexting! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sometimes it works... | |
Digest: [18 8c ab df 4a 78 3a 31 2e 9a 57 94 a8 b 76 42 6c 12 3d 83] | |
Offset: 3 | |
Excerpt: [df 4a 78 3a] | |
Unsigned: [5f 4a 78 3a] | |
Squashed: 5f4a783a | |
------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH unified_materials AS( | |
-- Find the base materials (used to calculate the 'base price' for an item?) | |
SELECT typename, quantity FROM invtypematerials AS mats | |
INNER JOIN invtypes ON invtypes.typeid = mats.materialtypeid | |
WHERE mats.typeid = 11993 | |
UNION | |
-- Find the complex materials (Never present in T1 stuff) | |
SELECT invtypes.typename, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pg' | |
require 'mongo' | |
require 'nokogiri' | |
mongo_conn = Mongo::Connection.new.db("qcloud_dev") | |
pg_conn = PG.connect(:dbname => "poc") | |
standards_collection = mongo_conn["standards"] | |
sheets_collection = mongo_conn["sheets"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def index | |
arel = DocumentFilter.find(params) | |
@documents = Pager.new(arel, :page => params[:page]).paged_results | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
non_paged_count | id [extra columns omitted] | |
-----------------+-------- | |
130 | 239184 | |
130 | 239183 | |
[98 additional records omitted] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Pager | |
attr_reader :arel, :page, :per_page | |
def initialize(arel, options={}) | |
@arel = arel | |
@page = Integer(options[:page]) rescue 1 | |
@per_page = Integer(options[:per_page]) rescue arel.klass.default_per_page | |
end | |
def paged_results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
results = arel. | |
select("COUNT(#{table_name}.id) OVER () AS non_paged_count, #{table_name}.*"). | |
offset(offset). | |
limit(per_page).all |