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
| const memoize = (f) => { | |
| const cache = {}; | |
| return (...args) => { | |
| const argSta = JSON.stringify(args) | |
| cache[argStr] = cache[argStr] || f(...arg); | |
| return cache[argStr]; | |
| } | |
| } | |
| const squareNumber = memoize(x => x * x); |
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
| /** | |
| * Creates a function that memoizes the result of `func`. If `resolver` is | |
| * provided, it determines the cache key for storing the result based on the | |
| * arguments provided to the memoized function. By default, the first argument | |
| * provided to the memoized function is used as the map cache key. The `func` | |
| * is invoked with the `this` binding of the memoized function. | |
| * | |
| * **Note:** The cache is exposed as the `cache` property on the memoized | |
| * function. Its creation may be customized by replacing the `memoize.Cache` | |
| * constructor with one whose instances implement the |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Save the Princess Game</title> | |
| <style> | |
| /* General Styles */ | |
| * { | |
| box-sizing: border-box; |
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
| # Make sure PowerShell 5 (or later, include PowerShell Core) and .NET Framework 4.5 (or later) are installed. Then run the following steps. | |
| # Install Scoop | |
| iex (new-object net.webclient).downloadstring('https://get.scoop.sh') | |
| # Note: if you get an error you might need to change the execution policy (i.e. enable Powershell) with Set-ExecutionPolicy RemoteSigned -scope CurrentUser | |
| # Install Python 3 | |
| scoop install python | |
| # Upgrade pip |
OlderNewer