Skip to content

Instantly share code, notes, and snippets.

View hngfu's full-sized avatar

흥푸 hngfu

View GitHub Profile
import Foundation
//영상과 요구사항
struct Video {}
struct Requirement {}
class Youtuber {
var editor: Editor?
func editVideo() {
func main() {
let input = InputView.read()
if Validator.isLessThanNine(input) == false { return }
guard let convertedInput = Converter.toInt(input) else { return }
let burgers = GodOfHamburger.hamburger(with: convertedInput)
print(burgers)
}
main()
func main() {
guard let inputedNumber = InputView.read() else { return } //값 입력받음
let burgers = GodOfHamburger.hamburger(with: inputedNumber) //햄버거 신에게 해당 개수만큼 햄버거 받음
print(burgers) //햄버거 출력
}
main()
class InputView {
static func read() -> Int? {
let scalar = Unicode.Scalar("흥")
let consonantIndex = (scalar.value - 0xac00) / 28 / 21
let consonantScalar = Unicode.Scalar(consonantIndex + 0x1100)!
print(consonantScalar) //ㅎ
@hngfu
hngfu / sort.swift
Last active April 5, 2019 06:07
다양한 조건을 걸어서 정렬하는 방법!
let familyNameSortDescriptor = NSSortDescriptor(key: CNContact.familyNameSortKey, ascending: true, selector: #selector(NSString.localizedStandardCompare(_:)))
let givenNameSortDescriptor = NSSortDescriptor(key: CNContact.givenNameSortKey, ascending: true, selector: #selector(NSString.localizedStandardCompare(_:)))
let sortDescriptors = [familyNameSortDescriptor, givenNameSortDescriptor]
let sortedContacts = (contacts as NSArray).sortedArray(using: sortDescriptors)
guard let contacts = sortedContacts as? [CNContact] else { return }
self.contacts = contacts
//
// main.swift
// UnitConverter
//
// Created by 조재흥 on 2018. 9. 11..
// Copyright © 2018년 hngfu. All rights reserved.
//
import Foundation
@hngfu
hngfu / gugudan.swift
Last active September 11, 2018 06:06
//: Playground - noun: a place where people can play
import Cocoa
////MARK: - 2, 3단 구현 - 계산과 출력
var str = "Hello, IOS World"
//2단
print("\(2*1)")
print("\(2*2)")
@hngfu
hngfu / gist.js
Created June 5, 2018 07:14
gist 테스트입니다!
var gist = 'gist 테스트.';
function gistTest(str){
console.log(str);
}
gistTest(gist);