Skip to content

Instantly share code, notes, and snippets.


Erik Nguyen eriknguyen

View GitHub Profile
View sep.html
<!DOCTYPE html>
<meta charset="utf-8" />
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
<title>chat.js - by SingaporeJS</title>
eriknguyen / .zshrc
Last active Jul 7, 2018
My Shell Settings
View .zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/khanh.nguyen/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See
eriknguyen /
Last active Feb 2, 2018 — forked from jllopezpino/
Replace keys in underscore lowercase convention for camel case convention and vice versa.
def camel_to_underscore(name):
Convert a name from camel case convention to underscore lower case convention.
name (str): name in camel case convention.
name in underscore lowercase convention.
camel_pat = compile(r'([A-Z])')
eriknguyen /
Last active Jan 22, 2018
Overview on building web API with Flask

Building Web APIs with Flask

Following the same-name course on

1. Getting up to speed with Flask

  • Use of __var_name and self.var_name in model
  • Decorator for oop in Python: @var_name.setter...
  • User serialize() for convert a class instance to dictionary type
  • Use app.error_handler_spec dictionary to map error handler to different handler

2. Create and Read

eriknguyen / gunicorn_start.bash
Created Nov 7, 2017 — forked from postrational/gunicorn_start.bash
Example of how to set up Django on Nginx with Gunicorn and supervisord
View gunicorn_start.bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=hello # the user to run as
GROUP=webapps # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name
eriknguyen /
Last active Aug 7, 2017
API Best Practices

API Design Best Practices

Curated list of best practices for creating API

Web API Design

Following Apigee api design guide

1. Use nouns with HTTP verbs

  • There should be only 2 base URLs per resource
    • First is for collection, eg. /dogs
    • Second is for element, eg. /dogs/1234