Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Lex Tang lexrus

🏠
Working from home
Block or report user

Report or block lexrus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Skifary
Skifary / main.m
Last active Nov 27, 2019
修改block的实现,先打印参数,再输出原有实现
View main.m
#import <Foundation/Foundation.h>
#import "ffi.h"
NSMutableArray *g_allocations;
ffi_cif g_cif;
ffi_closure *g_closure;
void *g_replacement_invoke;
void *g_origin_invoke;
@Skifary
Skifary / main.m
Last active Nov 27, 2019
替换block原有实现
View main.m
#import <Foundation/Foundation.h>
typedef struct __block_impl {
void *isa;
int Flags;
int Reserved;
void *FuncPtr;
}__block_impl;
typedef void(^GlobalBlock)(void);
View HeterogeneousCoresTest.swift
import Foundation
func machToNanoseconds(_ mach: UInt64) -> Double {
struct Static {
static var info: mach_timebase_info = {
var info = mach_timebase_info()
mach_timebase_info(&info)
return info
}()
}
@davibe
davibe / example.swift
Created Mar 16, 2017
react-native swift module with no macros
View example.swift
//
// RCTViewController.swift
// Grocerest
//
// Created by Davide Bertola on 15/03/2017.
//
import Foundation
import UIKit
View AvailabilityOverheadTest.swift
let info = mach_timebase_info_t.allocate(capacity: 1)
mach_timebase_info(info)
var avg: Double = 0
let lock: UnsafeMutableRawPointer!
if #available(macOS 10.12, iOS 10.0, *), true {
let lock1 = os_unfair_lock_t.allocate(capacity: 1)
lock1.initialize(to: os_unfair_lock())
lock = UnsafeMutableRawPointer(lock1)
@FilipZawada
FilipZawada / description.md
Last active Apr 4, 2018
Generating Lenses helpers using Sourcery
View description.md

What are Lenses? Great explanation by @mbrandonw

Files:

  • input.swift - sample structs for which we want helpers to be generated
  • lens.stencil - sourcery template to generate lenses helpers
  • output.swift - sample lenses helpers generated
  • zLens.swift - simple implementation of lenses, so you can play with it

Hints:

  • Usually you want to generate helpers only for certain structs in your project. To limit scope of sourcery changes, keep your relevant structs under one directory and just point sourcery to that directory instead of whole project.
@steipete
steipete / SpinlockTestTests.swift
Last active Nov 25, 2019 — forked from RomanTruba/Synchronization_test_iOS_SDK10
Updated for Xcode 8, Swift 3; added os_unfair_lock
View SpinlockTestTests.swift
//
// SpinlockTestTests.swift
// SpinlockTestTests
//
// Created by Peter Steinberger on 04/10/2016.
// Copyright © 2016 PSPDFKit GmbH. All rights reserved.
//
import XCTest
View zhHans.conf.ini
# 你可以从该 URL 下载这个配置文件: http://surge.run/config-example/ios.conf
# 用编辑器编辑后,再通过 iTunes, URL, AirDrop 或者 iCloud Drive 复制回 iOS 设备
# Version 2.0
[General]
# 日志等级: warning, notify, info, verbose (默认值: notify)
loglevel = notify
# 跳过某个域名或者 IP 段,这些目标主机将不会由 Surge Proxy 处理。(在 macOS
# 版本中,如果启用了 Set as System Proxy, 那么这些值会被写入到系统网络代理
# 设置中.)
@hujunfeng
hujunfeng / Root.plist
Last active Oct 19, 2019
Add version in Settings.bundle for iOS apps
View Root.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>DefaultValue</key>
<string></string>
<key>Key</key>
View yep_faye.markdown

Faye Server API Reference

说明

此为 Faye Server v1 文档,Faye Server 是使用 Faye 框架的基于 Bayeux 协议的消息系统。

客户端在 Faye Server 可以做的操作有:

You can’t perform that action at this time.