Skip to content

Instantly share code, notes, and snippets.

View erinwan's full-sized avatar

Yixin Wan erinwan

  • Mountain View, CA
View GitHub Profile
@erinwan
erinwan / gist:aa16709a0904fffbd4ab
Last active August 29, 2015 14:17
Remove blue border from css custom-styled button in Chrome
button:focus {outline:0 !important;}
/* http://stackoverflow.com/questions/20340138/remove-blue-border-from-css-custom-styled-button-in-chrome */
@erinwan
erinwan / gist:9e0779003d728854c6bb
Created March 7, 2015 03:41
heroku enter venv
source venv/bin/activate
@erinwan
erinwan / gist:0d0cf31a146b7698f1bf
Created March 7, 2015 03:34
heroku pg terminal
heroku pg:psql
@erinwan
erinwan / gist:dc19fac936f150c67c52
Last active August 29, 2015 14:16
Helpful psqlcommands
\? #List all \commands that can be used in psql.
\l #List all databases.
\d #List all tables in current database.
\d[table] #Show schema for table with name 'table'.
\du #List all users (roles) for this table.
\c[db] #Change to database with name 'db'.
\h #List SQL commands(e.g.SELECT,UPDATE...)
\q #Quit psql; you can also use Cmd/Ctrl+d
\d+ [tablename] # PostgreSQL “DESCRIBE TABLE”
SELECT current_database(); # show current database name
@erinwan
erinwan / gist:b837bcf90aa1098a2bac
Last active August 29, 2015 14:16
Postgres empty database
dropdb socialnetwork
createdb socialnetwork
createuser webapps
psql socialnetwork
GRANT ALL PRIVILEGES ON DATABASE socialnetwork TO webapps;
If you using MAC OS, you can stop port.
Find PID: lsof -i :1099
Kill port: kill -9 PID_number
@erinwan
erinwan / gist:937b4c03a3010fd10daf
Created February 26, 2015 05:05
python django sqlite delete all data in one table
Post.objects.all().delete()
@erinwan
erinwan / gist:1da68f5ccebfe70bb9c5
Created February 18, 2015 19:01
Prevent Mac from Sleeping
caffeinate
http://www.maclife.com/article/columns/terminal_101_prevent_your_mac_sleeping
@erinwan
erinwan / gist:d6cbaab90c10ecb74891
Last active August 29, 2015 14:15
python sqlite3 command line shell entrance
python manage.py shell
from socialnetwork.models import *
#import pdb; pdb.set_trace()
n: next