Skip to content

Instantly share code, notes, and snippets.

View SuperY's full-sized avatar
🎯
Focusing

SuperY SuperY

🎯
Focusing
View GitHub Profile
@SuperY
SuperY / VersonContro.sh
Created April 25, 2014 13:13
Set Xcode build number by the building time
version=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $PRODUCT_SETTINGS_PATH`
version=`expr $version + 1`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $version" $PRODUCT_SETTINGS_PATH
#/usr/libexec/PlistBuddy -c \"Set :CFBundleShortVersionString $version\" $PRODUCT_SETTINGS_PATH 这行代码会让version也自增,一般不需要"
#From 'http://blog.csdn.net/kafeidev/article/details/8221273'
@SuperY
SuperY / cellAutolayout
Created June 14, 2014 13:12
UITableViewCell Editing with Autolayout
- (void)awakeFromNib
{
[super awakeFromNib];
for (NSLayoutConstraint *cellConstraint in self.constraints)
{
[self removeConstraint:cellConstraint];
id firstItem = cellConstraint.firstItem == self ? self.contentView : cellConstraint.firstItem;
id seccondItem = cellConstraint.secondItem == self ? self.contentView : cellConstraint.secondItem;
//
// UINavigationBar+CustomHeight.h
//
// Copyright (c) 2014 Maciej Swic
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
#import <UIKit/UIKit.h>
@interface UIView (TLLayout)
@property (nonatomic, strong) NSArray *hiddenConstraints;
// set hidden and remove any constraints involving this view from its superview
- (void)hideAndRemoveConstraints;
- (void)showAndRestoreConstraints;
@SuperY
SuperY / ATableCell
Last active August 29, 2015 14:14
TableView Cell Animation
@implementation ATableCell
- (void)awakeFromNib{}
- (void)startAnimationWithDelay:(CGFloat)delayTime{
_tipView.transform = CGAffineTransformMakeTranslation(SCREENWIDTH, 0);
[UIView animateWithDuration:1. delay:delayTime usingSpringWithDamping:0.6 initialSpringVelocity:0
option:0
animations:^{
self.tipView.transform = CGAffineTransformIdentity;
}
@SuperY
SuperY / private.xml
Last active August 29, 2015 14:19 — forked from eamesliu/private.xml
<?xml version="1.0"?>
<root>
<item>
<name>F19 to F19</name>
<appendix>(F19 to Hyper (ctrl+shift+cmd+opt) + F19 Only, send escape)</appendix>
<identifier>private.f192f19_escape</identifier>
<autogen>
--KeyOverlaidModifier--
KeyCode::F19,
KeyCode::COMMAND_L,
@SuperY
SuperY / NavigationPushDoneTodo
Created May 19, 2016 09:04
UINavigationController push viewController do some function On main thread
CATransaction.begin()
self.navigationController?.pushViewController(self.connectingViewController, animated: true)
CATransaction.setCompletionBlock({
dispatch_async(dispatch_get_main_queue(),{
self.connectingViewController.doSomeThing()
})
})
CATransaction.commit()
extension PHPhotoLibrary {
typealias PhotoAsset = PHAsset
typealias PhotoAlbum = PHAssetCollection
static func saveImage(image: UIImage, albumName: String, completion: (PHAsset?)->()) {
if let album = self.findAlbum(albumName) {
saveImage(image, album: album, completion: completion)
return
}
@SuperY
SuperY / version_by_git_commit_number.sh
Last active August 26, 2016 14:13
编译把Git的提交次数作为小版本号
#Git 版本数
VERSION_NUMBER=`git rev-list head | sort | wc -l | awk '{print $1}'`
#VERSION_HASH=`git rev-list head | head -1`
echo $VERSION_NUMBER
#echo $VERSION_HASH
@SuperY
SuperY / Client.swift
Created December 12, 2017 10:34 — forked from kean/Client.swift
import Foundation
import Alamofire
import RxSwift
import RxCocoa
protocol ClientProtocol {
func request<Response>(_ endpoint: Endpoint<Response>) -> Single<Response>
}