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
//--- USAGE: | |
// After user is authenticated, Connects to WS | |
socket.connect(authHeaders); | |
// Then, Setup listeners for each WS channel | |
const sessionChannel = socket.join('SessionChannel'); | |
sessionChannel.on('logout', data => dispatch(logoutSuccess())); | |
const orderChannel = socket.join('OrderChannel'); |
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
# Ruby code that will flatten an array of arbitrarily nested arrays of integers | |
# into a flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4]. | |
# A tail recursion was adopted so the minimal amount of variables is added to the stack. | |
class Utils | |
def flatten_array(arr) | |
# if it's not array return nil | |
if !(arr.is_a? Array) | |
return nil | |
end |