Skip to content

Instantly share code, notes, and snippets.

Amit Patel AmitPatel-BoTreeConsulting

Block or report user

Report or block AmitPatel-BoTreeConsulting

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
AmitPatel-BoTreeConsulting / active_transfer.rb
Created Apr 29, 2019
Using CommandExecutable to send file over Firefox Send
View active_transfer.rb
require_relative 'command_executable'
class ActiveTransfer
include CommandExecutable
def initialize(file_path)
@file_path = file_path
def transfer
AmitPatel-BoTreeConsulting / command_executable.rb
Created Apr 29, 2019
Execute shell command and read command output
View command_executable.rb
require 'open3'
module CommandExecutable
attr_accessor :error, :output, :command_status
def execute_shell_command(command)
puts "+-+-+-+-+-+ Executing >>>>>>>> $ #{command.join(' ')}"
Open3.popen3(*command) do |stdin, stdout, stderr, wait_thr|
public interface MyOnClickListener {
void onClick(View v);
boolean onLongClick(View v);
AmitPatel-BoTreeConsulting /
Last active Apr 2, 2019
BoTree Technologies Rub on Rails Exercise

Build Simple Web Application where an user can:

  1. Self Sign up to Open(create) Account
  2. Deposit money
  3. Get the current balance
  4. With positive balance a. Withdraw money b. Transfer money to another account
  5. View statement of transactions like we receive from Bank

Other Instructions

  • Use Latest Stable Version of Ruby and Rails
AmitPatel-BoTreeConsulting / fix_jsonb.rb
Created Oct 26, 2018
Fix product_info jsonb column values
View fix_jsonb.rb
# Need to run following line in production/stagin rails console after merging
QuarantineCode.all.each do |q|
q.update!(product_info: JSON(q.product_info))
AmitPatel-BoTreeConsulting / test.sql
Created Oct 26, 2018
check if an attribute doesn't have null
View test.sql
SELECT * FROM "quarantine_codes" where (product_info->'inventory_group_attributes'->'rxcui')::text IS NOT NULL
View search_issue.rb
# Search product by show_name
p = Product.filter_by(show_name: 'Sildenafil').results
# Collect uniq drug names for search products
p.each_with_object([]) { |p, o| o << }.uniq
# => ["sildenafil 20 MG Oral Tablet", "sildenafil 100 MG Oral Tablet"]
# Search all drug with name `sildenafil`
Drug.where("name ilike '%sildenafil%'").pluck :name, :id
# => [["sildenafil 20 MG Oral Tablet", 1024], ["sildenafil 100 MG Oral Tablet", 1723], ["sildenafil 25 MG Oral Tablet", 2062], ["sildenafil 50 MG Oral Tablet", 4139], ["sildenafil 10 MG/ML Oral Suspension", 5588]]
View settings.local.yml
mms: '/home/amit/Downloads/market_rx_csv/MMS/'
qs1: '/home/amit/Downloads/market_rx_csv/QS1/'
offline_sandbox_ftp: '/home/amit/Downloads/market_rx_csv/offline_data/'
View access_google_driver.rb
require 'google/apis/drive_v3'
require "googleauth"
credentials =
client_id: "",
client_secret: "jWiGrijiFCNRmig1s3aQt",
scope: [""],
additional_parameters: { "access_type" => "offline" })
View google_drive.rb
require 'google/apis/drive_v3'
# Create object of the drice service
service = Google::Apis::DriveV3
# Authorize it with the help of credentials generated
service.authorization = credentials
You can’t perform that action at this time.