Skip to content

Instantly share code, notes, and snippets.

View Zedd0202's full-sized avatar
🌎

Zedd0202

🌎
View GitHub Profile
//1
func distance(ax : Int, ay : Int, bx :Int, by :Int)-> Float {
let a = pow(Float(bx-ax), 2)
let b = pow(Float(by-ay), 2)
let sol2 : Float = a + b
return sol2.squareRoot()
}
print(distance(ax: 1, ay: 1, bx: 5, by: 6))
@Zedd0202
Zedd0202 / Pascal's triangle.swift
Created July 10, 2017 09:55
Pascal's triangle Mission
//
// main.swift
// Misson
//
// Created by woowabrothers on 2017. 7. 10..
// Copyright © 2017년 woowabrothers. All rights reserved.
//
import Foundation
@Zedd0202
Zedd0202 / Date_Time.swift
Last active February 6, 2019 15:53
Swift Date & Time
//
// MyCalender.swift
// date
//
// Created by woowabrothers on 2017. 7. 11..
// Copyright © 2017년 woowabrothers. All rights reserved.
//
import Foundation
@Zedd0202
Zedd0202 / DetectTouchDirection.swift
Created November 24, 2017 04:38
스와이프시 방향 감지 방법
import UIKit
import AVFoundation
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
addSwipe()
}
func addSwipe() {
import UIKit
import Foundation
import SlackKit
class LonelyWolf {
let bot: SlackKit
init(token: String) {
bot = SlackKit()
1. Xcode 10.2로 프로젝트 생성 -> Xcode 10.2로 빌드 -> 12.2 디바이스
= 1.9MB
1) Xcode 10.2로 프로젝트 생성 -> Xcode 10.2로 빌드 -> 13.0 디바이스
= 못돌림
2. Xcode 10.2로 프로젝트 생성 -> Xcode 11 (Beta Seed 1)로 빌드 -> 12.2 디바이스
= 1.9MB
3. Xcode 10.2로 프로젝트 생성 -> Xcode 11 (Beta Seed 1)로 빌드 -> 13.0 디바이스
@Zedd0202
Zedd0202 / echoServer.go
Created January 13, 2020 01:30
example 1-1
package main
import (
"fmt"
"log"
"net/http"
"net/http/httputil"
)
func handler(w http.ResponseWriter, r *http.Request) {
class GradientCircle: UIView, CAAnimationDelegate {
let gradientLayer: CAGradientLayer = CAGradientLayer()
var startAngle: CGFloat = (-(.pi) / 2)
var endAngle: CGFloat = 3 * ((.pi) / 2)
override func draw(_ rect: CGRect) {
let center = CGPoint(x: rect.midX, y: rect.midY)
let albums = PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .any, options: nil) // system 앨범
let albums2 = PHAssetCollection.fetchAssetCollections(with: .album, subtype: .any, options: nil) // 사용자가 만든? 앨범
albums.enumerateObjects { (collection, _, _) in
let title = collection.localizedTitle
let count = PHAsset.fetchAssets(in: collection, options: nil).count
print(title, count)
}
extension UIImage {
func applyBlur_usingClamp(radius: CGFloat) -> UIImage {
let context = CIContext()
guard let ciImage = CIImage(image: self),
let clampFilter = CIFilter(name: "CIAffineClamp"),
let blurFilter = CIFilter(name: "CIGaussianBlur") else {
return self
}