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
View patch001.lua
luaSetWaxConfig({openBindOCFunction="true"})
waxClass{"Zus.SettingVC"}
function viewDidLoad(self)
print("lua viewDidLoad");
self:ORIGviewDidLoad();
self:setTitle("Wax-patched " .. wax.appVersion)
end
@lexrus
lexrus / swift-interview-outline.md
Last active Dec 28, 2016
Swift interview outline
View swift-interview-outline.md
  • Array 是 value type,使用 structs 实现
  • 数据类型没有隐式转换
  • 对于 String,count() 的复杂度是 O(n),每一个 Character 都是 unicode scalars 的序列
  • raw values 和 associated values 的区别
  • 如果必要,对于实现了 _ObjectiveCBridgeable 的 value types 会被自动桥接成 reference types
  • 讲一下 unowned 和 weak 的区别
  • 改 struct 的属性的方法名前要加 mutating,但如果这个 struct 用 let 声明的,改不了。修正:网友指出用 nonmutating set 也可以改属性。
  • nil 和 .None 的区别
  • capture list in closure
  • 举一个 guard ... where 的例子
@lexrus
lexrus / Vagrantfile
Created Dec 4, 2015
Vagrantfile for building latest Swift source in Ubuntu 15 with VirtualBox. Please install VirtualBox and Vagrant before vagrant up.
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/vivid64"
# config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder "./code", "/code"
config.vm.provider "virtualbox" do |vb|
vb.gui = false
@lexrus
lexrus / QNUploader.swift
Last active Dec 4, 2015
Upload images to Qiniu via multipart-form with Alamofire
View QNUploader.swift
//
// QNUploader.swift
//
// Created by Lex on 12/1/15.
//
import Foundation
import Alamofire
private let kCDNDomain = "__YOUR_QINIU_CDN_DOMAIN__"
@lexrus
lexrus / UIWindow+FLEX.swift
Created Nov 6, 2015
Toggle FLEX explorer with multi touch
View UIWindow+FLEX.swift
//
// UIWindow+FLEX.swift
//
// Created by Lex on 11/6/15.
// Copyright © 2015 lexrus.com. All rights reserved.
//
import UIKit
#if DEBUG
View ignore_qiniu_ssl_in_info_plist.xml
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>qbox.me</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
@lexrus
lexrus / Deliverfile.rb
Created Apr 3, 2015
Universal Change Log
View Deliverfile.rb
changelog({
"cmn-Hans" => "感谢使用 VPN On!为改善用户使用体验,我们每隔一周就会在 App Store 更新应用。你可以前往手机“设置”>“iTunes 与 App Store”>“自动下载的项目”,打开“更新”。\n\nVPN On 应用的每次更新都会改进速度和稳定性。一有新功能推出,我们会在应用中提示你。",
"cmn-Hant" => "感謝使用 VPN On!爲改善用戶使用體驗,我們每隔一週就會在 App Store 更新應用。你可以前往手機“設置”>“iTunes 與 App Store”>“自動下載的項目”,打開“更新”。\n\nVPN On 應用的每次更新都會改進速度和穩定性。一有新功能推出,我們會在應用中提示你。",
"ja-JP" => "VPN Onをご利用いただきありがとうございます。VPN Onではアプリをより快適にご利用いただくため、アプリストアで隔週でアップデートを行っております。[設定] > [iTunes & App Store] > [自動ダウンロード]でアップデートをオンにすることで、自動的に(このページにアクセスすることなく)アプリをアップデートいただけます。 \n\nVPN Onアプリのアップデートではスピードと信頼性の向上が行われており、また新しい機能が追加されると、アプリ内でその機能がハイライトされます。",
"it-IT" => "Grazie di usare VPN On! Per migliorare la nostra applicazione, pubblichiamo aggiornamenti nell'App Store ogni 2 settimane. Puoi aggiornare l'applicazione automaticamente (senza dover tornare qui) accedendo a Impostazioni > iTunes Store e App Store > Download automatici e attivando Aggiornamenti. \n\nOgni aggiornamento della nostra applicazione VPN On presenta miglioramenti relativi a velocità e aff
@lexrus
lexrus / svg2png.sh
Created Mar 31, 2015
Convert svg files to png.
View svg2png.sh
for f in *.svg; do cairosvg $f -f png -o $f.png; done
@lexrus
lexrus / auto-run.swift
Last active Jul 1, 2019 — forked from mikeash/auto-run.swift
把这个 swift 文件复制到 /usr/local/bin/ 下,chmod +x /usr/local/bin/auto-run.swift 。然后每次执行 auto-run.swift 都会检查是否需要重新编译,最后会执行编译后的 auto-run.swiftc。需要 Xcode 6.0+,亲测 bash 和 zsh 下可用,fish 下会报错。
View auto-run.swift
/*/../usr/bin/true
source="$0"
compiled="$0"c
if [[ "$source" -nt "$compiled" ]]; then
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcrun swiftc -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -g "$source" -o "$compiled" || exit
fi
"$compiled"
@lexrus
lexrus / gems.sh
Last active Jan 18, 2019
Xcoder 常用工具一键安装
View gems.sh
#!/bin/bash
# 解析 xcodeproj 的 Ruby 库 - https://github.com/CocoaPods/Xcodeproj
gem install --no-ri 'xcodeproj'
# xcoderbuild 的 Ruby 封装 - https://github.com/rayh/xcoder
gem install --no-ri 'xcoder'
# Xcode 工程配置工具 - https://github.com/thoughtbot/liftoff
gem install --no-ri 'liftoff'
You can’t perform that action at this time.