Normalization functions
Sometimes when coding, we discover a few different representations of the same data.
It can be tempting to write a function to combine these different representations.
Example:
function normalizeSku(sku: string|number) {Normalization functions
Sometimes when coding, we discover a few different representations of the same data.
It can be tempting to write a function to combine these different representations.
Example:
function normalizeSku(sku: string|number) {Can you do a first pass of cleanups? Pay attention to:
Leaked keys
Indirectly leaked keys
Overly defensive programming and hiding failures instead of letting errors bubble up, also while adding too much code.
Here is an example:
| #!/bin/bash | |
| if [ $# -lt 1 ]; then | |
| echo "Usage: $0 <search_pattern>" | |
| echo " Searches for pattern in file contents and filenames" | |
| exit 1 | |
| fi | |
| search_pattern=$1 |
This is a complete example of using candle to train a simple neural network on a XOR dataset.
Hopefully, this helps some folks trying candle for the first time!
| # Add this to your .gitconfig and use `git recent-branches` | |
| [alias] | |
| recent-branches = branch -v --sort=-committerdate |
| const object_to_watch = obj; // Change to the object you are inspecting | |
| const property_to_watch = 'example'; // Change to the property name in the object you are inspecting (here obj.example) | |
| // Store the original value | |
| object_to_watch.__storedValue = object_to_watch[property_to_watch]; | |
| Object.defineProperty(object_to_watch, property_to_watch, { | |
| get() { | |
| return this.__storedValue; | |
| }, |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <style> | |
| body{ | |
| padding: 0; | |
| margin: 0; | |
| } | |
| </style> |