Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am LuqiPan on github.
  • I am luqipan (https://keybase.io/luqipan) on keybase.
  • I have a public key whose fingerprint is 4842 11F7 1069 0677 667A 1746 5341 3ECF 0F22 93EB

To claim this, I am signing this object:

def login(login, password):
# ...
if request.POST['VIP_KEY'] == '5fa3e7a21e34714b44720836573a71ce':
request.session['is_vip'] = True
# log_helper.log method accept
log_helper.log('vip_log', {'is_vip': True, 'user_id': user.id})
else:
log_helper.log('vip_log', {'is_vip': False, 'user_id': user.id})
@LuqiPan
LuqiPan / log-2.py
Created January 24, 2017 06:23
Log Driven Development
def login(login, password):
# ...
if request.POST['VIP_KEY'] == '5fa3e7a21e34714b44720836573a71ce':
request.session['is_vip'] = True
# log_helper.log method accept
log_helper.log('vip_log', {'is_vip': True, 'user_id': user.id})
@LuqiPan
LuqiPan / log-1.py
Last active January 23, 2017 01:22
Log Driven Development
def log(log_name, log_fields):
"""Log with meta information populated
Args:
log_name (str): the log name to be written to
log_fields (dict): fields that need to be logged
Returns:
None
"""
@LuqiPan
LuqiPan / legacy.py
Last active January 23, 2017 01:08
Log Driven Development
def login(login, password):
"""This function tries to log the user in and populate the session
Args:
login (str): The login of the user
password (str): The (hashed) password of the user
Returns:
bool: The result of login. True for success, False otherwise
"""
@LuqiPan
LuqiPan / ci.sh
Last active August 29, 2015 14:03
Shell script to run on CI
#!/bin/bash
# ci.sh: a shell script to run on CI to automate things
bundle install
RAILS_ENV=test bundle exec rake test:ci