Skip to content

Instantly share code, notes, and snippets.

View rscarrera27's full-sized avatar
👊
Keep Going

Sunghyun Kim rscarrera27

👊
Keep Going
View GitHub Profile
@rscarrera27
rscarrera27 / simple_type_check.py
Last active November 12, 2019 08:34
Simple type check class
from dataclasses import dataclass
from typing import get_type_hints
@dataclass
class SimpleTypeCheck:
def __post_init__(self):
for k, t in get_type_hints(type(self)).items():
k_v = getattr(self, k)
if not isinstance(k_v, t):
@rscarrera27
rscarrera27 / tox.ini
Created November 18, 2019 02:23
For local testing environment
[pytest]
addopts = -rsxXvv
redis_exec = /usr/local/bin/redis-server
dynamodb_dir = /usr/local/opt/dynamodb
Country Code
Afghanistan AF
Albania AL
Algeria DZ
American AS
Andorra AD
Angola AO
Anguilla AI
Antigua AG
Argentina AR
Country CC
Afghanistan AF
Albania AL
Algeria DZ
American Samoa AS
Andorra AD
Angola AO
Anguilla AI
Antigua and Barbuda AG
Argentina AR
CC AOF
AT 14
BE 13
CL 14
CZ 15
DK 13
EE 13
FI 13
FR 15
IT 14
from sanic import Sanic
from sanic.response import json
from sanic.request import Request
from sanic_jwt_extended import JWT
import uuid
app = Sanic(__name__)
<!DOCTYPE html>
<html>
<head>
<title>ReDoc</title>
<!-- needed for adaptive design -->
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--
ReDoc doesn't change outer page styles
@rscarrera27
rscarrera27 / go_http_handling.go
Created February 9, 2020 10:15
Golang HTTP handling example
package main
import (
"fmt"
"net/http"
)
type Hello struct{}
func (h Hello) ServeHTTP(w http.ResponseWriter, r *http.Request) {
@rscarrera27
rscarrera27 / match.py
Last active February 12, 2020 06:10
Is this possible
@curry({"t", 12})
def do_x(v, t):
...
match(func, arg1, arg2) >> {
str: do_x,
int: lambda x: print x,
InternalException: handle,
...: handle_default,
}