Skip to content

Instantly share code, notes, and snippets.

View eriknguyen's full-sized avatar
🎯
f̶̗̣̰̥̝̘̹̞́͑̋̄̋̀̿͐̑͜͝ọ̴͙̦̟̾c̵̡̱̭̲̣͔̦͎͂̈̈́̆͊͗̚͝u̴̡͖̮̬͍͍͊͋̈́̓͠s̷̱̎̓̐͆

Erik Nguyen eriknguyen

🎯
f̶̗̣̰̥̝̘̹̞́͑̋̄̋̀̿͐̑͜͝ọ̴͙̦̟̾c̵̡̱̭̲̣͔̦͎͂̈̈́̆͊͗̚͝u̴̡͖̮̬͍͍͊͋̈́̓͠s̷̱̎̓̐͆
View GitHub Profile
@eriknguyen
eriknguyen / api_guide.md
Last active August 7, 2017 04:17
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
@eriknguyen
eriknguyen / gunicorn_start.bash
Created November 7, 2017 12:56 — forked from postrational/gunicorn_start.bash
Example of how to set up Django on Nginx with Gunicorn and supervisordhttp://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
#!/bin/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
eriknguyen / webapi_with_flask.md
Last active January 22, 2018 08:39
Overview on building web API with Flask

Building Web APIs with Flask

Following the same-name course on Lynda.com

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
eriknguyen / name_conventions_dictionaries.py
Last active February 2, 2018 09:01 — forked from jllopezpino/name_conventions_dictionaries.py
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.
Args:
name (str): name in camel case convention.
Returns:
name in underscore lowercase convention.
"""
camel_pat = compile(r'([A-Z])')
@eriknguyen
eriknguyen / .zshrc
Last active July 7, 2018 08:33
My Shell Settings
# 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 https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="refined"
@eriknguyen
eriknguyen / sep.html
Created September 23, 2020 09:45
Sep
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<title>chat.js - by SingaporeJS</title>