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
function viewDidLoad(self)
print("lua viewDidLoad");
self:setTitle("Wax-patched " .. wax.appVersion)
lexrus /
Last active Dec 28, 2016
Swift interview outline
  • 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 / 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| = "ubuntu/vivid64"
# "forwarded_port", guest: 80, host: 8080 "private_network", ip: ""
config.vm.synced_folder "./code", "/code"
config.vm.provider "virtualbox" do |vb|
vb.gui = false
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 / 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 All rights reserved.
import UIKit
View ignore_qiniu_ssl_in_info_plist.xml
lexrus / Deliverfile.rb
Created Apr 3, 2015
Universal Change Log
View Deliverfile.rb
"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 /
Created Mar 31, 2015
Convert svg files to png.
for f in *.svg; do cairosvg $f -f png -o $f.png; done
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
if [[ "$source" -nt "$compiled" ]]; then
DEVELOPER_DIR=/Applications/ xcrun swiftc -sdk /Applications/ -g "$source" -o "$compiled" || exit
lexrus /
Last active Jan 18, 2019
Xcoder 常用工具一键安装
# 解析 xcodeproj 的 Ruby 库 -
gem install --no-ri 'xcodeproj'
# xcoderbuild 的 Ruby 封装 -
gem install --no-ri 'xcoder'
# Xcode 工程配置工具 -
gem install --no-ri 'liftoff'
You can’t perform that action at this time.