Skip to content

Instantly share code, notes, and snippets.

View willard1218's full-sized avatar

Willard, Lin willard1218

View GitHub Profile
//
// ViewController.swift
// text
//
// Created by willard on 2018/4/2.
// Copyright © 2018年 willard. All rights reserved.
//
import UIKit
@willard1218
willard1218 / resume.md
Last active August 20, 2018 13:36
resume
連結 介紹
Swift protocol extension 介紹如何用 Swift 實作一個 API Request client (What),會大量使用 Protocol extension (How) 特性來擴充這個模組,近而讓程式變得容易維護且擴充性高 (Why)。
使用 Swift 寫爬蟲 使用 XPath + Swift 套件 爬 104 頁面
memory overuse debug 如何找出記憶體飆升的過程
SwiftSliderMenu 實作側邊選單的機制
WLAppleCalendar 實作蘋果內建的行事曆
Ted-subtitle-merge 合併 Ted 中英字幕
TableViewCell reuseIdentifier refactor 一步一步重構TableViewCell_reuseIdentifier 的過程
[NSArray.count-and-arithmetic-underflow](https://github.com/willard1218/
//
// XXXTableVC.swift
// t
//
// Created by willard on 2018/3/17.
// Copyright © 2018年 willard. All rights reserved.
//
import Foundation
import UIKit
@willard1218
willard1218 / playground.swift
Created March 16, 2018 23:22
playground.swift
//
// XXXTableVC.swift
// t
//
// Created by willard on 2018/3/17.
// Copyright © 2018年 willard. All rights reserved.
//
import Foundation
import UIKit
//: Playground - noun: a place where people can play
import UIKit
let a = NSDecimalNumber(string: "1.111111111111111111")
a.intValue
a.int8Value
a.int16Value
a.int32Value
@willard1218
willard1218 / Intro.md
Last active March 1, 2018 12:16
Protocol-Oriented Programming — Protocol Extension
We couldn’t find that file to show.
@willard1218
willard1218 / ProtocolNotofication.swift
Created December 30, 2017 02:11
ProtocolNotofication.swift
// origin author : https://gist.github.com/pofat/b0a05cd0348878e23027eae4273f0bed
//: Playground - noun: a place where people can play
import UIKit
// This is for dmoe, you can use a generice type to limit your observer to an UIViewController for common usage.
protocol Notifiable {
var name: Notification.Name { get }
func observe(by observer: Any, withSelector selector: Selector, object: Any?)
func post(object: Any? ,userInfo: [AnyHashable: Any]?)
static func remove(observer: Any)
// usage 1
extension Notification.Name {
public static let updateData = Notification.Name("updateData")
// nested
struct Category1 {
public static let nestedUpdateData = Notification.Name("nestedUpdateData")
}
}
import UIKit
protocol SomeP {}
struct Foo: SomeP {
var foo : String = "foo"
}
extension Array where Element == SomeP {
func m1() {}
@willard1218
willard1218 / server.js
Created October 25, 2017 04:00
web socket
const WebSocket = require('ws');
const wss = new WebSocket.Server({ port: 8080 });
wss.on('connection', function connection(ws) {
ws.on('message', function incoming(data) {
console.log("reveice : " + data)