Skip to content

Instantly share code, notes, and snippets.

기초 정규식 (점프 투 파이썬)

메타 문자

  • 원래 그 문자가 가진 뜻이 아닌 특별한 용도로 사용되는 문자
  • .^$*+?{}[]|()

문자 클래스 [ ]

[ ] -> '[ 와 ] 사이의 문자들과 매치'

@5minho
5minho / updateTextViewHeight.swift
Last active March 15, 2018 06:19
text 에 따라서 UITextView 의 height를 변경
extension ViewController : UITextViewDelegate {
func textViewDidChange(_ textView: UITextView) {
let expendSize = CGSize(width: textView.frame.width, height : .infinity)
let estimatedSize = textView.sizeThatFits(expendSize)
let heightOffset = estimatedSize.height - CGFloat(37.verticalValueAppliedScreenSize)
@5minho
5minho / PermMissingElem.py
Created May 6, 2018 16:30
Codility PermMissingElem
def solution(A):
appear_set = set(range(1, len(A) + 2))
return (appear_set - set(A)).pop()
@5minho
5minho / FrogJmp.py
Created May 6, 2018 16:46
Codility FrogJmp
import math
def solution(X, Y, D):
return math.ceil((Y-X)/D)
@5minho
5minho / TapeEquilibrium.py
Created May 6, 2018 17:19
Codility TapeEquilibrium
def solution(A):
left_sum, right_sum = A[0], sum(A[1:])
result = abs(left_sum - right_sum)
for x in range(1, len(A) - 1):
left_sum, right_sum = left_sum + A[x], right_sum - A[x]
result = min(result, abs(left_sum - right_sum))
return result
@5minho
5minho / cache.py
Created June 30, 2018 07:21
Book id SqliteCache
import os
import sqlite3
import logging
import re
from functools import wraps
from datetime import datetime, timedelta
from book_review_scraper.exceptions import BookIdCacheMissError, BookIdCacheExpiredError, ISBNError
class SqliteCache: