Skip to content

Instantly share code, notes, and snippets.

View trilliwon's full-sized avatar
🎯
Focusing

WonJo trilliwon

🎯
Focusing
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
</head>
<body onload="execDaumPostcode()">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0"/>
<div id = "layer" style = "display:block; position:absolute; overflow:hidden; z-index:1; -webkit-overflow-scrolling:touch; ">
</div>
@trilliwon
trilliwon / build-number-increase.sh
Created November 14, 2016 03:15
Automatically increase build number
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
@trilliwon
trilliwon / HashTable.swift
Created November 29, 2016 01:54
money class with TDD
public struct HashTable<Key: Hashable, Value> {
fileprivate typealias Element = (key: Key, value: Value)
fileprivate typealias Bucket = [Element]
fileprivate var buckets: [Bucket]
fileprivate(set) var count = 0
public init(capacity: Int) {
assert(capacity > 0)
buckets = .init(repeating: [], count: capacity)
@trilliwon
trilliwon / operators.swift
Created December 13, 2016 07:13
custom operators in swift
infix operator ???
infix operator ?->
// user.name ??? sendMessage()
// is euqual to
// if let name = user.name {
// sendMessage()
// }
@trilliwon
trilliwon / quicksort.swift
Last active December 15, 2016 07:20
Quicksort in Swift
import Foundation
func quicksort<T: Comparable>(array: [T]) -> [T] {
if array.count <= 1 { return array }
let pivot: T = array[array.count/2]
return quicksort(array: array.filter ({ $0 < pivot })) + array.filter ({ $0 == pivot }) + quicksort(array: array.filter ({ $0 > pivot }))
}
// http://www.slideshare.net/ssuserae280e/quicksort-in-swift
@trilliwon
trilliwon / QuicksortTests.swift
Created December 16, 2016 01:43
QuicksortTests in swift
import XCTest
@testable import Quicksort
class QuicksortTests: XCTestCase {
// RED
// / \
// REFACTOR GREEN
@trilliwon
trilliwon / heapsort.cpp
Created December 19, 2016 02:55
heapsort alghorithm cpp
/* #Heap Sort
###Input :
- 첫 번째 라인에는 입력할 키의 갯수(1 ≤ N ≤ 100,000)와 정수 k를 입력합니다.(1 ≤ k ≤ 30)
- 다음 라인 부터 N개의 키를 입력 합니다.
###Output :
- 첫 번째 라인은 힙에서 k개의 elements 감소하는 순서로 출력 합니다.
- 두 번째 라인은 힙에서 증가하는 순서로 k 개를 출력합니다.
@trilliwon
trilliwon / swift-screen-name.codesnippet
Created December 26, 2016 06:23
custom code snippets
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDECodeSnippetCompletionPrefix</key>
<string>trilliwon-screen-name</string>
<key>IDECodeSnippetCompletionScopes</key>
<array>
<string>ClassImplementation</string>
</array>
@trilliwon
trilliwon / InsertionSort.swift
Created January 4, 2017 03:11
InsertionSort in swift
import Foundation
func insertionSort(array: [Int]) -> [Int] {
var array = array
for index in 1..<array.count {
let nextValue = array[index]
var aux = index - 1
while aux >= 0 && array[aux] > nextValue {
import Foundation
import UIKit
// Usage Examples
let system12 = Font(.system, size: .standard(.h5)).instance
let robotoThin20 = Font(.installed(.RobotoThin), size: .standard(.h1)).instance
let robotoBlack14 = Font(.installed(.RobotoBlack), size: .standard(.h4)).instance
let helveticaLight13 = Font(.custom("Helvetica-Light"), size: .custom(13.0)).instance
struct Font {