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
| let test1; // undefined | |
| let test2 = null; // null | |
| const check = val => val ? 'ok' : 'ng'; | |
| check(false); // 'ng' | |
| check(0); // 'ng' | |
| check(""); // 'ng' | |
| check(NaN); // 'ng' | |
| check(null); // 'ng' |
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
| import numpy as np | |
| single_perceptron = lambda x, w, theta: 0 if np.sum(w * x) + theta <= 0 else 1 | |
| and_perceptron = lambda x: single_perceptron(x, np.array([0.5, 0.5]), -0.7) | |
| nand_perceptron = lambda x: single_perceptron(x, np.array([-0.5, -0.5]), 0.7) | |
| or_perceptron = lambda x: single_perceptron(x, np.array([0.5, 0.5]), -0.2) | |
| xor_perceptron = lambda x: and_perceptron(np.array([nand_perceptron(x), or_perceptron(x)])) | |
| INPUT_DATA = np.array([[0, 0], [1, 0], [0, 1], [1, 1]]) |
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
| import numpy as np | |
| class Rule(object): | |
| """Standard Deviation Rules 68%, 95% Variant""" | |
| STANDARD_DEVIATION_RANGE = 2 | |
| MAX_VALUE = 100 | |
| MIN_VALUE = 0 | |
| cleanMax = (lambda self, x: self.MAX_VALUE if x >= self.MAX_VALUE else 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
| class Fibonacci(object): | |
| """Fibonacci function.""" | |
| def __init__(self): | |
| print 'Fibonacci' | |
| def fibonacci(self, n): | |
| if n == 0: | |
| return 0 | |
| elif n == 1: |
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
| # ##################################### # | |
| # AmazonLinux minimal install For bash. # | |
| # ##################################### # | |
| # yum | |
| sudo yum install -y sqlite-devel postgresql-devel postgresql-server git gcc gcc-c++ openssl-devel readline-devel glibc-headers readline libyaml-devel zlib zlib-devel libffi-devel libxml2 libxslt libxml2-devel libxslt-devel nginx | |
| # anyenv | |
| git clone https://github.com/riywo/anyenv ~/.anyenv | |
| 'export PATH="$HOME/.anyenv/bin:$PATH"' >> ~/.bashrc |
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
| a |
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
| task myType << { task action } |