By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
Table of Contents
| import re | |
| import math | |
| from collections import Counter | |
| def get_cosine(vec1, vec2): | |
| intersection = set(vec1.keys()) & set(vec2.keys()) | |
| numerator = sum([vec1[x] * vec2[x] for x in intersection]) | |
| sum1 = sum([vec1[x]**2 for x in vec1.keys()]) |
By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
Table of Contents
| Copyright 2020 Aubrey Taylor | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTH |
| /* | |
| * This plugin makes sure karma doesn't run any specs when there's a | |
| * compilation error in a module by checking the finished compilation for warnings | |
| * which would prevent tests from accurately running. | |
| * | |
| * Inspiration for looking at the warnings length | |
| * https://gist.github.com/Stuk/6b574049435df532e905 | |
| */ | |
| import { Compiler } from 'webpack'; |
| // Based on: https://stackoverflow.com/a/46814952/283851 | |
| // Based on: https://gist.github.com/mindplay-dk/72f47c1a570e870a375bd3dbcb9328fb | |
| /** | |
| * Create a Base64 Image URL, with rotation applied to compensate for EXIF orientation, if needed. | |
| * | |
| * Optionally resize to a smaller maximum width - to improve performance for larger image thumbnails. | |
| */ | |
| export function getImageUrl(file: File, maxWidth: number|undefined): Promise<string> { | |
| return readOrientation(file).then(orientation => { |