Skip to content

Instantly share code, notes, and snippets.

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

Erik Nguyen eriknguyen

🎯
f̶̗̣̰̥̝̘̹̞́͑̋̄̋̀̿͐̑͜͝ọ̴͙̦̟̾c̵̡̱̭̲̣͔̦͎͂̈̈́̆͊͗̚͝u̴̡͖̮̬͍͍͊͋̈́̓͠s̷̱̎̓̐͆
View GitHub Profile
View sep.html
<!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>
@eriknguyen
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 https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="refined"
@eriknguyen
eriknguyen / name_conventions_dictionaries.py
Last active Feb 2, 2018 — forked from jllopezpino/name_conventions_dictionaries.py
Replace keys in underscore lowercase convention for camel case convention and vice versa.
View name_conventions_dictionaries.py
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 / webapi_with_flask.md
Last active Jan 22, 2018
Overview on building web API with Flask
View webapi_with_flask.md

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 / 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 supervisordhttp://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
View gunicorn_start.bash
#!/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 / api_guide.md
Last active Aug 7, 2017
API Best Practices
View api_guide.md

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