NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
| @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); | |
| /* | |
| MONOCHROMATIC | |
| - First attempt at Firefox CSS | |
| - By Liamb135 | |
| - With help from /r/FirefoxCSS |
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
| import math | |
| class Vector(object): | |
| def __init__(self, *args): | |
| """ Create a vector, example: v = Vector(1,2) """ | |
| if len(args)==0: self.values = (0,0) | |
| else: self.values = args | |
| def norm(self): | |
| """ Returns the norm (length, magnitude) of the vector """ |