A prototype is a property functions have. This property points points to an object.
This file contains 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
/* | |
* Because by default, some widgets do not inherit font-family and font-size from their parents. | |
* Many browsers use the system default appearance instead. To make your forms' appearance consistent | |
* with the rest of your content, we can add the following rules to our stylesheet: | |
*/ | |
button, input, select, textarea { | |
font-family : inherit; | |
font-size : 100%; | |
} |
This file contains 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
npm install http-server -g | |
#run | |
http-server -p 3000 --cors | |
More here: | |
https://stackoverflow.com/questions/21956683/enable-access-control-on-simple-http-server |
This file contains 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
# Element wise sum and multiplication | |
np.array([3, 1]) + np.array([2, 1]) # => np.array([5, 1]) | |
np.array([3, 1]) * np.array([2, 1]) # => np.array([6, 1]) | |
# Square root | |
np.sqrt(np.array([1,2])) # => array([1, 1.41421356]) | |
# Magnitude of a vector | |
np.linalg.norm(np.array([1, 2])) # => 2.23606797749979 |
This file contains 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
#!/bin/sh | |
# This pre-commit hook will prevent you from committing any line (or filename) containing | |
# the string NOCOMMIT. Use that tag in comments around source code you want to avoid | |
# accidentally committing, like temporary IP addresses or debug printfs. | |
# | |
# To add it to an existing repository, save it to .git/hooks/pre-commit (or append, if | |
# that file already exists). Remember to make executable (chmod +x ...) | |
# | |
# To automatically add this pre-commit hook to every repository you create or clone: |
This file contains 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
On the console, inspect an element that is part of the scope. | |
Then execute the following on the console: | |
> scope = angular.element($0).scope() | |
> scope.vm |
This file contains 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
docker build -t friendlyname . # Create image using this directory's Dockerfile | |
docker run -p 4000:80 friendlyname # Run "friendlyname" mapping port 4000 to 80 | |
docker run -d -p 4000:80 friendlyname # Same thing, but in detached mode | |
docker container ls # List all running containers | |
docker container ls -a # List all containers, even those not running | |
docker container stop <hash> # Gracefully stop the specified container | |
docker container kill <hash> # Force shutdown of the specified container | |
docker container rm <hash> # Remove specified container from this machine | |
docker container rm $(docker container ls -a -q) # Remove all containers | |
docker image ls -a # List all images on this machine |
Following this guide will set up a local Elasticsearch with Kibana and Marvel using Homebrew and Homebrew Cask
If you already have Java
installed on your system, skip steps Install Cask and Install Java
If you already have Java
and Homebrew
installed on your system, skip steps Prerequisites, start at Install Elasticsearch and Kibana after running $ brew update
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
This file contains 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
Ref: https://stackoverflow.com/questions/582336/how-can-you-profile-a-script | |
- Using kcachegrind and pyprof2calltree | |
$ python -m cProfile -o script.profile script.py | |
$ pyprof2calltree -i script.profile -o script.calltree | |
$ kcachegrind script.calltree |
This file contains 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
$ mkdir new-project | |
$ cd new-project | |
$ pyenv local <python-version> | |
$ pipenv install <package> | |
- About pipenv | |
https://docs.pipenv.org/ | |
https://docs.pipenv.org/basics/ | |
https://realpython.com/pipenv-guide/ |
NewerOlder