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
@lexrus
lexrus / RxTextFieldDelegateProxy.swift
Created Feb 14, 2018
RxSwift extension for textFieldShouldReturn of UITextFieldDelegate
View RxTextFieldDelegateProxy.swift
//
// RxTextFieldDelegateProxy.swift
//
// Created by Lex Tang on 2/14/18.
// Copyright © 2018 Krunoslav Zaher. All rights reserved.
//
import RxSwift
import RxCocoa
@lexrus
lexrus / HD.txt
Last active Jul 25, 2019
All WWDC 2013 Session Videos URLs in https://developer.apple.com/wwdc/videos/ dumped with Chrome. You can download these videos **without** a Apple developer account by running the download.sh script. There is also a sample code downloader here: https://github.com/jfahrenkrug/WWDC-Downloader
View HD.txt
http://devstreaming.apple.com/videos/wwdc/2013/710xfx3xn8197k4i9s2rvyb/710/710-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/202xdx2x47ezp1wein/202/202-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/200xdx2x35e1pxiinm/200/200-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/413xdx5x97itb5ek4yex3r7/413/413-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/612xax4xx65z1ervy5np1qb/612/612-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/221xex4xxohbllf4hblyngt/221/221-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/220xbx4xipaxfd1tggxuoib/220/220-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/711xcx4x8yuutk8sady6t9f/711/711-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/404xbx2xvp1eaaqonr8zokm/404/404-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/505xbx4xrgmhwby4oiwkrpp/505/505-HD.mov?dl=1
@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 / rmsenseless.sh
Last active Jun 20, 2019
Remove senseless files from my NAS
View rmsenseless.sh
#!/bin/bash
find . -name '*.DS_Store' -type f -delete;
find . -name 'Thumbs.db' -type f -delete;
find . -name '*.swp' -type f -delete;
find . -name '*.AppleDouble' -exec rm -rf {} \;
find . -name ".AppleDouble" -print0 | xargs -0 rm -rf;
find . -name ".TemporaryItems" -print0 | xargs -0 rm -rf;
find . -name ".Trashes" -print0 | xargs -0 rm -rf;
find . -name ".afpdeleted*" -print0 | xargs -0 rm -rf;
@lexrus
lexrus / disable_all_animation.sh
Created Aug 1, 2014
Disable all animations of OS X.
View disable_all_animation.sh
# opening and closing windows and popovers
defaults write -g NSAutomaticWindowAnimationsEnabled -bool false
# smooth scrolling
defaults write -g NSScrollAnimationEnabled -bool false
# showing and hiding sheets, resizing preference windows, zooming windows
# float 0 doesn't work
defaults write -g NSWindowResizeTime -float 0.001
@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'
@lexrus
lexrus / asicon.sh
Created Mar 6, 2012
AppStore Icons Generator
View asicon.sh
#!/bin/bash
# According to https://developer.apple.com/library/ios/#qa/qa1686/_index.html
# Install ImageMagick with MacPort: sudo port install ImageMagick
convert $1 -resize 512x512 iTunesArtwork.png # Ad Hoc iTunes
convert $1 -resize 144x144 Icon-72@2x.png # Home screen for "The New iPad"
convert $1 -resize 114x114 Icon@2x.png # Home screen for Retina display iPhone/iPod
convert $1 -resize 72x72 Icon-72.png # App Store and Home screen on iPad
convert $1 -resize 58x58 Icon-Small@2x.png # Spotlight and Settings for Retina display
convert $1 -resize 57x57 Icon.png # Home screen on non-Retina iPhone/iPod
convert $1 -resize 50x50 Icon-Small-50.png # Spotlight on iPad 1/2
@lexrus
lexrus / CollectionOperator.swift
Created Apr 24, 2017
Avoid hard-coded KVC collection operators
View CollectionOperator.swift
import Foundation
enum CollectionOperator: String {
case avg
case count
case max
case min
case sum
@lexrus
lexrus / createml.swift
Created Jun 29, 2018
CreateML 双色球
View createml.swift
import Cocoa
import CreateML
let 双色球神算子 = try MLTextClassifier(trainingData: [
"中奖啦": [
"09 11 14 20 27 30 09",
"02 09 14 15 16 23 10",
"11 16 19 22 25 30 08",
"02 05 06 13 16 19 03",
"04 09 15 16 19 27 10",
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/>
You can’t perform that action at this time.