Skip to content

Instantly share code, notes, and snippets.

View devxoul's full-sized avatar
👨‍💻
Always coding

Suyeol Jeon devxoul

👨‍💻
Always coding
View GitHub Profile
@devxoul
devxoul / xcode-version-and-build-number-auto-increment-runscript.sh
Last active March 28, 2022 11:07
XCode auto version and build number increment. Version number increased when 'Archive', build number increased when 'Build'.
#!/bin/bash
# Auto increment Version number when Archive
if [ $CONFIGURATION == Release ]; then
VERSIONNUM=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}")
NEWSUBVERSION=`echo $VERSIONNUM | awk -F "." '{print $3}'`
NEWSUBVERSION=$(($NEWSUBVERSION + 1))
NEWVERSIONSTRING=`echo $VERSIONNUM | awk -F "." '{print $1 "." $2 ".'$NEWSUBVERSION'" }'`
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $NEWVERSIONSTRING" "${PROJECT_DIR}/${INFOPLIST_FILE}"
/*
* UIButton+TouchAreaInsets.h
*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* Version 2, December 2004
*
* Copyright (C) 2013 Joyfl
*
* Everyone is permitted to copy and distribute verbatim or modified
* copies of this license document, and changing it is allowed as long
@devxoul
devxoul / jquery.loadasync.js
Created August 16, 2013 02:35
A jQuery plugin that allows you to load images asynchronously. <img class="async" src="PLACEHOLDER IMAGE URL HERE" async-src="ORIGINAL IMAGE URL HERE"> $(img.async).loadasync();
/*
* jquery.loadasync.js
*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* Version 2, December 2004
*
* Copyright (C) 2013 Su Yeol Jeon
*
* Everyone is permitted to copy and distribute verbatim or modified
* copies of this license document, and changing it is allowed as long
@devxoul
devxoul / replace_url_for_blueprint.py
Last active December 29, 2015 01:49
Replace non-blueprint `url_for` to specific blueprint. e.g. url_for('login') -> url_for('blueprint.login')
import os
import re
BLUEPRINT = 'blueprint'
TARGET_DIR = 'myproject/templates'
RECURSIVE = True
EXTENSIONS = ['py', 'html', 'htm']
pat = "url_for\('(?![a-z]+\.)(?!static)([a-z_]+)"
rep = "url_for('%s.\g<1>" % BLUEPRINT
@devxoul
devxoul / wtf_required_if.py
Last active March 13, 2022 00:13
WTForms `RequiredIf` validator.
class RequiredIf(object):
"""Validates field conditionally.
Usage::
login_method = StringField('', [AnyOf(['email', 'facebook'])])
email = StringField('', [RequiredIf(login_method='email')])
password = StringField('', [RequiredIf(login_method='email')])
facebook_token = StringField('', [RequiredIf(login_method='facebook')])
"""
@devxoul
devxoul / kb_balance.py
Last active August 14, 2022 11:25
국민은행 잔액조회
# -*- coding: utf-8 -*-
from datetime import datetime
import urllib2
def kb_balance(account, password, resident, username):
"""
국민은행 계좌 잔액 빠른조회. 빠른조회 서비스에 등록이 되어있어야 사용 가능.
빠른조회 서비스: https://obank.kbstar.com/quics?page=C018920
@devxoul
devxoul / korail.py
Last active January 24, 2023 08:39
[Deprecated] 코레일 승차권 검색 및 예매 프로그램. https://github.com/devxoul/korail
# -*- coding: utf-8 -*-
"""
This code won't be updated anymore.
Project has moved to repository: https://github.com/devxoul/korail
"""
import requests
from bs4 import BeautifulSoup
from datetime import datetime
set si
set nu
set expandtab
set shiftwidth=4
set tabstop=4
syntax enable
set background=light
colorscheme solarized
@devxoul
devxoul / localizable-encoding.sh
Last active August 29, 2015 14:05
Convert `Localizable.strings` file encoding to such encoding.
#!/bin/sh
ENCODING="utf-8"
for file in *.lproj/Localizable.strings; do
charset=`file -I "$file" | sed 's/.*charset=\(.*\)/\1/'`
if ! [[ "$charset" =~ "$ENCODING" ]]
then
output="$file.tmp"
iconv -f "$charset" -t "$ENCODING" "$file" > "$output" &&
@devxoul
devxoul / regex-find-unlocalized.txt
Created August 21, 2014 06:02
A regular expression for finding unlocalized string in Objective-c files.
(?<!NSLocalizedString\()(?<!NSLog\()(?<!patternname:)(?<!imageNamed:)(?<!key:)(?<!@\{)(?<!\[)@".+"