Skip to content

Instantly share code, notes, and snippets.

@yoojinyoung
yoojinyoung / settings.py
Last active Jan 6, 2019
django settings.py code for deloyment
View settings.py
import os
import json
from django.core.exceptions import ImproperlyConfigured
# Set ENV with system variable 'DJANGO_ENV'. If 'DJANGO_ENV' is not present, then use 'development' as ENV.
# In production server, set 'DJANGO_ENV' as 'production'
ENV = os.getenv('DJANGO_ENV', 'development')
View typing_sentences.json
[
"하늘을 우러러 한 점 부끄럼이 없기를",
"흙에서 자란 내마음 파란 하늘빛",
"넓은벌 동쪽끝으로 옛이야기",
"붉은 파밭의 푸른 새싹을 보아라",
"손금에는 맑은 강물이 흐르고",
"햇빛도 그늘이 있어야 맑고 눈이 부시다",
"엷은 졸음에 겨운 늙으신 아버지가",
"격의 없이 터놓은 관계라도 기본 예는 갖춤이 옳거니",
"이 많은 별빛이 내린 언덕 위에",
@yoojinyoung
yoojinyoung / pdf_to_image.py
Last active Dec 4, 2019
How to make pdf to image and and save that with instance when using django.
View pdf_to_image.py
# https://github.com/Belval/pdf2image
# https://www.revsys.com/tidbits/loading-django-files-from-code/
import os
import tempfile
from django.core.files import File
from pdf2image import convert_from_path
from .models import CustomModel
@yoojinyoung
yoojinyoung / readFileAsync.js
Created Feb 12, 2020
Using the FileReader API in async functions
View readFileAsync.js
// https://simon-schraeder.de/posts/filereader-async/
function readFileAsync(file) {
return new Promise((resolve, reject) => {
let reader = new FileReader();
reader.onload = () => {
resolve(reader.result);
};