This file contains hidden or 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
| #!/usr/bin/env ruby | |
| require 'rubygems' unless defined?(Gem) | |
| require 'json' | |
| require 'pry' | |
| require 'net/http' | |
| module Couch |
This file contains hidden or 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
| diff --git a/lib/token_generator.rb b/lib/token_generator.rb | |
| index 8481154..4fe7527 100644 | |
| --- a/lib/token_generator.rb | |
| +++ b/lib/token_generator.rb | |
| @@ -2,7 +2,6 @@ | |
| module TokenGenerator | |
| def self.generate | |
| - random_text = ([Time.now.to_f] + (1..10).map{rand}).join('--') | |
| - ActiveSupport::Base64.encode64_url(Digest::SHA1.digest(random_text)) |
This file contains hidden or 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
| diff --git a/lib/token_generator.rb b/lib/token_generator.rb | |
| index 8481154..a80ca28 100644 | |
| --- a/lib/token_generator.rb | |
| +++ b/lib/token_generator.rb | |
| @@ -2,7 +2,6 @@ | |
| module TokenGenerator | |
| def self.generate | |
| - random_text = ([Time.now.to_f] + (1..10).map{rand}).join('--') | |
| - ActiveSupport::Base64.encode64_url(Digest::SHA1.digest(random_text)) |
This file contains hidden or 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
| should "contain a sip_number_format that doesn't allow nil or bogus" do | |
| @sip_integration.set!(:sip_number_format => :E164) | |
| assert_raise ActiveRecord::StatementInvalid, /sip_number_format' cannot be null/ do | |
| @sip_integration.set!(:sip_number_format => nil) | |
| end | |
| assert_equal :E164, @sip_integration.sip_number_format | |
| end |
This file contains hidden or 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 Class | |
| def descendants | |
| ObjectSpace.each_object(::Class).select {|klass| klass < self } | |
| end | |
| end |
This file contains hidden or 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
| lib/elixir_sips_downloader/extractors/catalog.rb |
This file contains hidden or 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
| #!/usr/bin/env ruby# | |
| # encoding: utf-8 | |
| require 'thor' | |
| require 'octokit' | |
| require 'etc' | |
| class GithubKeyGenerator < Thor | |
| include Thor::Actions | |
| GITHUB_KEY_NAME = 'github_key' |
This file contains hidden or 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 write_csv(excelx_filename, outfile_name) | |
| CSV.open(outfile_name, "wb") do |csv| | |
| Roo::Excelx.new(excelx_filename, minimal_load: true).each_row_streaming do |row_cells| | |
| csv << row_cells.map(&:value) | |
| end | |
| end | |
| end |
This file contains hidden or 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
| # Excel column string to 0 indexed position | |
| def self.excel_col_to_index(str) | |
| offset = 'A'.ord - 1 | |
| str.upcase.chars.inject(0) { |x,c| x * 26 + c.ord - offset } - 1 | |
| end | |
| # 0 based index to column letter | |
| def self.index_to_excel_col(index) | |
| 'A'.tap do |name| | |
| index.times { name.succ! } |
This file contains hidden or 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 'csv' | |
| class FileSplitter | |
| SPLIT_COUNT = 250_000 | |
| COPY_HEADERS = true | |
| def initialize(filename) | |
| @filename = filename | |
| @header = nil | |
| @file_count = 1 |