Skip to content

Instantly share code, notes, and snippets.

View popeyelau's full-sized avatar
:octocat:
To the stars!

Popeye Lau popeyelau

:octocat:
To the stars!
View GitHub Profile
@popeyelau
popeyelau / IQKeyboardManagerSettings.m
Last active March 19, 2020 05:23
IQKeyboardManager基本配置|-|{"files":{"IQKeyboardManagerSettings.m":{"env":"plain"}},"tag":"Gists"}
[IQKeyboardManager sharedManager].shouldShowTextFieldPlaceholder = NO; //是否显示输入提示
[IQKeyboardManager sharedManager].keyboardDistanceFromTextField = 20.0; //键盘间距
[IQKeyboardManager sharedManager].overrideKeyboardAppearance = YES; //是否覆盖键盘样式
[IQKeyboardManager sharedManager].keyboardAppearance = UIKeyboardAppearanceDefault;//键盘样式
[IQKeyboardManager sharedManager].toolbarManageBehaviour = IQAutoToolbarByPosition; //根据位置上下切换第一响应者
[IQKeyboardManager sharedManager].shouldToolbarUsesTextFieldTintColor = YES; //toolbar按文本框tintColor渲染
@popeyelau
popeyelau / XCDFakeCarrier.m
Last active March 19, 2020 05:23 — forked from 0xced/XCDFakeCarrier.m
Hack to choose the displayed carrier name in the iOS simulator|-|{"files":{"XCDFakeCarrier.m":{"env":"plain"}},"tag":"Gists"}
//
// Copyright (c) 2012-2015 Cédric Luthi / @0xced. All rights reserved.
//
#import <Foundation/Foundation.h>
#if TARGET_OS_SIMULATOR
static const char *fakeCarrier;
static const char *fakeTime;
@popeyelau
popeyelau / .xvimrc
Last active March 19, 2020 05:23
.xvimrc|-|{"files":{".xvimrc":{"env":"plain"}},"tag":"Gists"}
" VIM SETTINGS <(
" 搜索忽略大小写
set ignorecase
" 高亮搜索
set hlsearch
" 显示行号和列号
set ruler
" 不显示状态行
" set laststatus=0
@popeyelau
popeyelau / XVim.md
Last active March 19, 2020 05:23
XVim|-|{"files":{"XVim.md":{"env":"plain"}},"tag":"Gists"}

XVim 快捷键

模式切换

i/I 光标前插入 / 光标所在行首插入

a/A 光标后插入 / 光标所在行尾插入

o/O 光标后插入新行 / 光标前插入新行

s/S 删除光标字符 / 删除光标所在行

@popeyelau
popeyelau / RxSwift.playground
Last active March 19, 2020 05:23
RxSwift Playground|-|{"files":{"RxSwift.playground":{"env":"plain"}},"tag":"Gists"}
//: [Previous](@previous)
//http://blog.callmewhy.com/2015/05/11/functional-reactive-programming-1/
//http://blog.callmewhy.com/2015/09/21/rxswift-getting-started-0/
//http://blog.callmewhy.com/2015/09/23/rxswift-getting-started-1/
import RxSwift
let disposeBag = DisposeBag()
@popeyelau
popeyelau / tmux-cheatsheet.markdown
Last active March 19, 2020 05:23 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet|-|{"files":{"tmux-cheatsheet.markdown":{"env":"plain"}},"tag":"Gists"}

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@popeyelau
popeyelau / Number+Extension.swift
Last active March 19, 2020 05:23
Swift Number formatter|-|{"files":{"Number+Extension.swift":{"env":"plain"}},"tag":"Gists"}
extension Formatter {
static let number = NumberFormatter()
}
extension FloatingPoint {
func fractionDigits(min: Int = 2, max: Int = 2, roundingMode: NumberFormatter.RoundingMode = .down) -> String {
Formatter.number.minimumFractionDigits = min
Formatter.number.maximumFractionDigits = max
Formatter.number.roundingMode = roundingMode
Formatter.number.numberStyle = .decimal
@popeyelau
popeyelau / TDM.md
Last active March 19, 2020 05:23
iMac Target Display Mode|-|{"files":{"TDM.md":{"env":"plain"}},"tag":"Gists"}

start.sh

# start.sh
osascript -e 'tell application "System Events" to key code 144 using command down'
echo "  🖥   Target Display Mode Started..."
blueutil off
echo "  🔵   iMac Bluetooth off..."
exit
@popeyelau
popeyelau / HandyJSON.md
Last active March 19, 2020 05:23
HandyJSON & Decodable Custom Mapping|-|{"files":{"HandyJSON.md":{"env":"plain"}},"tag":"Gists"}
  {
    "rabbets": ["0.100-0.300", "0.301-0.500"]
  }
class SomeObject: HandyJSON {
    
@popeyelau
popeyelau / Breakpoints_v2.xcbkptlist
Last active March 19, 2020 05:23
My Xcode User Breakpoints|-|{"files":{"Breakpoints_v2.xcbkptlist":{"env":"plain"}},"tag":"Gists"}
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "2"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.SymbolicBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"