Skip to content

Instantly share code, notes, and snippets.

@eJamesLin
eJamesLin / DownloadFont.swift
Created November 30, 2022 17:41
iOS downloading font and display at runtime
import UIKit
import CoreText
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let label = UILabel()
view.addSubview(label)
@eJamesLin
eJamesLin / xcode-beta-slink.sh
Created August 21, 2020 04:16 — forked from ethanhuang13/xcode-beta-slink.sh
Symbolic link from Xcode.app to Xcode-beta.app (Xcode 11.2)
@eJamesLin
eJamesLin / Sample.podspec
Last active March 5, 2020 06:37
Internal CocoaPods
==== Podfile =====
source 'https://github.com/CocoaPods/Specs.git'
source 'https://interval.host/specs.git'
target 'Runner' do
use_frameworks!
pod 'InternalLibA'
end
===============
@eJamesLin
eJamesLin / .zshrc
Last active February 25, 2020 04:58
.zshrc
# ref: https://medium.com/statementdog-engineering/prettify-your-zsh-command-line-prompt-3ca2acc967f
# ZSH_THEME="robbyrussell"
# ZSH_THEME="agnoster"
ZSH_THEME="powerlevel9k/powerlevel9k"
# 右側
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status time)
# 若當前登入的帳號為你的帳號 xxx,就不用特別顯示出來
@eJamesLin
eJamesLin / getpr.sh
Created February 21, 2020 11:38
Get remote PR
#!/bin/sh
branch="pull/$1/head:pr/$1"
echo $branch
local_branch="pr/$1"
echo $local_branch
git fetch upstream $branch
git checkout $local_branch
// Xcode 10.2 to Xcode 11 Beta
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
import UIKit
class ClosureButton: UIButton {
var actionClosure: (() -> Void)?
@objc func closureAction() {
actionClosure?()
}
func addClosure(for controlEvents: UIControlEvents, closure: (() -> Void)) {
//
// ViewController.m
// RunLoop
//
// Created by cj on 2017/4/26.
// Copyright © 2017年 cj. All rights reserved.
//
#import "ViewController.h"
#import <AFNetworking/AFNetworking.h>
@eJamesLin
eJamesLin / CoreDataMagicalRecordDemo.m
Last active April 12, 2017 05:47
CoreData MagicalRecord Demo
#import "ViewController.h"
#import <MagicalRecord/MagicalRecord.h>
#import "Artist+CoreDataClass.h"
@interface ViewController ()
@end
@implementation ViewController