Skip to content

Instantly share code, notes, and snippets.

@bumaociyuan
bumaociyuan / ImagePositionButton.swift
Created July 4, 2016 03:11
Custom UIButton Title Position
//
// ImagePositionButton.swift
//
//
// Created by zx on 7/4/16.
// Copyright © 2016 zx. All rights reserved.
//
import UIKit
{
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true
},
"settings": {
"ecmascript": 6,
"jsx": true
},
@bumaociyuan
bumaociyuan / demo.swift
Last active June 27, 2016 09:10
blur present viewcontroller
let vc = CustomViewController()
vc.modalTransitionStyle = UIModalTransitionStyle.CrossDissolve
vc.modalPresentationStyle = UIModalPresentationStyle.OverFullScreen
presentViewController(vc, animated: true, completion: nil)
// in CustomViewController
override func viewDidLoad() {
super.viewDidLoad()
let lightEffect = UIBlurEffect(style: .Light)
let lightView = UIVisualEffectView(effect: lightEffect)
@bumaociyuan
bumaociyuan / pre-commit.sh
Created June 20, 2016 07:38
swiftlint 的pre-commit 脚本, 自动在commit之前格式化代码
#!/bin/bash
# 这是一个pre-commit 的脚本
# Run SwiftLint
START_DATE=$(date +"%s")
echo $START_DATE
SWIFT_LINT=/usr/local/bin/swiftlint
@IBAction func moveBlock(sender: AnyObject) {
UIView.animateWithDuration(3, animations: { () -> Void in
self.viewToAnimate.frame = .zero
}) { (success) -> Void in
}
}
@IBAction func stop(sender: AnyObject) {
if viewToAnimate.layer.speed == 0 {
resumeLayer(viewToAnimate.layer)
@bumaociyuan
bumaociyuan / cd.applescript
Created March 7, 2016 03:02
go2shell for iterm2.9
tell application "Finder"
set pathList to (quoted form of POSIX path of (folder of the front window as alias))
set command to "clear; cd " & pathList
end tell
tell application "System Events"
-- some versions might identify as "iTerm2" instead of "iTerm"
set isRunning to (exists (processes where name is "iTerm")) or (exists (processes where name is "iTerm2"))
end tell
@bumaociyuan
bumaociyuan / xcode-build-bump.sh
Created February 19, 2016 02:21 — forked from sekati/xcode-build-bump.sh
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@bumaociyuan
bumaociyuan / revision.sh
Last active February 19, 2016 02:55 — forked from elmodos/revision.sh
Xcode build number Git revision number
# get GIT revision number
buildNumber=`git rev-list --count HEAD`
# write build number
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${buildNumber}" "${INFOPLIST_FILE}"
# if [ "$CONFIGURATION" == "Release" ]; then
# # version number like this V0.20160109.004
@bumaociyuan
bumaociyuan / shadow.sh
Created February 18, 2016 01:58
极路由安装ss
#!/bin/sh
#
echo ''
echo '/*教程请参考:极路由Shadowsocks家庭无痛翻墙实践*/'
echo 'https://luolei.org/hiwifi-shadowsocks/'
echo 'by @foru17'
echo ''
echo ''
echo '那一天,'
echo '人类终于回想起了,'
@bumaociyuan
bumaociyuan / shadow.sh
Created February 18, 2016 01:58
极路由安装ss
#!/bin/sh
#
echo ''
echo '/*教程请参考:极路由Shadowsocks家庭无痛翻墙实践*/'
echo 'https://luolei.org/hiwifi-shadowsocks/'
echo 'by @foru17'
echo ''
echo ''
echo '那一天,'
echo '人类终于回想起了,'