Skip to content

Instantly share code, notes, and snippets.

@giftbott
giftbott / HexColor.swift
Created February 2, 2019 22:42
hexColor Extension
extension String {
func hexToColor() -> UIColor {
let hexString = self.trimmingCharacters(in: .whitespacesAndNewlines)
let scanner = Scanner(string: hexString)
if hexString.hasPrefix("#") {
scanner.scanLocation = 1
}
let mask: UInt64 = 0xFF
import Foundation
fileprivate enum LogType: String {
case info = "Info"
case error = "Error"
case debug = "Debug"
case checking = "Check"
case warning = "Warn"
case fatal = "Fatal"
}
@giftbott
giftbott / crawl_zigbang.py
Created October 10, 2016 15:24
직방 매물정보 크롤링, 학습용으로 사용
# -*- coding: utf8 -*-
"""
# 주요기능 : 직방 매물 정보 크롤링
# 상세기능 : 원하는 지역의 매물ID 를 가진 URL 을 입력받아 각 매물별 상세 정보를 csv 파일 및 jpg 파일로 저장
# 추가계획 : 현재 계획 없음
# 최종수정 : 2016.10.10
"""
@giftbott
giftbott / get_preprocessed_number.py
Last active October 10, 2016 15:24
한글로 된 숫자를 진짜 숫자로 변환해주는 전처리 함수
def get_preprocessed_number(number):
preprocess_dict = {
"-": "",
":": "",
".": "",
"영": "0",
"공": "0",
"일": "1",
"하나": "1",
"둘": "2",
@giftbott
giftbott / crawl_webtoon.py
Last active January 18, 2018 06:01
학습용으로만 사용하세요.
# -*- coding: utf8 -*-
"""
# 주요기능 : 네이버 웹툰 이미지 크롤러
# 상세기능 : 원하는 웹툰의 최신 에피소드 번호와 DB에 저장된 번호를 비교해 이후의 모든 에피소드 이미지를 서버에 웹툰/에피소드/파일.jpg로 저장
# 파라미터 : 1. (필수 파라미터) (DB에 없는 웹툰) 웹툰의 titleid, (DB에 이미 있는 경우) 웹툰명 또는 titleid 입력
# 2. (생략 가능, 기본값 0) 가져올 마지막 에피소드 번호 , 1화부터가 아닌 최신 화부터 지정한 번호까지 역순으로 크롤링한다.
# 3. (생략 가능, 기본값 None) "only" 라는 값이 들어왔을 경우, 2번 파라미터에 해당하는 번호의 에피소드 하나만 가져온다.
#
@giftbott
giftbott / gist:1eaa46eed8eab4458fd5
Last active August 29, 2015 14:20
django error log trace
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
# Include the default Django email handler for errors
# This is what you'd get without configuring logging at all.
'mail_admins': {
'class': 'django.utils.log.AdminEmailHandler',
'level': 'ERROR',
# But the emails are plain text by default - HTML is nicer