As configured in my dotfiles.
start new:
tmux
start new with session name:
| function _launchctl_unload() { | |
| local plist_file=$1 | |
| test -f $plist_file || { echo "Invalid launchctl file for unloading!"; return; } | |
| local label_name=$(defaults read $(readlink -f $plist_file) Label) | |
| command launchctl stop $label_name || { echo "Failed to stop the service "$label_name ; return; } | |
| command launchctl unload -w $plist_file || { echo "Failed to unload the file "$plist_file ; return; } | |
| } |
| function _launchctl_unload() { | |
| local plist_file=$1 | |
| test -f $plist_file || { echo "Invalid launchctl file for unloading!"; return; } | |
| local label_name=$(defaults read $(readlink -f $plist_file) Label) | |
| command launchctl stop $label_name || { echo "Failed to stop the service "$label_name ; return; } | |
| command launchctl unload -w $plist_file || { echo "Failed to unload the file "$plist_file ; return; } | |
| } |
| #!/usr/bin/env bash | |
| # set -x | |
| # | |
| # Source: https://gist.github.com/xingheng/f7bc8d7d89a68a8f6ae42851b5aa0d0e | |
| # Author: Will Han | |
| # | |
| target_dir=${1:-$(pwd)} | |
| test ! -d ${target_dir} && { echo "Invalid target directory for searching!"; exit 1; } |
| // | |
| // UIView+EdgeBorder.h | |
| // DSUtility | |
| // | |
| // Created by WeiHan on 6/6/17. | |
| // Copyright © 2017 WeiHan. All rights reserved. | |
| // | |
| #import <UIKit/UIKit.h> |
| // | |
| // UIControl+BlockAction.h | |
| // Pods | |
| // | |
| // Created by WeiHan on 5/26/17. | |
| // | |
| // | |
| #import <UIKit/UIKit.h> |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| UIDeviceOrientation actualDeviceOrientation = [[UIDevice currentDevice] orientation]; | |
| BOOL changedDeviceOrientation = NO; | |
| if ((self.supportedInterfaceOrientations & (UIInterfaceOrientationMaskLandscapeLeft|UIInterfaceOrientationMaskLandscapeRight)) == 0) | |
| { | |
| if (UIScreen.mainScreen.bounds.size.width > UIScreen.mainScreen.bounds.size.height) // Device is in landscape orientation | |
| { | |
| [[UIDevice currentDevice] setValue:@(UIDeviceOrientationPortrait) forKey:@"orientation"]; | |
| changedDeviceOrientation = YES; | |
| } |
iOS 7 代码布局适配:坐标起点 iOS 7 中 UIViewController 使用了全屏布局的方式,也就是说导航栏和状态栏都是不占实际空间的,状态栏默认是全透明的,导航栏默认是毛玻璃的透明效果。例如在一个 view 中加入:
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0,0,100,100)];
[label setBackgroundColor:[UIColor greenColor]];
[self.view addSubview:label];上面代码加在没有 UINavigationController 作为 rootViewController 的情况下,得到的效果是:
| # This is not a ready-to-run script. It just shows the relevant command-line calls. | |
| XC_WORKSPACE=path/to/MyApp.xcworkspace | |
| XC_SCHEME=MyApp | |
| XC_CONFIG=Release | |
| ARCHIVE_PATH=dest/path/to/MyApp.xcarchive | |
| EXPORT_PATH=dest/path/to/MyApp.ipa | |
| DIST_PROFILE=NameOfDistributionProfile | |
| # Build and archive. This can be done by regular developers, using their developer key/profile. |
| #!/bin/sh | |
| # | |
| # Copyright (c) 2010 Warren Merrifield | |
| # | |
| # 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 | |
| # furnished to do so, subject to the following conditions: |