This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Color+Additions.swift | |
// EasyDrugs | |
// | |
// Created by Hyuk Hur on 2020-11-16. | |
// | |
import SwiftUI | |
extension Color { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { createContext, useContext, useReducer } from "react"; | |
export default (reducer, actionTypes, initialState = {}) => { | |
const StateContext = createContext([{}, () => {}]); | |
const StateProvider = ({ children }) => { | |
const reduced = useReducer( | |
(state, action) => reducer(state, action, actionTypes), | |
initialState | |
); | |
return ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"profile": [{ | |
"name" : "Hank Hur", | |
"picturePath" : "https://media.licdn.com/dms/image/C4D03AQHi1G39gRz6Vw/profile-displayphoto-shrink_200_200/0?e=1576713600&v=beta&t=kpja3bEO_nm8mA0_fNZkAl0iVmQ-LB_pLNv2TUSwZiQ", | |
"headline" : "Individual Lead Developer", | |
"location" : "Vancouver, BC, Canada", | |
"summary" : "12 year experienced iOS engineer and Java engineer" | |
}], | |
"about" : [{ | |
"description" : "I'm looking for a great, enthusiastic engineering team to work for that will provide me with challenging, interesting work that I can learn from and contribute to. I'd like to get a chance to contribute more to iOS and back-end integration.\n I launched a group SNS app which reached 2M+ users in 3 months. I built everything from the lower layer like network and log-in to the higher layer like UI components and everything in between. I led an iOS team in SNS part which has 90M+ active users in a month in LINE the messenger. I suggested building an integrated image c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let isRunningTests: Bool = ProcessInfo.processInfo.environment["XCInjectBundleInto"] != nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func luhnCheckSum(number stringWithoutSpaces: String) -> Bool { | |
guard let _ = Int(stringWithoutSpaces) else { return false } | |
var even = 0 | |
var sum = 0 | |
for char in stringWithoutSpaces.reversed() { | |
guard let decimals = Int(String(char)) else { continue } | |
let added: Int = decimals * ( 1 << (even & 1) ) | |
even = even + 1 | |
sum = sum + added % 10 + added / 10 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Swift 3.1 | |
func iterateEnum<T: Hashable>(_: T.Type) -> AnyIterator<T> { | |
var i = 0 | |
return AnyIterator { | |
let next = withUnsafeBytes(of: &i) { $0.load(as: T.self) } | |
if next.hashValue != i { return nil } | |
i += 1 | |
return next | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Disable { | |
var not: Bool { get } | |
} | |
extension Bool: Disable { | |
var not: Bool { | |
return !self | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum Events { | |
case home(category: Category) | |
case card(category: Category) | |
case briefing(category: Category) | |
case setting(category: Category) | |
var string: String { | |
return "" | |
} | |
var category: Category { | |
switch self { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@inline(__always) | |
func + <K,V>(left: Dictionary<K,V>, right: Dictionary<K,V>) -> Dictionary<K,V> { | |
return merge(left: left, right: right) | |
} | |
func merge<K,V>(left: Dictionary<K,V>, right: Dictionary<K,V>) -> Dictionary<K,V> { | |
var map = left | |
for (k, v) in right { | |
map[k] = v | |
} |
NewerOlder