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
/** | |
* Making a Search Condition for Crawler Product in Elastic Search | |
*/ | |
var search_condition = function(input){ | |
return new Promise(function(resolve, reject) { | |
// Variables needed to execute functions and make condition | |
var conditions = {limit: input.limit || 10, offset: input.offset || 0 }, | |
condition = [{term: {group_ids: input.group_id}}]; | |
Promise.all([channel_group_conditions(input), pim_conditions(input), range_conditions(input), crawler_conditions(input)]) | |
.then(function(condition){ |
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 GetRangeData < ActiveRecord::Migration[5.1] | |
def up | |
execute " | |
CREATE OR REPLACE FUNCTION public.GetRangeData( | |
thng_id INTEGER, | |
parameter VARCHAR, | |
duration INTEGER, -- 0 -> months, 1 -> weeks, 2 --> days, 3 --> hours | |
mnth INTEGER, -- 0 -> all_months, 1 -> Jan, 2 --> Feb, 3 --> Mar, ...., 12 --> Dec | |
yr INTEGER, | |
parameter_division INTEGER DEFAULT 1, |
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
# Single Stack Multi Array | |
=begin | |
Question: Remove all consecutive characters from string whose count is even | |
Input | |
array = [ | |
'azxxzyyyddddyzzz', | |
'xyzzyyyzx', | |
'cbbbaaaabbbccc' | |
] | |
How it works |
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
/# | |
How to Run the Program | |
1. Add list of arrays in the list below to test code | |
2. Execute the file from it's location | |
$ ruby array_flatten.rb | |
You will get your results as below | |
array: [1, 2, 3, [4, 5, 6, 7, [8, 9]]] | |
flatten_array: [1, 2, 3, 4, 5, 6, 7, 8, 9] | |
NewerOlder