Tools, Codes and How To
A collection of tools, codes, tips and hints, I want to share.
git
Start Git Repository
Assuming git is installed and within PATH. If not, install Git
- Create repository
git init - Create .gitignore file to git repository root directory
- Add all new files to repository
git add . - Commit changes
git commit -am "some unique commit comments"
gae
Command Line Deploy App
The command line statement below creates a new version of the app which then can be tested before replacing the version in production. replace [appid] with the corresponding app id. Execute from the local main app folder
sudo gcloud app deploy --project [appid] --no-promote
gae, python
Run App Locally
Within the main folder of the app. First, switch env and install libraries.
- virtualenv -p python3 env
- source env/bin/activate
- pip install -r requirements.txt
Finally run app
- python main.py
mac
Edit Hosts File on Mac
- Use terminal/nano to edit the file [⌘ <Spacebar>] terminal
- sudo nano /private/etc/hosts
- sudo dscacheutil -flushcache
design
Website Design
Tired to look up these urls, used frequently while building web pages:
design, css
Round Button
Height, width, line-height with border-radius 50% are the important properties. These values have to be adjusted manually. If the text spans multiple lines, change line-height to 1rem, use padding-top to place start of the text and adjust height to recover the circle.
<style> .button { display:block; width:100px; height:100px; line-height:100px; border: 2px solid #E91E63; border-radius: 50%; color:#f5f5f5; text-align:center; text-decoration:none; background: #0a2740; box-shadow: 0 0 3px gray; font-size:1rem; font-weight:bold; text-transform:uppercase; } .button:hover { background-color:#E91E63; } </style> <p><a href="" class="button">Button</a></p>