Skip to content

Instantly share code, notes, and snippets.

@velyan
velyan / Build Skia on MacOS
Last active July 10, 2024 01:14
Steps to build Skia on MacOS
mkdir $HOME/deps
cd $HOME/deps
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
git clone https://github.com/google/skia.git
export PATH="${PWD}/depot_tools:${PATH}"
cd skia
python tools/git-sync-deps
//static
bin/gn gen out/release --args="is_official_build=true skia_use_system_expat=false skia_use_system_icu=false skia_use_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false skia_use_libwebp=false extra_cflags_cc=[\"-frtti\"]"
@velyan
velyan / objcNameCollisions.swift
Last active September 10, 2018 02:49
NSObject Introspection
import Foundation
var count: UInt32 = 0
let list = class_copyMethodList(NSObject.self, &count)
var result: Set<String> = Set()
for i in 0 ..< count {
let x = list![Int(i)]
let nameString = NSStringFromSelector(method_getName(x))
@velyan
velyan / StateMachine.swift
Last active March 4, 2020 18:31
Swift State Pattern
import Foundation
fileprivate protocol Statelike {
var stateMachine: StateMachine { get }
func logIn()
func logOut()
}
extension Statelike {
func logIn() {}
@velyan
velyan / gist:33bca641ced413f027b4
Created January 29, 2015 20:59
CollectionViewFlowLayout Centered Cell
@interface YANCollectionViewFlowLayout : UICollectionViewFlowLayout
@property (nonatomic, assign) CGFloat previousOffset;
@property (nonatomic, assign) NSInteger currentPage;
@end
@implementation YANCollectionViewFlowLayout
- (void) setupInitialContentOffset {