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
Settings.client_databases.to_h.map{ |k,v| v }.uniq.each_with_index do |db, index| | |
puts "-------------------& DB - #{db} &-----------------\n\n" | |
Client.all.each do |client| | |
Mongoid::Multitenancy.current_tenant = client | |
puts " & Client - #{client.name} &\n\n" | |
UserRole.find_or_create_by!(name: 'Supplier Manager') | |
UserRole.find_or_create_by!(name: 'Project Admin') | |
UserRole.find_or_create_by!(name: 'Budget Admin') | |
end | |
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
module TransformationEngine | |
## | |
# This class is for transpose the rows | |
class TransposeTransformer < BaseTransformer | |
attr_accessor :fixed_cols, :varying_cols | |
def initialize(rule_hash) | |
super(rule_hash) | |
self.type = 'collection' | |
self.fixed_cols = rule_hash[:fixed_cols].split(',').map(&:to_sym) |
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
function currencyUsd(rate) { | |
return function(amt) { return (amt / rate) + ' USD' } | |
} | |
inrToUsd = currencyUsd(65) | |
krwToUsd = currencyUsd(1058) | |
inrToUsd(65) // 1 USD (65inr is 1usd) | |
krwToUsd(1058) // 1 USD (1058krw is 1usd) |
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
- PPT for javascript, CSS and HTML | |
- Closure and its examples | |
- Protractor for unit testing | |
http://www.protractortest.org/#/ | |
- Jquery and Ajax CORS | |
https://stackoverflow.com/questions/2067472/what-is-jsonp-all-about | |
- Mobile security considerations |
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
var x = [ | |
'1', | |
12, | |
[1, 2, { a: 'z' }], | |
{ a: 'zzz' } | |
] | |
function ArrayToString(x) { | |
var result = '[ ' |
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 profit(ex1, ex2, in_amt) | |
trd_amt = in_amt.to_f + in_amt.to_f * 0.01 | |
in_ripple = (in_amt.to_f/ex1.to_f) | |
final_amt = in_ripple*ex2.to_f | |
final_amt-trd_amt | |
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
in_amt_inr = 10000 # Investment amount in INR | |
cryp_inr = 69.70 # cyrpto 1 price in INR | |
cryp_btc = 0.000073 # cyrpto 1 price in USD | |
cryp2_btc = 0.019470 # cyrpto 2 price in USD | |
cryp2_inr = 18350 # cyrpto 2 price in INR | |
ex1_to_ex2_tf = 0.04 | |
conv_btc_ef = 0.0 | |
conv_btc_to_cryp2_ef = 0.0 | |
ex2_to_ex1_tf = 0.001 |
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
Mongoid.override_database 'sterlite_resustain_io' | |
Mongoid::Multitenancy.current_tenant = Client.first | |
callbacks = IndicatorRecord._save_callbacks.select { |cb| cb.kind == :before }.map { |cb| cb.as_json["key"] }.map(&:to_sym) | |
indi = Indicator.find('5910150062cee9ae1a000002') | |
indicator_attri = indi.indicator_attributes.where(attribute_type: 'formula') | |
IndicatorRecord.skip_callback(:save, :before, *callbacks) | |
IndicatorRecord.where(indicator_id: '5910150062cee9ae1a000002', grade: '6th', :start_date.gte => 'June 1,2015', type_of_set: 'Sample', :start_date.lte => 'March 1,2016').each_with_index do |ir,i| | |
puts i |
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
m = [ | |
{ | |
:src => :letters, | |
'Sample' => { 'BoY' => :boy_letter_score_for_sample, 'EoY' => :eoy_letter_score_for_sample }, | |
'Control' => { 'EoY' => :eoy_letter_scores, 'BoY' => :boy_letter_score } | |
}, | |
{ | |
:src => :sound_score, | |
'Sample' => { 'BoY' => :boy_sound_score_for_sample, 'EoY' => :eoy_sound_score_for_sample }, | |
'Control' => { 'EoY' => :eoy_sound_score_for_control, 'BoY' => :boy_sound_score_for_control } |
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 analytics_migration(old_project_id, new_project_id) | |
Analytic.where(project_ids: old_project_id).each do |analytic| | |
next unless analytic.project_ids.present? | |
analytic.project_ids = analytic.project_ids.map{ |_id| _id == old_project_id ? new_project_id : _id } | |
analytic.save! | |
end | |
end | |
def project_view_details_progress_outcomes_outputs_impacts(old_project_id, new_project_id) | |
class Output;belongs_to :project;end |
NewerOlder