Proxy cache passes GET instead of HEAD to upstream... so we have a 403.
This version include these fixes.
- Remove $request_method from $string_to_sign and pass static string "GET" instead
- Remove proxy_buffering directive for allowing the nginx cache
| // Design a system for interfacing with multiple flight APIs | |
| // Technical Requirements: | |
| // | |
| // 1. The system should be flexible enough to trivially add new flight APIs | |
| // 2. The flight responses should conform to an internal schema/interface | |
| // Questions: | |
| // | |
| // 1. How many different APIs/Data sources do we need to interact with? |
| When wanting to use composition for your components, how do you handle cases where you always need to map items | |
| for things like Radio Group or Accordion Items? | |
| For example: https://chakra-ui.com/docs/disclosure/accordion | |
| <Accordion> | |
| // How can I encapsulate this without losing composition? Is it even worth it? | |
| // In the case where we need to have other developers use this composition, how do we ensure they use it correctly? | |
| // Using TypeScript btw |
| function pairSum(data, target) { | |
| const pairMatches = {}; | |
| for(let i = 0; i < data.length; i++) { | |
| const number = data[i]; | |
| const difference = (target - number); | |
| if (pairMatches[number]) { | |
| return true; | |
| } |
| function pairSum(data, target) { | |
| let sumMatchesTarget; | |
| data.forEach((currentNumber, index) => { | |
| if (sumMatchesTarget) { return; } | |
| const dataFiltered = removeCurrentIndex(data, index); | |
| sumMatchesTarget = dataFiltered.some(nextNumber => { | |
| const sum = (currentNumber + nextNumber); |
| /* | |
| * Complete the 'pairSum' function below. | |
| * | |
| * The function is expected to return a BOOLEAN. | |
| * The function accepts following parameters: | |
| * 1. INTEGER_ARRAY array | |
| * 2. INTEGER target | |
| */ | |
| function pairSum(array, target) { | |
| for(let i = 0; i < array.length; i++) { |
Proxy cache passes GET instead of HEAD to upstream... so we have a 403.
This version include these fixes.
| add_action('init', function(){ | |
| session_set_cookie_params( 0 ); | |
| if(!session_id()) | |
| session_start(); | |
| }, 1); |
| class ExpressionEvaluator | |
| def self.parse(string) | |
| complex_exps = string.scan(/-\s\d+\s\d+/) | |
| simple_exps = string.gsub(/-\s\d+\s\d+/, '') | |
| complex_sum(complex_exps) + simple_sum(simple_exps) | |
| end | |
| def self.complex_sum(array) | |
| array.reduce(0) { |sum, exp| sum + (exp.split[1].to_i - exp.split[2].to_i) } | |
| end |
| class ExpressionEvaluator | |
| def self.parse(string) | |
| complex_exps = string.scan(/-\s\d+\s\d+/) | |
| simple_exps = string.gsub(/-\s\d+\s\d+/, '') | |
| complex_sum(complex_exps) + simple_sum(simple_exps) | |
| end | |
| end |
| def self.parse(string) | |
| sum = 0 | |
| char_array = string.split | |
| char_array.each_with_index do |char, i| | |
| sum += char.to_i | |
| next unless char == '-' && char_array[i + 2] | |
| if char_array[i + 2].to_i == 0 | |
| char_array[i + 1] = char + char_array[i + 1] | |
| else | |
| char_array[i + 2] = char + char_array[i + 2] |