This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Status Bar | |
* | |
* Related threads: | |
* - https://devforums.apple.com/message/867059#867059 | |
* - https://devforums.apple.com/thread/199395?start=0&tstart=0 | |
* | |
* The relevant messages to override are: | |
*/ | |
- (UIStatusBarStyle)preferredStatusBarStyle NS_AVAILABLE_IOS(7_0); // Defaults to UIStatusBarStyleDefault | |
- (BOOL)prefersStatusBarHidden NS_AVAILABLE_IOS(7_0); // Defaults to NO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Search "THE_TARGET_CONTENT" in all .m files | |
find . -type f -iname "*.m" -exec grep -i "THE_TARGET_CONTENT" {} + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Result: 1234***8910 | |
NSString * original = @"12345678910"; | |
NSError *error = nil; | |
NSRegularExpression * regex = | |
[NSRegularExpression regularExpressionWithPattern:@"\\d" | |
options:NSRegularExpressionCaseInsensitive | |
error:&error]; | |
NSString * result = | |
[regex stringByReplacingMatchesInString:original |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Note calloc() to get zero-filled memory. | |
__strong SomeClass **dynamicArray = (__strong SomeClass **)calloc(sizeof(SomeClass *), entries); | |
for (int i = 0; i < entries; ++i) | |
dynamicArray[i] = [[SomeClass alloc] init]; | |
// When you're done, set each entry to nil to tell ARC to release the object. | |
for (int i = 0; i < entries; ++i) | |
dynamicArray[i] = nil; | |
free(dynamicArray); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd $PROJECT_DIR | |
# BUILD_VERSION=`/usr/local/bin/git rev-parse --short HEAD` | |
BUILD_VERSION=`git rev-parse --short HEAD` | |
cd $BUILT_PRODUCTS_DIR/$PRODUCT_NAME.app | |
# Note: It's Info.plist, not Proj-Info.plist | |
RELEASE_VERSION=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" Info.plist) | |
/usr/libexec/PlistBuddy -c "Set CFBundleVersion $BUILD_VERSION" Info.plist | |
# here, 5 is my index of version part in |PreferenceSpecifiers| array | |
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:5:DefaultValue $RELEASE_VERSION ($BUILD_VERSION)" Settings.bundle/Root.plist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* Author: Kjuly(Kj Yu) | |
* Date: 09/29/2011 | |
* Feel free to use this code snippet. ;) | |
* | |
*/ | |
$(function() { | |
$(window).scroll(function() { | |
if ($(this).scrollTop() >= 100) { // The Logo's above the topbar is 100px |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Put it in as the browser address & press ENTER, after you have opened a web page. | |
javascript:document.body.contentEditable='true';document.designMode='on';void 0 |
NewerOlder