Last active
April 16, 2021 21:08
-
-
Save pxotox/d012ba3bb300a7dc2822182a77e07a95 to your computer and use it in GitHub Desktop.
Revisions
-
pxotox revised this gist
Apr 10, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ Here is the description of what you'll need to implement on this technical chall # Challenges ## 1. Cache function Implement a function, class or module (it can be on the same file - `request.py`) to cache requests made with the existing code, preventing unecessary calls. You MUST use [this Redis module](https://pypi.org/project/redis/) as a cache service. Feel free to change the code within the existing functions, but do not alter their behaviour. **Context**: Caching requests can be useful to avoid unecessary HTTP calls for the same resources, however, the resources can change during time, so it is important to keep in mind that cache needs to be invalidated at some point. -
pxotox revised this gist
Apr 10, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,7 @@ Working example:  **Note**: You may use ecmascript 6 features but must not use any framework or add any dependency. ## 3. Apply style Implement the CSS code to make the component on `component.html` look like the desired mockup below. Add attributes as you may need, but do not use HTML tags as CSS selectors to implement the styles. It will be tested on Google Chrome. -
pxotox revised this gist
Apr 9, 2019 . 1 changed file with 8 additions and 7 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,29 +5,29 @@ Here is the description of what you'll need to implement on this technical chall # Challenges ## 1. Cache function Implement a function, class or module (it can be on the same module - `request.py`) to cache requests made with the existing code, preventing unecessary calls. You MUST use [this Redis module](https://pypi.org/project/redis/) as a cache service. Feel free to change the code within the existing functions, but do not alter their behaviour. **Context**: Caching requests can be useful to avoid unecessary HTTP calls for the same resources, however, the resources can change during time, so it is important to keep in mind that cache needs to be invalidated at some point. **Note**: You may use any Python version and import other modules, unless they implement cache services for the requests. ## 2. Date formatting Implement a JavaScript code that replaces the value (`innerHTML` value) from elements with the class `js-date-format` with the formatted value of the time passed since the element initial time. The value within the elements will be a ISO date format (`2019-04-05T12:00:00.000Z` for example). It will be tested on Google Chrome. Use the following format: * 1 second ago OR X seconds ago * 1 minute ago OR X minutes ago * 1 hour ago OR X hours ago * Date in ISO format (original format) Working example:  **Note**: You should use ecmascript 6 features but may not use any framework or add any dependency. ## 3. Apply style Implement the CSS code to make the component on `component.html` look like the desired mockup below. Add attributes as you may need, but do not use HTML tags as CSS selectors to implement the styles. It will be tested on Google Chrome. Mockup: @@ -42,6 +42,7 @@ This is a list of what will be evaluated in your code: * Code is working as expected * [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) * [Separation of concers](https://en.wikipedia.org/wiki/Separation_of_concerns) * [Coding conventions](https://en.wikipedia.org/wiki/Coding_conventions) applied and [code consistency](https://medium.com/@jgefroh/why-consistency-is-one-of-the-top-indicators-of-good-code-352ba5d62020) * [Code readability](https://deviq.com/code-readability/) and how you [name things](https://deviq.com/naming-things/) * [Overengineering](https://en.wikipedia.org/wiki/Overengineering) * Usage of BEM, if used -
pxotox created this gist
Apr 5, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ # Technical challenge Here is the description of what you'll need to implement on this technical challenge. # Challenges ## 1. Cache function Implement a function (on the same module - `request.py`) to cache requests preventing unecessary calls. You MUST use [this Redis module](https://pypi.org/project/redis/) as a cache service. **Note**: You may use any Python version and import other modules, unless they implement cache services for the requests. ## 2. Date formatting Implement a JavaScript code that replaces the value (`innerHTML` value) from elements with the class `js-date-format` with the formatted value of the time passed since the current date time. The value within the elements will be a ISO date format (`2019-04-05T12:00:00.000Z` for example). Use the following format: * 1 second ago OR X seconds ago * 1 minute ago OR X minutes ago * 1 hour ago OR X hours ago * Date in ISO format (original format) It will be tested on Chrome. Working example:  **Note**: You should use ecmascript 6 features but may not use any framework or add any dependency. ## 3. Apply style Implement the CSS code to make the component on `component.html` look like the desired mockup below. Do not use HTML tags as CSS selectors. It will be tested on Chrome. Mockup:  **Note #1**: You should use new CSS features and add classes as you need, but try not to change the HTML structure. **Note #2**: We recommend you try using [BEM](http://getbem.com/introduction/). # Evaluation This is a list of what will be evaluated in your code: * Code is working as expected * [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) * [Separation of concers](https://en.wikipedia.org/wiki/Separation_of_concerns) * Used [coding conventions](https://en.wikipedia.org/wiki/Coding_conventions) * [Code readability](https://deviq.com/code-readability/) and how you [name things](https://deviq.com/naming-things/) * [Overengineering](https://en.wikipedia.org/wiki/Overengineering) 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>CrossKnowledge - Code challenge</title> <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet"> </head> <body> <article> <header> <div> <div> Avengers: Infinity War </div> <div> 156 minutes </div> </div> <div> 85% <img src="https://www.rottentomatoes.com/assets/pizza-pie/images/icons/global/cf-lg.3c29eff04f2.png" alt=""> </div> </header> <div> <img src="https://i.ibb.co/9tLcR7s/avengers.jpg"> <a href="https://www.rottentomatoes.com/m/avengers_infinity_war" target="_blank"> Check review </a> </div> <footer> <p> An unprecedented cinematic journey ten years in the making and spanning the entire Marvel Cinematic Universe, Marvel Studios' "Avengers: Infinity War" brings to the screen the ultimate, deadliest showdown of all time. The Avengers and their Super Hero allies must be willing to sacrifice all in an attempt to defeat the powerful Thanos before his blitz of devastation and ruin puts an end to the universe. </p> </footer> </article> </body> </html> 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>CrossKnowledge - Code challenge</title> </head> <body> <script> // This will create elements for testing, don't change this code (() => { const MS_PER_MINUTE = 60000 const NOW = new Date() let minutes = [0, 1, 30, 60, 6 * 60, 23 * 60, 24 * 60] let dates = [] minutes.forEach((i) => dates.push(new Date(NOW - i * MS_PER_MINUTE))) dates.forEach((item) => { let el = document.createElement("div") el.innerHTML = "Started " let dt = document.createElement('span') dt.className = 'js-date-format' dt.innerHTML = item.toISOString() el.appendChild(dt) document.body.appendChild(el) }) })(); </script> </body> </html> 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ import requests import redis def get(url, parameters=None): """ Fetches an URL and returns the response """ return requests.get(url, params=parameters).json() def post(url, parameters=None, data=None): """ Post data to an URL and returns the response """ return requests.post(url, params=parameters, data=data).json() def put(url, parameters=None, data=None): """ Put data to an resource and returns the response """ return requests.put(url, params=parameters, data=data).json() def patch(url, parameters=None, data=None): """ Patches an resource and returns the response """ return requests.patch(url, params=parameters, data=data).json() def delete(url, parameters=None, data=None): """ Requests the deletion of an resource and returns the response """ return requests.delete(url, params=parameters, data=data).json()